xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: [PATCH 1/5] raisin: Handle aliases for packages, add pciutils-dev / libpci-dev alias
Date: Wed, 14 Oct 2015 17:21:43 +0100	[thread overview]
Message-ID: <1444839707-2339-2-git-send-email-george.dunlap@eu.citrix.com> (raw)
In-Reply-To: <1444839707-2339-1-git-send-email-george.dunlap@eu.citrix.com>

It's not uncommon for packages to be renamed, and for package managers
to know the translation from old packages to new packages.  For
example:

# apt-get install pciutils-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libpci-dev' instead of 'pciutils-dev'
libpci-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

So the command succeeds, but the subsequent package check still fails,
cince "pciutils-dev" wasn't actually installed.  This means that even
after running "install-builddep", "build" will prompt you to install the
old package every time.

Allow components to specify known aliases for a given package by
speficying a a|b|c.  Check-package will check consecutively for a, b,
and c; if it finds any of them, it will stop looking and install
nothing.  If it finds nothing, it will add the first package to the
missing_packages list.

Assuming that package managers are backwards-compatible, components
should put the oldest known package first for maximum compatibility.

Also add such an alias for pciutils-dev|libpci-dev in qemu_traditional

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---
 components/qemu_traditional |  2 +-
 lib/common-functions.sh     | 25 ++++++++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/components/qemu_traditional b/components/qemu_traditional
index 3150c3e..d73c6b8 100644
--- a/components/qemu_traditional
+++ b/components/qemu_traditional
@@ -10,7 +10,7 @@ function qemu_traditional_skip() {
 }
 
 function qemu_traditional_check_package() {
-    local DEP_Debian_common="build-essential zlib1g-dev pciutils-dev pkg-config \
+    local DEP_Debian_common="build-essential zlib1g-dev pciutils-dev|libpci-dev pkg-config \
               libncurses5-dev"
     local DEP_Debian_x86_32="$DEP_Debian_common"
     local DEP_Debian_x86_64="$DEP_Debian_common"
diff --git a/lib/common-functions.sh b/lib/common-functions.sh
index 03642ae..a389054 100644
--- a/lib/common-functions.sh
+++ b/lib/common-functions.sh
@@ -233,14 +233,29 @@ function _install-package-unknown() {
 
 # Modifies inherited variable "missing"
 function check-package() {
+    local OIFS=${IFS}
+    local p
+    local x
+    
     for p in $*
     do
-        if ! _check-package-${PKGTYPE} $p
-        then
-            missing+=("$p")
-        fi
+	local found=false
+	IFS='|'
+	for x in $p
+	do
+            if _check-package-${PKGTYPE} $x
+            then
+		found=true
+            fi
+	done
+	IFS="$OIFS"
+	if ! $found
+	then
+	    # Add the first of the aliases, on the assumption that the package
+	    # manager will be backwards-compatible
+	    missing+=("${p%%|*}")
+	fi
     done
-
 }
 
 function install-package() {
-- 
2.1.4

  reply	other threads:[~2015-10-14 16:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 16:21 [PATCH 0/5] raisin: Miscelaneous improvements George Dunlap
2015-10-14 16:21 ` George Dunlap [this message]
2015-10-16 13:37   ` [PATCH 1/5] raisin: Handle aliases for packages, add pciutils-dev / libpci-dev alias Stefano Stabellini
2015-10-19  9:52     ` George Dunlap
2015-10-14 16:21 ` [PATCH 2/5] raisin: Detect systemd George Dunlap
2015-10-14 16:34   ` George Dunlap
2015-10-16 13:41     ` Stefano Stabellini
2015-10-19  9:54       ` George Dunlap
2015-10-19 11:09         ` Stefano Stabellini
2015-10-16 13:39   ` Stefano Stabellini
2015-10-16 14:02     ` Ian Campbell
2015-10-16 14:04       ` Stefano Stabellini
2015-10-19 10:01         ` George Dunlap
2015-10-19 11:15           ` Stefano Stabellini
2015-10-14 16:21 ` [PATCH 3/5] raisin: Allow iasl to alias acpica-tools, unify Fedora and CentOS deps for xen George Dunlap
2015-10-16 13:42   ` Stefano Stabellini
2015-10-14 16:21 ` [PATCH 4/5] raisin: Change update/release parsing OSes George Dunlap
2015-10-16 13:49   ` Stefano Stabellini
2015-10-19  9:16     ` George Dunlap
2015-10-19 11:26       ` Stefano Stabellini
2015-10-19 11:39         ` George Dunlap
2015-10-14 16:21 ` [PATCH 5/5] raisin: Add XEN_CONFIG_EXTRA to config file George Dunlap
2015-10-16 13:53   ` Stefano Stabellini
2015-10-19  9:24     ` George Dunlap
2015-10-19 11:37       ` Stefano Stabellini
2015-10-19 11:42         ` George Dunlap
2015-10-19 11:49           ` Stefano Stabellini

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=1444839707-2339-2-git-send-email-george.dunlap@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).