5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test the ability to call the ipkg tool trough SCons.
30 TODO: make a test to assert that the clean action removes ALL intermediate files
36 python
= TestSCons
.python
37 test
= TestSCons
.TestSCons()
38 ipkg
= test
.Environment().WhereIs('ipkg-build')
41 test
.skip_test("ipkg-build not found, skipping test\n")
43 test
.write( 'main.c', r
"""
44 int main(int argc, char *argv[])
50 test
.write( 'foo.conf', '' )
52 test
.write( 'SConstruct', r
"""
53 env=Environment(tools=['default', 'packaging'])
54 prog = env.Install( 'bin/', Program( 'main.c') )
55 conf = env.Install( 'etc/', File( 'foo.conf' ) )
56 env.Tag( conf, 'CONF', 'MEHR', 'UND MEHR' )
57 env.Package( PACKAGETYPE = 'ipk',
58 source = env.FindInstalledFiles(),
61 SUMMARY = 'foo is the ever-present example program -- it does everything',
62 DESCRIPTION = '''foo is not a real package. This is simply an example that you
63 may modify if you wish.
65 When you modify this example, be sure to change the Package, Version,
66 Maintainer, Depends, and Description fields.''',
68 SOURCE_URL = 'https://gnu.org/foo-0.0.tar.gz',
69 X_IPK_SECTION = 'extras',
70 X_IPK_PRIORITY = 'optional',
72 X_IPK_MAINTAINER = 'Familiar User <user@somehost.net>',
73 X_IPK_DEPENDS = 'libc6, grep', )
76 with os
.popen('id -un') as p
:
77 IPKGUSER
= p
.read().strip()
78 with os
.popen('id -gn') as p
:
79 IPKGGROUP
= p
.read().strip()
81 expected
="""scons: Reading SConscript files ...
82 scons: done reading SConscript files.
83 scons: Building targets ...
84 gcc -o main.o -c main.c
86 Copy file(s): "main" to "foo-0.0/bin/main"
87 Copy file(s): "foo.conf" to "foo-0.0/etc/foo.conf"
88 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"])
89 ipkg-build -o %s -g %s foo-0.0
90 Packaged contents of foo-0.0 into %s/foo_0.0_arm.ipk
91 scons: done building targets.
92 """%(IPKGUSER
, IPKGGROUP
, test
.workpath())
94 test
.run(arguments
="--debug=stacktrace foo_0.0_arm.ipk", stdout
=expected
)
95 test
.must_exist( 'foo-0.0/CONTROL/control' )
96 test
.must_exist( 'foo_0.0_arm.ipk' )
98 test
.subdir( 'foo-0.0' )
99 test
.subdir( [ 'foo-0.0', 'CONTROL' ] )
101 test
.write( [ 'foo-0.0', 'CONTROL', 'control' ], r
"""
105 Source: https://gnu.org/foo-0.0.tar.gz
108 Maintainer: Familiar User <user@somehost.net>
110 Description: foo is the ever-present example program -- it does everything
111 foo is not a real package. This is simply an example that you
112 may modify if you wish.
114 When you modify this example, be sure to change the Package, Version,
115 Maintainer, Depends, and Description fields.
118 test
.write( 'main.c', r
"""
119 int main(int argc, char *argv[])
125 test
.write('SConstruct', """
126 env = Environment( tools = [ 'default', 'ipkg' ] )
127 prog = env.Install( 'foo-0.0/bin/' , env.Program( 'main.c') )
128 env.Ipkg( [ env.Dir( 'foo-0.0' ), prog ] )
131 test
.run(arguments
='', stderr
= None)
132 test
.must_exist( 'foo_0.0_arm.ipk' )
138 # indent-tabs-mode:nil
140 # vim: set expandtab tabstop=4 shiftwidth=4: