From 0607d6de232f0b1b67939225b9a5b11444501a28 Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Tue, 20 Aug 2013 12:55:15 +0200 Subject: [PATCH] pkg-repgen.pl: Improved prt-get commands and added --prtdir switch --- doc/pkg-repgen.8 | 4 ++++ doc/pkg-repgen.8.txt | 1 + scripts/pkg-repgen.pl | 22 +++++++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/pkg-repgen.8 b/doc/pkg-repgen.8 index 17d0609..bf9b03f 100644 --- a/doc/pkg-repgen.8 +++ b/doc/pkg-repgen.8 @@ -32,6 +32,10 @@ insert FILE at the beginning of the html index .B \fB--title\fP=title use the specified title for the index page +.TP +.B +\fB--prtdir\fP=DIR +use alternative prtdir for prt-get commands .SH EXAMPLES \fBpkg-repgen\fP .PP diff --git a/doc/pkg-repgen.8.txt b/doc/pkg-repgen.8.txt index 0225769..5a2c07d 100644 --- a/doc/pkg-repgen.8.txt +++ b/doc/pkg-repgen.8.txt @@ -20,6 +20,7 @@ OPTIONS --header=FILE insert FILE at the beginning of the html index --header=FILE insert FILE at the beginning of the html index --title=title use the specified title for the index page + --prtdir=DIR use alternative prtdir for prt-get commands EXAMPLES pkg-repgen diff --git a/scripts/pkg-repgen.pl b/scripts/pkg-repgen.pl index 9e29f15..a2d461e 100755 --- a/scripts/pkg-repgen.pl +++ b/scripts/pkg-repgen.pl @@ -13,8 +13,9 @@ use warnings; use strict; use Getopt::Long; +our $prtget = "/usr/bin/prt-get"; our $prtdir; our $title = "CRUX Packages"; our $header; our $footer; -GetOptions("title=s"=>\$title, "header=s"=>\$header, "footer=s"=>\$footer); +GetOptions("prtdir=s"=>\$prtdir, "title=s"=>\$title, "header=s"=>\$header, "footer=s"=>\$footer); # Use compression-mode defined in pkgmk-conf our $compress = "gz"; @@ -30,6 +31,9 @@ if ($#ARGV >= 0) { # single packages pkgread(); pkginst(); } else { + if ($prtdir) { + $prtget = "$prtget --no-std-config --config-set=\"prtdir $prtdir\""; + } pkgrepo(); pkgdeps(); pkgread(); @@ -48,7 +52,7 @@ sub pkgdeps_single { my $found = 0; my $package = $packages[0]; $package =~ s/#.*//; - my $deps = `prt-get printf "%e" --filter="$package"`; + my $deps = `$prtget printf "%e" --filter="$package"`; if ($deps ne "") { my $isnew = `grep "$p .*:" PKGDEPS`; if ($isnew eq ""){ # package is new, put deps at the end. @@ -82,10 +86,10 @@ sub pkgrepo_single { my $du = (-s $package); my $md5 = `md5sum $package`; $md5 =~ s/ .*$|\n//g; - my $des=`prt-get printf %d --filter="$name"`; + my $des=`$prtget printf %d --filter="$name"`; $des =~ s/:/ /g; if ($des eq ""){$des = "N.A."}; - my $flags=`prt-get printf %E:%O:%R --filter="$name"`; + my $flags=`$prtget printf %E:%O:%R --filter="$name"`; if ($flags eq "") {$flags = "no:no:no"} my $isnew = `grep "$p#" PKGREPO`; if ($isnew eq ""){ # package is new, put it at the end @@ -115,7 +119,7 @@ sub pkgdeps { open (my $fh, '>PKGDEPS'); foreach my $package (@packages) { $package =~ s/#.*//; - my $deps = `prt-get printf "%e" --filter="$package"`; + my $deps = `$prtget printf "%e" --filter="$package"`; if ($deps ne "") { printf $fh "%-30s : %-s\n", $package, $deps; } @@ -141,10 +145,10 @@ sub pkgrepo { my $du = (-s $package); my $md5 = `md5sum $package`; $md5 =~ s/ .*$|\n//g; - my $des=`prt-get printf %d --filter="$name"`; + my $des=`$prtget printf %d --filter="$name"`; $des =~ s/:/ /g; if ($des eq ""){$des = "N.A."}; - my $flags=`prt-get printf %E:%O:%R --filter="$name"`; + my $flags=`$prtget printf %E:%O:%R --filter="$name"`; if ($flags eq "") {$flags = "no:no:no"} printf $fh "%-s:%-s:%-s:%-s:%-s\n", $package,$du,$md5,$des,$flags; my $version = $package; @@ -175,7 +179,7 @@ sub pkgread { print $fh "# README files for repository. Do NOT remove this line.\n"; foreach my $package (@packages) { $package =~ s/#.*//; - my $path = `prt-get path $package`; + my $path = `$prtget path $package`; $path =~ s/\n//g; if (-f "$path/README"){ print $fh "##### PKGREADME: $package\n"; @@ -203,7 +207,7 @@ sub pkginst { my @packages = glob("*#*.pkg.tar.$compress"); foreach my $package (@packages) { $package =~ s/#.*//; - my $path = `prt-get path $package`; + my $path = `$prtget path $package`; $path =~ s/\n//g; my $normal= $package; $normal =~ s/[^[:alnum:]]/_/g;