Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Mark Hatle <mark.hatle@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH] python-smartpm: Add an attempt install mode
Date: Tue, 10 Sep 2013 20:59:35 -0500	[thread overview]
Message-ID: <1378864775-7094-1-git-send-email-mark.hatle@windriver.com> (raw)

[ YOCTO #3723 ]

Add a mode to smart that will allow an installation to continue, instead of
failure in the case that one or more items is uninstallable.

Uninstallable packages are simply ignored, and no error is generated.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/package_rpm.bbclass                   |  7 +--
 .../python/python-smartpm/smart-attempt.patch      | 59 ++++++++++++++++++++++
 .../python/python-smartpm_1.4.1.bb                 |  1 +
 3 files changed, 62 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python-smartpm/smart-attempt.patch

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 8ab42c4..699d0f2 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -472,11 +472,8 @@ EOF
 		echo "Attempting $pkgs_to_install"
 		echo "Note: see `dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
 		translate_oe_to_smart ${sdk_mode} --attemptonly $package_attemptonly
-		for each_pkg in $pkgs_to_install ;  do
-			# We need to try each package individually as a single dependency failure
-			# will break the whole set otherwise.
-			smart --data-dir=${target_rootfs}/var/lib/smart install -y $each_pkg >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || true
-		done
+		echo "Attempting $pkgs_to_install" >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
+		smart --data-dir=${target_rootfs}/var/lib/smart install --attempt -y ${pkgs_to_install} >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1
 	fi
 }
 
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
new file mode 100644
index 0000000..0d603d3
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
@@ -0,0 +1,59 @@
+Add a mechanism to attempt the install operation, w/o failing.
+
+For complementary and 'attemptonly' packages, we need a way to instruct smart to
+try to install, but ignore any failures.
+
+This option only works for the install operation.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Index: smart-1.4.1/smart/commands/install.py
+===================================================================
+--- smart-1.4.1.orig/smart/commands/install.py
++++ smart-1.4.1/smart/commands/install.py
+@@ -50,6 +50,8 @@ def option_parser():
+     parser = OptionParser(usage=USAGE,
+                           description=DESCRIPTION,
+                           examples=EXAMPLES)
++    parser.add_option("--attempt", action="store_true",
++                      help=_("attempt to install packages, ignore failures"))
+     parser.add_option("--stepped", action="store_true",
+                       help=_("split operation in steps"))
+     parser.add_option("--urls", action="store_true",
+@@ -80,6 +82,9 @@ def main(ctrl, opts):
+     if not opts.args:
+         raise Error, _("no package(s) given")
+ 
++    if opts.attempt:
++	sysconf.set("attempt-install", True, soft=True)
++
+     if opts.explain:
+         sysconf.set("explain-changesets", True, soft=True)
+ 
+Index: smart-1.4.1/smart/transaction.py
+===================================================================
+--- smart-1.4.1.orig/smart/transaction.py
++++ smart-1.4.1/smart/transaction.py
+@@ -1216,9 +1216,17 @@ class Transaction(object):
+                     else:
+                         op = REMOVE
+                 if op is INSTALL or op is REINSTALL:
+-                    self._install(pkg, changeset, locked, pending)
+-                    if pkg in changeset:
+-                        changeset.setRequested(pkg, True)
++                    try:
++                        self._install(pkg, changeset, locked, pending)
++                        if pkg in changeset:
++                            changeset.setRequested(pkg, True)
++                    except Failed, e:
++                        if sysconf.has("attempt-install", soft=True):
++                            if pkg in changeset:
++                                del changeset[pkg]
++                            continue
++                        else:
++                            raise Failed, e
+                 elif op is REMOVE:
+                     self._remove(pkg, changeset, locked, pending)
+                 elif op is UPGRADE:
diff --git a/meta/recipes-devtools/python/python-smartpm_1.4.1.bb b/meta/recipes-devtools/python/python-smartpm_1.4.1.bb
index 5d673b9..f406d69 100644
--- a/meta/recipes-devtools/python/python-smartpm_1.4.1.bb
+++ b/meta/recipes-devtools/python/python-smartpm_1.4.1.bb
@@ -30,6 +30,7 @@ SRC_URI = "\
           file://smart-flag-ignore-recommends.patch \
           file://smart-flag-exclude-packages.patch \
           file://smart-config-ignore-all-recommends.patch \
+          file://smart-attempt.patch \
           "
 
 SRC_URI[md5sum] = "573ef32ba177a6b3c4bf7ef04873fcb6"
-- 
1.8.1.2.545.g2f19ada



             reply	other threads:[~2013-09-11  2:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11  1:59 Mark Hatle [this message]
2013-09-11  2:04 ` [PATCH] python-smartpm: Add an attempt install mode Mark Hatle
2013-09-11 10:04   ` Paul Eggleton
2013-09-11 13:47     ` Mark Hatle
2013-09-11 14:29       ` 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=1378864775-7094-1-git-send-email-mark.hatle@windriver.com \
    --to=mark.hatle@windriver.com \
    --cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox