Hello, guys, The mail I sent earlier had a patch which seems to depend upon a RHEL- distributed patch which I am now attaching (along with the original patch too).
I have logged bugs in the pertinent bug trackers.
--
Manuel Amador (Rudd-O) <[email protected]>
Rudd-O.com - http://rudd-o.com/
GPG key ID 0xC8D28B92 at http://wwwkeys.pgp.net/
Now playing, courtesy of Amarok: Aqua - Cartoon heroes
Windows 95 is not a virus. Viruses actually do something.
--- distutils/command/bdist_rpm.py 2009-03-10 16:43:08.000000000 -0500
+++ distutils/command/bdist_rpm.py 2009-03-10 17:25:31.000000000 -0500
@@ -383,10 +383,21 @@
list of strings (one per line).
"""
# definitions and headers
+ version = self.distribution.get_version()
+ release = self.release.replace('-','_')
+ import re ; regex = '[^0-9\.]'
+ splits = re.split(regex,version,maxsplit=1)
+ firstnonalnumchar = re.findall(regex,version)
+ if len(splits) == 1:
+ pass
+ else:
+ version = splits[0]
+ release = "0." + release + "." + firstnonalnumchar[0] + splits[1]
spec_file = [
'%define name ' + self.distribution.get_name(),
'%define version ' + self.distribution.get_version().replace('-','_'),
- '%define release ' + self.release.replace('-','_'),
+ '%define version ' + version,
+ '%define release ' + release,
'',
'Summary: ' + self.distribution.get_description(),
]
@@ -411,8 +422,10 @@
else:
spec_file.append('Source0: %{name}-%{version}.tar.gz')
+ license = self.distribution.get_license()
+ if len(license.splitlines()) > 1: license = "Other"
spec_file.extend([
- 'License: ' + self.distribution.get_license(),
+ 'License: ' + license,
'Group: ' + self.group,
'BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot',
'Prefix: %{_prefix}', ])
--- Python-2.4b1/Lib/distutils/command/bdist_rpm.py.bdist-rpm 2004-09-17 04:34:12.000000000 -0400
+++ Python-2.4b1/Lib/distutils/command/bdist_rpm.py 2004-11-04 16:15:52.406896823 -0500
@@ -334,29 +334,47 @@
if not self.keep_temp:
rpm_cmd.append('--clean')
rpm_cmd.append(spec_path)
+ # Determine the binary rpm names that should be built out of this spec
+ # file
+ # Note that some of these may not be really built (if the file
+ # list is empty)
+ nvr_string = "%{name}-%{version}-%{release}"
+ src_rpm = nvr_string + ".src.rpm"
+ non_src_rpm = "%{arch}/" + nvr_string + ".%{arch}.rpm"
+ q_cmd = r"rpm -q --qf '%s %s\n' --specfile '%s'" % (
+ src_rpm, non_src_rpm, spec_path)
+
+ out = os.popen(q_cmd)
+ binary_rpms = []
+ source_rpm = None
+ while 1:
+ line = out.readline()
+ if not line:
+ break
+ l = string.split(string.strip(line))
+ assert(len(l) == 2)
+ binary_rpms.append(l[1])
+ # The source rpm is named after the first entry in the spec file
+ if source_rpm is None:
+ source_rpm = l[0]
+
+ status = out.close()
+ if status:
+ raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
+
self.spawn(rpm_cmd)
- # XXX this is a nasty hack -- we really should have a proper way to
- # find out the names of the RPM files created; also, this assumes
- # that RPM creates exactly one source and one binary RPM.
if not self.dry_run:
if not self.binary_only:
- srpms = glob.glob(os.path.join(rpm_dir['SRPMS'], "*.rpm"))
- assert len(srpms) == 1, \
- "unexpected number of SRPM files found: %s" % srpms
- self.move_file(srpms[0], self.dist_dir)
+ srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
+ assert(os.path.exists(srpm))
+ self.move_file(srpm, self.dist_dir)
if not self.source_only:
- rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm"))
- debuginfo = glob.glob(os.path.join(rpm_dir['RPMS'], \
- "*/*debuginfo*.rpm"))
- if debuginfo:
- rpms.remove(debuginfo[0])
- assert len(rpms) == 1, \
- "unexpected number of RPM files found: %s" % rpms
- self.move_file(rpms[0], self.dist_dir)
- if debuginfo:
- self.move_file(debuginfo[0], self.dist_dir)
+ for rpm in binary_rpms:
+ rpm = os.path.join(rpm_dir['RPMS'], rpm)
+ if os.path.exists(rpm):
+ self.move_file(rpm, self.dist_dir)
# run()
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
