mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs_maintainer_history: add --fullreload option
Add an option that deletes all maintainer history records for the current layer branch so that they can then be reloaded from scratch. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
4b268a08b8
commit
58c56883fd
20
rrs/migrations/0009_rmh_layerbranch.py
Normal file
20
rrs/migrations/0009_rmh_layerbranch.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('layerindex', '0010_add_dependencies'),
|
||||||
|
('rrs', '0008_upgrade_info'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recipemaintainerhistory',
|
||||||
|
name='layerbranch',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, to='layerindex.LayerBranch'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -210,6 +210,7 @@ class RecipeMaintainerHistory(models.Model):
|
||||||
date = models.DateTimeField(db_index=True)
|
date = models.DateTimeField(db_index=True)
|
||||||
author = models.ForeignKey(Maintainer)
|
author = models.ForeignKey(Maintainer)
|
||||||
sha1 = models.CharField(max_length=64, unique=True)
|
sha1 = models.CharField(max_length=64, unique=True)
|
||||||
|
layerbranch = models.ForeignKey(LayerBranch, blank=True, null=True)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_last():
|
def get_last():
|
||||||
|
|
|
@ -88,6 +88,8 @@ def maintainer_history(options, logger):
|
||||||
for maintplan in maintplans:
|
for maintplan in maintplans:
|
||||||
for item in maintplan.maintenanceplanlayerbranch_set.all():
|
for item in maintplan.maintenanceplanlayerbranch_set.all():
|
||||||
layerbranch = item.layerbranch
|
layerbranch = item.layerbranch
|
||||||
|
if options.fullreload and not options.dry_run:
|
||||||
|
RecipeMaintainerHistory.objects.filter(layerbranch=layerbranch).delete()
|
||||||
urldir = str(layerbranch.layer.get_fetch_dir())
|
urldir = str(layerbranch.layer.get_fetch_dir())
|
||||||
repodir = os.path.join(fetchdir, urldir)
|
repodir = os.path.join(fetchdir, urldir)
|
||||||
layerdir = os.path.join(repodir, layerbranch.vcs_subdir)
|
layerdir = os.path.join(repodir, layerbranch.vcs_subdir)
|
||||||
|
@ -115,7 +117,7 @@ def maintainer_history(options, logger):
|
||||||
|
|
||||||
author = Maintainer.create_or_update(author_name, author_email)
|
author = Maintainer.create_or_update(author_name, author_email)
|
||||||
rms = RecipeMaintainerHistory(title=title, date=date, author=author,
|
rms = RecipeMaintainerHistory(title=title, date=date, author=author,
|
||||||
sha1=commit)
|
sha1=commit, layerbranch=layerbranch)
|
||||||
rms.save()
|
rms.save()
|
||||||
|
|
||||||
utils.runcmd("git checkout %s -f" % commit,
|
utils.runcmd("git checkout %s -f" % commit,
|
||||||
|
@ -177,6 +179,10 @@ def maintainer_history(options, logger):
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
parser = optparse.OptionParser(usage = """%prog [options]""")
|
parser = optparse.OptionParser(usage = """%prog [options]""")
|
||||||
|
|
||||||
|
parser.add_option("--fullreload",
|
||||||
|
help="Reload upgrade data from scratch",
|
||||||
|
action="store_true", dest="fullreload", default=False)
|
||||||
|
|
||||||
parser.add_option("-d", "--debug",
|
parser.add_option("-d", "--debug",
|
||||||
help = "Enable debug output",
|
help = "Enable debug output",
|
||||||
action="store_const", const=logging.DEBUG, dest="loglevel",
|
action="store_const", const=logging.DEBUG, dest="loglevel",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user