From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: yocto@yoctoproject.org
Cc: paul.eggleton@linux.intel.com
Subject: [PATCH 09/10][auh] upgradehelper.py: Move upstream versioning code to UniverseUpdater
Date: Wed, 29 Jul 2015 15:50:52 -0500 [thread overview]
Message-ID: <1438203053-7909-10-git-send-email-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <1438203053-7909-1-git-send-email-anibal.limon@linux.intel.com>
Reorder code related to upstream versioning detection no makes sense
to have in Updater because only in UniverseUpdater is used.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
upgradehelper.py | 161 ++++++++++++++++++++++++++-----------------------------
1 file changed, 77 insertions(+), 84 deletions(-)
diff --git a/upgradehelper.py b/upgradehelper.py
index a31d041..4d8685c 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -265,63 +265,12 @@ class Updater(object):
I(" %s: compiling for %s ..." % (self.pn, machine))
self.recipe.compile(machine)
- def _check_upstream_versions(self, packages=[("universe", None, None)]):
- I(" Fetching upstream version(s) ...")
-
- try:
- self.bb.checkpkg(" ".join([p[0] for p in packages]))
- except Error as e:
- for line in e.stdout.split('\n'):
- if line.find("ERROR: Task do_checkpkg does not exist") == 0:
- C(" \"distrodata.bbclass\" not inherited. Consider adding "
- "the following to your local.conf:\n\n"
- "INHERIT =+ \"distrodata\"\n")
- exit(1)
-
- def _parse_checkpkg_file(self, file_path):
- import csv
-
- pkgs_list = []
-
- with open(file_path, "r") as f:
- reader = csv.reader(f, delimiter='\t')
- for row in reader:
- if reader.line_num == 1: # skip header line
- continue
-
- pn = row[0]
- cur_ver = row[1]
- next_ver = row[2]
- status = row[11]
- maintainer = row[14]
- no_upgrade_reason = row[15]
-
- if status == 'UPDATE' and not no_upgrade_reason:
- pkgs_list.append((pn, next_ver, maintainer))
- else:
- if no_upgrade_reason:
- D(" Skip package %s (status = %s, current version = %s," \
- " next version = %s, no upgrade reason = %s)" %
- (pn, status, cur_ver, next_ver, no_upgrade_reason))
- else:
- D(" Skip package %s (status = %s, current version = %s," \
- " next version = %s)" %
- (pn, status, cur_ver, next_ver))
- return pkgs_list
-
def _get_packages_to_upgrade(self, packages=None):
if packages is None:
- return []
-
- if len(packages) == 1:
- # if user specified the version to upgrade to, just return the
- # tuple intact
- if packages[0][1] is not None:
- return packages
-
- self._check_upstream_versions(packages)
-
- return self._parse_checkpkg_file(get_build_dir() + "/tmp/log/checkpkg.csv")
+ I( "Nothing to upgrade")
+ exit(0)
+ else:
+ return packages
# this function will be called at the end of each recipe upgrade
def pkg_upgrade_handler(self, err):
@@ -530,6 +479,75 @@ class UniverseUpdater(Updater):
line.split(',')[3],
line.split(',')[4]]
+ def _update_master(self):
+ I(" Drop all uncommited changes (including untracked) ...")
+ self.git.reset_hard()
+ self.git.clean_untracked()
+
+ self.git.checkout_branch("master")
+ try:
+ self.git.delete_branch("upgrades")
+ except Error:
+ pass
+ I(" Sync master ...")
+ self.git.pull()
+ self.git.create_branch("upgrades")
+
+ def _prepare(self):
+ 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 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"))
+
+
+ def _check_upstream_versions(self, packages=[("universe", None, None)]):
+ I(" Fetching upstream version(s) ...")
+
+ try:
+ self.bb.checkpkg(" ".join([p[0] for p in packages]))
+ except Error as e:
+ for line in e.stdout.split('\n'):
+ if line.find("ERROR: Task do_checkpkg does not exist") == 0:
+ C(" \"distrodata.bbclass\" not inherited. Consider adding "
+ "the following to your local.conf:\n\n"
+ "INHERIT =+ \"distrodata\"\n")
+ exit(1)
+
+ def _parse_checkpkg_file(self, file_path):
+ import csv
+
+ pkgs_list = []
+
+ with open(file_path, "r") as f:
+ reader = csv.reader(f, delimiter='\t')
+ for row in reader:
+ if reader.line_num == 1: # skip header line
+ continue
+
+ pn = row[0]
+ cur_ver = row[1]
+ next_ver = row[2]
+ status = row[11]
+ maintainer = row[14]
+ no_upgrade_reason = row[15]
+
+ if status == 'UPDATE' and not no_upgrade_reason:
+ pkgs_list.append((pn, next_ver, maintainer))
+ else:
+ if no_upgrade_reason:
+ D(" Skip package %s (status = %s, current version = %s," \
+ " next version = %s, no upgrade reason = %s)" %
+ (pn, status, cur_ver, next_ver, no_upgrade_reason))
+ else:
+ D(" Skip package %s (status = %s, current version = %s," \
+ " next version = %s)" %
+ (pn, status, cur_ver, next_ver))
+ return pkgs_list
+
# checks if maintainer is in whitelist and that the recipe itself is not
# blacklisted: python, gcc, etc. Also, check the history if the recipe
# hasn't already been tried
@@ -580,30 +598,6 @@ class UniverseUpdater(Updater):
return True
- def update_master(self):
- I(" Drop all uncommited changes (including untracked) ...")
- self.git.reset_hard()
- self.git.clean_untracked()
-
- self.git.checkout_branch("master")
- try:
- self.git.delete_branch("upgrades")
- except Error:
- pass
- I(" Sync master ...")
- self.git.pull()
- self.git.create_branch("upgrades")
-
- def prepare(self):
- 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 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"))
-
def _get_packages_to_upgrade(self, packages=None):
last_date_checked = None
last_master_commit = None
@@ -649,7 +643,7 @@ class UniverseUpdater(Updater):
return pkgs_list
- def update_history(self, pn, new_ver, maintainer, upgrade_status):
+ def _update_history(self, pn, new_ver, maintainer, upgrade_status):
with open(self.history_file + ".tmp", "w+") as tmp_file:
if os.path.exists(self.history_file):
with open(self.history_file) as history:
@@ -661,15 +655,14 @@ class UniverseUpdater(Updater):
upgrade_status + "\n")
os.rename(self.history_file + ".tmp", self.history_file)
- # overriding the base method
def pkg_upgrade_handler(self, err):
super(UniverseUpdater, self).pkg_upgrade_handler(err)
- self.update_history(self.pn, self.new_ver, self.maintainer,
+ self._update_history(self.pn, self.new_ver, self.maintainer,
self._get_status_msg(err))
def run(self):
- self.update_master()
- self.prepare()
+ self._update_master()
+ self._prepare()
super(UniverseUpdater, self).run()
def close_child_processes(signal_id, frame):
--
1.9.1
next prev parent reply other threads:[~2015-07-29 20:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 20:50 [PATCH 00/10][auh] Add support for buildhistory and minor fixes Aníbal Limón
2015-07-29 20:50 ` [PATCH 01/10][auh] upgradehelper.py: Only run with one recipe or all Aníbal Limón
2015-07-31 13:48 ` Paul Eggleton
2015-07-29 20:50 ` [PATCH 02/10][auh] upgradehelper.py: Validate if upgrade is needed Aníbal Limón
2015-07-29 20:50 ` [PATCH 03/10][auh] upgradehelper.py: Only send emails when patch file exist Aníbal Limón
2015-07-29 20:50 ` [PATCH 04/10][auh] bitbake.py: Improve performance on env() call Aníbal Limón
2015-07-29 20:50 ` [PATCH 05/10][auh] upgradehelper.py: Add own step for loading environment Aníbal Limón
2015-07-31 13:48 ` Paul Eggleton
2015-07-29 20:50 ` [PATCH 06/10][auh] upgradehelper.py: UniverseUpdate don't abort if recipe checkpkg fails Aníbal Limón
2015-07-29 20:50 ` [PATCH 07/10][auh] bitbake.py: Rename bitbake_log.txt to bitbake_error_log Aníbal Limón
2015-07-29 20:50 ` [PATCH 08/10][auh] upgradehelper.py: Remove unused references to Buildhistory class Aníbal Limón
2015-07-29 20:50 ` Aníbal Limón [this message]
2015-07-29 20:50 ` [PATCH 10/10][auh] upgradehelper: Add support for generate buildhistory recipe diff's Aníbal Limón
2015-07-31 15:29 ` Paul Eggleton
2015-07-31 15:39 ` Aníbal Limón
2015-07-31 16:10 ` Paul Eggleton
2015-07-31 16:19 ` Aníbal Limón
2015-07-31 16:21 ` Paul Eggleton
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=1438203053-7909-10-git-send-email-anibal.limon@linux.intel.com \
--to=anibal.limon@linux.intel.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.