diff options
author | nanardon <nanardon@971eb68f-4bfb-0310-8326-d2484c010a4c> | 2005-10-04 04:08:46 +0000 |
---|---|---|
committer | nanardon <nanardon@971eb68f-4bfb-0310-8326-d2484c010a4c> | 2005-10-04 04:08:46 +0000 |
commit | 9e2966a33f9148fdc8ef81783bab1fe18e87bd34 (patch) | |
tree | 7497629483bdfca79e64991306f251dfdc9bdafb /RPM4/t/04spec.t | |
parent | 588601a22c421404c9db24e0a47330d2186977f9 (diff) | |
download | perl-RPM4-9e2966a33f9148fdc8ef81783bab1fe18e87bd34.tar perl-RPM4-9e2966a33f9148fdc8ef81783bab1fe18e87bd34.tar.gz perl-RPM4-9e2966a33f9148fdc8ef81783bab1fe18e87bd34.tar.bz2 perl-RPM4-9e2966a33f9148fdc8ef81783bab1fe18e87bd34.tar.xz perl-RPM4-9e2966a33f9148fdc8ef81783bab1fe18e87bd34.zip |
- move to trunk
git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@36 971eb68f-4bfb-0310-8326-d2484c010a4c
Diffstat (limited to 'RPM4/t/04spec.t')
-rw-r--r-- | RPM4/t/04spec.t | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/RPM4/t/04spec.t b/RPM4/t/04spec.t new file mode 100644 index 0000000..b1019eb --- /dev/null +++ b/RPM4/t/04spec.t @@ -0,0 +1,62 @@ +# $Id$ + +use strict; +use Test::More tests => 23; +use FindBin qw($Bin); +use File::Temp qw(tempdir); +use RPM4; + +my %info = RPM4::moduleinfo(); + +my $testdir = tempdir( CLEANUP => 1 ); +mkdir("$testdir/$_") foreach (qw(BUILD RPMS RPMS/noarch SRPMS)); + +my $passphrase = "RPM4"; + +RPM4::add_macro("_tmppath $testdir"); +RPM4::add_macro("_builddir $testdir"); +RPM4::add_macro("_topdir $testdir"); +RPM4::add_macro("_signature gpg"); +RPM4::add_macro("_gpg_name RPM4 test key"); +RPM4::add_macro("_gpg_path $Bin/gnupg"); + +ok((RPM4::installsrpm("$Bin/test-rpm-1.0-1mdk.src.rpm"))[0] =~ m/test-rpm\.spec$/, "installsrpms works"); +ok(!RPM4::installsrpm("$Bin/test-rpm-1.0-1mdk.noarch.rpm"), "installsrpms works"); + +my $spec; +if ($info{Hack} eq "Yes") { + ok( defined(RPM4::Spec->new()), "Create an empty spec object"); +} else { + ok(! defined(RPM4::Spec->new()), "Create an empty spec object don't works"); +} +ok(!defined($spec = RPM4::Spec->new("$Bin/test-rpm-1.0-1mdk.noarch.rpm")), "Loading a bad spec file"); +ok($spec = RPM4::Spec->new("$Bin/test-rpm.spec", passphrase => $passphrase), "Loading a spec file"); + +my @rpms = $spec->binrpm; +ok(@rpms == 1, "Can find binary package"); +ok($rpms[0] =~ m!noarch/test-rpm-1.0-1mdk.noarch.rpm$!, "binrpm return good value"); + +ok($spec->srcrpm =~ m!SRPMS/test-rpm-1.0-1mdk.src.rpm$!, "srcrpm return good value"); + +ok(!defined($spec->check()), "Running spec::check"); + +my $h; +ok(defined($h = $spec->srcheader()), "Geting source header before build"); +ok($h->queryformat("%{NAME}") eq "test-rpm", "can querying header give by spec"); + +ok($spec->build([ qw(PREP) ]) == 0, "simulate rpm -bp (check prep)"); +ok($spec->build([ qw(BUILD) ]) == 0, "simulate rpm -bc"); +ok($spec->build([ qw(INSTALL CHECK) ]) == 0, "simulate rpm -bi"); +ok($spec->build([ qw(FILECHECK) ]) == 0, "simulate rpm -bl"); +ok($spec->build([ qw(PACKAGEBINARY CLEAN) ]) == 0, "simulate rpm -bb (binary, clean)"); +ok($spec->build([ qw(PACKAGESOURCE) ]) == 0, "simulate rpm -bs"); +ok($spec->rpmbuild("bb") == 0, "testing spec->rpmbuild(-bb)"); +ok($spec->build([ qw(RMBUILD RMSOURCE) ]) == 0, "simulate cleaning spec, source, build"); + +ok(defined($h = $spec->srcheader()), "Geting source header after build"); +ok($h->queryformat("%{NAME}") eq "test-rpm", "can querying header give by spec"); + +my ($bh) = $spec->binheader(); +ok(defined($bh), "Can get binary header from spec"); +ok($bh->queryformat("%{NAME}") eq "test-rpm", "can querying header give by spec"); + |