# Copyright (c) 2002-2009 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: Release.bunit,v 1.3 2011/10/23 02:38:11 nagler Exp $ ShellUtil(); my($tmp) = tmp_dir(); config({ 'Bivio::Util::Release' => { rpm_arch => 'i386', rpm_home_dir => my $home = IO_File()->mkdir_p("$tmp/home"), rpm_user => $ENV{USER}, rpm_group => $ENV{USER}, tmp_dir => IO_File()->mkdir_p("$tmp/build"), cvs_rpm_spec_dir => 'not-needed', }, }); IO_File()->chdir($tmp); my $spec = 'release-bunit.spec'; IO_File()->write( $spec, << 'END', Summary: Release.bunit test data Group: Bivio/Test _b_release_include('release-bunit.include'); _b_release_files(q{ %defattr(440,root,root) ${bunit_macro2} ${bunit_macro1}->{bunit_file} ${bunit_macro1}->{not_found_value} % + %files }); END ); IO_File()->write( 'release-bunit.include', << 'END', %description %{summary} %prep %build %clean test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT %install test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT mkdir $RPM_BUILD_ROOT cd $RPM_BUILD_ROOT echo one > file1.txt echo two > file2.txt _b_release_define(bunit_macro1 => { bunit_file => q{ %attr(444,-,-) /file1.txt }, bunit_eval => q{ IO_File()->write('file3.txt', 'three') ; }, }); _b_release_define(bunit_macro2 => '/file2.txt'); /usr/bin/b-shell batch <<'EOF' Release(); my($x) = {%{bunit_macro1}}; Bivio::Die->eval_or_die($x->{bunit_eval}); EOF END ); [ [build => $spec] => sub { my($rpm) = "$home/release-bunit-HEAD.rpm"; assert_equals(1, -l $rpm); assert_equals("/file1.txt\n/file2.txt\n/file3.txt\n", scalar(`rpm -qlp $rpm`)); return 1; }, ];