summaryrefslogtreecommitdiffstats
path: root/test/packaging
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2015-09-21 17:03:12 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2015-09-21 17:03:12 (GMT)
commit0941093e0e5a030faa49968457638a3a6aee7ad8 (patch)
tree6d33513c14eb6eac0531dd050de0ecca4c39bd79 /test/packaging
downloadSCons-2.4.0.zip
SCons-2.4.0.tar.gz
SCons-2.4.0.tar.bz2
release 2.4.02.4.0
Diffstat (limited to 'test/packaging')
-rw-r--r--test/packaging/convenience-functions/convenience-functions.py64
-rw-r--r--test/packaging/convenience-functions/image/SConstruct10
-rw-r--r--test/packaging/convenience-functions/image/f10
-rw-r--r--test/packaging/convenience-functions/image/f20
-rw-r--r--test/packaging/convenience-functions/image/f30
-rw-r--r--test/packaging/guess-package-name.py111
-rw-r--r--test/packaging/ipkg.py135
-rw-r--r--test/packaging/msi/explicit-target.py97
-rw-r--r--test/packaging/msi/file-placement.py178
-rw-r--r--test/packaging/msi/package.py143
-rw-r--r--test/packaging/multiple-packages-at-once.py105
-rw-r--r--test/packaging/multiple-subdirs.py86
-rw-r--r--test/packaging/option--package-type.py94
-rw-r--r--test/packaging/place-files-in-subdirectory.py114
-rw-r--r--test/packaging/rpm/cleanup.py112
-rw-r--r--test/packaging/rpm/explicit-target.py94
-rw-r--r--test/packaging/rpm/internationalization.py187
-rw-r--r--test/packaging/rpm/multipackage.py121
-rw-r--r--test/packaging/rpm/package.py100
-rw-r--r--test/packaging/rpm/tagging.py107
-rw-r--r--test/packaging/sandbox-test/SConstruct19
-rw-r--r--test/packaging/sandbox-test/sandbox-test.py56
-rw-r--r--test/packaging/sandbox-test/src/foobar.c0
-rw-r--r--test/packaging/sandbox-test/src/foobar.h0
-rw-r--r--test/packaging/strip-install-dir.py71
-rw-r--r--test/packaging/tar/bz2.py69
-rw-r--r--test/packaging/tar/gz.py69
-rw-r--r--test/packaging/use-builddir.py99
-rw-r--r--test/packaging/zip.py71
29 files changed, 2312 insertions, 0 deletions
diff --git a/test/packaging/convenience-functions/convenience-functions.py b/test/packaging/convenience-functions/convenience-functions.py
new file mode 100644
index 0000000..a1be041
--- /dev/null
+++ b/test/packaging/convenience-functions/convenience-functions.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the FindInstalledFiles() and the FindSourceFiles() functions.
+"""
+
+import os.path
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.dir_fixture( "image" )
+
+bin_f1 = os.path.join('bin', 'f1')
+bin_f2 = os.path.join('bin', 'f2')
+
+bin__f1 = bin_f1.replace('\\', '\\\\')
+bin__f2 = bin_f2.replace('\\', '\\\\')
+
+expect_read = """\
+['SConstruct', 'f1', 'f2', 'f3']
+['%(bin__f1)s', '%(bin__f2)s']
+""" % locals()
+
+expect_build = """\
+Install file: "f1" as "%(bin_f1)s"
+Install file: "f2" as "%(bin_f2)s"
+""" % locals()
+
+expected = test.wrap_stdout(read_str = expect_read, build_str = expect_build)
+
+test.run(stdout=expected)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/convenience-functions/image/SConstruct b/test/packaging/convenience-functions/image/SConstruct
new file mode 100644
index 0000000..461961e
--- /dev/null
+++ b/test/packaging/convenience-functions/image/SConstruct
@@ -0,0 +1,10 @@
+
+env = Environment(tools=['default', 'packaging'])
+prog = env.Install( 'bin/', ["f1", "f2"] )
+env.File( "f3" )
+
+src_files = sorted(map(str, env.FindSourceFiles()))
+oth_files = sorted(map(str, env.FindInstalledFiles()))
+
+print src_files
+print oth_files
diff --git a/test/packaging/convenience-functions/image/f1 b/test/packaging/convenience-functions/image/f1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/packaging/convenience-functions/image/f1
diff --git a/test/packaging/convenience-functions/image/f2 b/test/packaging/convenience-functions/image/f2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/packaging/convenience-functions/image/f2
diff --git a/test/packaging/convenience-functions/image/f3 b/test/packaging/convenience-functions/image/f3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/packaging/convenience-functions/image/f3
diff --git a/test/packaging/guess-package-name.py b/test/packaging/guess-package-name.py
new file mode 100644
index 0000000..9c85b9a
--- /dev/null
+++ b/test/packaging/guess-package-name.py
@@ -0,0 +1,111 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+This tests the feature of guessing the package name from the given metadata
+projectname and version.
+
+Also overriding this default package name is tested
+
+Furthermore that targz is the default packager is tested.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+test = TestSCons.TestSCons()
+tar = test.detect('TAR', 'tar')
+
+if not tar:
+ test.skip_test('tar not found; skipping test\n')
+
+#
+# TEST: default package name creation.
+#
+test.subdir('src')
+
+test.write( [ 'src', 'main.c' ], r"""
+int main( int argc, char* argv[] )
+{
+ return 0;
+}
+""")
+
+test.write('SConstruct', """
+env=Environment(tools=['default', 'packaging'])
+env.Program( 'src/main.c' )
+env.Package( NAME = 'libfoo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'zip',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(options="--debug=stacktrace", stderr = None)
+
+test.must_exist( 'libfoo-1.2.3.zip' )
+
+#
+# TEST: overriding default package name.
+#
+
+test.write('SConstruct', """
+env=Environment(tools=['default', 'packaging'])
+env.Program( 'src/main.c' )
+env.Package( NAME = 'libfoo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'src_targz',
+ target = 'src.tar.gz',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(stderr = None)
+
+test.must_exist( 'src.tar.gz' )
+
+#
+# TEST: default package name creation with overriden packager.
+#
+
+test.write('SConstruct', """
+env=Environment(tools=['default', 'packaging'])
+env.Program( 'src/main.c' )
+env.Package( NAME = 'libfoo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'src_tarbz2',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(stderr = None)
+
+test.must_exist( 'libfoo-1.2.3.tar.bz2' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/ipkg.py b/test/packaging/ipkg.py
new file mode 100644
index 0000000..08889a9
--- /dev/null
+++ b/test/packaging/ipkg.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to call the ipkg tool trough SCons.
+
+TODO: make a test to assert that the clean action removes ALL intermediate files
+"""
+
+import os
+import TestSCons
+
+python = TestSCons.python
+test = TestSCons.TestSCons()
+ipkg = test.Environment().WhereIs('ipkg-build')
+
+if not ipkg:
+ test.skip_test("ipkg-build not found, skipping test\n")
+
+test.write( 'main.c', r"""
+int main(int argc, char *argv[])
+{
+ return 0;
+}
+""")
+
+test.write( 'foo.conf', '' )
+
+test.write( 'SConstruct', r"""
+env=Environment(tools=['default', 'packaging'])
+prog = env.Install( 'bin/', Program( 'main.c') )
+conf = env.Install( 'etc/', File( 'foo.conf' ) )
+env.Tag( conf, 'CONF', 'MEHR', 'UND MEHR' )
+env.Package( PACKAGETYPE = 'ipk',
+ source = env.FindInstalledFiles(),
+ NAME = 'foo',
+ VERSION = '0.0',
+ SUMMARY = 'foo is the ever-present example program -- it does everything',
+ DESCRIPTION = '''foo is not a real package. This is simply an example that you
+may modify if you wish.
+.
+When you modify this example, be sure to change the Package, Version,
+Maintainer, Depends, and Description fields.''',
+
+ SOURCE_URL = 'http://gnu.org/foo-0.0.tar.gz',
+ X_IPK_SECTION = 'extras',
+ X_IPK_PRIORITY = 'optional',
+ ARCHITECTURE = 'arm',
+ X_IPK_MAINTAINER = 'Familiar User <user@somehost.net>',
+ X_IPK_DEPENDS = 'libc6, grep', )
+""")
+
+expected="""scons: Reading SConscript files ...
+scons: done reading SConscript files.
+scons: Building targets ...
+gcc -o main.o -c main.c
+gcc -o main main.o
+Copy file(s): "main" to "foo-0.0/bin/main"
+Copy file(s): "foo.conf" to "foo-0.0/etc/foo.conf"
+build_specfiles(["foo-0.0/CONTROL/control", "foo-0.0/CONTROL/conffiles", "foo-0.0/CONTROL/postrm", "foo-0.0/CONTROL/prerm", "foo-0.0/CONTROL/postinst", "foo-0.0/CONTROL/preinst"], ["foo-0.0/bin/main", "foo-0.0/etc/foo.conf"])
+ipkg-build -o %s -g %s foo-0.0
+Packaged contents of foo-0.0 into %s/foo_0.0_arm.ipk
+scons: done building targets.
+"""%(os.popen('id -un').read().strip(), os.popen('id -gn').read().strip(), test.workpath())
+
+test.run(arguments="--debug=stacktrace foo_0.0_arm.ipk", stdout=expected)
+test.must_exist( 'foo-0.0/CONTROL/control' )
+test.must_exist( 'foo_0.0_arm.ipk' )
+
+test.subdir( 'foo-0.0' )
+test.subdir( [ 'foo-0.0', 'CONTROL' ] )
+
+test.write( [ 'foo-0.0', 'CONTROL', 'control' ], r"""
+Package: foo
+Priority: optional
+Section: extras
+Source: http://gnu.org/foo-0.0.tar.gz
+Version: 0.0
+Architecture: arm
+Maintainer: Familiar User <user@somehost.net>
+Depends: libc6, grep
+Description: foo is the ever-present example program -- it does everything
+ foo is not a real package. This is simply an example that you
+ may modify if you wish.
+ .
+ When you modify this example, be sure to change the Package, Version,
+ Maintainer, Depends, and Description fields.
+""")
+
+test.write( 'main.c', r"""
+int main(int argc, char *argv[])
+{
+ return 0;
+}
+""")
+
+test.write('SConstruct', """
+env = Environment( tools = [ 'default', 'ipkg' ] )
+prog = env.Install( 'foo-0.0/bin/' , env.Program( 'main.c') )
+env.Ipkg( [ env.Dir( 'foo-0.0' ), prog ] )
+""")
+
+test.run(arguments='', stderr = None)
+test.must_exist( 'foo_0.0_arm.ipk' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/msi/explicit-target.py b/test/packaging/msi/explicit-target.py
new file mode 100644
index 0000000..bc786ee
--- /dev/null
+++ b/test/packaging/msi/explicit-target.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to use a explicit target package name and the use
+of FindInstalledFiles() in conjuction with .msi packages.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+try:
+ from xml.dom.minidom import *
+except ImportError:
+ test.skip_test('Canoot import xml.dom.minidom skipping test\n')
+
+wix = test.Environment().WhereIs('candle')
+
+if not wix:
+ test.skip_test("No 'candle' found; skipping test\n")
+
+#
+# build with minimal tag set and test for the given package meta-data
+#
+test.write( 'file1.exe', "file1" )
+test.write( 'file2.exe', "file2" )
+
+test.write('SConstruct', """
+import os
+
+env = Environment(tools=['default', 'packaging'])
+
+f1 = env.Install( '/usr/' , 'file1.exe' )
+f2 = env.Install( '/usr/' , 'file2.exe' )
+
+env.Alias( 'install', [ f1, f2 ] )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2',
+ PACKAGETYPE = 'msi',
+ SUMMARY = 'balalalalal',
+ DESCRIPTION = 'this should be reallly really long',
+ VENDOR = 'Nanosoft_2000',
+ source = env.FindInstalledFiles(),
+ target = "mypackage.msi",
+ )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'foo-1.2.wxs' )
+test.must_exist( 'foo-1.2.msi' )
+
+dom = parse( test.workpath( 'foo-1.2.wxs' ) )
+Product = dom.getElementsByTagName( 'Product' )[0]
+Package = dom.getElementsByTagName( 'Package' )[0]
+
+test.fail_test( not Product.attributes['Manufacturer'].value == 'Nanosoft_2000' )
+test.fail_test( not Product.attributes['Version'].value == '1.2' )
+test.fail_test( not Product.attributes['Name'].value == 'foo' )
+
+test.fail_test( not Package.attributes['Description'].value == 'balalalalal' )
+test.fail_test( not Package.attributes['Comments'].value == 'this should be reallly really long' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/msi/file-placement.py b/test/packaging/msi/file-placement.py
new file mode 100644
index 0000000..2cc9e61
--- /dev/null
+++ b/test/packaging/msi/file-placement.py
@@ -0,0 +1,178 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the msi packagers ability to put files into distinct directories.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+try:
+ from xml.dom.minidom import *
+except ImportError:
+ test.skip_test('Cannot import xml.dom.minidom; skipping test\n')
+
+wix = test.Environment().WhereIs('candle')
+
+if not wix:
+ test.skip_test("No 'candle' found; skipping test\n")
+
+#
+# Test the default directory layout
+#
+test.write( 'file1.exe', "file1" )
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+f1 = env.Install( '/bin/' , 'file1.exe' )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2',
+ PACKAGETYPE = 'msi',
+ SUMMARY = 'balalalalal',
+ DESCRIPTION = 'this should be reallly really long',
+ VENDOR = 'Nanosoft_2000',
+ source = [ f1 ],
+ )
+""")
+
+test.run(arguments='', stderr = None)
+
+dom = parse( test.workpath( 'foo-1.2.wxs' ) )
+dirs = dom.getElementsByTagName( 'Directory' )
+
+test.fail_test( not dirs[0].attributes['Name'].value == 'SourceDir' )
+test.fail_test( not dirs[1].attributes['Name'].value == 'PFiles' )
+test.fail_test( not dirs[2].attributes['Name'].value == 'NANOSOF1' )
+test.fail_test( not dirs[3].attributes['Name'].value == 'FOO-1.2' )
+
+#
+# Try to put 7 files into 5 distinct directories of varying depth and overlapping count
+#
+test.write( 'file1.exe', "file1" )
+test.write( 'file2.exe', "file2" )
+test.write( 'file3.dll', "file3" )
+test.write( 'file4.dll', "file4" )
+test.write( 'file5.class', "file5" )
+test.write( 'file6.class', "file6" )
+test.write( 'file7.class', "file7" )
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+f1 = env.Install( '/bin/' , 'file1.exe' )
+f2 = env.Install( '/bin/' , 'file2.exe' )
+f3 = env.Install( '/lib/' , 'file3.dll' )
+f4 = env.Install( '/lib/' , 'file4.dll' )
+f5 = env.Install( '/java/edu/teco/' , 'file5.class' )
+f6 = env.Install( '/java/teco/' , 'file6.class' )
+f7 = env.Install( '/java/tec/' , 'file7.class' )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2',
+ PACKAGETYPE = 'msi',
+ SUMMARY = 'balalalalal',
+ DESCRIPTION = 'this should be reallly really long',
+ VENDOR = 'Nanosoft_2000',
+ LICENSE = 'afl',
+ source = [ f1, f2, f3, f4, f5, f6, f7 ],
+ )
+""")
+
+test.run(arguments='', stderr = None)
+
+dom = parse( test.workpath( 'foo-1.2.wxs' ) )
+files = dom.getElementsByTagName( 'File' )
+
+test.fail_test( not files[0].parentNode.parentNode.attributes['LongName'].value == 'bin' )
+test.fail_test( not files[1].parentNode.parentNode.attributes['LongName'].value == 'bin' )
+test.fail_test( not files[2].parentNode.parentNode.attributes['LongName'].value == 'lib' )
+test.fail_test( not files[3].parentNode.parentNode.attributes['LongName'].value == 'lib' )
+
+test.fail_test( not files[4].parentNode.parentNode.attributes['LongName'].value == 'teco' )
+test.fail_test( not files[4].parentNode.parentNode.parentNode.attributes['LongName'].value == 'edu' )
+test.fail_test( not files[4].parentNode.parentNode.parentNode.parentNode.attributes['LongName'].value == 'java' )
+
+test.fail_test( not files[5].parentNode.parentNode.attributes['LongName'].value == 'teco' )
+test.fail_test( not files[5].parentNode.parentNode.parentNode.attributes['LongName'].value == 'java' )
+
+test.fail_test( not files[6].parentNode.parentNode.attributes['LongName'].value == 'tec' )
+test.fail_test( not files[6].parentNode.parentNode.parentNode.attributes['LongName'].value == 'java' )
+
+#
+# Test distinct directories put into distinct features
+#
+test.write( 'file1.exe', "file1" )
+test.write( 'file2.exe', "file2" )
+test.write( 'file3.dll', "file3" )
+test.write( 'file3-.dll', "file3" )
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+f1 = env.Install( '/bin/' , 'file1.exe' )
+f2 = env.Install( '/bin/' , 'file2.exe' )
+f3 = env.Install( '/lib/' , 'file3.dll' )
+f4 = env.Install( '/lib/' , 'file3-.dll' ) # generate a collision in the ids
+
+env.Tag( [f1, f2, f4], X_MSI_FEATURE = 'Core Part' )
+env.Tag( f3, X_MSI_FEATURE = 'Java Part' )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2',
+ PACKAGETYPE = 'msi',
+ SUMMARY = 'balalalalal',
+ DESCRIPTION = 'this should be reallly really long',
+ VENDOR = 'Nanosoft_2000',
+ LICENSE = 'afl',
+ source = [ f1, f2, f3, f4 ],
+ )
+""")
+
+test.run(arguments='', stderr = None)
+
+dom = parse( test.workpath( 'foo-1.2.wxs' ) )
+features = dom.getElementsByTagName( 'Feature' )
+
+test.fail_test( not features[1].attributes['Title'].value == 'Core Part' )
+componentrefs = features[1].getElementsByTagName( 'ComponentRef' )
+test.fail_test( not componentrefs[0].attributes['Id'].value == 'file1.exe' )
+test.fail_test( not componentrefs[1].attributes['Id'].value == 'file2.exe' )
+test.fail_test( not componentrefs[2].attributes['Id'].value == 'file3.dll1' )
+
+test.fail_test( not features[2].attributes['Title'].value == 'Java Part' )
+componentrefs = features[2].getElementsByTagName( 'ComponentRef' )
+test.fail_test( not componentrefs[0].attributes['Id'].value == 'file3.dll' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/msi/package.py b/test/packaging/msi/package.py
new file mode 100644
index 0000000..4988742
--- /dev/null
+++ b/test/packaging/msi/package.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to create a simple msi package.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+try:
+ from xml.dom.minidom import *
+except ImportError:
+ test.skip_test('Canoot import xml.dom.minidom skipping test\n')
+
+wix = test.Environment().WhereIs('candle')
+
+if not wix:
+ test.skip_test("No 'candle' found; skipping test\n")
+
+#
+# build with minimal tag set and test for the given package meta-data
+#
+test.write( 'file1.exe', "file1" )
+test.write( 'file2.exe', "file2" )
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+
+f1 = env.Install( '/usr/' , 'file1.exe' )
+f2 = env.Install( '/usr/' , 'file2.exe' )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2',
+ PACKAGETYPE = 'msi',
+ SUMMARY = 'balalalalal',
+ DESCRIPTION = 'this should be reallly really long',
+ VENDOR = 'Nanosoft_2000',
+ source = [ f1, f2 ],
+ )
+
+env.Alias( 'install', [ f1, f2 ] )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'foo-1.2.wxs' )
+test.must_exist( 'foo-1.2.msi' )
+
+dom = parse( test.workpath( 'foo-1.2.wxs' ) )
+Product = dom.getElementsByTagName( 'Product' )[0]
+Package = dom.getElementsByTagName( 'Package' )[0]
+
+test.fail_test( not Product.attributes['Manufacturer'].value == 'Nanosoft_2000' )
+test.fail_test( not Product.attributes['Version'].value == '1.2' )
+test.fail_test( not Product.attributes['Name'].value == 'foo' )
+
+test.fail_test( not Package.attributes['Description'].value == 'balalalalal' )
+test.fail_test( not Package.attributes['Comments'].value == 'this should be reallly really long' )
+
+#
+# build with file tags resulting in multiple components in the msi installer
+#
+test.write( 'file1.exe', "file1" )
+test.write( 'file2.exe', "file2" )
+test.write( 'file3.html', "file3" )
+test.write( 'file4.dll', "file4" )
+test.write( 'file5.dll', "file5" )
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+f1 = env.Install( '/usr/' , 'file1.exe' )
+f2 = env.Install( '/usr/' , 'file2.exe' )
+f3 = env.Install( '/usr/' , 'file3.html' )
+f4 = env.Install( '/usr/' , 'file4.dll' )
+f5 = env.Install( '/usr/' , 'file5.dll' )
+
+env.Tag( f1, X_MSI_FEATURE = 'Java Part' )
+env.Tag( f2, X_MSI_FEATURE = 'Java Part' )
+env.Tag( f3, 'DOC' )
+env.Tag( f4, X_MSI_FEATURE = 'default' )
+env.Tag( f5, X_MSI_FEATURE = ('Another Feature', 'with a long description') )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2',
+ PACKAGETYPE = 'msi',
+ SUMMARY = 'balalalalal',
+ DESCRIPTION = 'this should be reallly really long',
+ VENDOR = 'Nanosoft_tx2000',
+ source = [ f1, f2, f3, f4, f5 ],
+ )
+
+env.Alias( 'install', [ f1, f2, f3, f4, f5 ] )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'foo-1.2.wxs' )
+test.must_exist( 'foo-1.2.msi' )
+
+dom = parse( test.workpath( 'foo-1.2.wxs' ) )
+elements = dom.getElementsByTagName( 'Feature' )
+test.fail_test( not elements[1].attributes['Title'].value == 'Main Part' )
+test.fail_test( not elements[2].attributes['Title'].value == 'Documentation' )
+test.fail_test( not elements[3].attributes['Title'].value == 'Another Feature' )
+test.fail_test( not elements[3].attributes['Description'].value == 'with a long description' )
+test.fail_test( not elements[4].attributes['Title'].value == 'Java Part' )
+
+
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/multiple-packages-at-once.py b/test/packaging/multiple-packages-at-once.py
new file mode 100644
index 0000000..8c3f72d
--- /dev/null
+++ b/test/packaging/multiple-packages-at-once.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+See if the packaging tool is able to build multiple packages at once.
+
+TODO: test if the packages are clean versions (i.e. do not contain files
+ added by different packager runs)
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+zip = test.detect('ZIP', 'zip')
+
+if not zip:
+ test.skip_test('zip not found, skipping test\n')
+
+test.subdir('src')
+
+test.write( [ 'src', 'main.c' ], r"""
+int main( int argc, char* argv[] )
+{
+ return 0;
+}
+""")
+
+test.write('SConstruct', """
+Program( 'src/main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( PACKAGETYPE = ['src_zip', 'src_targz'],
+ target = ['src.zip', 'src.tar.gz'],
+ PACKAGEROOT = 'test',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'src.zip' )
+test.must_exist( 'src.tar.gz' )
+
+test.write('SConstruct', """
+Program( 'src/main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( PACKAGETYPE = ['src_zip', 'src_targz'],
+ NAME = "src", VERSION = "1.0",
+ PACKAGEROOT = 'test',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'src-1.0.zip' )
+test.must_exist( 'src-1.0.tar.gz' )
+
+test.write('SConstruct', """
+Program( 'src/main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( PACKAGETYPE = ['src_zip', 'src_targz'],
+ NAME = "src", VERSION = "1.0",
+ PACKAGEROOT = 'test',
+ source = [ 'src/main.c', 'SConstruct' ],
+ target = 'src.zip' )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'src.zip' )
+test.must_exist( 'src-1.0.tar.gz' )
+
+
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/multiple-subdirs.py b/test/packaging/multiple-subdirs.py
new file mode 100644
index 0000000..66b81a3
--- /dev/null
+++ b/test/packaging/multiple-subdirs.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that we can build packages in different subdirectories.
+
+Test case courtesy Andrew Smith.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if not tar:
+ test.skip_test('No TAR executable found; skipping test\n')
+
+test.subdir('one', 'two', 'three')
+
+test.write('SConstruct', """\
+env = Environment(tools=['default', 'packaging'])
+Export('env')
+SConscript(dirs = ['one', 'two', 'three'])
+""")
+
+SConscript_template = """\
+Import('*')
+
+files = env.Install('/usr/bin', '%s.sh')
+
+pkg = env.Package(NAME = '%s',
+ VERSION = '1.0.0',
+ PACKAGETYPE = 'targz',
+ source = [files]
+ )
+"""
+
+test.write(['one', 'SConscript'], SConscript_template % ('one', 'one'))
+test.write(['two', 'SConscript'], SConscript_template % ('two', 'two'))
+test.write(['three', 'SConscript'], SConscript_template % ('three', 'three'))
+
+test.write(['one', 'one.sh'], "one/one.sh\n")
+test.write(['two', 'two.sh'], "two/two.sh\n")
+test.write(['three', 'three.sh'], "three/three.sh\n")
+
+test.run(arguments = '.')
+
+test.must_match(['one', 'one-1.0.0', 'usr', 'bin', 'one.sh'], "one/one.sh\n")
+test.must_match(['two', 'two-1.0.0', 'usr', 'bin', 'two.sh'], "two/two.sh\n")
+test.must_match(['three', 'three-1.0.0', 'usr', 'bin', 'three.sh'], "three/three.sh\n")
+
+test.must_exist(['one', 'one-1.0.0.tar.gz'])
+test.must_exist(['two', 'two-1.0.0.tar.gz'])
+test.must_exist(['three', 'three-1.0.0.tar.gz'])
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/option--package-type.py b/test/packaging/option--package-type.py
new file mode 100644
index 0000000..c8f22ca
--- /dev/null
+++ b/test/packaging/option--package-type.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the --package-type option.
+"""
+
+import TestSCons
+import SCons.Tool.rpmutils
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+rpm_build_root = test.workpath('rpm_build_root')
+
+scons = test.program
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+test.subdir('src')
+
+test.write( 'main', '' )
+
+test.write('SConstruct', """
+# -*- coding: iso-8859-15 -*-
+env=Environment(tools=['default', 'packaging'])
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+prog=env.Install( '/bin', 'main' )
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ LICENSE = 'gpl',
+ SUMMARY = 'hello',
+ PACKAGEVERSION = 0,
+ X_RPM_GROUP = 'Application/office',
+ 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'
+ )
+""" % locals())
+
+src_rpm = 'foo-1.2.3-0.src.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
+
+test.run(arguments='package PACKAGETYPE=rpm', stderr = None)
+
+test.must_exist( src_rpm )
+test.must_exist( machine_rpm )
+test.must_not_exist( 'bin/main.c' )
+test.must_not_exist( '/bin/main.c' )
+
+test.run(arguments='-c package PACKAGETYPE=rpm', stderr = None)
+
+test.run(arguments='package --package-type=rpm', stderr = None)
+test.must_exist( src_rpm )
+test.must_exist( machine_rpm )
+test.must_not_exist( 'bin/main.c' )
+test.must_not_exist( '/bin/main.c' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/place-files-in-subdirectory.py b/test/packaging/place-files-in-subdirectory.py
new file mode 100644
index 0000000..f7224ba
--- /dev/null
+++ b/test/packaging/place-files-in-subdirectory.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the requirement to place files in a given subdirectory before archiving.
+"""
+
+import os
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if not tar:
+ test.skip_test('tar not found, skipping test\n')
+
+#
+# TEST: subdir creation and file copying
+#
+test.subdir('src')
+
+test.write('src/main.c', '')
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+env.Package( NAME = 'libfoo',
+ PACKAGEROOT = 'libfoo',
+ PACKAGETYPE = 'src_zip',
+ VERSION = '1.2.3',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(arguments='libfoo-1.2.3.zip', stderr = None)
+
+test.must_exist( 'libfoo' )
+test.must_exist( 'libfoo/SConstruct' )
+test.must_exist( 'libfoo/src/main.c' )
+
+#
+# TEST: subdir guessing and file copying.
+#
+test.subdir('src')
+
+test.write('src/main.c', '')
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+env.Package( NAME = 'libfoo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'src_zip',
+ TARGET = 'src.zip',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(stderr = None)
+
+test.must_exist( 'libfoo-1.2.3' )
+test.must_exist( 'libfoo-1.2.3/SConstruct' )
+test.must_exist( 'libfoo-1.2.3/src/main.c' )
+
+#
+# TEST: unpacking without the buildir.
+#
+test.subdir('src')
+test.subdir('temp')
+
+test.write('src/main.c', '')
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'packaging'])
+env.Package( NAME = 'libfoo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'src_targz',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(stderr = None)
+
+str = os.popen( 'tar -tzf %s'%test.workpath('libfoo-1.2.3.tar.gz') ).read()
+test.fail_test( str != "libfoo-1.2.3/src/main.c\nlibfoo-1.2.3/SConstruct\n" )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/rpm/cleanup.py b/test/packaging/rpm/cleanup.py
new file mode 100644
index 0000000..b77dfd1
--- /dev/null
+++ b/test/packaging/rpm/cleanup.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Assert that files created by the RPM packager will be removed by 'scons -c'.
+"""
+
+import TestSCons
+import SCons.Tool.rpmutils
+
+_python_ = TestSCons._python_
+test = TestSCons.TestSCons()
+
+scons = test.program
+
+# TODO: skip this test, since only the intermediate directory needs to be
+# removed.
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+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;
+}
+""")
+
+test.write('SConstruct', """
+env=Environment(tools=['default', 'packaging'])
+
+env['ENV']['RPM_BUILD_ROOT'] = r'%(rpm_build_root)s/foo-1.2.3'
+
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+
+prog = env.Install( '/bin/' , Program( 'src/main.c') )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGEVERSION = 0,
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'balalalalal',
+ X_RPM_GROUP = 'Application/fu',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really really long',
+ source = [ prog ],
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ )
+
+env.Alias( 'install', prog )
+""" % locals())
+
+# first run: build the package
+# second run: make sure everything is up-to-date (sanity check)
+# third run: test if the intermediate files have been cleaned
+test.run( arguments='.' )
+test.up_to_date( arguments='.' )
+test.run( arguments='-c .' )
+
+src_rpm = 'foo-1.2.3-0.src.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
+
+test.must_not_exist( machine_rpm )
+test.must_not_exist( src_rpm )
+test.must_not_exist( 'foo-1.2.3.tar.gz' )
+test.must_not_exist( 'foo-1.2.3.spec' )
+test.must_not_exist( 'foo-1.2.3/foo-1.2.3.spec' )
+test.must_not_exist( 'foo-1.2.3/SConstruct' )
+test.must_not_exist( 'foo-1.2.3/src/main.c' )
+# We don't remove the directories themselves. Yet.
+#test.must_not_exist( 'foo-1.2.3' )
+#test.must_not_exist( 'foo-1.2.3/src' )
+test.must_not_exist( 'bin/main' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/rpm/explicit-target.py b/test/packaging/rpm/explicit-target.py
new file mode 100644
index 0000000..c383b57
--- /dev/null
+++ b/test/packaging/rpm/explicit-target.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to create a rpm package from a explicit target name.
+"""
+
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+scons = test.program
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+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;
+}
+""")
+
+test.write('SConstruct', """
+import os
+
+env=Environment(tools=['default', 'packaging'])
+
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+
+prog = env.Install( '/bin/' , Program( 'src/main.c') )
+
+env.Alias( 'install', prog )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGEVERSION = 0,
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'balalalalal',
+ X_RPM_GROUP = 'Application/fu',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --debug=tree --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really really long',
+ source = [ prog ],
+ target = "my_rpm_package.rpm",
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ )
+""" % locals())
+
+expect = """
+scons: *** Setting target is not supported for rpm.
+""" + test.python_file_line(test.workpath('SConstruct'), 24)
+
+test.run(arguments='', status=2, stderr=expect)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/rpm/internationalization.py b/test/packaging/rpm/internationalization.py
new file mode 100644
index 0000000..2ef0dfd
--- /dev/null
+++ b/test/packaging/rpm/internationalization.py
@@ -0,0 +1,187 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to handle internationalized package and file meta-data.
+
+These are x-rpm-Group, description, summary and the lang_xx file tag.
+"""
+
+import os
+import SCons.Tool.rpmutils
+
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+scons = test.program
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+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.write('SConstruct', """
+# -*- coding: utf-8 -*-
+import os
+
+env = Environment(tools=['default', 'packaging'])
+
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+
+prog = env.Install( '/bin', Program( 'main.c' ) )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'hello',
+ SUMMARY_de = 'hallo',
+ SUMMARY_fr = 'bonjour',
+ PACKAGEVERSION = 0,
+ X_RPM_GROUP = 'Application/office',
+ X_RPM_GROUP_de = 'Applikation/büro',
+ X_RPM_GROUP_fr = 'Application/bureau',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really long',
+ DESCRIPTION_de = 'das sollte wirklich lang sein',
+ DESCRIPTION_fr = 'ceci devrait être vraiment long',
+ source = [ prog ],
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ )
+
+env.Alias ( 'install', prog )
+""" % locals())
+
+test.run(arguments='', stderr = None)
+
+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( src_rpm )
+test.must_exist( machine_rpm )
+
+test.must_not_exist( 'bin/main' )
+
+cmd = 'rpm -qp --queryformat \'%%{GROUP}-%%{SUMMARY}-%%{DESCRIPTION}\' %s'
+
+os.environ['LANGUAGE'] = 'de'
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
+test.fail_test( out != 'Applikation/büro-hallo-das sollte wirklich lang sein' )
+
+os.environ['LANGUAGE'] = 'fr'
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
+test.fail_test( out != 'Application/bureau-bonjour-ceci devrait être vraiment long' )
+
+os.environ['LANGUAGE'] = 'en'
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
+test.fail_test( out != 'Application/office-hello-this should be really long' )
+
+os.environ['LC_ALL'] = 'ae'
+out = os.popen( cmd % test.workpath(machine_rpm) ).read()
+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;
+}
+""")
+
+test.write( ['man.de'], '' )
+test.write( ['man.en'], '' )
+test.write( ['man.fr'], '' )
+
+test.write('SConstruct', """
+# -*- coding: utf-8 -*-
+import os
+
+env = Environment(tools=['default', 'packaging'])
+prog = env.Install( '/bin', Program( 'main.c' ) )
+
+man_pages = Flatten( [
+ env.Install( '/usr/share/man/de', 'man.de' ),
+ env.Install( '/usr/share/man/en', 'man.en' ),
+ env.Install( '/usr/share/man/fr', 'man.fr' )
+] )
+
+env.Tag( man_pages, 'LANG_DE', 'DOC')
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'hello',
+ SUMMARY_de = 'hallo',
+ SUMMARY_fr = 'bonjour',
+ PACKAGEVERSION = 0,
+ X_RPM_GROUP = 'Application/office',
+ X_RPM_GROUP_de = 'Applikation/büro',
+ X_RPM_GROUP_fr = 'Application/bureau',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really long',
+ DESCRIPTION_de = 'das sollte wirklich lang sein',
+ DESCRIPTION_fr = 'ceci devrait être vraiment long',
+ source = [ prog, man_pages ],
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz',
+ )
+
+env.Alias ( 'install', [ prog, man_pages ] )
+""" % locals())
+
+
+test.run(arguments='--install-sandbox=blubb install', stderr = None)
+
+test.must_exist( src_rpm )
+test.must_exist( machine_rpm )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/rpm/multipackage.py b/test/packaging/rpm/multipackage.py
new file mode 100644
index 0000000..ab8734d
--- /dev/null
+++ b/test/packaging/rpm/multipackage.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to create more than rpm file with different package root
+from one SCons environment.
+"""
+
+import os
+import SCons.Tool.rpmutils
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+scons = test.program
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+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;
+}
+""")
+
+test.write('SConstruct', """
+import os
+
+env=Environment(tools=['default', 'packaging'])
+
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+
+prog = env.Install( '/bin/' , Program( 'src/main.c') )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGEVERSION = 0,
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'balalalalal',
+ X_RPM_GROUP = 'Application/fu',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --debug=tree --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really really long',
+ source = [ prog ],
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ )
+
+env.Package( NAME = 'foo2',
+ VERSION = '1.2.3',
+ PACKAGEVERSION = 0,
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'balalalalal',
+ X_RPM_GROUP = 'Application/fu',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --debug=tree --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really really long',
+ source = [ prog ],
+ )
+
+
+
+env.Alias( 'install', prog )
+""" % locals())
+
+test.run(arguments='', stderr = None)
+
+src_rpm = 'foo-1.2.3-0.src.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
+src_rpm2 = 'foo2-1.2.3-0.src.rpm'
+machine_rpm2 = 'foo2-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
+
+test.must_exist( machine_rpm )
+test.must_exist( src_rpm )
+
+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')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py
new file mode 100644
index 0000000..d8c2785
--- /dev/null
+++ b/test/packaging/rpm/package.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to create a really simple rpm package.
+"""
+
+import os
+import SCons.Tool.rpmutils
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+scons = test.program
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+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;
+}
+""")
+
+test.write('SConstruct', """
+import os
+
+env=Environment(tools=['default', 'packaging'])
+
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+
+prog = env.Install( '/bin/' , Program( 'src/main.c') )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGEVERSION = 0,
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'balalalalal',
+ X_RPM_GROUP = 'Application/fu',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --debug=tree --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really really long',
+ source = [ prog ],
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ )
+
+env.Alias( 'install', prog )
+""" % locals())
+
+test.run(arguments='', stderr = None)
+
+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 )
+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')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/rpm/tagging.py b/test/packaging/rpm/tagging.py
new file mode 100644
index 0000000..3016274
--- /dev/null
+++ b/test/packaging/rpm/tagging.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to add file tags
+"""
+
+import os
+import SCons.Tool.rpmutils
+
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+scons = test.program
+
+rpm = test.Environment().WhereIs('rpm')
+
+if not rpm:
+ test.skip_test('rpm not found, skipping test\n')
+
+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;
+}
+""")
+
+test.write('SConstruct', """
+import os
+
+env = Environment(tools=['default', 'packaging'])
+
+env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
+env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
+
+install_dir= os.path.join( ARGUMENTS.get('prefix', '/'), 'bin/' )
+prog_install = env.Install( install_dir , Program( 'src/main.c' ) )
+env.Tag( prog_install, UNIX_ATTR = '(0755, root, users)' )
+env.Alias( 'install', prog_install )
+
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'rpm',
+ LICENSE = 'gpl',
+ SUMMARY = 'balalalalal',
+ PACKAGEVERSION = 0,
+ X_RPM_GROUP = 'Applicatio/fu',
+ X_RPM_INSTALL = r'%(_python_)s %(scons)s --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
+ DESCRIPTION = 'this should be really really long',
+ source = [ prog_install ],
+ SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
+ )
+""" % locals())
+
+test.run(arguments='', stderr = None)
+
+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 )
+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')
+
+expect = '(0755, root, users) /bin/main'
+test.must_contain_all_lines(test.read('foo-1.2.3.spec'), [expect])
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/sandbox-test/SConstruct b/test/packaging/sandbox-test/SConstruct
new file mode 100644
index 0000000..f44a471
--- /dev/null
+++ b/test/packaging/sandbox-test/SConstruct
@@ -0,0 +1,19 @@
+
+from glob import glob
+
+src_files = glob( 'src/*.c' )
+include_files = glob( 'src/*.h' )
+
+SharedLibrary( 'foobar', src_files )
+
+env = Environment(tools=['default', 'packaging'])
+
+env.Package( NAME = 'libfoobar',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'targz',
+ source = src_files + include_files )
+
+env.Package( NAME = 'libfoobar',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'zip',
+ source = src_files + include_files )
diff --git a/test/packaging/sandbox-test/sandbox-test.py b/test/packaging/sandbox-test/sandbox-test.py
new file mode 100644
index 0000000..c6d2140
--- /dev/null
+++ b/test/packaging/sandbox-test/sandbox-test.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test a simple project
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if not tar:
+ test.skip_test('tar not found, skipping test\n')
+
+test.dir_fixture('src','src')
+test.file_fixture('SConstruct')
+
+test.run(stderr=None)
+
+test.must_exist( 'libfoobar-1.2.3.tar.gz' )
+test.must_exist( 'libfoobar-1.2.3.zip' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/sandbox-test/src/foobar.c b/test/packaging/sandbox-test/src/foobar.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/packaging/sandbox-test/src/foobar.c
diff --git a/test/packaging/sandbox-test/src/foobar.h b/test/packaging/sandbox-test/src/foobar.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/packaging/sandbox-test/src/foobar.h
diff --git a/test/packaging/strip-install-dir.py b/test/packaging/strip-install-dir.py
new file mode 100644
index 0000000..92f0361
--- /dev/null
+++ b/test/packaging/strip-install-dir.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test stripping the InstallBuilder of the Package source file.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if not tar:
+ test.skip_test('tar not found, skipping test\n')
+
+test.write( 'main.c', '' )
+test.write('SConstruct', """
+prog = Install( '/bin', 'main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( NAME = 'foo',
+ VERSION = '1.2.3',
+ source = [ prog ],
+ )
+""")
+
+expected = """scons: Reading SConscript files ...
+scons: done reading SConscript files.
+scons: Building targets ...
+Copy file(s): "main.c" to "foo-1.2.3/bin/main.c"
+tar -zc -f foo-1.2.3.tar.gz foo-1.2.3/bin/main.c
+scons: done building targets.
+"""
+
+test.run(arguments='', stderr = None, stdout=expected)
+
+test.must_not_exist( 'bin/main.c' )
+test.must_not_exist( '/bin/main.c' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/tar/bz2.py b/test/packaging/tar/bz2.py
new file mode 100644
index 0000000..1552fd1
--- /dev/null
+++ b/test/packaging/tar/bz2.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+This tests the SRC bz2 packager, which does the following:
+ - create a tar package from the specified files
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if tar:
+ test.subdir('src')
+
+ test.write( [ 'src', 'main.c' ], r"""
+int main( int argc, char* argv[] )
+{
+ return 0;
+}
+""")
+
+ test.write('SConstruct', """
+Program( 'src/main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( PACKAGETYPE = 'src_tarbz2',
+ target = 'src.tar.bz2',
+ PACKAGEROOT = 'test',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+ test.run(arguments='', stderr = None)
+
+ test.must_exist( 'src.tar.bz2' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/tar/gz.py b/test/packaging/tar/gz.py
new file mode 100644
index 0000000..f841c59
--- /dev/null
+++ b/test/packaging/tar/gz.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+This tests the SRC 'targz' packager, which does the following:
+ - create a targz package containing the specified files.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if tar:
+ test.subdir('src')
+
+ test.write( [ 'src', 'main.c' ], r"""
+int main( int argc, char* argv[] )
+{
+ return 0;
+}
+""")
+
+ test.write('SConstruct', """
+Program( 'src/main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( PACKAGETYPE = 'src_targz',
+ target = 'src.tar.gz',
+ PACKAGEROOT = 'test',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+ test.run(arguments='', stderr = None)
+
+ test.must_exist( 'src.tar.gz' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/use-builddir.py b/test/packaging/use-builddir.py
new file mode 100644
index 0000000..76b9737
--- /dev/null
+++ b/test/packaging/use-builddir.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to use the archiver in combination with builddir.
+"""
+
+import os
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+tar = test.detect('TAR', 'tar')
+
+if not tar:
+ test.skip_test('tar not found, skipping test\n')
+
+#
+# TEST: builddir usage.
+#
+test.subdir('src')
+test.subdir('build')
+
+test.write('src/main.c', '')
+
+test.write('SConstruct', """
+VariantDir('build', 'src')
+env=Environment(tools=['default', 'packaging'])
+env.Package( NAME = 'libfoo',
+ PACKAGEROOT = 'build/libfoo',
+ VERSION = '1.2.3',
+ PACKAGETYPE = 'src_zip',
+ target = 'build/libfoo-1.2.3.zip',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(stderr = None)
+
+test.must_exist( 'build/libfoo-1.2.3.zip' )
+
+# TEST: builddir not placed in archive
+# XXX: VariantDir should be stripped.
+#
+test.subdir('src')
+test.subdir('build')
+test.subdir('temp')
+
+test.write('src/main.c', '')
+
+test.write('SConstruct', """
+VariantDir('build', 'src')
+env=Environment(tools=['default', 'packaging'])
+env.Package( NAME = 'libfoo',
+ VERSION = '1.2.3',
+ PAKCAGETYPE = 'src_targz',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(stderr = None)
+
+test.must_exist( 'libfoo-1.2.3.tar.gz' )
+
+os.popen( 'tar -C temp -xzf %s'%test.workpath('libfoo-1.2.3.tar.gz') )
+
+test.must_exist( 'temp/libfoo-1.2.3/src/main.c' )
+test.must_exist( 'temp/libfoo-1.2.3/SConstruct' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/packaging/zip.py b/test/packaging/zip.py
new file mode 100644
index 0000000..89f3074
--- /dev/null
+++ b/test/packaging/zip.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+This tests the SRC zip packager, which does the following:
+ - create a zip package from the specified files
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+zip = test.detect('ZIP', 'zip')
+
+if not zip:
+ test.skip_test('zip not found, skipping test\n')
+
+test.subdir('src')
+
+test.write( [ 'src', 'main.c' ], r"""
+int main( int argc, char* argv[] )
+{
+ return 0;
+}
+""")
+
+test.write('SConstruct', """
+Program( 'src/main.c' )
+env=Environment(tools=['default', 'packaging'])
+env.Package( PACKAGETYPE = 'src_zip',
+ target = 'src.zip',
+ PACKAGEROOT = 'test',
+ source = [ 'src/main.c', 'SConstruct' ] )
+""")
+
+test.run(arguments='', stderr = None)
+
+test.must_exist( 'src.zip' )
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: