diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-04-06 14:59:06 +0100 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-04-06 15:01:24 +0100 |
commit | f7fa15dd365b8903b608834a536e2b83f3cef289 (patch) | |
tree | 3f5c108322045fd646b9f073f88985a8e049af53 /layerindex | |
parent | 4c08b28387fcf523048712cffca6f7aad16e6acc (diff) | |
download | openembedded-core-contrib-f7fa15dd365b8903b608834a536e2b83f3cef289.tar.gz |
Allow layers to have no master branch
With BSPs being "retired" e.g. in meta-intel, it is possible for layers
to not exist on the master branch; since this is legitimate we need the
layer index to handle it.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex')
-rw-r--r-- | layerindex/models.py | 5 | ||||
-rwxr-xr-x | layerindex/update.py | 26 |
2 files changed, 19 insertions, 12 deletions
diff --git a/layerindex/models.py b/layerindex/models.py index ae9509ab2a..1f239033da 100644 --- a/layerindex/models.py +++ b/layerindex/models.py @@ -63,7 +63,10 @@ class LayerItem(models.Model): self.status = newstatus def get_layerbranch(self, branchname): - res = list(self.layerbranch_set.filter(branch__name=branchname)[:1]) + if branchname: + res = list(self.layerbranch_set.filter(branch__name=branchname)[:1]) + else: + res = list(self.layerbranch_set.all()[:1]) if res: return res[0] return None diff --git a/layerindex/update.py b/layerindex/update.py index fe933f327b..90e1e50c76 100755 --- a/layerindex/update.py +++ b/layerindex/update.py @@ -278,17 +278,25 @@ def main(): layerbranch = LayerBranch() layerbranch.layer = layer layerbranch.branch = branch - layerbranch_master = layer.get_layerbranch('master') - if layerbranch_master: - layerbranch.vcs_subdir = layerbranch_master.vcs_subdir + layerbranch_source = layer.get_layerbranch('master') + if not layerbranch_source: + layerbranch_source = layer.get_layerbranch(None) + if layerbranch_source: + layerbranch.vcs_subdir = layerbranch_source.vcs_subdir + if layerbranch.vcs_subdir: + checksubdir = os.path.join(repodir, layerbranch.vcs_subdir) + if not os.path.exists(checksubdir): + logger.info("Skipping update of layer %s for branch %s - subdirectory %s does not exist on this branch" % (layer.name, branchdesc, layerbranch.vcs_subdir)) + transaction.rollback() + continue layerbranch.save() - if layerbranch_master: - for maintainer in layerbranch_master.layermaintainer_set.all(): + if layerbranch_source: + for maintainer in layerbranch_source.layermaintainer_set.all(): maintainer.pk = None maintainer.id = None maintainer.layerbranch = layerbranch maintainer.save() - for dep in layerbranch_master.dependencies_set.all(): + for dep in layerbranch_source.dependencies_set.all(): dep.pk = None dep.id = None dep.layerbranch = layerbranch @@ -315,11 +323,7 @@ def main(): if not os.path.exists(layerdir): if options.branch == 'master': - logger.error("Subdirectory for layer %s does not exist on branch %s!" % (layer.name, branchdesc)) - transaction.rollback() - continue - else: - logger.info("Skipping update of layer %s for branch %s - subdirectory does not exist on this branch" % (layer.name, branchdesc)) + logger.error("Subdirectory for layer %s does not exist on branch %s - if this is legitimate, the layer branch record should be deleted" % (layer.name, branchdesc)) transaction.rollback() continue |