mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
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>
This commit is contained in:
parent
add075ae00
commit
fdec9d1d63
|
@ -85,7 +85,7 @@ def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitb
|
||||||
Upgrade history handler.
|
Upgrade history handler.
|
||||||
"""
|
"""
|
||||||
def upgrade_history(options, logger):
|
def upgrade_history(options, logger):
|
||||||
from rrs.models import MaintenancePlan
|
from rrs.models import MaintenancePlan, RecipeUpgrade
|
||||||
|
|
||||||
# start date
|
# start date
|
||||||
now = datetime.today()
|
now = datetime.today()
|
||||||
|
@ -93,7 +93,6 @@ def upgrade_history(options, logger):
|
||||||
if options.initial:
|
if options.initial:
|
||||||
# starting date of the yocto project 1.6 release
|
# starting date of the yocto project 1.6 release
|
||||||
since = "2013-11-11"
|
since = "2013-11-11"
|
||||||
#RecipeUpgrade.objects.all().delete()
|
|
||||||
else:
|
else:
|
||||||
# FIXME this is awful - we should be storing the last commit somewhere
|
# FIXME this is awful - we should be storing the last commit somewhere
|
||||||
since = (now - timedelta(days=8)).strftime("%Y-%m-%d")
|
since = (now - timedelta(days=8)).strftime("%Y-%m-%d")
|
||||||
|
@ -105,6 +104,8 @@ def upgrade_history(options, logger):
|
||||||
for maintplan in maintplans:
|
for maintplan in maintplans:
|
||||||
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
|
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
|
||||||
layerbranch = maintplanbranch.layerbranch
|
layerbranch = maintplanbranch.layerbranch
|
||||||
|
if options.initial and options.fullreload and not options.dry_run:
|
||||||
|
RecipeUpgrade.objects.filter(recipe__layerbranch=layerbranch).delete()
|
||||||
layer = layerbranch.layer
|
layer = layerbranch.layer
|
||||||
urldir = layer.get_fetch_dir()
|
urldir = layer.get_fetch_dir()
|
||||||
repodir = os.path.join(fetchdir, urldir)
|
repodir = os.path.join(fetchdir, urldir)
|
||||||
|
@ -157,7 +158,15 @@ if __name__=="__main__":
|
||||||
help = "Do not write any data back to the database",
|
help = "Do not write any data back to the database",
|
||||||
action="store_true", dest="dry_run", default=False)
|
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)
|
options, args = parser.parse_args(sys.argv)
|
||||||
logger.setLevel(options.loglevel)
|
logger.setLevel(options.loglevel)
|
||||||
|
|
||||||
|
if options.fullreload and not options.initial:
|
||||||
|
logger.error('--fullreload requires -i/--initial')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
upgrade_history(options, logger)
|
upgrade_history(options, logger)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user