From 00673a71ed8aeb99831272e0daba01ad36cdd073 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 7 Aug 2018 17:05:50 -0600 Subject: Fix rpm tests for newer rpmbuild (fixes #3164) Two issues: (1) ARCHITECTURE, if supplied, actually needs to be set in the specfile BuildArch: field (or passed on the command line). (2) rpmbuild on Fedora builds all kind of debug stuff behind the scenes (it makes packages not requested by the specfile!). This causes scons rpm tests to fail, so force in a flag to turn off this generation. That is done unconditionally at the moment by writing %global debug_package %{nil}\n to the specfile. If anyone eventually ends up needing to produce these debug packages through scons, we can add a flag to allow it by omitting the above setting. Some doc and comment cleanup done, and one of the tests now builds a noarch package to test actually supplying an ARCHITECTURE value that is not the machine default. Also, one of the tools called by rpm packaging did not supply the right suffix for the Tar builder, presumably a copy-paste error in a place that is not stressed by any test. Fedora packaging now also generates a file containing the build id and puts it into the package (another behind the scenes bit of magic - this does not appear in our %files section but is still added to the package). It is possible to turn this behavior off as well, but for the tests affected, the choice was made instead to have them now check the files in the generated package /contain/ the expected filenames rather than /exactly-match/ the expected filenames. Testing: on recent Fedora all the rpm-related tests now pass after six failed previously; on a Centos 7.4 system which did not fail any tests, the modified code still passes - did not introduce regressions. At the moment do not believe any of the CI setup will cause rpm tests to be run. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 4 +++ src/engine/SCons/Tool/packaging/__init__.xml | 15 ++++++---- src/engine/SCons/Tool/packaging/rpm.py | 41 ++++++++++++++++------------ src/engine/SCons/Tool/packaging/tarbz2.py | 2 +- test/packaging/option--package-type.py | 8 ++++-- test/packaging/rpm/multipackage.py | 6 ++-- test/packaging/rpm/package.py | 6 ++-- test/packaging/rpm/tagging.py | 7 +++-- 8 files changed, 56 insertions(+), 33 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6534f3a..8be3bbe 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -120,6 +120,10 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - 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 be resistant to automatic supplying of build-id file on certain rpmbuild + versions; a little doc and comment cleanup. From Hao Wu - typo in customized decider example in user guide diff --git a/src/engine/SCons/Tool/packaging/__init__.xml b/src/engine/SCons/Tool/packaging/__init__.xml index e4b1865..68e4fed 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 Architecture: field in an Ipkg control file, -and as part of the name of a generated RPM file. +and the BuildArch: field +in the RPM .spec file, +as well as forming part of the name of a generated RPM package file. @@ -120,7 +122,6 @@ the control for Ipkg, the .wxs for MSI). If set, the function will be called after the SCons template for the file has been written. -XXX @@ -164,10 +165,10 @@ section of an RPM -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. @@ -383,6 +384,7 @@ This is used to fill in the BuildRequires: field in the RPM .spec file. +Note this should only be used on a host managed by rpm as the dependencies will not be resolvable at build time otherwise. @@ -441,7 +443,8 @@ field in the RPM This is used to fill in the Epoch: -field in the controlling information for RPM packages. +field in the RPM +.spec file. diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py index a3481a4..e93c4f0 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]) # @@ -211,6 +208,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', @@ -232,16 +230,23 @@ def build_specfile_header(spec): '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 ) + + # github #3164: if we don't turn off debug package generation + # the tests which build packages all fail. This just slams + # a flag into the specfile header, could make it an X_RPM_NODEBUGPKGS + # which is controllable by an environment setting. + str += '%global debug_package %{nil}\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/multipackage.py b/test/packaging/rpm/multipackage.py index ab8734d..f756cf4 100644 --- a/test/packaging/rpm/multipackage.py +++ b/test/packaging/rpm/multipackage.py @@ -109,8 +109,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..6723a9f 100644 --- a/test/packaging/rpm/package.py +++ b/test/packaging/rpm/package.py @@ -88,8 +88,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/tagging.py b/test/packaging/rpm/tagging.py index a558242..15f82a7 100644 --- a/test/packaging/rpm/tagging.py +++ b/test/packaging/rpm/tagging.py @@ -91,9 +91,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]) -- cgit v0.12 From 2915abd83891c89e0302cf3f35e367de55c0abab Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 4 Sep 2018 07:50:08 -0600 Subject: generalize the fix for #3164 Add a new flag, X_RPM_EXTRADEFS, which lets the user supply any additional flag lines needed in the specfile. If the tag is not present in the specfile, supply a value which turns off debug package generation. To retain debug package generation, supply the flag with a value of None, or with a list that does not include the disable value. So like the previous change the default is now not to generate debug, but that default can be overridden, and it is documented. --- src/CHANGES.txt | 9 +++++--- src/engine/SCons/Tool/packaging/__init__.xml | 32 ++++++++++++++++++++++++++++ src/engine/SCons/Tool/packaging/rpm.py | 20 +++++++++++------ test/packaging/rpm/cleanup.py | 10 +++------ test/packaging/rpm/explicit-target.py | 10 +++------ test/packaging/rpm/internationalization.py | 17 +++------------ test/packaging/rpm/multipackage.py | 9 ++------ test/packaging/rpm/package.py | 9 ++------ test/packaging/rpm/src/main.c | 5 +++++ test/packaging/rpm/tagging.py | 10 ++------- 10 files changed, 72 insertions(+), 59 deletions(-) create mode 100644 test/packaging/rpm/src/main.c diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 8be3bbe..8c5b90a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -121,9 +121,12 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - 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 be resistant to automatic supplying of build-id file on certain rpmbuild - versions; a little doc and comment cleanup. + auto debug package generation on certain rpmbuild versions; adjust some + tests to be resistant to automatic supplying of build-id file on + certain rpmbuild versions; tests now use a file fixture for the + repeated (trivial) main.c program. A little doc and comment cleanup. + A new tag is added, X_RPM_EXTRADEFS, to allow supplying custom settings + to the specfile without adding specific logic for each one to scons. From Hao Wu - typo in customized decider example in user guide diff --git a/src/engine/SCons/Tool/packaging/__init__.xml b/src/engine/SCons/Tool/packaging/__init__.xml index 68e4fed..348b2be 100644 --- a/src/engine/SCons/Tool/packaging/__init__.xml +++ b/src/engine/SCons/Tool/packaging/__init__.xml @@ -471,6 +471,38 @@ field in the RPM + + + +A list used to supply extra defintions or flags +to be added to the RPM .spec 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 +'%global debug_package %{nil}' +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. + + + +env.Package( + NAME = 'foo', +... + X_RPM_EXTRADEFS = [ + '%define _unpackaged_files_terminate_build 0' + '%define _missing_doc_files_terminate_build 0' + ], +... ) + + + + + diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py index e93c4f0..0a4db6c 100644 --- a/src/engine/SCons/Tool/packaging/rpm.py +++ b/src/engine/SCons/Tool/packaging/rpm.py @@ -198,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 ) @@ -227,7 +228,8 @@ 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 systems which @@ -241,11 +243,17 @@ def build_specfile_header(spec): 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. This just slams - # a flag into the specfile header, could make it an X_RPM_NODEBUGPKGS - # which is controllable by an environment setting. - str += '%global debug_package %{nil}\n' + # 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/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 f756cf4..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 diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py index 6723a9f..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 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 15f82a7..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 -- cgit v0.12 From c53e548e750f31917e36ed35af8519ebfc85344e Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 6 Sep 2018 11:34:38 -0400 Subject: Improve issue template --- .github/issue_template.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v0.12 From bbde3d2bbf2a7e34d369c5be069fde2d5e235670 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 7 Sep 2018 07:37:58 -0600 Subject: Improvements to tarball packager Both gz and bzip2 now skip the test if tar is not found (previously they would not test, but mark the test OK). Since tar is now found on recent Windows 10, but the helper program bzip2 is not, check for bzip2 as well. This is actually a correct test for other systems as well, they have just been very unlikely to not have had bzip2 provisioned so it has not bitten us. Note: on Windows, with cygwin installed, the test may well find bzip2 but c:\Windows\System32\tar.exe does not find it and the test fails anyway. Work needed on this "finds too much" issue (not unique to this test). Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 5 ++++- test/packaging/tar/bz2_packaging.py | 17 +++++++++++------ test/packaging/tar/gz.py | 13 +++++++------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6f7e851..6fa9649 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -129,13 +129,16 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - 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. - - One swig test now checks for Python.h instead of failing + - 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. 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. + - tar packaging test fixups From Hao Wu - typo in customized decider example in user guide 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() -- cgit v0.12 From fe27baf677366633c9ec64f2f7b22cb4063adc28 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 11 Sep 2018 07:24:41 -0600 Subject: Add java 11 jdk 11.0 is almost at GA, and it will be the first edition designated as Long Term Support (LTS), with commercial support until Sept 2023, so we might as well add support to scons. Going forward, is it worth continuing to check for individual versions as being "supported"? Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 2 +- src/engine/SCons/Tool/JavaCommon.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6f7e851..353d5ab 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -101,7 +101,7 @@ 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 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) -- cgit v0.12