Skip to contentSkip to conversation

Misc fixes for Automatic Upgrade Helper

PATCH New Paul Eggleton 1 participant 5 messages Aug 15, 2014

lore
Share & tools
lore
#0 lore raw

cover Misc fixes for Automatic Upgrade Helper

The following changes since commit a7e440395abd37722ba6ae7bc4fd02528b64a4eb:

Fix adding new files to recipe bug (2014-08-14 14:31:59 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib paule/auh-fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/auh-fixes

Paul Eggleton (4):
Add ability to set machines in config file
Simply config file option reading
Handle upgrades for recipes with no maintainer
README: clarify warning

 README           |  9 ++++++---
 upgradehelper.py | 27 +++++++++++++++++++--------
 2 files changed, 25 insertions(+), 11 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/4 Add ability to set machines in config file

---
 README           | 2 ++
 upgradehelper.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
README +2 -0
index 74a8ecc..c43fa5e 100644
@@ -41,6 +41,8 @@ clean_sstate=yes
 clean_tmp=yes
 # keep previous commits or not
 drop_previous_commits=yes
+# machines to test build with
+machines=qemux86 qemux86-64 qemuarm qemumips qemuppc
 --------------- snip ---------------
 
 3. Enable distrodata and supply appropriate additional metadata. For
upgradehelper.py +1 -1
index cc90958..2429897 100755
@@ -130,7 +130,7 @@ class Updater(object):
         self.skip_compilation = skip_compilation
         self.interactive = not auto_mode
 
-        self.machines = ["qemux86", "qemux86-64", "qemuarm", "qemumips", "qemuppc"]
+        self.machines = settings.get('machines', 'qemux86 qemux86-64 qemuarm qemumips qemuppc').split()
 
         self.upgrade_steps = [
             (self._create_workdir, None),
Signature · 1 line
1.9.3
#2 lore raw

PATCH 2/4 Simply config file option reading

In reply to Paul Eggleton

It's much easier to use .get() rather than checking if the item is in the dict; you can also specify a default value.

---
 upgradehelper.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
upgradehelper.py +3 -4
index 2429897..44b394a 100755
@@ -495,11 +495,11 @@ class UniverseUpdater(Updater, Email):
         self.git.create_branch("upgrades")
 
     def prepare(self):
-        if "clean_sstate" in settings and settings["clean_sstate"] == "yes" and \
+        if settings.get("clean_sstate", "no") == "yes" and \
                 os.path.exists(os.path.join(get_build_dir(), "sstate-cache")):
             I(" Removing sstate directory ...")
             shutil.rmtree(os.path.join(get_build_dir(), "sstate-cache"))
-        if "clean_tmp" in settings and settings["clean_tmp"] == "yes" and \
+        if settings.get("clean_tmp", "no") == "yes" and \
                 os.path.exists(os.path.join(get_build_dir(), "tmp")):
             I(" Removing tmp directory ...")
             shutil.rmtree(os.path.join(get_build_dir(), "tmp"))
@@ -580,8 +580,7 @@ class UniverseUpdater(Updater, Email):
         # drop last upgrade from git. It's safer this way if the upgrade has
         # problems and other recipes depend on it. Give the other recipes a
         # chance...
-        if ("drop_previous_commits" in settings and
-                settings["drop_previous_commits"] == "yes" and
+        if (settings.get("drop_previous_commits", "no") == "yes" and
                 err is None) or (err is not None and self.patch_file is not None):
             I(" %s: Dropping changes from git ..." % self.pn)
             self.git.reset_hard(1)
Signature · 1 line
1.9.3
#3 lore raw

PATCH 3/4 Handle upgrades for recipes with no maintainer

In reply to Paul Eggleton

You still want to be able to use this tool manually even if there is no maintainer defined for the recipe.

---
 upgradehelper.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
upgradehelper.py +15 -3
index 44b394a..42ac110 100755
@@ -165,9 +165,15 @@ class Updater(object):
         self.recipe_dir = os.path.dirname(self.env['FILE'])
 
     def _parse_checkpkg_line(self, line):
-        m = re.match("^([^ \t]*)[ \t]+([^ \t]*)[ \t]+([^ \t]*).*<(.*)@(.*)>[ \t]+.*", line)
-        if m is not None:
-            return (m.group(1), m.group(2), m.group(3), m.group(4) + "@" + m.group(5))
+        m = re.match("^([^ \t]*)[ \t]+([^ \t]*)[ \t]+([^ \t]*)[ \t]+.*", line)
+        if m:
+            res = (m.group(1), m.group(2), m.group(3))
+            m = re.search("<([^ \t]+@[^ \t]+)>", line)
+            if m:
+                maintainer = m.group(1)
+            else:
+                maintainer = None
+            return res + (maintainer,)
 
         return (None, None, None, None)
 
@@ -290,6 +296,8 @@ class Updater(object):
         pkgs_list = []
 
         with open(get_build_dir() + "/tmp/log/checkpkg.csv") as csv:
+            # Skip header line
+            next(csv)
             for line in csv:
                 (pn, cur_ver, next_ver, maintainer) = self._parse_checkpkg_line(line)
 
@@ -443,6 +451,10 @@ class UniverseUpdater(Updater, Email):
     # blacklisted: python, gcc, etc. Also, check the history if the recipe
     # hasn't already been tried
     def pkg_upgradable(self, pn, next_ver, maintainer):
+        if not maintainer:
+            D("Skipping upgrade of %s: no maintainer" % pn)
+            return False
+
         if "blacklist" in settings:
             for p in settings["blacklist"].split():
                 if p == pn:
Signature · 1 line
1.9.3
#4 lore raw

PATCH 4/4 README: clarify warning

In reply to Paul Eggleton

Emails only get sent when "all" is used (at least at the moment).

---
 README | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
README +4 -3
index c43fa5e..ec3f955 100644
@@ -59,9 +59,10 @@ require conf/distro/include/upstream_tracking.inc
 WARNING: if you are using the default maintainers.inc file supplied
          with Poky (in meta-yocto) and you don't set a
          maintainers_whitelist or maintainer_override in the
-         upgrade-helper configuration as above, the script will
-         automatically send out emails to the default maintainers.
-         Please be careful not to do this :)
+         upgrade-helper configuration as above, and you specify "all"
+         on the command line, the script will automatically send out
+         emails to the default maintainers. Please be careful not to
+         do this :)
 
 4. Enable buildhistory by adding the following lines to your
 conf/local.conf file:
Signature · 1 line
1.9.3