[Python-checkins] r70051 - in python/branches/py3k: Lib/distutils/command/bdist_rpm.py Lib/distutils/tests/test_bdist_rpm.py Misc/NEWS

tarek.ziade python-checkins at python.org
Sat Feb 28 11:16:43 CET 2009


Author: tarek.ziade
Date: Sat Feb 28 11:16:43 2009
New Revision: 70051

Log:
Merged revisions 70049 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70049 | tarek.ziade | 2009-02-28 11:08:02 +0100 (Sat, 28 Feb 2009) | 1 line
  
  Issues #1533164 and #5378: Added quiet and force-optimize options to Distutils bdist_rpm command
........


Added:
   python/branches/py3k/Lib/distutils/tests/test_bdist_rpm.py
      - copied unchanged from r70049, /python/trunk/Lib/distutils/tests/test_bdist_rpm.py
Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/distutils/command/bdist_rpm.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/distutils/command/bdist_rpm.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/bdist_rpm.py	(original)
+++ python/branches/py3k/Lib/distutils/command/bdist_rpm.py	Sat Feb 28 11:16:43 2009
@@ -122,10 +122,21 @@
         # 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',
@@ -175,6 +186,8 @@
         self.no_autoreq = 0
 
         self.force_arch = None
+        self.quiet = 0
+        self.force_optimize = 1
 
     def finalize_options(self):
         self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
@@ -311,6 +324,7 @@
         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:
@@ -322,6 +336,10 @@
                              '_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
@@ -474,13 +492,19 @@
         # 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),

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Feb 28 11:16:43 2009
@@ -173,6 +173,11 @@
 Library
 -------
 
+- Issue #1533164: Installed but not listed *.pyo was breaking Distutils
+  bdist_rpm command.
+
+- Issue #5378: added --quiet option to Distutils bdist_rpm command.
+
 - Issue #5052: make Distutils compatible with 2.3 again.
 
 - Issue #5316: Fixed buildbot failures introduced by multiple inheritance


More information about the Python-checkins mailing list