diff options
author | Olivier Thauvin <nanardon@mandriva.org> | 2005-02-20 23:20:42 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mandriva.org> | 2005-02-20 23:20:42 +0000 |
commit | d05e986e5f15123fb9568ec901ee4a7f205343a8 (patch) | |
tree | 11c19ae25b3930617b028cc72900f70cf6271402 | |
parent | aeb385b7aba77c6fcba1aba3e2a4d13917e98455 (diff) | |
download | rpmtools-d05e986e5f15123fb9568ec901ee4a7f205343a8.tar rpmtools-d05e986e5f15123fb9568ec901ee4a7f205343a8.tar.gz rpmtools-d05e986e5f15123fb9568ec901ee4a7f205343a8.tar.bz2 rpmtools-d05e986e5f15123fb9568ec901ee4a7f205343a8.tar.xz rpmtools-d05e986e5f15123fb9568ec901ee4a7f205343a8.zip |
- minor fix
- 5.8.11
-rwxr-xr-x | gendistrib | 81 | ||||
-rw-r--r-- | rpmtools.spec | 12 |
2 files changed, 60 insertions, 33 deletions
@@ -25,12 +25,13 @@ use Cwd; use URPM; use URPM::Build; use Getopt::Long; +use Distribconf; my $urpm = new URPM; my $headers_dir = (-d $ENV{TMPDIR} ? $ENV{TMPDIR} : -d "$ENV{HOME}/tmp" ? "$ENV{HOME}/tmp" : "/tmp") . "/.build_hdlist"; sub usage { - print <<EOF; + print STDERR <<EOF; Usage: $0 [options] dir dir should be the top level of distro Options: @@ -59,6 +60,7 @@ GetOptions( 'distrib=s' => \my $rootdistrib, 'fermetagueule|s' => \my $nooutput, 'hdlists=s' => \$urpmfiles{hdlists}, + 'mediacfg=s' => \$urpmfiles{mediacfg}, 'headersdir=s' => \$headers_dir, 'nobadrpm' => \my $dontdie, 'nochkdep' => \my $nochkdep, @@ -72,15 +74,24 @@ my @root = grep { $_ } ($rootdistrib, @ARGV); @root > 0 or do { usage(); exit 1 }; -my $root = $root[0]; +my $distrib = Distribconf->new($root[0]); + +$distrib->loadtree or die "$root[0] does not seems to be a distrib tree"; + +if (defined($urpmfiles{mediacfg})) { + $distrib->parse_mediacfg($urpmfiles{mediacfg}) or die "Can't read $urpmfiles{mediacfg}"; +} elsif (defined($urpmfiles{hdlists})) { + $distrib->parse_hdlists($urpmfiles{hdlists}) or die "Can't read $urpmfiles{hdlists}"; +} else { + $distrib->parse_mediacfg || $distrib->parse_hdlists or die "Can't read the dsitrib config"; +} my %default_urpmfiles = ( - depslist => "$root/media/media_info/depslist.ordered", - provides => "$root/media/media_info/provides", - compss => "$root/media/media_info/compss", - hdlists => "$root/media/media_info/hdlists", - version => "$root/VERSION", - md5sum => "$root/media/media_info/MD5SUM", + depslist => $distrib->getpath(undef, "root") . '/' . $distrib->getpath(undef, "infodir") . "/depslist.ordered", + provides => $distrib->getpath(undef, "root") . '/' . $distrib->getpath(undef, "infodir") . "/provides", + compss => $distrib->getpath(undef, "root") . '/' . $distrib->getpath(undef, "infodir") . "/compss", + version => $distrib->getpath(undef, "root") . "/VERSION", + md5sum => $distrib->getpath(undef, "root") . '/' . $distrib->getpath(undef, "infodir") . "/MD5SUM", ); while (my ($k, $v) = each(%default_urpmfiles)) { @@ -88,29 +99,19 @@ while (my ($k, $v) = each(%default_urpmfiles)) { } my @hdlists; -open my $fh, $urpmfiles{hdlists} or die "unable to open $urpmfiles{hdlists}"; -foreach (<$fh>) { - chomp; - s/\s*#.*$//; - /^\s*$/ and next; - /^(?:askmedia|suppl)/ and next; - my ($name, $dir, $descr) = m/^\s*(?:noauto:)?(hdlist\S*\.cz2?)\s+(\S+)\s*(.*)$/ - or die qq(invalid hdlist description "$_" in hdlists file\n); - - $descr =~ s/\([^(]+\)\s*$//; #- remove trailing size info - $descr =~ s/\s*$//; +foreach ($distrib->listmedia) { push @hdlists, { - synthesis => "$root/media/media_info/synthesis.$name", - hdlist => "$root/media/media_info/$name", - dir => $dir, - descr => $descr, - mediainfo => "$root/$dir/media_info", - synthesis2 => "$root/$dir/media_info/synthesis.hdlist.cz", - hdlist2 => "$root/$dir/media_info/hdlist.cz", - md5sum => "$root/$dir/media_info/MD5SUM", + synthesis => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath($_, 'synthesis'), + hdlist => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath($_, 'hdlist'), + dir => $distrib->getpath($_, 'path'), + descr => $distrib->getvalue($_, 'name'), + mediainfo => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath(undef, 'infodir'), + thismediainfo => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath($_, 'path') . "/media_info", + synthesis2 => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath($_, 'path') . "/media_info/synthesis.hdlist.cz", + hdlist2 => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath($_, 'path') . "/media_info/hdlist.cz", + md5sum => $distrib->getpath(undef, 'root') . '/' . $distrib->getpath($_, 'path') . "/media_info/MD5SUM", }; } -close $fh; sub clean_cache { unless ($noclean) { @@ -192,11 +193,17 @@ foreach (0..$#hdlists) { synthesis => $e->{synthesis}); unless ($nomediainfo && $nomd5sum) { - mkdir $e->{mediainfo}, 0755 - or print STDERR qq(Can't create directory "$e->{mediainfo}": $!\n); + if (! -d $e->{mediainfo}) { + mkdir $e->{mediainfo}, 0755 + or print STDERR qq(Can't create directory "$e->{mediainfo}": $!\n); + } } unless ($nomediainfo) { + if (! -d $e->{thismediainfo}) { + mkdir $e->{thismediainfo}, 0755 + or print STDERR qq(Can't create directory "$e->{thismediainfo}": $!\n); + } print STDERR qq(link alternate locations of synthesis and hdlists\n) unless $nooutput; unlink $e->{hdlist2}, $e->{synthesis2}; link $e->{hdlist}, $e->{hdlist2} @@ -227,11 +234,23 @@ $urpm->build_base_files(depslist => $urpmfiles{depslist}, provides => $urpmfiles{provides}, compss => $urpmfiles{compss}); +#compatibility +if (-f $distrib->getpath(undef, 'root') . '/' . $distrib->getpath(undef, 'infodir') . '/media.cfg') { + if (! -f $distrib->getpath(undef, 'root') . '/' . $distrib->getpath(undef, 'infodir') . '/hdlists' || + ((stat($distrib->getpath(undef, 'root') . '/' . $distrib->getpath(undef, 'infodir') . '/media.cfg'))[9] > + (stat($distrib->getpath(undef, 'root') . '/' . $distrib->getpath(undef, 'infodir') . '/hdlists'))[9])) { + print STDERR "Write hdlists files" unless($nooutput); + $distrib->write_hdlists(); + } +} + + + #- safety cleaning unlink $urpmfiles{md5sum}; unless ($nomd5sum) { my $here = getcwd(); - chdir "$root/media/media_info"; + chdir $distrib->getpath(undef, 'root') . "/" . $distrib->getpath(undef, 'infodir'); my $md5sum = `/usr/bin/md5sum hdlist* synthesis*`; chdir $here; if (open my $md5sumfh, '>', $urpmfiles{md5sum}) { diff --git a/rpmtools.spec b/rpmtools.spec index 2b98a8b..d6eba69 100644 --- a/rpmtools.spec +++ b/rpmtools.spec @@ -2,7 +2,7 @@ %define release 1mdk # do not modify here, see Makefile in the CVS -%define version 5.0.10 +%define version 5.0.11 %define group %(perl -e 'printf "%%s\\n", "%_vendor" =~ /mandrake/i ? "System/Configuration/Packaging" : "System Environment/Base"') %define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm) @@ -65,6 +65,10 @@ is fully compatible with old packdrake. %{_bindir}/gendistrib %{_bindir}/genhdlist %{_bindir}/rpm2cpio.pl +%{_bindir}/dumpdistribconf +%{perl_vendorlib}/Distribconf.pm +%{_mandir}/man1/* +%{_mandir}/man3/Distribconf.* %files -n packdrake %defattr(-,root,root) @@ -72,9 +76,13 @@ is fully compatible with old packdrake. %{perl_vendorlib}/packdrake.pm %{perl_vendorlib}/Packdrakeng.pm %{perl_vendorlib}/Packdrakeng/zlib.pm -%{_mandir}/*/* +%{_mandir}/man3/[pP]ackdrake* %changelog +* Sun Feb 20 2005 Olivier Thauvin <thauvin@aerov.jussieu.fr> 5.0.11-1mdk +- add Distribconf.pm and dumpdistribconf to manage distrib config +- gendistrib use Distribconf.pm + * Thu Feb 17 2005 Rafael Garcia-Suarez <rgarciasuarez@mandrakesoft.com> 5.0.10-1mdk - gendistrib: - Generate hdlists and synthesis as hard links in <name>/media_info |