diff options
author | Jesse Keating <jkeating@redhat.com> | 2010-07-14 20:56:14 -0700 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2010-07-14 20:56:14 -0700 |
commit | f9a10ebd045abe18fd05f1743c7cf63870685ab0 (patch) | |
tree | 6c9b0a4c6127af7e979894b3de24847092200606 /src | |
parent | 2c422a6b91b24814e5d78f88951b5c445d5e750b (diff) | |
download | fedora-packager-f9a10ebd045abe18fd05f1743c7cf63870685ab0.tar.gz fedora-packager-f9a10ebd045abe18fd05f1743c7cf63870685ab0.tar.xz fedora-packager-f9a10ebd045abe18fd05f1743c7cf63870685ab0.zip |
Fix ver rel output when subpackages are involved.
The idea here came from Xavier Lamien. I just modified it slightly.
Diffstat (limited to 'src')
-rw-r--r-- | src/pyfedpkg/__init__.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index c5a30c3..06ade47 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -869,28 +869,36 @@ class PackageModule: cmd = ['rpm'] cmd.extend(self.rpmdefines) - cmd.extend(['-q', '--qf', '%{VERSION}', '--specfile', + # We make sure there is a space at the end of our query so that + # we can split it later. When ther eare sub packages, we get a + # listing for each subpackage. We only care about the first. + cmd.extend(['-q', '--qf', '"%{VERSION} "', '--specfile', os.path.join(self.path, self.spec)]) try: output = subprocess.Popen(' '.join(cmd), shell=True, stdout=subprocess.PIPE).communicate() except subprocess.CalledProcessError, e: raise FedpkgError('Could not get version of %s: %s' % (self.module, e)) - return output[0] + # Get just the output, then split it by space, grab the first + return output[0].split()[0] def getrel(self): """Return the version-release of a package module.""" cmd = ['rpm'] cmd.extend(self.rpmdefines) - cmd.extend(['-q', '--qf', '%{RELEASE}', '--specfile', + # We make sure there is a space at the end of our query so that + # we can split it later. When ther eare sub packages, we get a + # listing for each subpackage. We only care about the first. + cmd.extend(['-q', '--qf', '"%{RELEASE} "', '--specfile', os.path.join(self.path, self.spec)]) try: output = subprocess.Popen(' '.join(cmd), shell=True, stdout=subprocess.PIPE).communicate() except subprocess.CalledProcessError, e: raise FedpkgError('Could not get release of %s: %s' % (self.module, e)) - return output[0] + # Get just the output, then split it by space, grab the first + return output[0].split()[0] def gimmespec(self): """Return the name of a specfile within a package module""" |