diff options
Diffstat (limited to 'lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm')
5 files changed, 0 insertions, 486 deletions
diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/__init__.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/__init__.py deleted file mode 100644 index 429730a0..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Portions Copyright Buildbot Team Members -# Portions Copyright Steve 'Ashcrow' Milner <smilner+buildbot@redhat.com> -""" -Steps specific to the rpm format. -""" - -from buildbot.steps.package.rpm.rpmbuild import RpmBuild -from buildbot.steps.package.rpm.rpmspec import RpmSpec -from buildbot.steps.package.rpm.rpmlint import RpmLint -from buildbot.steps.package.rpm.mock import MockBuildSRPM, MockRebuild - -__all__ = ['RpmBuild', 'RpmSpec', 'RpmLint', 'MockBuildSRPM', 'MockRebuild'] - - diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/mock.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/mock.py deleted file mode 100644 index 8c7e3491..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/mock.py +++ /dev/null @@ -1,174 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Portions Copyright Buildbot Team Members -# Portions Copyright Marius Rieder <marius.rieder@durchmesser.ch> -""" -Steps and objects related to mock building. -""" - -import re - -from buildbot.steps.shell import ShellCommand -from buildbot.process import buildstep -from buildbot import config - -class MockStateObserver(buildstep.LogLineObserver): - _line_re = re.compile(r'^.*State Changed: (.*)$') - - def outLineReceived(self, line): - m = self._line_re.search(line.strip()) - if m: - state = m.group(1) - if not state == 'end': - self.step.descriptionSuffix = ["[%s]"%m.group(1)] - else: - self.step.descriptionSuffix = None - self.step.step_status.setText(self.step.describe(False)) - -class Mock(ShellCommand): - """Add the mock logfiles and clean them if they already exist. Add support - for the root and resultdir parameter of mock.""" - - name = "mock" - - haltOnFailure = 1 - flunkOnFailure = 1 - - mock_logfiles = ['build.log', 'root.log', 'state.log'] - - root = None - resultdir = None - - def __init__(self, - root=None, - resultdir=None, - **kwargs): - """ - Creates the Mock object. - - @type root: str - @param root: the name of the mock buildroot - @type resultdir: str - @param resultdir: the path of the result dir - @type kwargs: dict - @param kwargs: All further keyword arguments. - """ - ShellCommand.__init__(self, **kwargs) - if root: - self.root = root - if resultdir: - self.resultdir = resultdir - - if not self.root: - config.error("You must specify a mock root") - - - self.command = ['mock', '--root', self.root] - if self.resultdir: - self.command += ['--resultdir', self.resultdir] - - def start(self): - """ - Try to remove the old mock logs first. - """ - if self.resultdir: - for lname in self.mock_logfiles: - self.logfiles[lname] = self.build.path_module.join(self.resultdir, - lname) - else: - for lname in self.mock_logfiles: - self.logfiles[lname] = lname - self.addLogObserver('state.log', MockStateObserver()) - - cmd = buildstep.RemoteCommand('rmdir', {'dir': - map(lambda l: self.build.path_module.join('build', self.logfiles[l]), - self.mock_logfiles)}) - d = self.runCommand(cmd) - def removeDone(cmd): - ShellCommand.start(self) - d.addCallback(removeDone) - d.addErrback(self.failed) - -class MockBuildSRPM(Mock): - """Build a srpm within a mock. Requires a spec file and a sources dir.""" - - name = "mockbuildsrpm" - - description = ["mock buildsrpm"] - descriptionDone = ["mock buildsrpm"] - - spec = None - sources = '.' - - def __init__(self, - spec=None, - sources=None, - **kwargs): - """ - Creates the MockBuildSRPM object. - - @type spec: str - @param spec: the path of the specfiles. - @type sources: str - @param sources: the path of the sources dir. - @type kwargs: dict - @param kwargs: All further keyword arguments. - """ - Mock.__init__(self, **kwargs) - if spec: - self.spec = spec - if sources: - self.sources = sources - - if not self.spec: - config.error("You must specify a spec file") - if not self.sources: - config.error("You must specify a sources dir") - - self.command += ['--buildsrpm', '--spec', self.spec, - '--sources', self.sources] - - def commandComplete(self, cmd): - out = cmd.logs['build.log'].getText() - m = re.search(r"Wrote: .*/([^/]*.src.rpm)", out) - if m: - self.setProperty("srpm", m.group(1), 'MockBuildSRPM') - -class MockRebuild(Mock): - """Rebuild a srpm within a mock. Requires a srpm file.""" - - name = "mock" - - description = ["mock rebuilding srpm"] - descriptionDone = ["mock rebuild srpm"] - - srpm = None - - def __init__(self, srpm=None, **kwargs): - """ - Creates the MockRebuildRPM object. - - @type srpm: str - @param srpm: the path of the srpm file. - @type kwargs: dict - @param kwargs: All further keyword arguments. - """ - Mock.__init__(self, **kwargs) - if srpm: - self.srpm = srpm - - if not self.srpm: - config.error("You must specify a srpm") - - self.command += ['--rebuild', self.srpm] diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmbuild.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmbuild.py deleted file mode 100644 index 9d5c88ea..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmbuild.py +++ /dev/null @@ -1,137 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Portions Copyright Buildbot Team Members - -from __future__ import with_statement -# Portions Copyright Dan Radez <dradez+buildbot@redhat.com> -# Portions Copyright Steve 'Ashcrow' Milner <smilner+buildbot@redhat.com> - -import os -from buildbot.steps.shell import ShellCommand -from buildbot.process import buildstep -from buildbot import config - -class RpmBuild(ShellCommand): - """ - RpmBuild build step. - """ - - name = "rpmbuilder" - haltOnFailure = 1 - flunkOnFailure = 1 - description = ["RPMBUILD"] - descriptionDone = ["RPMBUILD"] - - def __init__(self, - specfile=None, - topdir='`pwd`', - builddir='`pwd`', - rpmdir='`pwd`', - sourcedir='`pwd`', - specdir='`pwd`', - srcrpmdir='`pwd`', - dist='.el5', - autoRelease=False, - vcsRevision=False, - **kwargs): - """ - Create the RpmBuild object. - - @type specfile: str - @param specfile: location of the specfile to build - @type topdir: str - @param topdir: define the _topdir rpm parameter - @type builddir: str - @param builddir: define the _builddir rpm parameter - @type rpmdir: str - @param rpmdir: define the _rpmdir rpm parameter - @type sourcedir: str - @param sourcedir: define the _sourcedir rpm parameter - @type specdir: str - @param specdir: define the _specdir rpm parameter - @type srcrpmdir: str - @param srcrpmdir: define the _srcrpmdir rpm parameter - @type dist: str - @param dist: define the dist string. - @type autoRelease: boolean - @param autoRelease: Use auto incrementing release numbers. - @type vcsRevision: boolean - @param vcsRevision: Use vcs version number as revision number. - """ - ShellCommand.__init__(self, **kwargs) - self.rpmbuild = ( - 'rpmbuild --define "_topdir %s" --define "_builddir %s"' - ' --define "_rpmdir %s" --define "_sourcedir %s"' - ' --define "_specdir %s" --define "_srcrpmdir %s"' - ' --define "dist %s"' % (topdir, builddir, rpmdir, sourcedir, - specdir, srcrpmdir, dist)) - self.specfile = specfile - self.autoRelease = autoRelease - self.vcsRevision = vcsRevision - - if not self.specfile: - config.error("You must specify a specfile") - - def start(self): - if self.autoRelease: - relfile = '%s.release' % ( - os.path.basename(self.specfile).split('.')[0]) - try: - with open(relfile, 'r') as rfile: - rel = int(rfile.readline().strip()) - except: - rel = 0 - self.rpmbuild = self.rpmbuild + ' --define "_release %s"' % rel - with open(relfile, 'w') as rfile: - rfile.write(str(rel+1)) - - if self.vcsRevision: - revision = self.getProperty('got_revision') - # only do this in the case where there's a single codebase - if revision and not isinstance(revision, dict): - self.rpmbuild = (self.rpmbuild + ' --define "_revision %s"' % - revision) - - self.rpmbuild = self.rpmbuild + ' -ba %s' % self.specfile - - self.command = self.rpmbuild - - # create the actual RemoteShellCommand instance now - kwargs = self.remote_kwargs - kwargs['command'] = self.command - cmd = buildstep.RemoteShellCommand(**kwargs) - self.setupEnvironment(cmd) - self.startCommand(cmd) - - def createSummary(self, log): - rpm_prefixes = ['Provides:', 'Requires(', 'Requires:', - 'Checking for unpackaged', 'Wrote:', - 'Executing(%', '+ ', 'Processing files:'] - rpm_err_pfx = [' ', 'RPM build errors:', 'error: '] - - rpmcmdlog = [] - rpmerrors = [] - - for line in log.getText().splitlines(True): - for pfx in rpm_prefixes: - if line.startswith(pfx): - rpmcmdlog.append(line) - break - for err in rpm_err_pfx: - if line.startswith(err): - rpmerrors.append(line) - break - self.addCompleteLog('RPM Command Log', "".join(rpmcmdlog)) - if rpmerrors: - self.addCompleteLog('RPM Errors', "".join(rpmerrors)) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmlint.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmlint.py deleted file mode 100644 index ab14ca1a..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmlint.py +++ /dev/null @@ -1,77 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Portions Copyright Buildbot Team Members -# Portions Copyright Steve 'Ashcrow' Milner <smilner+buildbot@redhat.com> -""" -Steps and objects related to rpmlint. -""" - -from buildbot.steps.shell import Test - - -class RpmLint(Test): - """ - Rpmlint build step. - """ - - name = "rpmlint" - - description = ["Checking for RPM/SPEC issues"] - descriptionDone = ["Finished checking RPM/SPEC issues"] - - fileloc = '.' - config = None - - def __init__(self, - fileloc=None, - config=None, - **kwargs): - """ - Create the Rpmlint object. - - @type fileloc: str - @param fileloc: Location glob of the specs or rpms. - @type config: str - @param config: path to the rpmlint user config. - @type kwargs: dict - @param fileloc: all other keyword arguments. - """ - Test.__init__(self, **kwargs) - if fileloc: - self.fileloc = fileloc - if config: - self.config = config - - self.command = ["rpmlint", "-i"] - if self.config: - self.command += ['-f', self.config] - self.command.append(self.fileloc) - - def createSummary(self, log): - """ - Create nice summary logs. - - @param log: log to create summary off of. - """ - warnings = [] - errors = [] - for line in log.readlines(): - if ' W: ' in line: - warnings.append(line) - elif ' E: ' in line: - errors.append(line) - if warnings: - self.addCompleteLog('%d Warnings'%len(warnings), "".join(warnings)) - if errors: - self.addCompleteLog('%d Errors'%len(errors), "".join(errors)) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmspec.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmspec.py deleted file mode 100644 index a3676c81..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/steps/package/rpm/rpmspec.py +++ /dev/null @@ -1,71 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Portions Copyright Buildbot Team Members -# Portions Copyright Dan Radez <dradez+buildbot@redhat.com> -# Portions Copyright Steve 'Ashcrow' Milner <smilner+buildbot@redhat.com> -""" -library to populate parameters from and rpmspec file into a memory structure -""" - -import re -from buildbot.steps.shell import ShellCommand - - -class RpmSpec(ShellCommand): - """ - read parameters out of an rpm spec file - """ - - #initialize spec info vars and get them from the spec file - n_regex = re.compile('^Name:[ ]*([^\s]*)') - v_regex = re.compile('^Version:[ ]*([0-9\.]*)') - - def __init__(self, specfile=None, **kwargs): - """ - Creates the RpmSpec object. - - @type specfile: str - @param specfile: the name of the specfile to get the package - name and version from - @type kwargs: dict - @param kwargs: All further keyword arguments. - """ - self.specfile = specfile - self._pkg_name = None - self._pkg_version = None - self._loaded = False - - def load(self): - """ - call this function after the file exists to populate properties - """ - # If we are given a string, open it up else assume it's something we - # can call read on. - if isinstance(self.specfile, str): - f = open(self.specfile, 'r') - else: - f = self.specfile - - for line in f: - if self.v_regex.match(line): - self._pkg_version = self.v_regex.match(line).group(1) - if self.n_regex.match(line): - self._pkg_name = self.n_regex.match(line).group(1) - f.close() - self._loaded = True - - # Read-only properties - loaded = property(lambda self: self._loaded) - pkg_name = property(lambda self: self._pkg_name) - pkg_version = property(lambda self: self._pkg_version) |