aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-03-29 16:09:35 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit58c56883fd14692c25aee1e5e2c153fec3a85db0 (patch)
tree1f0e70a1e1be95641e981a258e3f30e5f82cf915
parent4b268a08b8eb5261937879e136ccb12fb3cf867e (diff)
downloadopenembedded-core-contrib-58c56883fd14692c25aee1e5e2c153fec3a85db0.tar.gz
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>
-rw-r--r--rrs/migrations/0009_rmh_layerbranch.py20
-rw-r--r--rrs/models.py1
-rwxr-xr-xrrs/tools/rrs_maintainer_history.py10
3 files changed, 29 insertions, 2 deletions
diff --git a/rrs/migrations/0009_rmh_layerbranch.py b/rrs/migrations/0009_rmh_layerbranch.py
new file mode 100644
index 0000000000..b2a7b862f2
--- /dev/null
+++ b/rrs/migrations/0009_rmh_layerbranch.py
@@ -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'),
+ ),
+ ]
diff --git a/rrs/models.py b/rrs/models.py
index 2833a23078..536f3b1329 100644
--- a/rrs/models.py
+++ b/rrs/models.py
@@ -210,6 +210,7 @@ class RecipeMaintainerHistory(models.Model):
date = models.DateTimeField(db_index=True)
author = models.ForeignKey(Maintainer)
sha1 = models.CharField(max_length=64, unique=True)
+ layerbranch = models.ForeignKey(LayerBranch, blank=True, null=True)
@staticmethod
def get_last():
diff --git a/rrs/tools/rrs_maintainer_history.py b/rrs/tools/rrs_maintainer_history.py
index 19559ec69d..72681be107 100755
--- a/rrs/tools/rrs_maintainer_history.py
+++ b/rrs/tools/rrs_maintainer_history.py
@@ -88,6 +88,8 @@ def maintainer_history(options, logger):
for maintplan in maintplans:
for item in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = item.layerbranch
+ if options.fullreload and not options.dry_run:
+ RecipeMaintainerHistory.objects.filter(layerbranch=layerbranch).delete()
urldir = str(layerbranch.layer.get_fetch_dir())
repodir = os.path.join(fetchdir, urldir)
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)
rms = RecipeMaintainerHistory(title=title, date=date, author=author,
- sha1=commit)
+ sha1=commit, layerbranch=layerbranch)
rms.save()
utils.runcmd("git checkout %s -f" % commit,
@@ -176,7 +178,11 @@ def maintainer_history(options, logger):
if __name__=="__main__":
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",
help = "Enable debug output",
action="store_const", const=logging.DEBUG, dest="loglevel",