[Yum-devel] RFC: yum+rpm ppc64p7 patches

James Antill james.antill at redhat.com
Wed Apr 18 12:22:13 UTC 2012


On Fri, 2012-03-23 at 19:22 +0100, Phil Knirsch wrote:
> Hi folks.
> 
> Here the promised patches to add support for adding a power7
> optimized 
> arch to ppc64 for rpm and yum.
> 
> It's pretty similar to the ARM neon support code from dgilmore, only 
> that i needed to add the detection properly in rpm as well.
> 
> I've tested them to some degree with a local repository containing 
> packages build with --target ppc64p7 and then installing, removing
> and 
> updating the respective package. Selection worked as expected,
> preferred 
> ppc64p7 obviously on a Power7 box.
> 
> The detection code is a bit rough, both in yum and rpm, but i didn't 
> want to manually parse the C struct from /proc/self/auxv.

 Bah, never replied to this for the yum side.

> diff -up yum-3.4.3/rpmUtils/arch.py.ppc64p7 yum-3.4.3/rpmUtils/arch.py
> --- yum-3.4.3/rpmUtils/arch.py.ppc64p7  2012-03-23 19:06:05.554002837
> +0100
> +++ yum-3.4.3/rpmUtils/arch.py  2012-03-23 19:06:09.143997990 +0100
> @@ -2,6 +2,8 @@
>  #
>  
>  import os
> +import subprocess
> +import tempfile
>  import rpm
>  
>  _ppc64_native_is_best = True
> @@ -31,6 +33,7 @@ arches = {
>      "ia32e": "x86_64",
>      
>      # ppc
> +    "ppc64p7": "ppc64",
>      "ppc64pseries": "ppc64",
>      "ppc64iseries": "ppc64",    
>      "ppc64": "ppc",
> @@ -260,13 +260,27 @@ def getCanonPPCArch(arch):
>          if line.find("machine") != -1:
>              machine = line.split(':')[1]
>              break
> -    if machine is None:
> +
> +    platform = None
> +    so = tempfile.NamedTemporaryFile(mode="rw+b")
> +    obj = subprocess.Popen(["LD_SHOW_AUXV=1 /bin/true"], shell=True, close_fds=True, stdout=so.file)
> +    obj.wait()
> +    so.file.seek(0, 0)
> +    for line in so.readlines():
> +        if line.find("AT_PLATFORM:") != -1:
> +            platform = line.split(':')[1]


 This is a bit meh ... is it possible we could get an rpm API or
something to do this? Does the above work in anaconda? Not sure if there
are any other gotchas with having to be able to run other applications,
esp. this far down.
 Also seems like it could use pipes instead of files ... but then again
it's all in the ppc code, so as long as it works...

> +    if machine is None and platform is None:
>          return arch
>  
> -    if machine.find("CHRP IBM") != -1:
> -        return "ppc64pseries"
> -    if machine.find("iSeries") != -1:
> -        return "ppc64iseries"
> +    if platform != None and platform.find("power7") != -1:
> +        return "ppc64p7"
> +
> +    if machine != None:
> +        if machine.find("CHRP IBM") != -1:
> +            return "ppc64pseries"
> +        if machine.find("iSeries") != -1:
> +            return "ppc64iseries"
>      return arch

 I think what you want to do here is just add:

+ if platofrm is None:
+     arch
+ if platform.find("power7") != -1:
+     return "ppc64p7"
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20120418/5985d208/attachment.asc>


More information about the Yum-devel mailing list