pkg-repgen.pl: Improved prt-get commands and added --prtdir switch
This commit is contained in:
parent
b020e2b7ec
commit
0607d6de23
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user