summaryrefslogtreecommitdiffstats
path: root/t/02create_pkgs.t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-04-24 19:34:32 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-04-24 19:34:32 +0000
commit4df7583caa71a35d6d68c373fc0c62d1be6d955b (patch)
treebddf36169b314d82ff20036dea7e47fa4fec5bcd /t/02create_pkgs.t
parent7a606ec3537b2f465f8e06e99b445c756bfcca8f (diff)
downloadurpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar
urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar.gz
urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar.bz2
urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar.xz
urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.zip
re-sync after the big svn loss
Diffstat (limited to 't/02create_pkgs.t')
-rw-r--r--t/02create_pkgs.t71
1 files changed, 59 insertions, 12 deletions
diff --git a/t/02create_pkgs.t b/t/02create_pkgs.t
index ff4fda0c..caf6aaa5 100644
--- a/t/02create_pkgs.t
+++ b/t/02create_pkgs.t
@@ -5,33 +5,80 @@ use warnings;
use Test::More 'no_plan';
chdir 't' if -d 't';
-system('rm -rf BUILD RPMS media');
-foreach (qw(media BUILD RPMS RPMS/noarch)) {
+system('rm -rf tmp media');
+foreach (qw(media tmp tmp/BUILD tmp/RPMS tmp/RPMS/noarch tmp/SRPMS)) {
mkdir $_;
}
-# locally build a test rpms
-foreach my $spec (glob("SPECS/*.spec")) {
- system_("rpmbuild --quiet --define '_topdir .' -bb --clean $spec");
- my ($name) = $spec =~ m!([^/]*)\.spec$!;
- mkdir "media/$name";
- system_("mv RPMS/*/*.rpm media/$name");
+
+# locally build test rpms
+
+foreach my $dir (grep { -d $_ } glob("data/SPECS/*")) {
+ my ($medium_name) = $dir =~ m!([^/]*)$!;
+ rpmbuild($_, $medium_name) foreach glob("$dir/*.spec");
+ genhdlist_std($medium_name);
+}
+
+foreach my $spec (glob("data/SPECS/*.spec")) {
+ my $name = rpmbuild($spec);
if ($name eq 'various') {
system_("cp -r media/$name media/${name}_nohdlist");
system_("cp -r media/$name media/${name}_no_subdir");
system_("genhdlist --dest media/${name}_no_subdir");
+ symlink "${name}_nohdlist", "media/${name} nohdlist";
+ symlink "${name}", "media/${name}_bis";
}
-
- system_("genhdlist --subdir media/$name/media_info media/$name");
+ genhdlist_std($name);
+}
+foreach my $spec (glob("data/SPECS/srpm*.spec")) {
+ my $name = rpmbuild_srpm($spec);
+ genhdlist_std($name);
}
{
my $name = 'rpm-v3';
- system_("cp -r $name media");
+ system_("cp -r data/$name media");
system_("cp -r media/$name media/${name}_nohdlist");
system_("cp -r media/$name media/${name}_no_subdir");
system_("genhdlist --dest media/${name}_no_subdir");
- system_("genhdlist --subdir media/$name/media_info media/$name");
+ genhdlist_std($name);
+}
+
+mkdir 'media/media_info';
+system_("cp -r data/media.cfg media/media_info");
+system_('gendistrib .');
+
+sub genhdlist_std {
+ my ($medium_name) = @_;
+ system_("genhdlist --subdir media/$medium_name/media_info media/$medium_name");
+}
+
+sub rpmbuild {
+ my ($spec, $o_medium_name) = @_;
+
+ system_("rpmbuild --quiet --define '_topdir tmp' -bb --clean --nodeps $spec");
+
+ my ($name) = $spec =~ m!([^/]*)\.spec$!;
+
+ my $medium_name = $o_medium_name || $name;
+ mkdir "media/$medium_name";
+ system_("mv tmp/RPMS/*/*.rpm media/$medium_name");
+
+ $medium_name;
+}
+
+sub rpmbuild_srpm {
+ my ($spec) = @_;
+
+ system_("rpmbuild --quiet --define '_topdir tmp' -bs --clean --nodeps $spec");
+
+ my ($name) = $spec =~ m!([^/]*)\.spec$!;
+
+ my $medium_name = "SRPMS-$name";
+ mkdir "media/$medium_name";
+ system_("mv tmp/SRPMS/*.rpm media/$medium_name");
+
+ $medium_name;
}
sub system_ {