Sat, 27 Jan 2024 14:28:09 +0100
adds schema validation - fixes #291
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | package de.unixwork.uwproj; |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | import org.w3c.dom.Element; |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | public class PkgConfigPackage { |
91
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
6 | private String id; |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | private String name; |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
8 | private String atleast; |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
9 | private String exact; |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
10 | private String max; |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | public static PkgConfigPackage parse(Element e) throws Exception { |
41 | 13 | var p = new PkgConfigPackage(); |
40
b42bfc9e9983
first minor code improvements
Mike Becker <universe@uap-core.de>
parents:
0
diff
changeset
|
14 | String name = Util.getContent(e); |
41 | 15 | if (name.isBlank()) { |
16 | throw new Exception("pkgconfig element: value required"); | |
17 | } else { | |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | p.setName(name); |
91
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
19 | p.setId(Util.shId(name)); |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | } |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
21 | p.setAtleast(e.getAttribute("atleast")); |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
22 | p.setExact(e.getAttribute("exact")); |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
23 | p.setMax(e.getAttribute("max")); |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | return p; |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | } |
41 | 26 | |
91
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
27 | public String getId() { |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
28 | return id; |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
29 | } |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
30 | |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
31 | public void setId(String id) { |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
32 | this.id = id; |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
33 | } |
f14d77dd4215
fix duplicate output when checking dependencies
Mike Becker <universe@uap-core.de>
parents:
63
diff
changeset
|
34 | |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | public String getName() { |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | return name; |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | } |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | public void setName(String name) { |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | this.name = name; |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | } |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
43 | public String getAtleast() { |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
44 | return atleast; |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | } |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
47 | public void setAtleast(String atleast) { |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
48 | this.atleast = atleast; |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | } |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
51 | public String getMax() { |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
52 | return max; |
46
096f3105b3b1
add support for pkgconf version constraints - fixes #294
Mike Becker <universe@uap-core.de>
parents:
41
diff
changeset
|
53 | } |
096f3105b3b1
add support for pkgconf version constraints - fixes #294
Mike Becker <universe@uap-core.de>
parents:
41
diff
changeset
|
54 | |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
55 | public void setMax(String max) { |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
56 | this.max = max; |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
57 | } |
46
096f3105b3b1
add support for pkgconf version constraints - fixes #294
Mike Becker <universe@uap-core.de>
parents:
41
diff
changeset
|
58 | |
63
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
59 | public String getExact() { |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
60 | return exact; |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
61 | } |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
62 | |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
63 | public void setExact(String exact) { |
ac47c2fb2c4a
fix bogus version constraint test - relates to #294
Mike Becker <universe@uap-core.de>
parents:
46
diff
changeset
|
64 | this.exact = exact; |
0
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | } |
38775db5fdf5
add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | } |