[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/5] raisin: Handle aliases for packages, add pciutils-dev / libpci-dev alias



On 16/10/15 14:37, Stefano Stabellini wrote:
> On Wed, 14 Oct 2015, George Dunlap wrote:
>> 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@xxxxxxxxxxxxx>
> 
> Thanks for the patch, this is very useful and I like the way it is done.
> 
> Please use spaces for indentation.

Oops -- used to emacs just doing that for me automatically.

> 
> 
>>  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 OIFS="$IFS"

Ack

> 
> 
>> +    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
>> -
>>  }
> 
> Everything else is fine

Cool, thanks.

 -George


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.