summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-02-23 22:23:34 -0500
committerColin Walters <walters@verbum.org>2010-02-23 22:23:34 -0500
commit002e5fd5df172148bf1ca3c05cf3d93c61a5c9eb (patch)
tree1c6c12360e8c23fca7784b751e97a8f46fb07b9e
parentcee6a3708c0e71f928aa12f72ad22eda6029488b (diff)
downloadfedpkg-make-pull-002e5fd5df172148bf1ca3c05cf3d93c61a5c9eb.tar.gz
fedpkg-make-pull-002e5fd5df172148bf1ca3c05cf3d93c61a5c9eb.tar.xz
fedpkg-make-pull-002e5fd5df172148bf1ca3c05cf3d93c61a5c9eb.zip
Yet more hacking
-rwxr-xr-xfedpkg-make-pull33
-rwxr-xr-xfedpkg-pull-build-chain55
2 files changed, 60 insertions, 28 deletions
diff --git a/fedpkg-make-pull b/fedpkg-make-pull
index a84e965..84530eb 100755
--- a/fedpkg-make-pull
+++ b/fedpkg-make-pull
@@ -30,6 +30,7 @@ class Vcs(object):
def __init__(self, parsedurl):
self._parsed_url = parsedurl
# Deliberately drop params/query
+ print "%r %r %r" % (parsedurl.scheme, parsedurl.netloc, parsedurl.path)
self._nonfragment_url_string = urlparse.urlunparse((parsedurl.scheme,
parsedurl.netloc,
parsedurl.path,
@@ -57,15 +58,24 @@ class Vcs(object):
@classmethod
def new_from_url(cls, url):
- parsed_url = urlparse.urlparse(url)
- if parsed_url.scheme == 'git':
- return GitVcs(parsed_url)
+ orig = urlparse.urlsplit(url)
+ # We want to support fragments, even if the URL type isn't recognized. So change the
+ # scheme to http temporarily.
+ temp = urlparse.urlunsplit(('http', orig.netloc, orig.path, orig.query, orig.fragment))
+ new = urlparse.urlsplit(temp)
+ combined = urlparse.SplitResult(orig.scheme, new.netloc, new.path, new.query, new.fragment)
+ if combined.scheme == 'git':
+ return GitVcs(combined)
class GitVcs(Vcs):
def checkout(self, destdir):
self._vcs_exec(['git', 'clone', '--depth=1', self._nonfragment_url_string, destdir])
+ if self._branch:
+ self._vcs_exec(['git', 'checkout', self._branch], cwd=directory)
def update(self, directory):
+ if self._branch:
+ self._vcs_exec(['git', 'checkout', self._branch], cwd=directory)
self._vcs_exec(['git', 'pull', '-r'], cwd=directory)
def get_id(self, directory):
@@ -80,12 +90,7 @@ class BuildSystem(object):
def new_from_directory(cls, directory):
autogen_path = os.path.join(directory, 'autogen.sh')
if os.path.exists(autogen_path):
- f = open(autogen_path)
- for line in f:
- if line.find('gnome-autogen.sh') >= 0:
- f.close()
- return GnomeAutotools(directory)
- f.close()
+ return AutogenAutotools(directory)
if os.path.exists(os.path.join(directory, 'Makefile.am')):
return Autotools(directory)
@@ -99,15 +104,19 @@ class Autotools(BuildSystem):
def get_bootstrap_buildrequires(self):
return ['libtool', 'automake', 'autoconf']
-class GnomeAutotools(Autotools):
+ def get_substitutions(self):
+ return [(re.compile('^%configure'), 'autoreconf -f -i\n%configure')]
+
+class AutogenAutotools(Autotools):
def get_bootstrap_buildrequires(self):
- bootstrap = super(GnomeAutotools, self).get_bootstrap_buildrequires()
+ bootstrap = super(AutogenAutotools, self).get_bootstrap_buildrequires()
bootstrap.append('gnome-common')
+ bootstrap.append('intltool')
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')]
+ return [(re.compile('^%configure'), './autogen.sh')]
class Spec(object):
def __init__(self, filename):
diff --git a/fedpkg-pull-build-chain b/fedpkg-pull-build-chain
index 4c943b3..37d14e1 100755
--- a/fedpkg-pull-build-chain
+++ b/fedpkg-pull-build-chain
@@ -89,9 +89,27 @@ def main():
if filename.endswith('.src.rpm'):
print "Deleting old srpm: " + fpath
os.unlink(fpath)
+
+
+ mock_resultdir = os.path.join('_build', arg)
+ try:
+ os.makedirs(mock_resultdir)
+ except OSError, e:
+ # assume EEXIST,
+ for filename in os.listdir(mock_resultdir):
+ if filename == 'lastbuild-status':
+ continue
+ os.unlink(os.path.join(mock_resultdir, filename))
+
+ lastbuild_filepath = os.path.join(mock_resultdir, 'lastbuild-status')
+ if os.path.exists(lastbuild_filepath):
+ last_build_succeeded = open(lastbuild_filepath).read() == 'success'
+ else:
+ last_build_succeeded = False
+
print "Running fedpkg-make-pull"
args = ['fedpkg-make-pull']
- if force:
+ if force or not last_build_succeeded:
args.append('--force')
try:
check_call_verbose(args, stdout=sys.stdout, stderr=sys.stderr, cwd=release_dir)
@@ -99,25 +117,16 @@ def main():
print "Failed: " + unicode(e)
failed.append(arg)
continue
-
+
srpm = None
for filename in os.listdir(release_dir):
fpath = os.path.join(release_dir, filename)
if filename.endswith('.src.rpm'):
srpm = fpath
- if srpm is None:
- print "No SRPM, assuming no changes upstream"
+ if srpm is None and last_build_succeeded:
+ print "No updates and have a previous successful build, nothing to do"
continue
- mock_resultdir = os.path.join('_build', arg)
- try:
- os.makedirs(mock_resultdir)
- except OSError, e:
- # assume EEXIST, and clean out old results
- for filename in os.listdir(mock_resultdir):
- os.unlink(os.path.join(mock_resultdir, filename))
-
-
current_failed = False
for mockrelease in mockreleases:
try:
@@ -128,15 +137,29 @@ def main():
failed.append(arg)
break
if current_failed:
- continue
-
+ f = open(lastbuild_filepath, 'w')
+ f.write('failed')
+ f.close()
+ break
+
+ print "Successfully built %r" % (arg, )
+ print "Updating repository in %r" % (resultdir, )
+ linkname = os.path.join(resultdir, os.path.basename(srpm))
+ if not os.path.exists(linkname):
+ os.link(srpm, linkname)
for filename in os.listdir(mock_resultdir):
if not filename.endswith('.rpm'):
continue
src = os.path.join(mock_resultdir, filename)
linkname = os.path.join(resultdir, filename)
- print "Linking %r to %r" % (src, linkname)
+ if os.path.exists(linkname):
+ continue
os.link(src, linkname)
+ check_call_verbose(['createrepo', '.'], cwd=resultdir)
+
+ f = open(lastbuild_filepath, 'w')
+ f.write('success')
+ f.close()
if len(failed) > 0:
sys.exit(1)