summaryrefslogtreecommitdiffstats
path: root/fedpkg-make-pull
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-02-23 13:51:31 -0500
committerColin Walters <walters@verbum.org>2010-02-23 13:51:31 -0500
commit35e96ff0fe270e7dab7b2f9a95e607468396bd28 (patch)
tree418dba982c32b9ee0874d82916dbf6d91c19009f /fedpkg-make-pull
parent7eeea948dcab8e38f8c8a3c018a31f42f9f70639 (diff)
downloadfedpkg-make-pull-35e96ff0fe270e7dab7b2f9a95e607468396bd28.tar.gz
fedpkg-make-pull-35e96ff0fe270e7dab7b2f9a95e607468396bd28.tar.xz
fedpkg-make-pull-35e96ff0fe270e7dab7b2f9a95e607468396bd28.zip
Add pull-build-chain, various fixes
Diffstat (limited to 'fedpkg-make-pull')
-rwxr-xr-xfedpkg-make-pull47
1 files changed, 35 insertions, 12 deletions
diff --git a/fedpkg-make-pull b/fedpkg-make-pull
index b4f38c9..a6bc34a 100755
--- a/fedpkg-make-pull
+++ b/fedpkg-make-pull
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# make-pull.py
+# fedpkg-make-pull:
# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
# Copyright (C) 2010 Red Hat, Inc.
# Written by Colin Walters <walters@verbum.org>
@@ -89,7 +89,10 @@ class BuildSystem(object):
return Autotools(directory)
def get_bootstrap_buildrequires(self):
- pass
+ return []
+
+ def get_substitutions(self):
+ return []
class Autotools(BuildSystem):
def get_bootstrap_buildrequires(self):
@@ -101,6 +104,10 @@ class GnomeAutotools(Autotools):
bootstrap.append('gnome-common')
return bootstrap
+ def get_substitutions(self):
+ # We'll configure twice with this, but oh well. Need this in RPM.
+ return [(re.compile('^%configure'), './autogen.sh\n%configure')]
+
class Spec(object):
def __init__(self, filename):
self._filename = filename
@@ -112,6 +119,7 @@ class Spec(object):
self._new_release = None
self._source_dirname = None
self._source_archivename = None
+ self._substitutions = []
def add_buildrequires(self, new_buildrequires):
self._append_buildrequires = new_buildrequires
@@ -141,15 +149,31 @@ class Spec(object):
self._source_dirname = dirname
self._source_archivename = archivename
+ def substitute(self, substitutions):
+ self._substitutions = substitutions
+
def save(self, new_filename):
+ wrote_buildrequires = False
output = open(new_filename, 'w')
for line in self._lines:
- if line.startswith('Release:'):
+ replacement_matched = False
+ for sub_re, replacement in self._substitutions:
+ (line, subcount) = sub_re.subn(replacement, line)
+ if subcount > 0:
+ replacement_matched = True
+ break
+ if replacement_matched:
+ output.write(line)
+ elif line.startswith('Release:'):
output.write('Release: %s\n' % self._new_release)
elif line.startswith('Source0:'):
output.write('Source0: %s\n' % self._source_archivename)
elif line.startswith('%setup'): # This is dumb, need to automate this in RPM
output.write('%%setup -q -n %s\n' % self._source_dirname)
+ elif line.startswith('BuildRequires:') and not wrote_buildrequires:
+ output.write(line)
+ for req in self._append_buildrequires:
+ output.write('BuildRequires: %s\n' % req)
else:
output.write(line)
@@ -224,21 +248,20 @@ def main():
print "Checking out from %r into new directory %r" % (vcsurl, targetdir)
vcs.checkout(targetdir)
newid = vcs.get_id(targetdir)
-
- buildsys = BuildSystem.new_from_directory(targetdir)
- if buildsys is None:
- print "WARNING: Unrecognized buildsystem in directory %r" % (targetdir, )
- bootstrap_deps = []
- else:
- bootstrap_deps = buildsys.get_bootstrap_buildrequires()
snapshot_dirname = '%s-%s%s%s' % (name, version, vcs.get_scheme(), newid)
snapshot_archivename = snapshot_dirname + '.tar.bz2'
- subprocess.check_call(['tar', '-cj', '--transform=s,^,' + snapshot_dirname + ',', '-f', '../' + snapshot_archivename, '.'], cwd=targetdir)
+ subprocess.check_call(['tar', '-cj', r'--transform=s,^\.,' + snapshot_dirname + ',', '-f', '../' + snapshot_archivename, '.'], cwd=targetdir)
new_specname = '%s-%s%s.spec.tmp' % (name, vcs.get_scheme(), newid)
- spec.add_buildrequires(bootstrap_deps)
+ buildsys = BuildSystem.new_from_directory(targetdir)
+ if buildsys is None:
+ print "WARNING: Unrecognized buildsystem in directory %r" % (targetdir, )
+ else:
+ spec.add_buildrequires(buildsys.get_bootstrap_buildrequires())
+ spec.substitute(buildsys.get_substitutions())
+
spec.set_source(snapshot_dirname, snapshot_archivename)
spec.increment_release_snapshot(newid)
spec.save(new_specname)