From 7a981b054d0f81028eba5713c8babab2ad289f5c Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Tue, 02 Oct 2012 20:36:33 +0000 Subject: Use arch-aware exclude list for yumcfg too Use arch considerations in yumcfg like the repos module. This involved promoting fedora_arch to be a global option. --- diff --git a/doc/README b/doc/README index 7a46796..d362cf7 100644 --- a/doc/README +++ b/doc/README @@ -141,6 +141,11 @@ fedora_release The numeric release number of the Fedora operating system to base the OLPC OS build on. For example, 11 for Fedora 11. +fedora_arch + + The processor architecture to use for Fedora package selection. + See http://mirrors.fedoraproject.org/ for the available values. + olpc_version_major The major version component of the OLPC version tag to include in diff --git a/examples/f18-xo1.5.ini b/examples/f18-xo1.5.ini index 68da11c..9a979b1 100644 --- a/examples/f18-xo1.5.ini +++ b/examples/f18-xo1.5.ini @@ -1,5 +1,6 @@ [global] fedora_release=18 +fedora_arch=i386 olpc_version_major=13 olpc_version_minor=1 olpc_version_release=0 @@ -13,7 +14,6 @@ langs=en_US,en_AU,es,ar,pt,pt_BR,fr,ht,mn,mr_IN,am_ET,km_KH,ne_NP,ur_PK,rw,ps,fa [sd_card_image] [repos] -fedora_arch=i386 fedora=fedora,fedora-updates,fedora-updates-testing olpc_publicrpms_1=1,f18 olpc_publicrpms_2=1,f18-xo1.5 diff --git a/examples/f18-xo1.75.ini b/examples/f18-xo1.75.ini index 9344ce5..294b401 100644 --- a/examples/f18-xo1.75.ini +++ b/examples/f18-xo1.75.ini @@ -1,5 +1,6 @@ [global] fedora_release=18 +fedora_arch=armhfp olpc_version_major=13 olpc_version_minor=1 olpc_version_release=0 @@ -13,7 +14,6 @@ langs=en_US,en_AU,es,ar,pt,pt_BR,fr,ht,mn,mr_IN,am_ET,km_KH,ne_NP,ur_PK,rw,ps,fa [sd_card_image] [repos] -fedora_arch=armhfp fedora=fedora,fedora-updates-testing olpc_publicrpms_1=1,f18 olpc_publicrpms_2=1,f18-xo1.75 diff --git a/examples/f18-xo1.ini b/examples/f18-xo1.ini index 2299140..994369a 100644 --- a/examples/f18-xo1.ini +++ b/examples/f18-xo1.ini @@ -1,5 +1,6 @@ [global] fedora_release=18 +fedora_arch=i386 olpc_version_major=13 olpc_version_minor=1 olpc_version_release=0 @@ -13,7 +14,6 @@ langs=en_US,en_AU,es,ar,pt,pt_BR,fr,ht,mn,mr_IN,am_ET,km_KH,ne_NP,ur_PK,rw,ps,fa [jffs2_image] [repos] -fedora_arch=i386 fedora=fedora,fedora-updates,fedora-updates-testing olpc_publicrpms_1=1,f18 olpc_publicrpms_2=1,f18-xo1 diff --git a/examples/f18-xo4.ini b/examples/f18-xo4.ini index ab69a74..51f41ec 100644 --- a/examples/f18-xo4.ini +++ b/examples/f18-xo4.ini @@ -1,5 +1,6 @@ [global] fedora_release=18 +fedora_arch=armhfp olpc_version_major=13 olpc_version_minor=1 olpc_version_release=0 @@ -13,7 +14,6 @@ langs=en_US,en_AU,es,ar,pt,pt_BR,fr,ht,mn,mr_IN,am_ET,km_KH,ne_NP,ur_PK,rw,ps,fa [sd_card_image] [repos] -fedora_arch=armhfp fedora=fedora,fedora-updates-testing olpc_publicrpms_1=1,f18 olpc_publicrpms_2=1,f18-xo4 diff --git a/lib/ooblib.py b/lib/ooblib.py index 93cf7d8..dc3fba6 100644 --- a/lib/ooblib.py +++ b/lib/ooblib.py @@ -70,7 +70,7 @@ def arch_matches(myarch, arch): else: return False -def add_packages_from_xml(fd, pkglist, myarch=None): +def add_packages_from_xml(fd, pkglist, myarch): et = ElementTree(file=fd) root = et.getroot() for i in root.getchildren(): diff --git a/modules/repos/README b/modules/repos/README index c69ef14..ada9dd7 100644 --- a/modules/repos/README +++ b/modules/repos/README @@ -8,20 +8,15 @@ release repository (and perhaps update) or equivalent is enabled. Everything is done through the configuration. -Firstly, the 'fedora' and 'fedora_arch' options: +Firstly, the 'fedora' option: [repos] -fedora_arch=i386 fedora=fedora,fedora_updates,fedora_updates_testing This is a comma-separated list of official Fedora repositories to enable for the build. The 4 possible options are fedora, fedora_updates, fedora_updates_testing and rawhide. -If using the fedora option, the fedora_arch option must be specified too. -This specifies the processor architecture to use for Fedora package selection. -See http://mirrors.fedoraproject.org/ for the available values. - A Fedora mirror is normally automatically selected by yum through Fedora's mirrorlist mechanism. If you wish to override the mirror selection choice, you can either add the repos as custom repos (see below), or you can use @@ -29,7 +24,6 @@ you can either add the repos as custom repos (see below), or you can use [repos] fedora=fedora,fedora_updates -fedora_arch=i386 url_fedora_updates=http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/fedora/linux/updates/16/i386/ url_fedora=http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/fedora/linux/development/16/i386/os/ @@ -96,11 +90,11 @@ For example, this is useful to specify that packages in OLPC's "override" repos take precedence over the official Fedora repos, even if the Fedora repo contains a newer version of a particular package. -If the fedora_arch option was present, the exclude list is generated in a -manner that takes arch considerations into account. For example, -if fedora_arch=i386 but there is an ARM package in a repository that -conributes to the exclude list, the package will *not* be added to the list -(since it is not suitable for your architecture). +The exclude list is generated in a manner that takes arch considerations into +account. For example, if the global fedora_arch setting is 'i386' but there is +an ARM package in a repository that contributes to the exclude list, +the package will *not* be added to the list (since it is not suitable for your +architecture). The add_excludes_to option value is a comma-separated list of repository names where the exclude list should be applied. The names are the same diff --git a/modules/repos/ksmain.50.repos.py b/modules/repos/ksmain.50.repos.py index e19f87a..bde0b09 100644 --- a/modules/repos/ksmain.50.repos.py +++ b/modules/repos/ksmain.50.repos.py @@ -11,10 +11,7 @@ excludepkgs = set() addexcludes = ooblib.read_config('repos', 'add_excludes_to') fedora = ooblib.read_config('repos', 'fedora') fver = ooblib.read_config('global', 'fedora_release').strip() -farch = ooblib.read_config('repos', 'fedora_arch') - -if farch: - farch = farch.strip() +farch = ooblib.read_config('global', 'fedora_arch').strip() def add_to_excludes(baseurl, addexcludes): print >>sys.stderr, "Reading repository information for", baseurl diff --git a/modules/yumcfg/kspost.50.yumcfg.py b/modules/yumcfg/kspost.50.yumcfg.py index 6685913..cda5273 100644 --- a/modules/yumcfg/kspost.50.yumcfg.py +++ b/modules/yumcfg/kspost.50.yumcfg.py @@ -11,6 +11,8 @@ import ooblib addrepos = [] excludes = set() +farch = ooblib.read_config('global', 'fedora_arch').strip() + # read in repos for var in os.environ: if not var.startswith("CFG_yumcfg__addrepo"): @@ -28,7 +30,7 @@ for for_excludes, name, url in addrepos: data = fd.read() fd.close() fd = GzipFile(fileobj=StringIO(data)) - ooblib.add_packages_from_xml(fd, excludes) + ooblib.add_packages_from_xml(fd, excludes, farch) # write shell code to generate yum repo files for for_excludes, name, url in addrepos: -- cgit v0.9.1