[Yum] installroot and arch

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

 



On Mon, 23 Aug 2004, Bogdan Costescu wrote:

> While trying to use --installroot to set up some cluster nodes, I came 
> across the problem of specifying the architecture of the machine that 
> will run the software from installroot.

... and apparently some parts of the problem can be solved and others 
can't.

First the good news: the part that is doable is being able to specify
athlon when running on an i686 or lower and vice-versa. The patch at
the end of this message (against yum-2.0.7 that comes with TaoLinux,
so there might be some offsets due to the "protectbase" patch)  
implements this by simply fooling archwork.bestarch() to return the
"forced" architecture _if_ the architecture is part of the list (=
there is a package for that architecture). The implementation might
not be the best as I tried to make the minimum of modifications to the
source.

Then the bad news: the part that is not doable is being able to
specify an architecture whose $basearch is different from the install
machine's $basearch (like sparc vs. i386). By fooling with
archwork.getArch() I was able to make yum choose f.e. x86_64 packages
on an i686, but rpm refused to install these packages. So unless some
kind of "cross-rpm" (analogy to cross-compilation) comes up, this is
not doable. The only exception would probably be making an i686/athlon
installroot on a x86_64, in which case the patch would still be
useful...

I do not ask for inclusion of this patch in the official sources, I
merely present it here to be archived for people that might be looking
for this functionality.


diff -Nur yum-2.0.7-orig/archwork.py yum-2.0.7/archwork.py
--- yum-2.0.7-orig/archwork.py	2004-05-07 06:58:34.000000000 +0200
+++ yum-2.0.7/archwork.py	2004-08-26 15:48:06.000000000 +0200
@@ -19,6 +19,8 @@
 import rpm
 import re
 
+forcedarch = ""
+
 def getArch():
     arch = os.uname()[4]
     newarch = None
@@ -59,6 +61,8 @@
     del score2
 
 def bestarch(archlist):
+    if forcedarch != "" and forcedarch in archlist:
+        return forcedarch
     currentarch = archlist[0]
     for arch in archlist[1:]:
         currentarch = betterarch(currentarch, arch)
diff -Nur yum-2.0.7-orig/yummain.py yum-2.0.7/yummain.py
--- yum-2.0.7-orig/yummain.py	2004-08-26 15:46:19.000000000 +0200
+++ yum-2.0.7/yummain.py	2004-08-26 15:48:06.000000000 +0200
@@ -19,6 +19,7 @@
 import fcntl
 import sys
 import getopt
+import archwork
 import clientStuff
 import nevral
 import pkgaction
@@ -51,6 +52,7 @@
     try:
         gopts, cmds = getopt.getopt(args, 'tCc:fhR:e:d:y', ['help', 'version', 
                                                            'installroot=',
+                                                           'installrootarch=',
                                                            'exclude=',
                                                            'download-only'])
     except getopt.error, e:
@@ -65,6 +67,8 @@
             if o == '--installroot':
                 if os.access(a + "/etc/yum.conf", os.R_OK):
                     yumconffile = a + '/etc/yum.conf'
+            if o == '--installrootarch':
+                archwork.forcedarch = a
             if o == '-R':
                 sleeptime=random.randrange(int(a)*60)
                 # debug print sleeptime

-- 
Bogdan Costescu

IWR - Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen
Universitaet Heidelberg, INF 368, D-69120 Heidelberg, GERMANY
Telephone: +49 6221 54 8869, Telefax: +49 6221 54 8868
E-mail: Bogdan.Costescu@xxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux