diff options
author | 2014-07-17 16:14:31 +0200 | |
---|---|---|
committer | 2014-07-17 16:14:31 +0200 | |
commit | 160534995aad8623f278485047ee67303daf5b60 (patch) | |
tree | 6ed3c6b09251840e777005e65e9b36995969c3c7 | |
parent | roverlay/util/portage_regex: small cleanup/fix (diff) | |
download | R_overlay-160534995aad8623f278485047ee67303daf5b60.tar.gz R_overlay-160534995aad8623f278485047ee67303daf5b60.tar.bz2 R_overlay-160534995aad8623f278485047ee67303daf5b60.zip |
package rules: add "version" match keyword
-rw-r--r-- | doc/rst/usage.rst | 9 | ||||
-rw-r--r-- | roverlay/packagerules/acceptors/util.py | 12 | ||||
-rw-r--r-- | roverlay/packagerules/parser/context/match.py | 3 |
3 files changed, 24 insertions, 0 deletions
diff --git a/doc/rst/usage.rst b/doc/rst/usage.rst index ffa690b..f841f36 100644 --- a/doc/rst/usage.rst +++ b/doc/rst/usage.rst @@ -1819,6 +1819,15 @@ These *match keywords* are recognized: +---------------+------------------+--------------------------------------+ | name | *implicit* | *alias to ebuild_name* | +---------------+------------------+--------------------------------------+ + | version | *implicit* | ebuild version ``${PV}`` | + | | | | + | | | To be exact, matches the ebuild | + | | | version with revision ``-rN`` | + | | | (``${PVR}``). ``-r0`` gets always | + | | | omitted and all packages are | + | | | initially ``-r0``, so *version* | + | | | effectively matches ``${PV}``. | + +---------------+------------------+--------------------------------------+ | category | exact-string | the package's overlay category, | | | | which is unknown (represented by | | | | ``@default``) unless it has been set | diff --git a/roverlay/packagerules/acceptors/util.py b/roverlay/packagerules/acceptors/util.py index e3b62cd..6b8e472 100644 --- a/roverlay/packagerules/acceptors/util.py +++ b/roverlay/packagerules/acceptors/util.py @@ -30,3 +30,15 @@ def get_ebuild_name ( p_info ): def get_category ( p_info ): return p_info.get ( 'category', None ) or DEFAULT_CATEGORY_REPLACEMENT # --- end of get_category (...) --- + +def get_ebuild_version_tuple ( p_info ): + return p_info ['version'] +# --- end of get_ebuild_version_tuple (...) --- + +def get_ebuild_version ( p_info ): + return p_info ['ebuild_verstr'] +# --- end of get_ebuild_version (...) --- + + +get_ebuild_version_tuple.func_name = "version" +get_ebuild_version.func_name = "version" diff --git a/roverlay/packagerules/parser/context/match.py b/roverlay/packagerules/parser/context/match.py index 8eab9bb..577c1cf 100644 --- a/roverlay/packagerules/parser/context/match.py +++ b/roverlay/packagerules/parser/context/match.py @@ -138,6 +138,9 @@ class RuleMatchContext ( 'ebuild_name' : ( None, roverlay.packagerules.acceptors.util.get_ebuild_name, ), + 'version' : ( + None, roverlay.packagerules.acceptors.util.get_ebuild_version, + ), } def __init__ ( self, namespace, level=0, bool_type=None, priority=-1 ): |