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 add file tags
35 machine = TestSCons.machine
36 _python_ = TestSCons._python_
38 test = TestSCons.TestSCons()
42 rpm = test.Environment().WhereIs('rpm')
45 test.skip_test('rpm not found, skipping test\n')
47 rpm_build_root = test.workpath('rpm_build_root')
50 # Test adding an attr tag to the built program.
54 test.write( [ 'src', 'main.c' ], r"""
55 int main( int argc, char* argv[] )
61 test.write('SConstruct', """
64 env = Environment(tools=['default', 'packaging'])
66 env.Prepend(RPM = 'TAR_OPTIONS=--wildcards ')
67 env.Append(RPMFLAGS = r' --buildroot %(rpm_build_root)s')
69 install_dir= os.path.join( ARGUMENTS.get('prefix', '/'), 'bin/' )
70 prog_install = env.Install( install_dir , Program( 'src/main.c' ) )
71 env.Tag( prog_install, UNIX_ATTR = '(0755, root, users)' )
72 env.Alias( 'install', prog_install )
74 env.Package( NAME = 'foo',
78 SUMMARY = 'balalalalal',
80 X_RPM_GROUP = 'Applicatio/fu',
81 X_RPM_INSTALL = r'%(_python_)s %(scons)s --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"',
82 DESCRIPTION = 'this should be really really long',
83 source = [ prog_install ],
84 SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
88 test.run(arguments='', stderr = None)
90 src_rpm = 'foo-1.2.3-0.src.rpm'
91 machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine
93 test.must_exist( machine_rpm )
94 test.must_exist( src_rpm )
95 test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
96 test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
98 expect = '(0755, root, users) /bin/main'
99 test.must_contain_all_lines(test.read('foo-1.2.3.spec'), [expect])
105 # indent-tabs-mode:nil
107 # vim: set expandtab tabstop=4 shiftwidth=4: