diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-28 10:08:02 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-28 10:08:02 (GMT) |
commit | 7334735ee17951e4ee5555e1183ae4f269fe04af (patch) | |
tree | 0551617787bdb6438c445702d931267f27de24cc /Lib/distutils/command | |
parent | 5c189b16a8e915889b26d0fecc45faec935092c4 (diff) | |
download | cpython-7334735ee17951e4ee5555e1183ae4f269fe04af.zip cpython-7334735ee17951e4ee5555e1183ae4f269fe04af.tar.gz cpython-7334735ee17951e4ee5555e1183ae4f269fe04af.tar.bz2 |
Issues #1533164 and #5378: Added quiet and force-optimize options to Distutils bdist_rpm command
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r-- | Lib/distutils/command/bdist_rpm.py | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py index a48e0f1..34822ec 100644 --- a/Lib/distutils/command/bdist_rpm.py +++ b/Lib/distutils/command/bdist_rpm.py @@ -123,10 +123,21 @@ class bdist_rpm (Command): # Allow a packager to explicitly force an architecture ('force-arch=', None, "Force an architecture onto the RPM build process"), - ] + + ('quiet', 'q', + "Run the INSTALL phase of RPM building in quiet mode"), + + # Forces the -O1 option when calling the install command, + # so the rpm contains all files needed for proper operation under + # SELinux. Some systems checks for this on build-time and will + # fail without this. + ('force-optimize', None, + "Forces the -O1 option when calling the install command"), + + ] boolean_options = ['keep-temp', 'use-rpm-opt-flags', 'rpm3-mode', - 'no-autoreq'] + 'no-autoreq', 'quiet', 'force-optimize'] negative_opt = {'no-keep-temp': 'keep-temp', 'no-rpm-opt-flags': 'use-rpm-opt-flags', @@ -176,6 +187,8 @@ class bdist_rpm (Command): self.no_autoreq = 0 self.force_arch = None + self.quiet = 0 + self.force_optimize = 1 # initialize_options() @@ -322,6 +335,7 @@ class bdist_rpm (Command): if os.path.exists('/usr/bin/rpmbuild') or \ os.path.exists('/bin/rpmbuild'): rpm_cmd = ['rpmbuild'] + if self.source_only: # what kind of RPMs? rpm_cmd.append('-bs') elif self.binary_only: @@ -333,6 +347,10 @@ class bdist_rpm (Command): '_topdir %s' % os.path.abspath(self.rpm_base)]) if not self.keep_temp: rpm_cmd.append('--clean') + + if self.quiet: + rpm_cmd.append('--quiet') + rpm_cmd.append(spec_path) # Determine the binary rpm names that should be built out of this spec # file @@ -486,13 +504,19 @@ class bdist_rpm (Command): # that we open and interpolate into the spec file, but the defaults # are just text that we drop in as-is. Hmmm. + # forcing -O1 if force-optimize + if self.force_optimize: + optimize = ' -O1' + else: + optimize = '' + + install_cmd = ('%s install%s --root=$RPM_BUILD_ROOT ' + '--record=INSTALLED_FILES') % (def_setup_call, optimize) + script_options = [ ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"), ('build', 'build_script', def_build), - ('install', 'install_script', - ("%s install " - "--root=$RPM_BUILD_ROOT " - "--record=INSTALLED_FILES") % def_setup_call), + ('install', 'install_script', install_cmd), ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"), ('verifyscript', 'verify_script', None), ('pre', 'pre_install', None), |