summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2018-09-20 21:14:06 (GMT)
committerGitHub <noreply@github.com>2018-09-20 21:14:06 (GMT)
commita2e3ec1c7fbdc9f89e562146e1138445a0896d30 (patch)
tree18f202831c7c77cd7d54335e2f1885b0135a6811
parent4edd05726a8fad7f192e486a9539c44ea012cd94 (diff)
parentf4821b9c97eb9317d87bab2607c0885d85f69b73 (diff)
downloadSCons-a2e3ec1c7fbdc9f89e562146e1138445a0896d30.zip
SCons-a2e3ec1c7fbdc9f89e562146e1138445a0896d30.tar.gz
SCons-a2e3ec1c7fbdc9f89e562146e1138445a0896d30.tar.bz2
Merge branch 'master' into stdlib-OrderedDict
-rw-r--r--.github/issue_template.md3
-rw-r--r--src/CHANGES.txt33
-rw-r--r--src/engine/SCons/Tool/JavaCommon.py4
-rw-r--r--src/engine/SCons/Tool/packaging/__init__.xml47
-rw-r--r--src/engine/SCons/Tool/packaging/rpm.py53
-rw-r--r--src/engine/SCons/Tool/packaging/tarbz2.py2
-rw-r--r--test/packaging/option--package-type.py8
-rw-r--r--test/packaging/rpm/cleanup.py10
-rw-r--r--test/packaging/rpm/explicit-target.py10
-rw-r--r--test/packaging/rpm/internationalization.py17
-rw-r--r--test/packaging/rpm/multipackage.py15
-rw-r--r--test/packaging/rpm/package.py15
-rw-r--r--test/packaging/rpm/src/main.c5
-rw-r--r--test/packaging/rpm/tagging.py17
-rw-r--r--test/packaging/tar/bz2_packaging.py17
-rw-r--r--test/packaging/tar/gz.py13
16 files changed, 158 insertions, 111 deletions
diff --git a/.github/issue_template.md b/.github/issue_template.md
index 9f632b0..1d35486 100644
--- a/.github/issue_template.md
+++ b/.github/issue_template.md
@@ -2,10 +2,11 @@
# See: http://scons.org/bugs.html
# If the issue is confirmed to be a bug please include the following information
+* Link to SCons Users thread discussing your issue.
* Version of SCons
* Version of Python
* Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc)
* How you installed SCons
* What Platform are you on? (Linux/Windows and which version)
* How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues.
-* Link to SCons Users thread discussing your issue.
+* How you invoke scons (The command line you're using "scons --flags some_arguments") \ No newline at end of file
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 6f873b0..a155da7 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -101,12 +101,12 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
This changes SCons to better comply with normal Python installation practices.
From Mats Wichmann:
- - Recognize new java 9, 10 (as 9.0 and 10.0)
+ - Recognize new java 9, 10, 11 (as 9.0 and 10.0, 11.0)
- Updated manpage scons.xml to fix a nested list problem
- Updated doc terminiology: use prepend instead of append as appropriate
- - xml validity fixes from SConstruct.py change
- - update wiki links to new github location
- - update bug links to new github location
+ - XML validity fixes from SConstruct.py change
+ - Update wiki links to new github location
+ - Update bug links to new github location
- Make it easier for SConscript() call to fail on missing script.
It was possible to call SCons.Warnings.warningAsException
(not documented as a user API) to make all warnings fail. Now
@@ -117,18 +117,29 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
behavior (which still defaults to warn, not fail) by calling
SCons.Script.set_missing_sconscript_error, which is also not a
documented interface at the moment.
- - convert TestCmd.read to use with statement on open (quiets 17 py3 warnings)
- - quiet py3 warning in UtilTests.py
- - fix tests specifying octal constants for py3
- - fix must_contain tests for py3
- - one swig test now checks for Python.h instead of failing
- - if test opens os.devnull, register with atexit so file opens do not leak.
+ - Convert TestCmd.read to use with statement on open (quiets 17 py3 warnings)
+ - Quiet py3 warning in UtilTests.py
+ - Fix tests specifying octal constants for py3
+ - Fix must_contain tests for py3
+ - RPM package generation:
+ - Fix supplying a build architecture
+ - Disable auto debug package generation on certain rpmbuild versions
+ - Adjust some tests to only supply build-id file on certain rpmbuild versions
+ - Tests now use a file fixture for the repeated (trivial) main.c program.
+ - Document and comment cleanup.
+ - Added new Environment Value X_RPM_EXTRADEFS to supply custom settings
+ to the specfile without adding specific logic for each one to scons.
+ - The test for Python.h needed by swig tests is moved to get_python_platform
+ so it does not have to be repeated in every test; picks up one failure
+ which did not make the (previously needed) check.
+ - If test opens os.devnull, register with atexit so file opens do not leak.
- Fix bugs in Win32 process spawn logic to handle OSError exception correctly.
- - use time.perf_counter instead of time.clock if it exists.
+ - Use time.perf_counter instead of time.clock if it exists.
time.clock deprecated since py3.3, due to remove in 3.8. deprecation
warnings from py3.7 were failing a bunch of tests on Windows since they
mess up expected stderr.
- Remove obsoleted internal implementaiton of OrderedDict.
+ - Test for tar packaging fixups
From Hao Wu
- typo in customized decider example in user guide
diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py
index 8349164..e90e768 100644
--- a/src/engine/SCons/Tool/JavaCommon.py
+++ b/src/engine/SCons/Tool/JavaCommon.py
@@ -69,7 +69,7 @@ if java_parsing:
def __init__(self, version=default_java_version):
if not version in ('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7',
- '1.8', '5', '6', '9.0', '10.0'):
+ '1.8', '5', '6', '9.0', '10.0', '11.0'):
msg = "Java version %s not supported" % version
raise NotImplementedError(msg)
@@ -177,7 +177,7 @@ if java_parsing:
if self.version in ('1.1', '1.2', '1.3', '1.4'):
clazz = self.listClasses[0]
self.listOutputs.append('%s$%d' % (clazz, self.nextAnon))
- elif self.version in ('1.5', '1.6', '1.7', '1.8', '5', '6', '9.0', '10.0'):
+ elif self.version in ('1.5', '1.6', '1.7', '1.8', '5', '6', '9.0', '10.0', '11.0'):
self.stackAnonClassBrackets.append(self.brackets)
className = []
className.extend(self.listClasses)
diff --git a/src/engine/SCons/Tool/packaging/__init__.xml b/src/engine/SCons/Tool/packaging/__init__.xml
index e4b1865..348b2be 100644
--- a/src/engine/SCons/Tool/packaging/__init__.xml
+++ b/src/engine/SCons/Tool/packaging/__init__.xml
@@ -106,7 +106,9 @@ This is used to fill in the
<literal>Architecture:</literal>
field in an Ipkg
<filename>control</filename> file,
-and as part of the name of a generated RPM file.
+and the <literal>BuildArch:</literal> field
+in the RPM <filename>.spec</filename> file,
+as well as forming part of the name of a generated RPM package file.
</para>
</summary>
</cvar>
@@ -120,7 +122,6 @@ the <filename>control</filename> for Ipkg,
the <filename>.wxs</filename> for MSI).
If set, the function will be called
after the SCons template for the file has been written.
-XXX
</para>
</summary>
</cvar>
@@ -164,10 +165,10 @@ section of an RPM
<cvar name="LICENSE">
<summary>
<para>
-The abbreviated name of the license under which
-this project is released (gpl, lpgl, bsd etc.).
+The abbreviated name, preferably the SPDX code, of the license under which
+this project is released (GPL-3.0, LGPL-2.1, BSD-2-Clause etc.).
See http://www.opensource.org/licenses/alphabetical
-for a list of license names.
+for a list of license names and SPDX codes.
</para>
</summary>
</cvar>
@@ -383,6 +384,7 @@ This is used to fill in the
<literal>BuildRequires:</literal>
field in the RPM
<filename>.spec</filename> file.
+Note this should only be used on a host managed by rpm as the dependencies will not be resolvable at build time otherwise.
</para>
</summary>
</cvar>
@@ -441,7 +443,8 @@ field in the RPM
<para>
This is used to fill in the
<literal>Epoch:</literal>
-field in the controlling information for RPM packages.
+field in the RPM
+<filename>.spec</filename> file.
</para>
</summary>
</cvar>
@@ -468,6 +471,38 @@ field in the RPM
</summary>
</cvar>
+<cvar name="X_RPM_EXTRADEFS">
+<summary>
+<para>
+A list used to supply extra defintions or flags
+to be added to the RPM <filename>.spec<filename> file.
+Each item is added as-is with a carriage return appended.
+This is useful if some specific RPM feature not otherwise
+anticipated by SCons needs to be turned on or off.
+Note if this variable is omitted, SCons will by
+default supply the value
+<literal>'%global debug_package %{nil}'</literal>
+to disable debug package generation.
+To enable debug package generation, include this
+variable set either to None, or to a custom
+list that does not include the default line.
+Added in version 3.1.
+</para>
+
+<example_commands>
+env.Package(
+ NAME = 'foo',
+...
+ X_RPM_EXTRADEFS = [
+ '%define _unpackaged_files_terminate_build 0'
+ '%define _missing_doc_files_terminate_build 0'
+ ],
+... )
+</example_commands>
+
+</summary>
+</cvar>
+
<cvar name="X_RPM_GROUP">
<summary>
<para>
diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py
index a3481a4..0a4db6c 100644
--- a/src/engine/SCons/Tool/packaging/rpm.py
+++ b/src/engine/SCons/Tool/packaging/rpm.py
@@ -51,10 +51,9 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
if str(target[0])!="%s-%s"%(NAME, VERSION):
raise UserError( "Setting target is not supported for rpm." )
else:
- # This should be overridable from the construction environment,
- # which it is by using ARCHITECTURE=.
+ # Deduce the build architecture, but allow it to be overridden
+ # by setting ARCHITECTURE in the construction env.
buildarchitecture = SCons.Tool.rpmutils.defaultMachine()
-
if 'ARCHITECTURE' in kw:
buildarchitecture = kw['ARCHITECTURE']
@@ -126,20 +125,18 @@ def build_specfile(target, source, env):
""" Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes.
"""
- file = open(target[0].get_abspath(), 'w')
-
- try:
- file.write( build_specfile_header(env) )
- file.write( build_specfile_sections(env) )
- file.write( build_specfile_filesection(env, source) )
- file.close()
+ with open(target[0].get_abspath(), 'w') as file:
+ try:
+ file.write(build_specfile_header(env))
+ file.write(build_specfile_sections(env))
+ file.write(build_specfile_filesection(env, source))
- # call a user specified function
- if 'CHANGE_SPECFILE' in env:
- env['CHANGE_SPECFILE'](target, source)
+ # call a user specified function
+ if 'CHANGE_SPECFILE' in env:
+ env['CHANGE_SPECFILE'](target, source)
- except KeyError as e:
- raise SCons.Errors.UserError( '"%s" package field for RPM is missing.' % e.args[0] )
+ except KeyError as e:
+ raise SCons.Errors.UserError('"%s" package field for RPM is missing.' % e.args[0])
#
@@ -201,7 +198,8 @@ def build_specfile_header(spec):
'PACKAGEVERSION' : '%%define release %s\nRelease: %%{release}\n',
'X_RPM_GROUP' : 'Group: %s\n',
'SUMMARY' : 'Summary: %s\n',
- 'LICENSE' : 'License: %s\n', }
+ 'LICENSE' : 'License: %s\n',
+ }
str = str + SimpleTagCompiler(mandatory_header_fields).compile( spec )
@@ -211,6 +209,7 @@ def build_specfile_header(spec):
'X_RPM_URL' : 'Url: %s\n',
'SOURCE_URL' : 'Source: %s\n',
'SUMMARY_' : 'Summary(%s): %s\n',
+ 'ARCHITECTURE' : 'BuildArch: %s\n',
'X_RPM_DISTRIBUTION' : 'Distribution: %s\n',
'X_RPM_ICON' : 'Icon: %s\n',
'X_RPM_PACKAGER' : 'Packager: %s\n',
@@ -229,19 +228,33 @@ def build_specfile_header(spec):
'X_RPM_PREFIX' : 'Prefix: %s\n',
# internal use
- 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n', }
+ 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n',
+ }
# fill in default values:
- # Adding a BuildRequires renders the .rpm unbuildable under System, which
+ # Adding a BuildRequires renders the .rpm unbuildable under systems which
# are not managed by rpm, since the database to resolve this dependency is
# missing (take Gentoo as an example)
-# if not s.has_key('x_rpm_BuildRequires'):
-# s['x_rpm_BuildRequires'] = 'scons'
+ #if 'X_RPM_BUILDREQUIRES' not in spec:
+ # spec['X_RPM_BUILDREQUIRES'] = 'scons'
if 'X_RPM_BUILDROOT' not in spec:
spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}'
str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec )
+
+ # Add any extra specfile definitions the user may have supplied.
+ # These flags get no processing, they are just added.
+ # github #3164: if we don't turn off debug package generation
+ # the tests which build packages all fail. If there are no
+ # extra flags, default to adding this one. If the user wants
+ # to turn this back on, supply the flag set to None.
+
+ if 'X_RPM_EXTRADEFS' not in spec:
+ spec['X_RPM_EXTRADEFS'] = ['%global debug_package %{nil}']
+ for extra in spec['X_RPM_EXTRADEFS']:
+ str += extra + '\n'
+
return str
#
diff --git a/src/engine/SCons/Tool/packaging/tarbz2.py b/src/engine/SCons/Tool/packaging/tarbz2.py
index 2e38da2..3806e76 100644
--- a/src/engine/SCons/Tool/packaging/tarbz2.py
+++ b/src/engine/SCons/Tool/packaging/tarbz2.py
@@ -32,7 +32,7 @@ from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
def package(env, target, source, PACKAGEROOT, **kw):
bld = env['BUILDERS']['Tar']
- bld.set_suffix('.tar.gz')
+ bld.set_suffix('.tar.bz2')
target, source = putintopackageroot(target, source, env, PACKAGEROOT)
target, source = stripinstallbuilder(target, source, env)
return bld(env, target, source, TARFLAGS='-jc')
diff --git a/test/packaging/option--package-type.py b/test/packaging/option--package-type.py
index c8f22ca..7ff8535 100644
--- a/test/packaging/option--package-type.py
+++ b/test/packaging/option--package-type.py
@@ -26,6 +26,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test the --package-type option.
+
+Side effect: also tests that we can produce a noarch package
+by supplying the ARCHITECTURE tag.
"""
import TestSCons
@@ -63,12 +66,13 @@ env.Package( NAME = 'foo',
X_RPM_INSTALL = r'%(_python_)s %(scons)s --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
DESCRIPTION = 'this should be really long',
source = [ prog ],
- SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz',
+ ARCHITECTURE = 'noarch'
)
""" % locals())
src_rpm = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
+machine_rpm = 'foo-1.2.3-0.noarch.rpm'
test.run(arguments='package PACKAGETYPE=rpm', stderr = None)
diff --git a/test/packaging/rpm/cleanup.py b/test/packaging/rpm/cleanup.py
index b77dfd1..7483750 100644
--- a/test/packaging/rpm/cleanup.py
+++ b/test/packaging/rpm/cleanup.py
@@ -28,6 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Assert that files created by the RPM packager will be removed by 'scons -c'.
"""
+import os
import TestSCons
import SCons.Tool.rpmutils
@@ -47,13 +48,8 @@ if not rpm:
rpm_build_root = test.workpath('rpm_build_root')
test.subdir('src')
-
-test.write( [ 'src', 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
- return 0;
-}
-""")
+mainpath = os.path.join('src', 'main.c')
+test.file_fixture(mainpath, mainpath)
test.write('SConstruct', """
env=Environment(tools=['default', 'packaging'])
diff --git a/test/packaging/rpm/explicit-target.py b/test/packaging/rpm/explicit-target.py
index c383b57..e8fbd39 100644
--- a/test/packaging/rpm/explicit-target.py
+++ b/test/packaging/rpm/explicit-target.py
@@ -28,6 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the ability to create a rpm package from a explicit target name.
"""
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -44,13 +45,8 @@ if not rpm:
rpm_build_root = test.workpath('rpm_build_root')
test.subdir('src')
-
-test.write( [ 'src', 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
- return 0;
-}
-""")
+mainpath = os.path.join('src', 'main.c')
+test.file_fixture(mainpath, mainpath)
test.write('SConstruct', """
import os
diff --git a/test/packaging/rpm/internationalization.py b/test/packaging/rpm/internationalization.py
index 2ef0dfd..ad77f40 100644
--- a/test/packaging/rpm/internationalization.py
+++ b/test/packaging/rpm/internationalization.py
@@ -33,7 +33,6 @@ These are x-rpm-Group, description, summary and the lang_xx file tag.
import os
import SCons.Tool.rpmutils
-
import TestSCons
_python_ = TestSCons._python_
@@ -52,12 +51,7 @@ rpm_build_root = test.workpath('rpm_build_root')
#
# test INTERNATIONAL PACKAGE META-DATA
#
-test.write( [ 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
- return 0;
-}
-""")
+test.file_fixture('src/main.c', 'main.c')
test.write('SConstruct', """
# -*- coding: utf-8 -*-
@@ -123,13 +117,8 @@ test.fail_test( out != 'Application/office-hello-this should be really long' )
#
# test INTERNATIONAL PACKAGE TAGS
#
-
-test.write( [ 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
- return 0;
-}
-""")
+mainpath = os.path.join('src', 'main.c')
+test.file_fixture(mainpath)
test.write( ['man.de'], '' )
test.write( ['man.en'], '' )
diff --git a/test/packaging/rpm/multipackage.py b/test/packaging/rpm/multipackage.py
index ab8734d..fd67a09 100644
--- a/test/packaging/rpm/multipackage.py
+++ b/test/packaging/rpm/multipackage.py
@@ -47,13 +47,8 @@ if not rpm:
rpm_build_root = test.workpath('rpm_build_root')
test.subdir('src')
-
-test.write( [ 'src', 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
- return 0;
-}
-""")
+mainpath = os.path.join('src', 'main.c')
+test.file_fixture(mainpath, mainpath)
test.write('SConstruct', """
import os
@@ -109,8 +104,10 @@ test.must_exist( machine_rpm2 )
test.must_exist( src_rpm2 )
test.must_not_exist( 'bin/main' )
-test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
-test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
+out = os.popen( 'rpm -qpl %s' % machine_rpm).read()
+test.must_contain_all_lines( out, '/bin/main')
+out = os.popen( 'rpm -qpl %s' % src_rpm).read()
+test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
test.pass_test()
diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py
index d8c2785..2ba66b9 100644
--- a/test/packaging/rpm/package.py
+++ b/test/packaging/rpm/package.py
@@ -46,13 +46,8 @@ if not rpm:
rpm_build_root = test.workpath('rpm_build_root')
test.subdir('src')
-
-test.write( [ 'src', 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
- return 0;
-}
-""")
+mainpath = os.path.join('src', 'main.c')
+test.file_fixture(mainpath, mainpath)
test.write('SConstruct', """
import os
@@ -88,8 +83,10 @@ machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
test.must_exist( machine_rpm )
test.must_exist( src_rpm )
test.must_not_exist( 'bin/main' )
-test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
-test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
+out = os.popen( 'rpm -qpl %s' % machine_rpm).read()
+test.must_contain_all_lines( out, '/bin/main')
+out = os.popen( 'rpm -qpl %s' % src_rpm).read()
+test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
test.pass_test()
diff --git a/test/packaging/rpm/src/main.c b/test/packaging/rpm/src/main.c
new file mode 100644
index 0000000..49e8969
--- /dev/null
+++ b/test/packaging/rpm/src/main.c
@@ -0,0 +1,5 @@
+
+int main( int argc, char* argv[] )
+{
+ return 0;
+}
diff --git a/test/packaging/rpm/tagging.py b/test/packaging/rpm/tagging.py
index a558242..b685c91 100644
--- a/test/packaging/rpm/tagging.py
+++ b/test/packaging/rpm/tagging.py
@@ -30,7 +30,6 @@ Test the ability to add file tags
import os
import SCons.Tool.rpmutils
-
import TestSCons
_python_ = TestSCons._python_
@@ -50,13 +49,8 @@ rpm_build_root = test.workpath('rpm_build_root')
# Test adding an attr tag to the built program.
#
test.subdir('src')
-
-test.write( [ 'src', 'main.c' ], r"""
-int main( int argc, char* argv[] )
-{
-return 0;
-}
-""")
+mainpath = os.path.join('src', 'main.c')
+test.file_fixture(mainpath, mainpath)
test.write('SConstruct', """
import os
@@ -91,9 +85,12 @@ src_rpm = 'foo-1.2.3-0.src.rpm'
machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
test.must_exist( machine_rpm )
+out = os.popen('rpm -qpl %s' % machine_rpm).read()
+test.must_contain_all_lines( out, '/bin/main')
+
test.must_exist( src_rpm )
-test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
-test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
+out = os.popen('rpm -qpl %s' % src_rpm).read()
+test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
expect = '(0755, root, users) /bin/main'
test.must_contain_all_lines(test.read('foo-1.2.3.spec',mode='r'), [expect])
diff --git a/test/packaging/tar/bz2_packaging.py b/test/packaging/tar/bz2_packaging.py
index 1552fd1..2a8b506 100644
--- a/test/packaging/tar/bz2_packaging.py
+++ b/test/packaging/tar/bz2_packaging.py
@@ -36,18 +36,23 @@ python = TestSCons.python
test = TestSCons.TestSCons()
tar = test.detect('TAR', 'tar')
+if not tar:
+ test.skip_test('tar not found, skipping test\n')
-if tar:
- test.subdir('src')
+bz2 = test.where_is('bzip2')
+if not bz2:
+ test.skip_test('tar found, but helper bzip2 not found, skipping test\n')
- test.write( [ 'src', 'main.c' ], r"""
+test.subdir('src')
+
+test.write([ 'src', 'main.c'], r"""
int main( int argc, char* argv[] )
{
return 0;
}
""")
- test.write('SConstruct', """
+test.write('SConstruct', """
Program( 'src/main.c' )
env=Environment(tools=['default', 'packaging'])
env.Package( PACKAGETYPE = 'src_tarbz2',
@@ -56,9 +61,9 @@ env.Package( PACKAGETYPE = 'src_tarbz2',
source = [ 'src/main.c', 'SConstruct' ] )
""")
- test.run(arguments='', stderr = None)
+test.run(arguments='', stderr=None)
- test.must_exist( 'src.tar.bz2' )
+test.must_exist('src.tar.bz2')
test.pass_test()
diff --git a/test/packaging/tar/gz.py b/test/packaging/tar/gz.py
index f841c59..05661b7 100644
--- a/test/packaging/tar/gz.py
+++ b/test/packaging/tar/gz.py
@@ -36,18 +36,19 @@ python = TestSCons.python
test = TestSCons.TestSCons()
tar = test.detect('TAR', 'tar')
+if not tar:
+ test.skip_test('tar not found, skipping test\n')
-if tar:
- test.subdir('src')
+test.subdir('src')
- test.write( [ 'src', 'main.c' ], r"""
+test.write(['src', 'main.c'], r"""
int main( int argc, char* argv[] )
{
return 0;
}
""")
- test.write('SConstruct', """
+test.write('SConstruct', """
Program( 'src/main.c' )
env=Environment(tools=['default', 'packaging'])
env.Package( PACKAGETYPE = 'src_targz',
@@ -56,9 +57,9 @@ env.Package( PACKAGETYPE = 'src_targz',
source = [ 'src/main.c', 'SConstruct' ] )
""")
- test.run(arguments='', stderr = None)
+test.run(arguments='', stderr=None)
- test.must_exist( 'src.tar.gz' )
+test.must_exist('src.tar.gz')
test.pass_test()