summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-10-08 11:47:04 -0400
committerColin Walters <walters@verbum.org>2010-10-08 11:47:04 -0400
commit84e5bb7d1fad8c22ffcf9885900787c0127a4930 (patch)
tree70ddd77d0ef1fc86c53c95cfb2ee5a2de9267b4e
parent9fb4bb811ab61a6afa2d67eb29d4a230338a0907 (diff)
downloadrpmci-84e5bb7d1fad8c22ffcf9885900787c0127a4930.tar.gz
rpmci-84e5bb7d1fad8c22ffcf9885900787c0127a4930.tar.xz
rpmci-84e5bb7d1fad8c22ffcf9885900787c0127a4930.zip
rpmci-binrpm-builder: Some hacking on building binaries
-rw-r--r--rpmci/artifact.py9
-rw-r--r--rpmci/rpmci_binrpm_builder_main.py92
-rw-r--r--sample.config7
3 files changed, 69 insertions, 39 deletions
diff --git a/rpmci/artifact.py b/rpmci/artifact.py
index 22a3b25..1787fd3 100644
--- a/rpmci/artifact.py
+++ b/rpmci/artifact.py
@@ -47,8 +47,10 @@ class BuildTarget(object):
return 0
class Artifact(object):
- def __init__(self, name, targets):
+ def __init__(self, name, os, architectures, targets):
self.name = name
+ self.os = os
+ self.architectures = architectures
self.targets = targets
class ArtifactSet(object):
@@ -90,7 +92,10 @@ class ArtifactSet(object):
target = BuildTarget(module, os, architecture)
artifact_build_targets.append(target)
- artifacts.append(Artifact(artifact_name, artifact_build_targets))
+ artifacts.append(Artifact(artifact_name,
+ os,
+ architectures,
+ artifact_build_targets))
return cls(artifacts)
def fedora_git_url_for_build_target(config, buildtarget):
diff --git a/rpmci/rpmci_binrpm_builder_main.py b/rpmci/rpmci_binrpm_builder_main.py
index d8dd02b..86ddf5d 100644
--- a/rpmci/rpmci_binrpm_builder_main.py
+++ b/rpmci/rpmci_binrpm_builder_main.py
@@ -57,49 +57,73 @@ class BinRPMBuilder(object):
return target
return None
+ def _srpm_for_target(self, repo, target):
+ for rpm in repo.iter_rpms():
+ basename = os.path.basename(rpm):
+ srpm_name = rpmutils.get_rpm_name(basename)
+ if srpm_name == target.module:
+ return rpm
+ return None
+
+ def _mock_root_from_os_arch(self, os, architecture):
+ fedora_os_master = config.get('fedora', 'master')
+ if buildtarget.os == fedora_os_master:
+ os = 'devel':
+ else:
+ os = buildtarget.os
+ if target.architecture == 'i686':
+ arch = 'i386'
+ else:
+ arch = target.architecture
+ return '%s-%s' % (os, arch)
+
def _on_srpm_message(self, q, messages):
msg_list = list(messages)
num_msgs = len(msg_list)
logging.debug("Starting processing of %d messages" % (num_msgs, ))
+ latest_repoversion = -1
for msg in msg_list:
- srpm_name = msg.payload['srpm']
- logging.debug("Processing update for SRPM %r" % (srpm_name, ))
- target = self._target_for_srpm(srpm_name)
- if target is None:
- logging.warn("Skipping unknown srpm %r" % (srpm_name, ))
- continue
- affected_artifacts = []
- for artifact in self._artifactset.artifacts:
- if target in artifact.targets:
- affected_artifacts.append(artifact)
-
- self._handle_srpm_message_name(q, srpm_name)
+ repoversion = msg.payload['version']
+ if repoversion > latest_repoversion:
+ latest_repoversion = repoversion
+ logging.debug("Processing update to repository version %r" % (repoversion, ))
q.consume(msg)
+
+ self._rebuild_to_repoversion(repoversion)
logging.debug("Processed %d messages successfully" % (num_msgs, ))
- def _handle_srpm_message_name(self, q, srpm_name):
+ def _rebuild_to_repoversion(self, repoversion):
exec_basedir = os.path.dirname(sys.argv[0])
-
- subtask.spawn_sync('mock-many-srpms' % (target.module, ),
- args, cwd=fedora_dir)
-
- args = ['rpmbuild']
- args.extend(self._get_base_rpmbuild_args(fedora_dir))
- args.extend(['-bs', specname])
- subtask.spawn_sync('rpmbuild-srpm-%s' % (target.module, ),
- args, cwd=fedora_dir)
- srpm_path = None
- srpm_basename = None
- for filename in os.listdir(fedora_dir):
- if filename.endswith('.src.rpm'):
- srpm_basename = filename
- srpm_path = os.path.join(fedora_dir, filename)
- break
- assert srpm_path is not None
- os.rename(srpm_path, os.path.join(self._srcdir, srpm_basename))
- self._srcrepo.update_repo_sync()
-
- self._srpm_msgqueue.append(msgqueue.Message(None, {'type': 'srpm'}, {'filename': srpm_basename}))
+
+ for artifact in self._artifactset.artifacts:
+ artifact_srpms = set()
+ failed = False
+ for target in artifact.targets:
+ srpm = self._srpm_for_target(target)
+ if srpm is None:
+ logger.warn("Couldn't find srpm for target %r of artifact %r" % (target.module, artifact.name))
+ failed = True
+ break
+ artifact_srpms.add(srpm)
+ if failed:
+ continue
+ taskid = 'mock-many-srpms-%s' % (artifact.name, )
+
+ arch_roots = []
+ for arch in artifact.architectures:
+ arch_roots.append(self._mock_root_from_os_arch(artifact.os, arch))
+ base_artifactdir = self._config.get('build', 'artifactdir')
+ artifactdir = os.path.join(base_artifactdir, artifact.name)
+ base_logdir = self._config.get('build', 'logdir')
+ logdir = os.path.join(base_logdir, artifact.name)
+
+ args = [os.path.join(exec_basedir, 'mock-many-srpms'),
+ '--skip-have-build',
+ '--resultdir=' + resultdir,
+ '--logdir=' + logdir]
+ for root in arch_roots:
+ args.append('--root=' + root)
+ subtask.spawn_sync(taskid, args)
def main():
glib.threads_init()
diff --git a/sample.config b/sample.config
index 6251ba6..164fcef 100644
--- a/sample.config
+++ b/sample.config
@@ -1,5 +1,5 @@
[fedora]
-master=f15
+master=fedora-15
[subtask]
basedir=%(home)s/rpmci
@@ -9,9 +9,9 @@ subtask_dir=%(basedir)s/subtask
artifacts=base-gnome-3-f15
#artifacts=gnome-3-f15
artifact_base_gnome_3_f15_modules=glib2 pixman cairo
-artifact_base_gnome_3_f15_os=f15
+artifact_base_gnome_3_f15_os=fedora-15
#artifact_gnome_3_f15_modules=glib2 pixman cairo gobject-introspection libgee vala dconf pango atk gdk-pixbuf2 gtk2 gtk3 json-glib clutter mutter gjs gnome-shell
-#artifact_gnome_3_f15_os=f15
+#artifact_gnome_3_f15_os=fedora-15
[VCS]
# Standard stuff
@@ -40,4 +40,5 @@ basedir=%(home)s/rpmci
msg_basedir=%(basedir)s/msgqueue
msgqueue=%(msg_basedir)s/build
+logdir=%(basedir)/build-logs
artifactdir=%(basedir)/repos