* [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/
@ 2013-08-07 16:10 André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2013-08-07 16:10 UTC (permalink / raw
To: gentoo-commits
commit: b4c86bbcfc6f1278a43e76ac9ce29ffdb9b29096
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 7 15:57:30 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 7 15:57:30 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b4c86bbc
roverlay/packagerules: remove TODO note
Remove old TODO note (everything listed there has implemented).
---
roverlay/packagerules/__init__.py | 6 ------
1 file changed, 6 deletions(-)
diff --git a/roverlay/packagerules/__init__.py b/roverlay/packagerules/__init__.py
index 100cd2f..7800bed 100644
--- a/roverlay/packagerules/__init__.py
+++ b/roverlay/packagerules/__init__.py
@@ -3,9 +3,3 @@
# Copyright (C) 2013 André Erdmann <dywi@mailerd.de>
# Distributed under the terms of the GNU General Public License;
# either version 2 of the License, or (at your option) any later version.
-
-# TODO:
-# * load rules from a file (make them accessible)
-# -> syntax
-# * logging
-# * doc/rst
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/packagerules/
@ 2014-07-18 2:28 André Erdmann
2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
0 siblings, 1 reply; 5+ messages in thread
From: André Erdmann @ 2014-07-18 2:28 UTC (permalink / raw
To: gentoo-commits
commit: a66935abdbccc21e52d51a1ccc7b5849afe4b3c6
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 00:07:24 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 00:07:24 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a66935ab
packagerules/rules->PackageRules: append_rule()
minor cleanup / comment
---
roverlay/packagerules/rules.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/roverlay/packagerules/rules.py b/roverlay/packagerules/rules.py
index 0dd0d3d..9e828d1 100644
--- a/roverlay/packagerules/rules.py
+++ b/roverlay/packagerules/rules.py
@@ -61,7 +61,7 @@ class PackageRules ( roverlay.packagerules.abstract.rules.NestedPackageRule ):
Defaults to True.
"""
if self._rules:
- rule.priority = 1 + max ( rule.priority for rule in self._rules )
+ rule.priority = 1 + max ( self._rules, key=(lambda r: r.priority) )
else:
rule.priority = 0
@@ -71,8 +71,12 @@ class PackageRules ( roverlay.packagerules.abstract.rules.NestedPackageRule ):
rule.set_logger ( self.logger.getChild ( 'nested' ) )
rule.prepare()
# no need to sort self._rules
- # self._rules [-1].prio > self._rules [-2].prio
- # <=> sorted if self.prepare() has been called before
+ # len(self._rules) > 1:
+ # self._rules [-1].prio > self._rules [-2].prio
+ # <=> sorted if self.prepare() has been called before
+ # else:
+ # sorted.
+ #
# --- end of append_rule (...) ---
def _gen_rules_str ( self, level ):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/
@ 2014-07-18 16:20 André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2014-07-18 16:20 UTC (permalink / raw
To: gentoo-commits
commit: c56757276df58cf03a19512d3ed4f9d36cef6f06
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 17 23:53:48 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 17 23:58:33 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c5675727
packagerules/rules->PackageRules: append_rule()
Adds a rule to an (possibly) already-sorted PackageRules object and gives it the
lowest priority (highest int, 1+max(self._rules priority).
Will be used to add generated rules that should be applied last (add-policy).
---
roverlay/packagerules/rules.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/roverlay/packagerules/rules.py b/roverlay/packagerules/rules.py
index 5cbe600..0dd0d3d 100644
--- a/roverlay/packagerules/rules.py
+++ b/roverlay/packagerules/rules.py
@@ -47,6 +47,34 @@ class PackageRules ( roverlay.packagerules.abstract.rules.NestedPackageRule ):
self.is_toplevel = True
# --- end of __init__ (...) ---
+ def append_rule ( self, rule, prepare_rule=True ):
+ """
+ Sets the given rule's priority to 1 + lowest prio of already-added rules
+ (so that it will be applied last) and adds it.
+
+ Optionally prepares the rule so that prepare() doesn't need to be
+ called afterwards, assuming that the PackageRules was already prepared.
+
+ arguments:
+ * rule --
+ * prepare_rule -- whether to prepare the added rule or not
+ Defaults to True.
+ """
+ if self._rules:
+ rule.priority = 1 + max ( rule.priority for rule in self._rules )
+ else:
+ rule.priority = 0
+
+ self.add_rule ( rule )
+
+ if prepare_rule:
+ rule.set_logger ( self.logger.getChild ( 'nested' ) )
+ rule.prepare()
+ # no need to sort self._rules
+ # self._rules [-1].prio > self._rules [-2].prio
+ # <=> sorted if self.prepare() has been called before
+ # --- end of append_rule (...) ---
+
def _gen_rules_str ( self, level ):
if level == 0:
last_rule_index = len ( self._rules ) - 1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/
2014-07-18 2:28 [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/packagerules/ André Erdmann
@ 2014-07-18 16:20 ` André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2014-07-18 16:20 UTC (permalink / raw
To: gentoo-commits
commit: a66935abdbccc21e52d51a1ccc7b5849afe4b3c6
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 00:07:24 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 00:07:24 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a66935ab
packagerules/rules->PackageRules: append_rule()
minor cleanup / comment
---
roverlay/packagerules/rules.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/roverlay/packagerules/rules.py b/roverlay/packagerules/rules.py
index 0dd0d3d..9e828d1 100644
--- a/roverlay/packagerules/rules.py
+++ b/roverlay/packagerules/rules.py
@@ -61,7 +61,7 @@ class PackageRules ( roverlay.packagerules.abstract.rules.NestedPackageRule ):
Defaults to True.
"""
if self._rules:
- rule.priority = 1 + max ( rule.priority for rule in self._rules )
+ rule.priority = 1 + max ( self._rules, key=(lambda r: r.priority) )
else:
rule.priority = 0
@@ -71,8 +71,12 @@ class PackageRules ( roverlay.packagerules.abstract.rules.NestedPackageRule ):
rule.set_logger ( self.logger.getChild ( 'nested' ) )
rule.prepare()
# no need to sort self._rules
- # self._rules [-1].prio > self._rules [-2].prio
- # <=> sorted if self.prepare() has been called before
+ # len(self._rules) > 1:
+ # self._rules [-1].prio > self._rules [-2].prio
+ # <=> sorted if self.prepare() has been called before
+ # else:
+ # sorted.
+ #
# --- end of append_rule (...) ---
def _gen_rules_str ( self, level ):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/
2014-07-18 2:28 [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
@ 2014-07-18 16:20 ` André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2014-07-18 16:20 UTC (permalink / raw
To: gentoo-commits
commit: a56814f1d04894840b08621f394fcb5ba94b126e
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 02:19:10 2014 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 02:19:25 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a56814f1
packagerules/rules: fix
fixes a66935abdbccc21e52d51a1ccc7b5849afe4b3c6
---
roverlay/packagerules/rules.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/packagerules/rules.py b/roverlay/packagerules/rules.py
index 9e828d1..f6a83c2 100644
--- a/roverlay/packagerules/rules.py
+++ b/roverlay/packagerules/rules.py
@@ -61,7 +61,7 @@ class PackageRules ( roverlay.packagerules.abstract.rules.NestedPackageRule ):
Defaults to True.
"""
if self._rules:
- rule.priority = 1 + max ( self._rules, key=(lambda r: r.priority) )
+ rule.priority = 1 + max ( k.priority for k in self._rules )
else:
rule.priority = 0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-18 16:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18 2:28 [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/packagerules/ André Erdmann
2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
-- strict thread matches above, loose matches on Subject: below --
2014-07-18 16:20 André Erdmann
2014-07-18 2:28 [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-08-07 16:10 André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox