aboutsummaryrefslogtreecommitdiffstats
path: root/rrs/tools/rrs_upgrade_history.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-03-24 01:08:14 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commitfdec9d1d6388fac48bba797493be63eabb7c5b19 (patch)
treec326cef975e48dcbdbe5b46b658b54d9554b323a /rrs/tools/rrs_upgrade_history.py
parentadd075ae009cc4a79dada1c7540905d945577d0c (diff)
downloadopenembedded-core-contrib-fdec9d1d6388fac48bba797493be63eabb7c5b19.tar.gz
rrs_upgrade_history: add a --fullreload option
Add a --fullreload option which deletes all upgrade records for the layerbranch first. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'rrs/tools/rrs_upgrade_history.py')
-rwxr-xr-xrrs/tools/rrs_upgrade_history.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/rrs/tools/rrs_upgrade_history.py b/rrs/tools/rrs_upgrade_history.py
index e48eba326b..f60e678253 100755
--- a/rrs/tools/rrs_upgrade_history.py
+++ b/rrs/tools/rrs_upgrade_history.py
@@ -85,7 +85,7 @@ def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitb
Upgrade history handler.
"""
def upgrade_history(options, logger):
- from rrs.models import MaintenancePlan
+ from rrs.models import MaintenancePlan, RecipeUpgrade
# start date
now = datetime.today()
@@ -93,7 +93,6 @@ def upgrade_history(options, logger):
if options.initial:
# starting date of the yocto project 1.6 release
since = "2013-11-11"
- #RecipeUpgrade.objects.all().delete()
else:
# FIXME this is awful - we should be storing the last commit somewhere
since = (now - timedelta(days=8)).strftime("%Y-%m-%d")
@@ -105,6 +104,8 @@ def upgrade_history(options, logger):
for maintplan in maintplans:
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = maintplanbranch.layerbranch
+ if options.initial and options.fullreload and not options.dry_run:
+ RecipeUpgrade.objects.filter(recipe__layerbranch=layerbranch).delete()
layer = layerbranch.layer
urldir = layer.get_fetch_dir()
repodir = os.path.join(fetchdir, urldir)
@@ -157,7 +158,15 @@ if __name__=="__main__":
help = "Do not write any data back to the database",
action="store_true", dest="dry_run", default=False)
+ parser.add_option("--fullreload",
+ help="Reload upgrade data from scratch (requires -i/--initial)",
+ action="store_true", dest="fullreload", default=False)
+
options, args = parser.parse_args(sys.argv)
logger.setLevel(options.loglevel)
+ if options.fullreload and not options.initial:
+ logger.error('--fullreload requires -i/--initial')
+ sys.exit(1)
+
upgrade_history(options, logger)