All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <yocto@yoctoproject.org>
Cc: Konrad.Scherer@windriver.com, paul.eggleton@linux.intel.com
Subject: [PATCH V3 11/11] update_layer.py: delete layerbranch for non-existed branch
Date: Thu, 1 Jun 2017 23:38:20 -0700	[thread overview]
Message-ID: <19bfcf0d170372bcd2d2c1e361906533f2b7d2cc.1496384657.git.liezhi.yang@windriver.com> (raw)
In-Reply-To: <cover.1496384657.git.liezhi.yang@windriver.com>

The branch is not needed any more when it has been removed from the repo, so we
also need remove its layerbranch, otherwise it still can be got from the web,
which causes confusions.

Note, we have to move the location of tinfiol's code to make it can be shutdown
correctly.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 layerindex/update_layer.py | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index 68ca836..34ed1e0 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -220,21 +220,6 @@ def main():
 
     bitbakepath = os.path.join(fetchdir, 'bitbake')
 
-    try:
-        (tinfoil, tempdir) = recipeparse.init_parser(settings, branch, bitbakepath, nocheckout=options.nocheckout, logger=logger)
-    except recipeparse.RecipeParseError as e:
-        logger.error(str(e))
-        sys.exit(1)
-    # Clear the default value of SUMMARY so that we can use DESCRIPTION instead if it hasn't been set
-    tinfoil.config_data.setVar('SUMMARY', '')
-    # Clear the default value of DESCRIPTION so that we can see where it's not set
-    tinfoil.config_data.setVar('DESCRIPTION', '')
-    # Clear the default value of HOMEPAGE ('unknown')
-    tinfoil.config_data.setVar('HOMEPAGE', '')
-    # Set a blank value for LICENSE so that it doesn't cause the parser to die (e.g. with meta-ti -
-    # why won't they just fix that?!)
-    tinfoil.config_data.setVar('LICENSE', '')
-
     layer = utils.get_layer(options.layer)
     urldir = layer.get_fetch_dir()
     repodir = os.path.join(fetchdir, urldir)
@@ -258,12 +243,29 @@ def main():
             topcommit = repo.commit('origin/%s' % branchname)
     except:
         if layerbranch:
-            logger.error("Failed update of layer %s - branch %s no longer exists" % (layer.name, branchdesc))
+            logger.info("layer %s - branch %s no longer exists, removing it from database" % (layer.name, branchdesc))
+            if not options.dryrun:
+                layerbranch.delete()
         else:
             logger.info("Skipping update of layer %s - branch %s doesn't exist" % (layer.name, branchdesc))
         sys.exit(1)
 
     try:
+        (tinfoil, tempdir) = recipeparse.init_parser(settings, branch, bitbakepath, nocheckout=options.nocheckout, logger=logger)
+    except recipeparse.RecipeParseError as e:
+        logger.error(str(e))
+        sys.exit(1)
+    # Clear the default value of SUMMARY so that we can use DESCRIPTION instead if it hasn't been set
+    tinfoil.config_data.setVar('SUMMARY', '')
+    # Clear the default value of DESCRIPTION so that we can see where it's not set
+    tinfoil.config_data.setVar('DESCRIPTION', '')
+    # Clear the default value of HOMEPAGE ('unknown')
+    tinfoil.config_data.setVar('HOMEPAGE', '')
+    # Set a blank value for LICENSE so that it doesn't cause the parser to die (e.g. with meta-ti -
+    # why won't they just fix that?!)
+    tinfoil.config_data.setVar('LICENSE', '')
+
+    try:
         with transaction.atomic():
             newbranch = False
             if not layerbranch:
-- 
2.10.2



  parent reply	other threads:[~2017-06-02  6:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02  6:28 [PATCH V3 00/11] Several fixes for layerindex Robert Yang
2017-06-02  6:28 ` [PATCH V3 01/11] layerconfparse.py: remove unused layerbranch from parse_layer() Robert Yang
2017-06-02  6:28 ` [PATCH V3 02/11] utils.py: remove obsolete dependencies Robert Yang
2017-06-02  6:28 ` [PATCH V3 03/11] update_layer.py: set layerbranch's collection before add_dependencies Robert Yang
2017-06-02  6:28 ` [PATCH V3 04/11] update.py: fix -l option Robert Yang
2017-06-02  6:28 ` [PATCH V3 05/11] recipeparse.py: restore cwd when the parsing is done Robert Yang
2017-06-02  6:28 ` [PATCH V3 06/11] update.py: update layers orderly Robert Yang
2017-06-02  6:28 ` [PATCH V3 07/11] update_layer.py: remove --update-dependencies Robert Yang
2017-06-02  6:28 ` [PATCH V3 08/11] update.py: add option -a to update actual branch Robert Yang
2017-06-02  6:28 ` [PATCH V3 09/11] update_layer.py: move the location of transaction.atomic() Robert Yang
2017-06-02  6:38 ` [PATCH V3 10/11] update.py: add -p to git fetch Robert Yang
2017-06-02  6:38 ` Robert Yang [this message]
2017-06-09  6:42 ` [PATCH V3 00/11] Several fixes for layerindex Robert Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19bfcf0d170372bcd2d2c1e361906533f2b7d2cc.1496384657.git.liezhi.yang@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=Konrad.Scherer@windriver.com \
    --cc=paul.eggleton@linux.intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.