summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-04-10 09:28:14 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit201c74ca0f202171d6a4a92ec14b1b781298aaf6 (patch)
tree8d2fc0d652d37569f070d4db4e8600f5dbbe0d66
parentbaa3f78498a07ca38ba1f31448292901a819e3c8 (diff)
downloadopenembedded-core-contrib-201c74ca0f202171d6a4a92ec14b1b781298aaf6.tar.gz
openembedded-core-contrib-201c74ca0f202171d6a4a92ec14b1b781298aaf6.tar.bz2
openembedded-core-contrib-201c74ca0f202171d6a4a92ec14b1b781298aaf6.zip
rrs/tools: add -p/--plan option
Add an option to specify which maintenance plan to operate on (largely for debugging purposes). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xrrs/tools/rrs_distros.py18
-rwxr-xr-xrrs/tools/rrs_maintainer_history.py18
-rwxr-xr-xrrs/tools/rrs_upgrade_history.py18
-rwxr-xr-xrrs/tools/rrs_upstream_email.py18
-rwxr-xr-xrrs/tools/rrs_upstream_history.py22
5 files changed, 72 insertions, 22 deletions
diff --git a/rrs/tools/rrs_distros.py b/rrs/tools/rrs_distros.py
index d4400dec6b..d408b330c6 100755
--- a/rrs/tools/rrs_distros.py
+++ b/rrs/tools/rrs_distros.py
@@ -92,13 +92,23 @@ if __name__=="__main__":
help = "Do not write any data back to the database",
action="store_true", dest="dry_run", default=False)
+ parser.add_option("-p", "--plan",
+ help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
+ action="store", dest="plan", default=None)
+
options, args = parser.parse_args(sys.argv)
logger.setLevel(options.loglevel)
- maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
- if not maintplans.exists():
- logger.error('No enabled maintenance plans found')
- sys.exit(1)
+ if options.plan:
+ maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
+ if not maintplans.exists():
+ logger.error('No maintenance plan with ID %s found' % options.plan)
+ sys.exit(1)
+ else:
+ maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
+ if not maintplans.exists():
+ logger.error('No enabled maintenance plans found')
+ sys.exit(1)
logger.debug("Starting recipe distros update ...")
diff --git a/rrs/tools/rrs_maintainer_history.py b/rrs/tools/rrs_maintainer_history.py
index 8af658f4d3..5e14d39ef4 100755
--- a/rrs/tools/rrs_maintainer_history.py
+++ b/rrs/tools/rrs_maintainer_history.py
@@ -72,10 +72,16 @@ def get_commit_info(info, logger):
"""
def maintainer_history(options, logger):
fetchdir = settings.LAYER_FETCH_DIR
- maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
- if not maintplans.exists():
- logger.error('No enabled maintenance plans found')
- sys.exit(1)
+ if options.plan:
+ maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
+ if not maintplans.exists():
+ logger.error('No maintenance plan with ID %s found' % options.plan)
+ sys.exit(1)
+ else:
+ maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
+ if not maintplans.exists():
+ logger.error('No enabled maintenance plans found')
+ sys.exit(1)
no_maintainer, _ = Maintainer.objects.get_or_create(name='No maintainer')
@@ -191,6 +197,10 @@ def maintainer_history(options, logger):
if __name__=="__main__":
parser = optparse.OptionParser(usage = """%prog [options]""")
+ parser.add_option("-p", "--plan",
+ help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
+ action="store", dest="plan", default=None)
+
parser.add_option("--fullreload",
help="Reload upgrade data from scratch",
action="store_true", dest="fullreload", default=False)
diff --git a/rrs/tools/rrs_upgrade_history.py b/rrs/tools/rrs_upgrade_history.py
index cf808cf00c..8dac42a868 100755
--- a/rrs/tools/rrs_upgrade_history.py
+++ b/rrs/tools/rrs_upgrade_history.py
@@ -89,10 +89,16 @@ def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitb
def upgrade_history(options, logger):
from rrs.models import MaintenancePlan, RecipeUpgrade
- maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
- if not maintplans.exists():
- logger.error('No enabled maintenance plans found')
- sys.exit(1)
+ if options.plan:
+ maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
+ if not maintplans.exists():
+ logger.error('No maintenance plan with ID %s found' % options.plan)
+ sys.exit(1)
+ else:
+ maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
+ if not maintplans.exists():
+ logger.error('No enabled maintenance plans found')
+ sys.exit(1)
lockfn = os.path.join(fetchdir, "layerindex.lock")
lockfile = utils.lock_file(lockfn)
@@ -205,6 +211,10 @@ if __name__=="__main__":
help="Reload upgrade data from scratch",
action="store_true", dest="fullreload", default=False)
+ parser.add_option("-p", "--plan",
+ help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
+ action="store", dest="plan", default=None)
+
options, args = parser.parse_args(sys.argv)
logger.setLevel(options.loglevel)
diff --git a/rrs/tools/rrs_upstream_email.py b/rrs/tools/rrs_upstream_email.py
index c4657b09d0..7d2aa419b0 100755
--- a/rrs/tools/rrs_upstream_email.py
+++ b/rrs/tools/rrs_upstream_email.py
@@ -123,6 +123,10 @@ def main():
usage = """
%prog [options]""")
+ parser.add_option("-p", "--plan",
+ help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
+ action="store", dest="plan", default=None)
+
parser.add_option("-s", "--subject",
action="store", dest="subject", help='Override email subject')
parser.add_option("-f", "--from",
@@ -139,10 +143,16 @@ def main():
options, args = parser.parse_args(sys.argv)
# get recipes for send email
- maintplans = MaintenancePlan.objects.filter(email_enabled=True)
- if not maintplans.exists():
- logger.error('No maintenance plans with email enabled were found')
- sys.exit(1)
+ if options.plan:
+ maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
+ if not maintplans.exists():
+ logger.error('No maintenance plan with ID %s found' % options.plan)
+ sys.exit(1)
+ else:
+ maintplans = MaintenancePlan.objects.filter(email_enabled=True)
+ if not maintplans.exists():
+ logger.error('No maintenance plans with email enabled were found')
+ sys.exit(1)
for maintplan in maintplans:
recipes = {}
diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py
index a20fae3fe5..50d59d8daa 100755
--- a/rrs/tools/rrs_upstream_history.py
+++ b/rrs/tools/rrs_upstream_history.py
@@ -134,7 +134,11 @@ def get_upstream_info(layerbranch, recipe_data, result):
if __name__=="__main__":
parser = optparse.OptionParser(usage = """%prog [options]""")
-
+
+ parser.add_option("-p", "--plan",
+ help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
+ action="store", dest="plan", default=None)
+
parser.add_option("-d", "--debug",
help = "Enable debug output",
action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO)
@@ -146,12 +150,18 @@ if __name__=="__main__":
options, args = parser.parse_args(sys.argv)
logger.setLevel(options.loglevel)
- logger.debug("Starting upstream history...")
+ if options.plan:
+ maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
+ if not maintplans.exists():
+ logger.error('No maintenance plan with ID %s found' % options.plan)
+ sys.exit(1)
+ else:
+ maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
+ if not maintplans.exists():
+ logger.error('No enabled maintenance plans found')
+ sys.exit(1)
- maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
- if not maintplans.exists():
- logger.error('No enabled maintenance plans found')
- sys.exit(1)
+ logger.debug("Starting upstream history...")
lockfn = os.path.join(fetchdir, "layerindex.lock")
lockfile = utils.lock_file(lockfn)