From 297cd66d7ba0ab41beb08897af99b963d2cb18d9 Mon Sep 17 00:00:00 2001 From: nanardon Date: Sat, 8 Oct 2005 17:30:58 +0000 Subject: - code was still using Hdlist :\ git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@41 971eb68f-4bfb-0310-8326-d2484c010a4c --- RPM4/bin/hrpmreb | 112 +++++++++++++++++++++++----------------------- RPM4/bin/rpm_produced | 14 +++--- RPM4/bin/rpmresign | 6 +-- RPM4/bin/urpm_interactive | 14 +++--- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/RPM4/bin/hrpmreb b/RPM4/bin/hrpmreb index a5ea8ce..7febdf5 100755 --- a/RPM4/bin/hrpmreb +++ b/RPM4/bin/hrpmreb @@ -69,7 +69,7 @@ hrpmreb =head1 DESCRIPTION -A very powerful rpm rebuilder using perl-Hdlist +A very powerful rpm rebuilder using perl-RPM4 =head1 SYNOPSYS @@ -231,12 +231,12 @@ to use hrpmreb --stat to immediatelly get status of the current build. =cut -require Hdlist; -Hdlist::setverbosity($verbose || "INFO"); +require RPM4; +RPM4::setverbosity($verbose || "INFO"); my $hlog = undef; -Hdlist::setlogcallback( +RPM4::setlogcallback( sub { my %arg = @_; loging("%s", $arg{msg}); @@ -253,7 +253,7 @@ sub loging { config_macros(); -if (Hdlist::expandnumeric("%livestat")) { +if (RPM4::expandnumeric("%livestat")) { require IPC::ShareLite; foreach my $k (1000 .. 1020) { $ipcstat = new IPC::ShareLite ( @@ -275,34 +275,34 @@ my %status = ( currentstep => '', ); -my $passphrase = Hdlist::expand('%{?gpgpass}'); +my $passphrase = RPM4::expand('%{?gpgpass}'); -my @srcdir = split(':', Hdlist::expand('%{?srcdir}')); -print Hdlist::expand("Source dir: %{?srcdir}%{?!srcdir:(none)}\n") if ($batch); +my @srcdir = split(':', RPM4::expand('%{?srcdir}')); +print RPM4::expand("Source dir: %{?srcdir}%{?!srcdir:(none)}\n") if ($batch); !@srcdir && $batch and die "No src dir, please define \%srcdir\n"; -my @bindir = split(':', Hdlist::expand('%{?bindir}')); -if (Hdlist::expandnumeric('%checkbinary')) { +my @bindir = split(':', RPM4::expand('%{?bindir}')); +if (RPM4::expandnumeric('%checkbinary')) { if (@bindir) { - print Hdlist::expand("Using binary dir: %{?bindir}%{?!bindir:(none)}\n"); + print RPM4::expand("Using binary dir: %{?bindir}%{?!bindir:(none)}\n"); } else { die "No bin dir, please define \%bindir or unset \%checkbinary\n"; } } if ($dumpconfig) { - Hdlist::dumprc(\*STDOUT); + RPM4::dumprc(\*STDOUT); exit 0; } --d Hdlist::expand("%{?logdir}%{!?logdir:.}") or mkdir Hdlist::expand("%{?logdir}%{!?logdir:.}") - or die "Can't create logdir ". Hdlist::expand("%{?logdir}%{!?logdir:.}") . " $!\n"; +-d RPM4::expand("%{?logdir}%{!?logdir:.}") or mkdir RPM4::expand("%{?logdir}%{!?logdir:.}") + or die "Can't create logdir ". RPM4::expand("%{?logdir}%{!?logdir:.}") . " $!\n"; -if (Hdlist::expandnumeric('%createrpmsdir')) { +if (RPM4::expandnumeric('%createrpmsdir')) { foreach my $macro (qw(%_topdir %_sourcedir %_builddir %_srpmdir %_rpmdir %_rpmdir/noarch %_rpmdir/%_target_cpu %_specdir %_tmppath)) { - -d Hdlist::expand($macro) or mkdir Hdlist::expand($macro) - or die "Can't create dir " . Hdlist::expand($macro) . "($macro): $!"; + -d RPM4::expand($macro) or mkdir RPM4::expand($macro) + or die "Can't create dir " . RPM4::expand($macro) . "($macro): $!"; } } @@ -333,7 +333,7 @@ if (! $status{srpmtotal}) { die sprintf("Nothing to do, %s\n", $batch ? "check \%srcdir value" : "give src.rpm too rebuild or use -b"); } -if (Hdlist::expandnumeric("%sortbybuilddate")) { +if (RPM4::expandnumeric("%sortbybuilddate")) { loging("Sorting srpms by buildate\n"); set_ipc_status(currentstep => "sorting srpms"); @srpmstobuild = sort_srpms(@srpmstobuild); @@ -353,8 +353,8 @@ foreach my $specfile (@specstobuild) { config_macros(); } else { - my $oldcmd = Hdlist::expand("%___build_cmd"); - Hdlist::add_macro("___build_cmd %myself --trap %_tmppath/%name-%version-%release.build.log $oldcmd"); + my $oldcmd = RPM4::expand("%___build_cmd"); + RPM4::add_macro("___build_cmd %myself --trap %_tmppath/%name-%version-%release.build.log $oldcmd"); exit(build_specfile($specfile)); } } @@ -370,8 +370,8 @@ foreach my $srpm (@srpmstobuild) { config_macros(); } else { - my $oldcmd = Hdlist::expand("%___build_cmd"); - Hdlist::add_macro("___build_cmd %myself --trap %_tmppath/%name-%version-%release.build.log $oldcmd"); + my $oldcmd = RPM4::expand("%___build_cmd"); + RPM4::add_macro("___build_cmd %myself --trap %_tmppath/%name-%version-%release.build.log $oldcmd"); exit(build_srcrpm($srpm)); } } @@ -425,7 +425,7 @@ sub set_ipc_status { sub sort_srpms { my %s; - my $db = Hdlist::newdb(); + my $db = RPM4::newdb(); $db->vsflags([ qw(NOSIGNATURES NOPAYLOAD NODIGESTS) ]); my $done = 0; my @specs; @@ -440,21 +440,21 @@ sub sort_srpms { } sub config_macros { - Hdlist::resetmacros(); + RPM4::resetmacros(); - Hdlist::add_macro("logfileformat %name.log"); + RPM4::add_macro("logfileformat %name.log"); - Hdlist::readconfig(); + RPM4::readconfig(); - Hdlist::loadmacrosfile($_) foreach (@macros); - Hdlist::add_macro($_) foreach(@define); + RPM4::loadmacrosfile($_) foreach (@macros); + RPM4::add_macro($_) foreach(@define); - Hdlist::add_macro("myself $0"); + RPM4::add_macro("myself $0"); } sub checkbinary { my ($spec) = @_; - Hdlist::expandnumeric('%checkbinary') or return 1; + RPM4::expandnumeric('%checkbinary') or return 1; my $missing = 0; my @bin = $spec->binrpm(); foreach my $r (@bin) { @@ -479,19 +479,19 @@ sub checkbinary { } } return 0 if ($missing == 0); - return Hdlist::expandnumeric('%checkbinary') <= ($missing == scalar(@bin) ? 2 : 1); + return RPM4::expandnumeric('%checkbinary') <= ($missing == scalar(@bin) ? 2 : 1); } sub build_srcrpm { my ($srpm) = @_; - my ($specf, $cookies) = Hdlist::installsrpm($srpm) or return 1; + my ($specf, $cookies) = RPM4::installsrpm($srpm) or return 1; my $rc = 0; my $spec; - if ($spec = Hdlist::specnew($specf, $passphrase, "/", $cookies, 0, 0)) { - open($hlog, ">", Hdlist::expand('%{?logdir:%{logdir}/}%{logfileformat}')); - $0 = Hdlist::expand("hrpmreb [%name-%version-%release]"); - set_ipc_status(currentsrpms => Hdlist::expand("%name-%version-%release")); + if ($spec = RPM4::specnew($specf, $passphrase, "/", $cookies, 0, 0)) { + open($hlog, ">", RPM4::expand('%{?logdir:%{logdir}/}%{logfileformat}')); + $0 = RPM4::expand("hrpmreb [%name-%version-%release]"); + set_ipc_status(currentsrpms => RPM4::expand("%name-%version-%release")); $SIG{'TERM'} = sub { $spec && $spec->build(["RMSOURCE", "RMSPEC", "RMBUILD"]); $spec && $spec->build(["CLEAN"]); @@ -504,15 +504,15 @@ sub build_srcrpm { loging("Found binary, skipping build\n"); } - if ($rc || Hdlist::expandnumeric('%keepalllog')) { - if (open(my $buildlog, "<", Hdlist::expand("%_tmppath/%name-%version-%release.build.log"))) { + if ($rc || RPM4::expandnumeric('%keepalllog')) { + if (open(my $buildlog, "<", RPM4::expand("%_tmppath/%name-%version-%release.build.log"))) { while (<$buildlog>) { print $hlog $_; } close($buildlog); } } else { - unlink(Hdlist::expand("\%{?logdir:%{logdir}/}%{logfileformat}")); + unlink(RPM4::expand("\%{?logdir:%{logdir}/}%{logfileformat}")); } close($hlog); $hlog = undef; @@ -520,7 +520,7 @@ sub build_srcrpm { $rc = 1; } - $spec ||= Hdlist::specnew($specf, $passphrase, "/", $cookies, 1, 1); + $spec ||= RPM4::specnew($specf, $passphrase, "/", $cookies, 1, 1); if ($spec) { set_ipc_status(currentstep => "cleaning"); @@ -528,7 +528,7 @@ sub build_srcrpm { $spec && $spec->build(["RMSOURCE", "RMSPEC", "RMBUILD"]); } - unlink(Hdlist::expand("%_tmppath/%name-%version-%release.build.log")); + unlink(RPM4::expand("%_tmppath/%name-%version-%release.build.log")); return $rc; } @@ -537,10 +537,10 @@ sub build_specfile { my $rc = 0; my $spec; - if ($spec = Hdlist::specnew($specf, $passphrase, "/", undef, 0, 0)) { - open($hlog, ">", Hdlist::expand('%{?logdir:%{logdir}/}%{logfileformat}')); - $0 = Hdlist::expand("hrpmreb [%name-%version-%release]"); - set_ipc_status(currentsrpms => Hdlist::expand("%name-%version-%release")); + if ($spec = RPM4::specnew($specf, $passphrase, "/", undef, 0, 0)) { + open($hlog, ">", RPM4::expand('%{?logdir:%{logdir}/}%{logfileformat}')); + $0 = RPM4::expand("hrpmreb [%name-%version-%release]"); + set_ipc_status(currentsrpms => RPM4::expand("%name-%version-%release")); $SIG{'TERM'} = sub { $spec && $spec->build(["RMBUILD"]); }; @@ -555,15 +555,15 @@ sub build_specfile { loging("Found binary, skipping build\n"); } - if ($rc || Hdlist::expandnumeric('%keepalllog')) { - if (open(my $buildlog, "<", Hdlist::expand("%_tmppath/%name-%version-%release.build.log"))) { + if ($rc || RPM4::expandnumeric('%keepalllog')) { + if (open(my $buildlog, "<", RPM4::expand("%_tmppath/%name-%version-%release.build.log"))) { while (<$buildlog>) { print $hlog $_; } close($buildlog); } } else { - unlink(Hdlist::expand("\%{?logdir:%{logdir}/}%{logfileformat}")); + unlink(RPM4::expand("\%{?logdir:%{logdir}/}%{logfileformat}")); } close($hlog); $hlog = undef; @@ -571,7 +571,7 @@ sub build_specfile { $rc = 1; } - $spec ||= Hdlist::specnew($specf, $passphrase, "/", undef, 1, 1); + $spec ||= RPM4::specnew($specf, $passphrase, "/", undef, 1, 1); if ($spec) { set_ipc_status(currentstep => "cleaning"); @@ -579,7 +579,7 @@ sub build_specfile { $spec && $spec->build(["RMBUILD"]); } - unlink(Hdlist::expand("%_tmppath/%name-%version-%release.build.log")); + unlink(RPM4::expand("%_tmppath/%name-%version-%release.build.log")); return $rc; } @@ -590,17 +590,17 @@ sub build_spec { $starttime = time; - if (Hdlist::expandnumeric('%installdep') && $srpm) { + if (RPM4::expandnumeric('%installdep') && $srpm) { set_ipc_status(currentstep => "installing dep"); runmacro("%installdepcmd", $srpm); $installdeptime = time; } - nice(Hdlist::expand("%{?nice}")) if (Hdlist::expandnumeric("%{?nice:1}")); + nice(RPM4::expand("%{?nice}")) if (RPM4::expandnumeric("%{?nice:1}")); set_ipc_status(currentstep => "checking dep"); my @pb; { - my $db = Hdlist::newdb(); + my $db = RPM4::newdb(); my $sh = $spec->srcheader(); $db->transadd($sh, "", 0); @@ -611,7 +611,7 @@ sub build_spec { if (@pb) { loging("\nMissing dependancies:\n"); - loging("$_\n") foreach(Hdlist::format_rpmpb(@pb)); + loging("$_\n") foreach(RPM4::format_rpmpb(@pb)); $rc = 1; } elsif(! $nobuild) { set_ipc_status(currentstep => "compiling"); @@ -647,7 +647,7 @@ sub upload_build { } } $noexist and return 1; - if (Hdlist::expandnumeric('%upload')) { + if (RPM4::expandnumeric('%upload')) { set_ipc_status(currentstep => "uploading"); !runmacro("%uploadcmd", @buildrpms) and unlink @buildrpms; } @@ -656,7 +656,7 @@ sub upload_build { sub runmacro { my ($macro, @args) = @_; - my $cmd = Hdlist::expand($macro. " " . join(' ', @args)); + my $cmd = RPM4::expand($macro. " " . join(' ', @args)); $cmd =~ /^\Q$macro/ and return 1; loging("Executing(%%%s) %s\n", $macro, $cmd); system($cmd) diff --git a/RPM4/bin/rpm_produced b/RPM4/bin/rpm_produced index e9fe67b..db593dc 100755 --- a/RPM4/bin/rpm_produced +++ b/RPM4/bin/rpm_produced @@ -39,13 +39,13 @@ Options: --no-src do not show the src.rpm "; -Hdlist::add_macro("_sourcedir $tmp"); -Hdlist::add_macro("_specdir $tmp"); +RPM4::add_macro("_sourcedir $tmp"); +RPM4::add_macro("_specdir $tmp"); sub set_config { - Hdlist::readconfig(); + RPM4::readconfig(); foreach (@macros) { - Hdlist::add_macro($_); + RPM4::add_macro($_); } } @@ -60,8 +60,8 @@ sub specquery { foreach my $file (@ARGV) { set_config(); $file =~ m/\.src\.rpm$/ and do { - if(my ($specfile) = Hdlist::installsrpm($file)) { - if (my $spec = Hdlist::specnew($specfile, undef, undef, undef, 1, 1)) { + if(my ($specfile) = RPM4::installsrpm($file)) { + if (my $spec = RPM4::specnew($specfile, undef, undef, undef, 1, 1)) { specquery($spec); $spec->build([qw(RMSOURCE RMSPEC)]); } @@ -69,7 +69,7 @@ foreach my $file (@ARGV) { next; }; $file =~ m/\.spec$/ and do { - if (my $spec = Hdlist::specnew($file, undef, undef, undef, 1, 1)) { + if (my $spec = RPM4::specnew($file, undef, undef, undef, 1, 1)) { specquery($spec); } next; diff --git a/RPM4/bin/rpmresign b/RPM4/bin/rpmresign index 4cce105..7c860e1 100755 --- a/RPM4/bin/rpmresign +++ b/RPM4/bin/rpmresign @@ -18,7 +18,7 @@ use strict; use warnings; use Getopt::Long; -use Hdlist::Sign; +use RPM4::Sign; my ($configfile, $batch, $sigtype, $passfile, $macrofile, $fastmode, $path, $name, $keyid, $pass); my @defines; @@ -35,7 +35,7 @@ GetOptions( ); foreach (@defines) { - Hdlist::add_macro($_); + RPM4::add_macro($_); } if (!$passfile) { @@ -43,7 +43,7 @@ if (!$passfile) { chomp($pass); } -my $sign = Hdlist::Sign->new( +my $sign = RPM4::Sign->new( passphrase => $pass, _signature => $sigtype, path => $path, diff --git a/RPM4/bin/urpm_interactive b/RPM4/bin/urpm_interactive index 7756fea..59e5f04 100755 --- a/RPM4/bin/urpm_interactive +++ b/RPM4/bin/urpm_interactive @@ -21,14 +21,14 @@ use strict; use warnings; -use Hdlist::Media; -use Hdlist::Media::Solve; +use RPM4::Media; +use RPM4::Media::Solve; use Term::ReadLine; use Text::ParseWords; use urpm; use Getopt::Long; -#Hdlist::setverbosity('DEBUG'); +#RPM4::setverbosity('DEBUG'); my $dbpath; @@ -37,9 +37,9 @@ GetOptions( ); -Hdlist::add_macro("_dbpath $dbpath") if ($dbpath); +RPM4::add_macro("_dbpath $dbpath") if ($dbpath); -my $s = Hdlist::Media::Solve->new( +my $s = RPM4::Media::Solve->new( ); { @@ -50,7 +50,7 @@ my $s = Hdlist::Media::Solve->new( my $dir = $m->{url}; $dir =~ s!file:/+!/!; $s->addmedia( - Hdlist::Media->new( + RPM4::Media->new( hdlist => $m->{with_hdlist}, rpmsdir => $dir, ), @@ -62,7 +62,7 @@ $s->add_system_dep('REQUIRE', "basesystem"); $s->load(); -my $term = new Term::ReadLine 'Hdlist'; +my $term = new Term::ReadLine 'RPM4'; my $prompt = "urpm > "; -- cgit v1.2.1