- error out on uncompilable python code (Tim Waugh)

This commit is contained in:
Panu Matilainen 2009-02-20 18:38:44 +00:00
parent aa38a18e85
commit 86a7924ceb
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,17 @@
diff -up rpm-4.6.0/scripts/brp-python-bytecompile.validate rpm-4.6.0/scripts/brp-python-bytecompile
--- rpm-4.6.0/scripts/brp-python-bytecompile.validate 2009-02-20 20:31:30.000000000 +0200
+++ rpm-4.6.0/scripts/brp-python-bytecompile 2009-02-20 20:31:37.000000000 +0200
@@ -20,7 +20,12 @@ if [ -z "$depth" -o "$depth" -le "1" ];
fi
# Generate normal (.pyc) byte-compiled files.
-$python -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1)' > /dev/null
+$python -c 'import compileall, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, quiet=1))'
+if [ $? != 0 ]; then
+ # One or more of the files has a syntax error.
+ exit 1
+fi
+
# Generate optimized (.pyo) byte-compiled files.
$python -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1)' > /dev/null

View File

@ -18,7 +18,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: 5%{?dist}
Release: 6%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -42,6 +42,7 @@ Patch202: rpm-4.6.0-anyarch-actions-fix.patch
# These are not yet upstream
Patch300: rpm-4.6.0-extra-provides.patch
Patch301: rpm-4.6.0-python-validate.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@ -178,6 +179,7 @@ that will manipulate RPM packages and databases.
%patch202 -p1 -b .anyarch-actions-fix
%patch300 -p1 -b .extra-prov
%patch301 -p1 -b .python-bytecompile
%if %{with int_bdb}
ln -s db-%{bdbver} db
@ -377,6 +379,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Fri Feb 20 2009 Panu Matilainen <pmatilai@redhat.com> - 4.6.0-6
- error out on uncompilable python code (Tim Waugh)
* Tue Feb 17 2009 Jindrich Novy <jnovy@redhat.com> - 4.6.0-5
- remove two offending hunks from anyarch patch causing that
RPMTAG_BUILDARCHS isn't written to SRPMs