mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs_upgrade_history: implement file path filtering
Make it possible to re-collect all the history for a given path. (Typically this would only be used for debugging, as it saves time if you are trying to correct an issue with upgrade data collection for a single recipe.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
8f9c95abff
commit
d8011bc305
|
@ -71,6 +71,8 @@ def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitb
|
||||||
cmd += ' --initial="%s"' % comment
|
cmd += ' --initial="%s"' % comment
|
||||||
if bitbake_rev:
|
if bitbake_rev:
|
||||||
cmd += ' --bitbake-rev %s' % bitbake_rev
|
cmd += ' --bitbake-rev %s' % bitbake_rev
|
||||||
|
if options.filter_files:
|
||||||
|
cmd += ' --filter-files %s' % options.filter_files
|
||||||
if options.dry_run:
|
if options.dry_run:
|
||||||
cmd += ' --dry-run'
|
cmd += ' --dry-run'
|
||||||
if options.loglevel == logging.DEBUG:
|
if options.loglevel == logging.DEBUG:
|
||||||
|
@ -131,7 +133,11 @@ def upgrade_history(options, logger):
|
||||||
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
|
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
|
||||||
layerbranch = maintplanbranch.layerbranch
|
layerbranch = maintplanbranch.layerbranch
|
||||||
if options.fullreload and not options.dry_run:
|
if options.fullreload and not options.dry_run:
|
||||||
RecipeUpgrade.objects.filter(recipesymbol__layerbranch=layerbranch).delete()
|
logger.debug('fullreload: deleting upgrade objects')
|
||||||
|
if options.filter_files:
|
||||||
|
RecipeUpgrade.objects.filter(recipesymbol__layerbranch=layerbranch, filepath__startswith=options.filter_files).delete()
|
||||||
|
else:
|
||||||
|
RecipeUpgrade.objects.filter(recipesymbol__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)
|
||||||
|
@ -195,6 +201,9 @@ def upgrade_history(options, logger):
|
||||||
if layersubdir_start and not (diffitem.a_path.startswith(layersubdir_start) or diffitem.b_path.startswith(layersubdir_start)):
|
if layersubdir_start and not (diffitem.a_path.startswith(layersubdir_start) or diffitem.b_path.startswith(layersubdir_start)):
|
||||||
# Not in this layer, skip it
|
# Not in this layer, skip it
|
||||||
continue
|
continue
|
||||||
|
if options.filter_files and not (diffitem.a_path.startswith(options.filter_files) or diffitem.b_path.startswith(options.filter_files)):
|
||||||
|
# Doesn't match path filter
|
||||||
|
continue
|
||||||
if diffitem.a_path.endswith(('.bb', '.inc')) or diffitem.b_path.endswith(('.bb', '.inc')):
|
if diffitem.a_path.endswith(('.bb', '.inc')) or diffitem.b_path.endswith(('.bb', '.inc')):
|
||||||
# We need to look at this commit
|
# We need to look at this commit
|
||||||
touches_recipe = True
|
touches_recipe = True
|
||||||
|
@ -211,7 +220,7 @@ def upgrade_history(options, logger):
|
||||||
continue
|
continue
|
||||||
logger.debug("Analysing commit %s ..." % ct)
|
logger.debug("Analysing commit %s ..." % ct)
|
||||||
run_internal(maintplanbranch, ct, ctdate, options, logger, bitbake_map)
|
run_internal(maintplanbranch, ct, ctdate, options, logger, bitbake_map)
|
||||||
if not options.dry_run:
|
if not (options.dry_run or options.filter_files):
|
||||||
maintplanbranch.upgrade_rev = ct
|
maintplanbranch.upgrade_rev = ct
|
||||||
maintplanbranch.upgrade_date = ctdate
|
maintplanbranch.upgrade_date = ctdate
|
||||||
maintplanbranch.save()
|
maintplanbranch.save()
|
||||||
|
@ -247,6 +256,10 @@ if __name__=="__main__":
|
||||||
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
||||||
action="store", dest="plan", default=None)
|
action="store", dest="plan", default=None)
|
||||||
|
|
||||||
|
parser.add_option("-F", "--filter-files",
|
||||||
|
help="Only operate on a specified subset of files (filepath 'startswith')",
|
||||||
|
action="store", dest="filter_files", default='')
|
||||||
|
|
||||||
parser.add_option("--regroup",
|
parser.add_option("--regroup",
|
||||||
help="Re-group records only",
|
help="Re-group records only",
|
||||||
action="store_true", dest="regroup", default=False)
|
action="store_true", dest="regroup", default=False)
|
||||||
|
@ -254,4 +267,8 @@ if __name__=="__main__":
|
||||||
options, args = parser.parse_args(sys.argv)
|
options, args = parser.parse_args(sys.argv)
|
||||||
logger.setLevel(options.loglevel)
|
logger.setLevel(options.loglevel)
|
||||||
|
|
||||||
|
if options.filter_files and not options.plan:
|
||||||
|
logger.error('-F/--filter-files must be specified in conjunction with -p/--plan and --fullreload')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
upgrade_history(options, logger)
|
upgrade_history(options, logger)
|
||||||
|
|
|
@ -349,7 +349,11 @@ def generate_history(options, layerbranch_id, commit, logger):
|
||||||
deleted = []
|
deleted = []
|
||||||
moved = []
|
moved = []
|
||||||
else:
|
else:
|
||||||
fns, deleted, moved = _get_recipes_filenames(commit, repo, repodir, layersubdir_start, logger)
|
if options.filter_files:
|
||||||
|
filepath_start = options.filter_files
|
||||||
|
else:
|
||||||
|
filepath_start = layersubdir_start
|
||||||
|
fns, deleted, moved = _get_recipes_filenames(commit, repo, repodir, filepath_start, logger)
|
||||||
if not (fns or deleted or moved):
|
if not (fns or deleted or moved):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -501,6 +505,10 @@ 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("-F", "--filter-files",
|
||||||
|
help="Only operate on a specified subset of files (wildcards allowed)",
|
||||||
|
action="store", dest="filter_files", default='')
|
||||||
|
|
||||||
options, args = parser.parse_args(sys.argv)
|
options, args = parser.parse_args(sys.argv)
|
||||||
|
|
||||||
logger.setLevel(options.loglevel)
|
logger.setLevel(options.loglevel)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user