summaryrefslogtreecommitdiffstats
path: root/modules/build.py
diff options
context:
space:
mode:
authorYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-08 16:43:14 -0500
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-08 16:43:14 -0500
commitc27ff3ce07de79215b58f5fd10ff175424cba7cb (patch)
treed7ab5511655050adf4905468b2b7e9ff15afde47 /modules/build.py
parent3bcae770792afe5d5fff2af127cad2c1d0d59d57 (diff)
downloadfedora-devshell-c27ff3ce07de79215b58f5fd10ff175424cba7cb.tar.gz
fedora-devshell-c27ff3ce07de79215b58f5fd10ff175424cba7cb.tar.xz
fedora-devshell-c27ff3ce07de79215b58f5fd10ff175424cba7cb.zip
adds 135 kilocraps of documentation
135 kilocraps = 1 metric craptonne
Diffstat (limited to 'modules/build.py')
-rw-r--r--modules/build.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/modules/build.py b/modules/build.py
index 7fcc1b0..93b2056 100644
--- a/modules/build.py
+++ b/modules/build.py
@@ -36,8 +36,16 @@ from modules.package import Package
from modules.profile import Profile
class Build(Directory):
+ '''A wrapper around rpmbuild functions
+ '''
_type = 'build'
def setup_source(self, package):
+ '''Given a package, set's it up in the buildroot for being built with rpmbuild
+
+ package is a directory name to a Package (Directory).
+
+ returns nothing
+ '''
pkg = DirFactory(package)
with pwd(pkg.dir):
symlink(pkg.spec_file,
@@ -49,12 +57,47 @@ class Build(Directory):
symlink(patch, join(self.dir, 'SOURCES', patch))
def build_quick_rpm(self, package, profile=None):
+ '''Builds an rpm on the local system using rpmbuild (aka no clean chroots)
+
+ This method may be useful in determining the difference between
+ a chroot and the working system. It can also help make sure the
+ package can be built in the first place, and quickly.
+
+ package is a directory name to a Package (Directory).
+ profile is a Profile object, this parameter should only be used internally
+
+ returns nothing
+ '''
self.rpmbuild('-ba', package, profile)
def build_source_rpm(self, package, profile=None):
+ '''Builds an source rpm on the local system using rpmbuild
+
+ This method is necessary to build SRPMs for many other modules.
+ The user may find that certain dist related macros in the RPM are
+ set to the system wide defaults. The parameter 'profile' is used heavily
+ internally to mimic aspects of the Fedora Build system in order
+ override the defaults. Without the assistance of other modules
+ that are profile aware, profile makes no sense here.
+
+ package is a directory name to a Package (Directory).
+ profile is a Profile object, this parameter should only be used internally
+
+ returns nothing
+ '''
self.rpmbuild('-bs', package, profile)
def rpmbuild(self, param, package, profile=None):
+ '''The work horse of building rpms
+
+ Given a directive param for rpmbuild, the package, and a possible
+ profile, it runs rpmbuild appropriatly.
+
+ package is a directory name to a Package (Directory).
+ profile is a Profile object, this parameter should only be used internally
+
+ returns nothing
+ '''
pkg = DirFactory(package)
if profile:
defines = join_defines(profile.dist_defines,
@@ -75,6 +118,15 @@ class Build(Directory):
log.debug(p.returncode)
def fetch_rpms(self, target_dir):
+ '''fetches all rpm files from the buildroot to another target directory
+
+ As a module author, it is a good idea to use this to clean up
+ afterwards. This module pulls all RPMs said module may have made
+ as well as any other RPMs from earlier incantations of other modules.
+ Please be courteous to other module authors and run this liberally.
+
+ target_dir is a path to the destination for all the rpms
+ '''
with pwd(self.dir):
for path, dirs, files in walk('.'):
for f in files:
@@ -82,6 +134,14 @@ class Build(Directory):
move(join(path, f), join(target_dir, f))
def fetch_build(self, package):
+ '''fetches the built source tree from the execution of rpmbuild for review
+
+ This is usefull to see if rpmbuild did anything funny in execution
+ of the spec file. Hopefully you'll never need this. The results
+ end up in the top level directory of the given package
+
+ package is a directory name to a Package (Directory).
+ '''
pkg = DirFactory(package)
with pwd(self.dir):
source = pkg.cfg['source']