diff options
-rw-r--r-- | schemas/pkglist.xsd | 4 | ||||
-rw-r--r-- | src/lib/Client/Redhat.py | 13 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Pkgmgr.py | 15 |
3 files changed, 29 insertions, 3 deletions
diff --git a/schemas/pkglist.xsd b/schemas/pkglist.xsd index bd73e8095..a0bc79af8 100644 --- a/schemas/pkglist.xsd +++ b/schemas/pkglist.xsd @@ -17,6 +17,8 @@ <xsd:attribute type='xsd:string' name='verify'/> <xsd:attribute type='xsd:string' name='simplefile'/> <xsd:attribute type='xsd:string' name='reloc'/> + <xsd:attribute type='xsd:string' name='multiarch'/> + <xsd:attribute type='xsd:string' name='srcs'/> </xsd:complexType> <xsd:complexType name='ContainerType'> @@ -36,6 +38,8 @@ <xsd:attribute name='priority' type='xsd:integer' use='required'/> <xsd:attribute name='type' use='optional' type='PackageTypeEnum' /> <xsd:attribute name='uri' type='xsd:string' use='optional'/> + <xsd:attribute type='xsd:string' name='multiarch'/> + <xsd:attribute type='xsd:string' name='srcs'/> </xsd:complexType> </xsd:element> </xsd:schema>
\ No newline at end of file diff --git a/src/lib/Client/Redhat.py b/src/lib/Client/Redhat.py index 80aa3a8c8..e980ad9c1 100644 --- a/src/lib/Client/Redhat.py +++ b/src/lib/Client/Redhat.py @@ -93,6 +93,19 @@ class ToolsetImpl(Toolset): return False if self.installed.has_key(entry.get('name')): if entry.get('version') == self.installed[entry.get('name')]: + if entry.get('multiarch'): + archs = entry.get('multiarch').split() + info = self.saferun('rpm -q %s --qf "%{NAME} %{VERSION}-%{RELEASE} %{ARCH}\n"' % (entry.get('name')))[1] + while info: + (_, vers, arch) = info.pop() + if arch in archs: + archs.remove(arch) + else: + self.logger.error("Got pkg install for Package %s: arch %s" % (entry.get('name'), arch)) + return False + if archs: + self.logger.error("Package %s not installed for arch: %s" % (entry.get('name'), archs)) + return False if (self.setup['quick'] or (entry.get('verify', 'true') == 'false')): if entry.get('verify', 'true') == 'false': self.logger.debug("Skipping checksum verification for package %s" % (entry.get('name'))) diff --git a/src/lib/Server/Plugins/Pkgmgr.py b/src/lib/Server/Plugins/Pkgmgr.py index 563a7c448..d358127c4 100644 --- a/src/lib/Server/Plugins/Pkgmgr.py +++ b/src/lib/Server/Plugins/Pkgmgr.py @@ -7,8 +7,8 @@ logger = logging.getLogger('Bcfg2.Plugins.Pkgmgr') class PNode(Bcfg2.Server.Plugin.INode): '''PNode has a list of packages available at a particular group intersection''' - splitters = {'rpm':re.compile('^(?P<name>[\w\+\d\.]+(-[\w\+\d\.]+)*)-' + \ - '(?P<version>[\w\d\.]+-([\w\d\.]+))\.(?P<arch>\w+)\.rpm$'), + splitters = {'rpm':re.compile('^(.*/)?(?P<name>[\w\+\d\.]+(-[\w\+\d\.]+)*)-' + \ + '(?P<version>[\w\d\.]+-([\w\d\.]+))\.(?P<arch>\S+)\.rpm$'), 'encap':re.compile('^(?P<name>\w+)-(?P<version>[\w\d\.-]+).encap.*$')} ignore = ['Package'] @@ -30,7 +30,14 @@ class PNode(Bcfg2.Server.Plugin.INode): self.contents['Package'][pkg.get('name')] = pkg.attrib else: if pkg.attrib.has_key('file'): - pkg.set('url', '%s/%s' % (pkg.get('uri'), pkg.get('file'))) + if pkg.attrib.has_key('multiarch'): + archs = pkg.get('multiarch').split() + srcs = pkg.get('srcs', pkg.get('multiarch')).split() + url = ' '.join(["%s/%s" % (pkg.get('uri'), pkg.get('file') % (srcs[idx], archs[idx])) + for idx in range(len(archs))]) + pkg.set('url', url) + else: + pkg.set('url', '%s/%s' % (pkg.get('uri'), pkg.get('file'))) if self.splitters.has_key(pkg.get('type')) and pkg.get('file') != None: mdata = self.splitters[pkg.get('type')].match(pkg.get('file')) if not mdata: @@ -43,6 +50,8 @@ class PNode(Bcfg2.Server.Plugin.INode): self.contents['Package'][pkgname]['type'] = pkg.get('type') if pkg.get('verify'): self.contents['Package'][pkgname]['verify'] = pkg.get('verify') + if pkg.get('multiarch'): + self.contents['Package'][pkgname]['multiarch'] = pkg.get('multiarch') if pkgname not in pdict['Package']: pdict['Package'].append(pkgname) else: |