from mic import msger
+RPM_RE = re.compile("(.*)\.(.*) (.*)-(.*)")
+RPM_FMT = "%(name)s.%(arch)s %(ver_rel)s"
+SRPM_RE = re.compile("(.*)-(\d+.*)-(\d+\.\d+).src.rpm")
+
def get_md5sum(fpath):
blksize = 65536 # should be optimized enough
def get_source_name(pkg, repometadata):
def get_bin_name(pkg):
- m = re.match("(.*)\.(.*) (.*)-(.*)", pkg)
+ m = RPM_RE.match(pkg)
if m:
return m.group(1)
return None
def get_src_name(srpm):
- m = re.match("(.*)-(\d+.*)-(\d+\.\d+).src.rpm", srpm)
+ m = SRPM_RE.match(srpm)
if m:
return m.group(1)
return None
return None
def get_src_name(srpm):
- m = re.match("(.*)-(\d+.*)-(\d+\.\d+).src.rpm", srpm)
+ m = SRPM_RE.match(srpm)
if m:
return m.group(1)
return None
# record all pkg and the content
for pkg in dlpkgs:
- pkg_long_name = "%s.%s %s" % (pkg.name, pkg.arch, pkg.printVer())
+ pkg_long_name = misc.RPM_FMT % {
+ 'name': pkg.name,
+ 'arch': pkg.arch,
+ 'ver_rel': pkg.printVer(),
+ }
self.__pkgs_content[pkg_long_name] = pkg.files
license = pkg.license
if license in self.__pkgs_license.keys():
license = ''
if pkg.name() in localpkgs:
hdr = rpmmisc.readRpmHeader(self.ts, self.localpkgs[pkg.name()])
- pkg_long_name = "%s.%s %s-%s" \
- % (hdr['name'],
- hdr['arch'],
- hdr['version'],
- hdr['release'])
+ pkg_long_name = misc.RPM_FMT % {
+ 'name': hdr['name'],
+ 'arch': hdr['arch'],
+ 'ver_rel': '%s-%s' % (hdr['version'],
+ hdr['release']),
+ }
license = hdr['license']
else:
- pkg_long_name = "%s.%s %s" \
- % (pkg.name(),
- pkg.arch(),
- pkg.edition())
+ pkg_long_name = misc.RPM_FMT % {
+ 'name': pkg.name(),
+ 'arch': pkg.arch(),
+ 'ver_rel': pkg.edition(),
+ }
package = zypp.asKindPackage(pkg)
license = package.license()