1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA256 |
3 |
|
4 |
Hey all -- i have an idea for a new helper function for |
5 |
versionator.eclass, that should improve correctness and convenience |
6 |
when wanting to leverage $REPLACING_VERSIONS for checks in the |
7 |
related phase functions. |
8 |
|
9 |
Comments? |
10 |
|
11 |
|
12 |
diff --git a/eclass/versionator.eclass b/eclass/versionator.eclass |
13 |
index 74e676e..a92dfa7 100644 |
14 |
- --- a/eclass/versionator.eclass |
15 |
+++ b/eclass/versionator.eclass |
16 |
@@ -507,4 +507,27 @@ version_format_string() { |
17 |
eval echo "${fstr}" |
18 |
} |
19 |
|
20 |
+# @FUNCTION: replacing_version_at_least |
21 |
+# @USAGE: <want> |
22 |
+# @DESCRIPTION: |
23 |
+# Are all values present in ${REPLACING_VERSIONS} at least version |
24 |
$1? Uses version_is_at_least |
25 |
+# and so may not be reliable, be sure to do very careful testing |
26 |
before actually |
27 |
+# using this. |
28 |
+# Returns false if ${REPLACING_VERSIONS} is empty |
29 |
+replacing_version_at_least() { |
30 |
+ local tmp want=$1 |
31 |
+ |
32 |
+ case ${EBUILD_PHASE} in |
33 |
+ pretend|setup|preinst|postinst) |
34 |
+ if [[ -z ${REPLACING_VERSIONS} ]]; then |
35 |
return 1 ; fi |
36 |
+ for tmp in ${REPLACING_VERSIONS}; do |
37 |
+ if ! version_is_at_least ${want} |
38 |
${tmp}; then return 1; fi |
39 |
+ done |
40 |
+ return 0; |
41 |
+ ;; |
42 |
+ *) |
43 |
+ die "replacing_version_at_least - invalid |
44 |
phase: ${EBUILD_PHASE}" |
45 |
+ esac |
46 |
+} |
47 |
+ |
48 |
fi |
49 |
-----BEGIN PGP SIGNATURE----- |
50 |
Version: GnuPG v2 |
51 |
|
52 |
iF4EAREIAAYFAlXzdD8ACgkQAJxUfCtlWe1nZQEAql2yv9bRSCGKdFTAM1dlszua |
53 |
r1sAO6uV24+bUVvz4aMA/09q12uRea07Vy7I8pXT1w8YvN8EV03Fput8hDbunMHl |
54 |
=Jkja |
55 |
-----END PGP SIGNATURE----- |