Makefile: bump version to 1.3.3
portspage: move stylesheet rules to a separate file that the user can modify, infer appropriate level of timestamp_accuracy when performing a quick-update on an existing index, provide more examples in the man-page prtcreate: read templates from /usr/share instead of /usr/lib prtverify: anticipate that pkgmk will soon support zstd compression, and extend the clean-repo regexp accordingly
This commit is contained in:
parent
ddc2bb13e2
commit
47c8552854
13
Makefile
13
Makefile
|
@ -47,13 +47,21 @@ install-lib:
|
|||
fi; \
|
||||
done
|
||||
|
||||
install-share:
|
||||
for tool in $(TOOLS); do \
|
||||
if [ -d share/$$tool ]; then \
|
||||
install -d $(DESTDIR)$(PREFIX)/share/$$tool; \
|
||||
install -m 644 share/$$tool/* $(DESTDIR)$(PREFIX)/share/$$tool; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
prtverify:
|
||||
@make -C scripts
|
||||
|
||||
revdep/revdep:
|
||||
@make -C revdep
|
||||
|
||||
install: install-man install-bin install-lib install-symlink
|
||||
install: install-man install-bin install-lib install-share install-symlink
|
||||
|
||||
uninstall:
|
||||
@for tool in $(TOOLS); do \
|
||||
|
@ -62,6 +70,9 @@ uninstall:
|
|||
if [ -d lib/$$tool ]; then \
|
||||
rm -rf $(DESTDIR)$(LIBDIR)/$$tool; \
|
||||
fi; \
|
||||
if [ -d share/$$tool ]; then \
|
||||
rm -rf $(DESTDIR)$(PREFIX)/share/$$tool; \
|
||||
fi; \
|
||||
done
|
||||
rm -rf $(DESTDIR)$(BINDIR)/prtverify.awk
|
||||
rm -rf $(DESTDIR)$(BINDIR)/revdep
|
||||
|
|
|
@ -51,7 +51,7 @@ the Pkgfile format and the package database), **prt-get**, or their config files
|
|||
| package database (opened by calling pkginfo) | pkgsize |
|
||||
| signature or footprint parsed in the script itself | oldfiles, prtcheck, prtsweep, prtverify |
|
||||
| /etc/pkgmk.conf parsed by the script | oldfiles, dllist |
|
||||
| Pkgfile parsed in the script (not sourced) | prtverify |
|
||||
| Pkgfile parsed in the script (not sourced) | prtverify, portspage |
|
||||
| Pkgfile [sourced by the script](#sourcing-pkgfile) or a subshell | dllist, pkgsize, prtcheck, prtwash |
|
||||
| /etc/prt-get.conf parsed by the script itself | pkgfoster, prtorphan, oldfiles, prtwash |
|
||||
| prt-get printf | finddeps, oldfiles, pkg\_installed, prtcheckperms |
|
||||
|
@ -84,10 +84,9 @@ language other than bash would insert an extra layer between the user-facing sid
|
|||
side that deals with the ports tree. For now the only tool with such a translation layer
|
||||
is prtwash. The most promising candidates for a future rewrite are:
|
||||
|
||||
- findredundantdeps
|
||||
- prtrej
|
||||
- pkgfoster
|
||||
- pkgexport
|
||||
- dllist
|
||||
- pkgsize
|
||||
- prtcheck
|
||||
|
||||
Open a Gitea pull request if you write a replacement for one of the scripts above and
|
||||
want it included in the next version of prt-utils.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
." Text automatically generated by txt2man-1.4.7
|
||||
.TH portspage 1 "15 April 2024" "prt\-utils 1.3.3" "CRUX port utilities"
|
||||
.TH portspage 1 "17 April 2024" "prt\-utils 1.3.3" "CRUX port utilities"
|
||||
.SH NAME
|
||||
portspage \- generate html index of a port directory
|
||||
.SH SYNOPSIS
|
||||
|
@ -16,10 +16,10 @@ if no such argument is given. With one or zero arguments, the complete index
|
|||
is recalculated based on the directory contents at the time of execution
|
||||
(suitable for a cgi script). The value of [directory], if given, will be used
|
||||
verbatim in any HTML links, so provide a relative path if you want the resulting
|
||||
index to be usable in a website. Names of individual ports may be passed as
|
||||
subsequent arguments, allowing you to quickly update a previously-generated
|
||||
index (saved as index.htm*) or to generate a restricted index that shows
|
||||
only the specified ports.
|
||||
index to be usable in a website. Any subsequent arguments will be interpreted as
|
||||
names of individual ports, allowing you to quickly update a previously\-generated
|
||||
index (saved as index.htm*) or to generate a restricted index that shows only
|
||||
the specified ports (if index.htm* does not match anything in [directory]).
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-title\fP=TITLE
|
||||
|
@ -33,6 +33,14 @@ name of file to insert after port listing
|
|||
.TP
|
||||
\fB\-\-timestamp\-accuracy\fP=LEVEL
|
||||
0 = no timestamp, 1 = date only, 2 = date and time (default is 1)
|
||||
.PP
|
||||
Passing \-\-timestamp\-accuracy=0 will suppress the "Last modified" column from appearing
|
||||
in the resulting index, both in full\-repository mode and quick\-update mode.
|
||||
Passing a level greater than 0 in quick\-update mode will only recompute the timestamps
|
||||
of ports named on the command line; the timestamps of other ports will be copied verbatim
|
||||
from the previously\-generated index. If the existing index.html was generated with
|
||||
\-\-timestamp\-accuracy=0, then \fBportspage\fP in quick-update mode will behave as if it
|
||||
saw the same option, regardless of the value given on the command line.
|
||||
.TP
|
||||
\fB\-\-date\-from\-file\fP
|
||||
take date from newest file instead of directory
|
||||
|
@ -51,13 +59,33 @@ For local use (not shared on the public www, so absolute paths are acceptable):
|
|||
\fBportspage \-\-header\fP=/path/to/portspage.header /usr/ports/mine > /usr/ports/mine/index.html
|
||||
.TP
|
||||
For an index that you want to share on the public www:
|
||||
cd /usr/ports/mine && \fBportspage \-\-header\fP=/path/to/portspage.header . > index.html
|
||||
.nf
|
||||
cd /usr/ports/mine
|
||||
\fBportspage \-\-header\fP=/path/to/portspage.header . > index.html
|
||||
.fi
|
||||
.TP
|
||||
Updating an individual port (local use):
|
||||
Breaking up the index of a large collection into two separate pages using shell globs:
|
||||
.nf
|
||||
cd /usr/ports/mine && rm \-f index*.htm*
|
||||
\fBportspage \-\-footer=\fP/path/to/footer1 . [a\-m]* > index1.html
|
||||
\fBportspage \-\-footer=\fP/path/to/footer2 . [n\-z]* > index2.html
|
||||
.fi
|
||||
.TP
|
||||
Fancier (interactive) version of \fBprt\-get printf\fP "%i:%n\et%v-%r\et%d\en" | \
|
||||
\fBgrep\fP \-v ^no | \fBcut\fP \-d: \-f2 , but limited to users who have \
|
||||
write permission on /usr/ports/installed:
|
||||
.nf
|
||||
\fBpkg_installed\fP && \fBportspage\fP /usr/ports/installed | \fBlynx\fP \-stdin
|
||||
.fi
|
||||
.TP
|
||||
Insert or update an individual port (local use):
|
||||
\fBportspage\fP /usr/ports/mine my\-updated\-port > /usr/ports/mine/index.html.new
|
||||
.TP
|
||||
Updating an individual port (public www):
|
||||
cd /usr/ports/mine && \fBportspage\fP . my\-updated\-port > index.html.new
|
||||
Insert or update an individual port (public www):
|
||||
.nf
|
||||
cd /usr/ports/mine
|
||||
\fBportspage\fP . my\-updated\-port > index.html.new
|
||||
.fi
|
||||
.SH COMPARISON WITH OTHER UTILITIES
|
||||
Code from \fBportspage\fP was later incorporated into \fBpkg\-repgen\fP(8) for generating
|
||||
the html index of a shared package directory. While \fBportspage\fP interprets the
|
||||
|
@ -71,7 +99,7 @@ are reunited in their behaviour:
|
|||
index.
|
||||
.IP
|
||||
\(bu write a wrapper script or shell function that intercepts @ARGV and then
|
||||
invokes /usr/bin/portspage or /usr/bin/pkg-repgen with the sanitized argument list.
|
||||
invokes /usr/bin/portspage or /usr/bin/pkg\-repgen with the sanitized argument list.
|
||||
.IP
|
||||
\(bu install a forked version of \fBpkg\-repgen\fP that interprets its first non\-option argument
|
||||
the same way that \fBportspage\fP does (and then takes any subsequent words in @ARGV as the
|
||||
|
@ -84,12 +112,20 @@ on the command line; this fork would expect $PWD to be the collection (just as
|
|||
Users who share their repositories via all three commands
|
||||
(\fBportspage\fP, \fBpkg\-repgen\fP, and \fBhttpup\-repgen\fP) are encouraged to select
|
||||
a workaround that aligns with the most familiar tool; lest they encounter
|
||||
unnecessary delay when issuing one of the less-frequently-used commands (i.e., second-guessing
|
||||
whether it will have the intended effect). See README.md in the \fBprt-utils\fP repository for
|
||||
unnecessary delay when issuing one of the less\-frequently\-used commands (i.e., second\-guessing
|
||||
whether it will have the intended effect). See README.md in the \fBprt\-utils\fP repository for
|
||||
an example of grouping the tools according to their expected environment and argument.
|
||||
.SH FILES
|
||||
/usr/share/portspage/style.html
|
||||
.PP
|
||||
Starting with \fBportspage\fP 1.1, the doctype declaration and stylesheet rules have been moved
|
||||
out of the script itself, and are now read from a separate file. You are free to edit this file
|
||||
with your own customizations (only colors, fonts, and header level (1\-\-3), not the names of the
|
||||
classes!), and protect it from being overwritten by creating the appropriate UPGRADE NO
|
||||
directive in \fBpkgadd.conf\fP(5).
|
||||
.SH AUTHORS
|
||||
Jukka Heino <jukka@karsikkopuu.net>
|
||||
.PP
|
||||
John McQuah <jmcquah@disroot.org>
|
||||
.SH SEE ALSO
|
||||
\fBports\fP(8), \fBhttpup\fP(8), \fBhttpup\-repgen\fP(8), \fBpkg\-repgen\fP(8)
|
||||
\fBports\fP(8), \fBPkgfile\fP(5), \fBhttpup\fP(8), \fBhttpup\-repgen\fP(8), \fBpkg\-repgen\fP(8)
|
||||
|
|
|
@ -18,7 +18,7 @@ Print a brief reminder of usage.
|
|||
.B \-f
|
||||
Force the operation even if a Pkgfile already exists.
|
||||
.SH ARGUMENT
|
||||
If given, each argument is interpreted as the name of a file under /usr/lib/prtcreate.
|
||||
If given, each argument is interpreted as the name of a file under /usr/share/prtcreate.
|
||||
This directory contains templates for several common build systems (autotools, meson,
|
||||
cmake, perl, py3pip, py3setup, and r). The contents of the requested template(s) will be
|
||||
copied verbatim into the Pkgfile \fIbuild()\fP function. Most of the time you will only
|
||||
|
@ -38,39 +38,39 @@ new Pkgfiles.
|
|||
root@hostname:/root #
|
||||
.fi
|
||||
.PP
|
||||
You can populate \fI/usr/lib/prtcreate\fP with your own templates, as illustrated in
|
||||
the third example below. Or you can edit the provided templates and safeguard your
|
||||
You can populate \fI/usr/share/prtcreate\fP with your own templates, as illustrated
|
||||
in the third example below. Or you can edit the provided templates and safeguard your
|
||||
changes using UPGRADE NO rules in \fBpkgadd.conf\fP(5).
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
Call \fBprtcreate\fP without arguments in a newly created directory:
|
||||
.PP
|
||||
.nf
|
||||
root@hostname:/root # mkdir my-new-port
|
||||
root@hostname:/root # cd my-new-port
|
||||
root@hostname:/root/my-new-port # prtcreate
|
||||
root@hostname:/root/my-new-port # cat Pkgfile
|
||||
root@hostname:/root # mkdir my\-new\-port
|
||||
root@hostname:/root # cd my\-new\-port
|
||||
root@hostname:/root/my\-new\-port # prtcreate
|
||||
root@hostname:/root/my\-new\-port # cat Pkgfile
|
||||
|
||||
# Description:
|
||||
# URL:
|
||||
# Maintainer:
|
||||
# Depends on:
|
||||
|
||||
name=my-new-port
|
||||
name=my\-new\-port
|
||||
version=
|
||||
release=1
|
||||
source=()
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
cd $name\-$version
|
||||
}
|
||||
.fi
|
||||
.PP
|
||||
Call \fBprtcreate\fP with one argument in a newly created directory:
|
||||
.PP
|
||||
.nf
|
||||
root@hostname:/root # mkdir my-new-port
|
||||
root@hostname:/root # cd my-new-port
|
||||
root@hostname:/root # mkdir my\-new\-port
|
||||
root@hostname:/root # cd my\-new\-port
|
||||
root@hostname:/root/my-new-port # prtcreate autotools
|
||||
root@hostname:/root/my-new-port # cat Pkgfile
|
||||
|
||||
|
@ -79,15 +79,15 @@ Call \fBprtcreate\fP with one argument in a newly created directory:
|
|||
# Maintainer:
|
||||
# Depends on:
|
||||
|
||||
name=my-new-port
|
||||
name=my\-new\-port
|
||||
version=
|
||||
release=1
|
||||
source=()
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
# autoreconf -fvi
|
||||
./configure --prefix=/usr
|
||||
cd $name\-$version
|
||||
# autoreconf \-fvi
|
||||
./configure \-\-prefix=/usr
|
||||
|
||||
make
|
||||
make DESTDIR="$PKG" install
|
||||
|
@ -97,35 +97,35 @@ Call \fBprtcreate\fP with one argument in a newly created directory:
|
|||
Call \fBprtcreate\fP with two arguments in a newly created directory:
|
||||
.PP
|
||||
.nf
|
||||
root@hostname:/root # mkdir my-new-port
|
||||
root@hostname:/root # cd my-new-port
|
||||
root@hostname:/root/my-new-port # prtcreate mytests mycmake
|
||||
root@hostname:/root/my-new-port # cat Pkgfile
|
||||
root@hostname:/root # mkdir my\-new\-port
|
||||
root@hostname:/root # cd my\-new\-port
|
||||
root@hostname:/root/my\-new\-port # prtcreate mytests mycmake
|
||||
root@hostname:/root/my\-new\-port # cat Pkgfile
|
||||
|
||||
# Description:
|
||||
# URL:
|
||||
# Maintainer:
|
||||
# Depends on:
|
||||
|
||||
name=my-new-port
|
||||
name=my\-new\-port
|
||||
version=
|
||||
release=1
|
||||
source=()
|
||||
|
||||
build() {
|
||||
prt-get isinst my-softdep-1 || PKGMK_THISPORT+=(-Dsoftdep_1=disabled)
|
||||
prt-get isinst my-softdep-2 || PKGMK_THISPORT+=(-Dsoftdep_2=disabled)
|
||||
PKGMK_THISPORT=(\-DCMAKE_BUILD_TYPE=Release
|
||||
\-DCMAKE_INSTALL_PREFIX=/usr
|
||||
\-DCMAKE_INSTALL_LIBDIR=lib
|
||||
\-DCMAKE_C_FLAGS_RELEASE="$CFLAGS"
|
||||
\-DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS"
|
||||
\-Wno\-dev)
|
||||
prt\-get isinst my\-softdep\-1 || PKGMK_THISPORT+=(\-Dsoftdep_1=disabled)
|
||||
prt\-get isinst my\-softdep\-2 || PKGMK_THISPORT+=(\-Dsoftdep_2=disabled)
|
||||
|
||||
cmake -S $name-$version -B build \\
|
||||
-DCMAKE_BUILD_TYPE=Release \\
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \\
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \\
|
||||
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS" \\
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \\
|
||||
-Wno-dev "${PKGMK_THISPORT[@]}"
|
||||
cmake \-S $name\-$version \-B build "${PKGMK_THISPORT[@]}"
|
||||
|
||||
cmake --build build
|
||||
DESTDIR="$PKG" cmake --install build
|
||||
cmake \-\-build build
|
||||
DESTDIR="$PKG" cmake \-\-install build
|
||||
}
|
||||
.SH AUTHORS
|
||||
Martin Opel <mo at obbl dot net>,
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
cd Module-$version
|
||||
perl Makefile.PL INSTALLDIRS=vendor
|
||||
make
|
||||
make DESTDIR="$PKG" install
|
||||
|
||||
find "$PKG" \( -name '.packlist' -o -name '*.pod' \) -delete
|
|
@ -1,3 +0,0 @@
|
|||
cd Module
|
||||
mkdir -p $PKG/usr/lib/R/library
|
||||
R CMD INSTALL . -l $PKG/usr/lib/R/library
|
|
@ -22,7 +22,7 @@ loglevel_ok(FATAL) && FILENAME ~ PKGFILE && FNR==1 {
|
|||
list_files(PORTDIR, af)
|
||||
|
||||
for (f in af) {
|
||||
if (f ~ "(.(rar|svn|tar.(bz2|gz|lz|xz)|tgz|zip)|CVS|REPO|index.html)$")
|
||||
if (f ~ "(.(rar|svn|tar.(bz2|gz|lz|xz|zst)|tgz|tzst|zip)|CVS|REPO|index.html)$")
|
||||
perror(FATAL, "invalid file/directory: " f)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
our $version = "1.0.6";
|
||||
our $version = "1.1";
|
||||
|
||||
########################################################################
|
||||
#
|
||||
|
@ -10,9 +10,10 @@ our $version = "1.0.6";
|
|||
# Distributed under the terms of the GPL license.
|
||||
#
|
||||
# Changelog:
|
||||
# 1.0.6
|
||||
# 1.1
|
||||
# - Limit recursion to depth 1 when searching for Pkgfiles
|
||||
# - Treat additional args as ports to be inserted into an existing index
|
||||
# - Read the stylesheet from an external file
|
||||
# 1.0.5
|
||||
# - Added a table row containing the signify public key
|
||||
# 1.0.4
|
||||
|
@ -35,11 +36,13 @@ our %options =
|
|||
timestamp_accuracy => 1,
|
||||
date_from_file => 0,
|
||||
);
|
||||
our $stylepage = "/usr/share/portspage/style.html";
|
||||
our @updates; our @ports;
|
||||
our %parity = ( 0 => "even", 1 => "odd" );
|
||||
|
||||
sub print_usage {
|
||||
print <<EOT;
|
||||
my $ok = shift;
|
||||
print STDERR <<EOT;
|
||||
Usage: portspage [OPTION]... [DIRECTORY [port1...portN]]
|
||||
|
||||
--title=TITLE set the page title
|
||||
|
@ -56,7 +59,7 @@ Usage: portspage [OPTION]... [DIRECTORY [port1...portN]]
|
|||
|
||||
Report bugs to <jmcquah\@disroot dot org>.
|
||||
EOT
|
||||
exit $_;
|
||||
exit $ok;
|
||||
}
|
||||
|
||||
sub parse_args {
|
||||
|
@ -73,17 +76,17 @@ sub parse_args {
|
|||
elsif ($arg =~ /^--timestamp-accuracy=(0|1|2)$/) {
|
||||
$options{timestamp_accuracy} = $1;
|
||||
}
|
||||
elsif ($arg =~ /^--date-from-file$/) {
|
||||
elsif ($arg eq "--date-from-file") {
|
||||
$options{date_from_file} = 1;
|
||||
}
|
||||
elsif ($arg =~ /^--date-from-pkgfile$/) {
|
||||
elsif ($arg eq "--date-from-pkgfile") {
|
||||
$options{date_from_pkgfile} = 1;
|
||||
}
|
||||
elsif ($arg =~ /^--version$/) {
|
||||
elsif ($arg eq "--version") {
|
||||
print "$version\n";
|
||||
exit 0;
|
||||
}
|
||||
elsif ($arg =~ /^--help$/) {
|
||||
elsif ($arg eq "--help") {
|
||||
print_usage(0);
|
||||
}
|
||||
elsif (! $options{directory}) {
|
||||
|
@ -97,7 +100,6 @@ sub parse_args {
|
|||
}
|
||||
|
||||
sub main {
|
||||
|
||||
parse_args();
|
||||
|
||||
if (@updates) { # individual ports passed as args.
|
||||
|
@ -105,6 +107,8 @@ sub main {
|
|||
foreach my $port (@updates) {
|
||||
if (-f "$options{directory}/$port/Pkgfile") {
|
||||
push @ports, $port;
|
||||
} else {
|
||||
print STDERR "$port not found in $options{directory}, ignoring.\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -114,56 +118,14 @@ sub main {
|
|||
}
|
||||
}
|
||||
|
||||
print <<EOH;
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
EOH
|
||||
|
||||
print " <title>$options{title}</title>\n";
|
||||
|
||||
print <<EOH;
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
font-family: Verdana, sans-serif;
|
||||
font-size: 85%;
|
||||
padding: 2em;
|
||||
}
|
||||
a
|
||||
{
|
||||
color: black;
|
||||
}
|
||||
table
|
||||
{
|
||||
border: solid #CAD4E9 1px;
|
||||
font-size: 85%;
|
||||
}
|
||||
td
|
||||
{
|
||||
padding: 6px;
|
||||
}
|
||||
tr.header
|
||||
{
|
||||
background-color: #CAD4E9;
|
||||
}
|
||||
tr.odd
|
||||
{
|
||||
background-color: #ECF0F7;
|
||||
}
|
||||
tr.even
|
||||
{
|
||||
background-color: #F7F9FC;
|
||||
}
|
||||
</style>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
</head>
|
||||
<body>
|
||||
EOH
|
||||
|
||||
print " <h2>$options{title}</h2>\n";
|
||||
open(my $fS, $stylepage) or die "style page missing! please reinstall $ARGV[0]";
|
||||
while (<$fS>) {
|
||||
if (m/<(title|h[1-3])>/) {
|
||||
s/(title|h[1-3])>[^<]*</\1>$options{title}</;
|
||||
}
|
||||
print;
|
||||
}
|
||||
close($fS);
|
||||
|
||||
if ($options{header}) {
|
||||
open(my $hH, $options{header}) or die "Couldn't open header file";
|
||||
|
@ -173,41 +135,25 @@ EOH
|
|||
close($hH);
|
||||
}
|
||||
|
||||
print " <table width=\"100%\" cellspacing=\"0\">\n";
|
||||
my $CWD = getcwd;
|
||||
my $repo = (split /\//, $CWD)[-1];
|
||||
my $pubkey = "/etc/ports/".$repo.".pub";
|
||||
if (-e $pubkey) {
|
||||
open(my $kH, $pubkey) or die "Couldn't read from public key!";
|
||||
while (my $line = <$kH>) {
|
||||
chomp $line;
|
||||
if ($line !~ "untrusted comment") {
|
||||
print " <tr class=\"header\"><td colspan=\"4\">\n";
|
||||
print " <strong>Signify public key:</strong> $line\n";
|
||||
print " </td></tr>\n";
|
||||
}
|
||||
}
|
||||
close($kH);
|
||||
}
|
||||
print " <tr class=\"header\"><td><strong>Port</strong></td>";
|
||||
print "<td><strong>Version</strong></td><td><strong>Description</strong></td>";
|
||||
if ($options{timestamp_accuracy} > 0) {
|
||||
print "<td><strong>Last modified</strong></td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
my $count = 0;
|
||||
my $firstrun = 0;
|
||||
if (@updates) { # individual ports passed as arguments,
|
||||
# usually when an existing index.html only needs a quick update
|
||||
if (@updates) { # when an existing index.html only needs a quick update
|
||||
my @queue = sort @ports;
|
||||
my %followH; my $oH; my $oline; my $oname; my $fname;
|
||||
my %followH; my $oH; my $col_checked=0; my $oline; my $oname; my $fname;
|
||||
my @oldIdx = glob($options{directory} . "/index.htm*");
|
||||
if ($#oldIdx >= 0) {
|
||||
# check how many columns the existing index has, and modify our options accordingly
|
||||
open ($oH, $oldIdx[0]);
|
||||
while (($options{timestamp_accuracy}>0) and ($col_checked==0) and ($oline = <$oH>)) {
|
||||
if ($oline =~ m/class="header".*Port/) {
|
||||
$options{timestamp_accuracy} -= ($oline =~ m/Last modified/) ? 0 : $options{timestamp_accuracy};
|
||||
$col_checked = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$firstrun = 1;
|
||||
}
|
||||
tablehead();
|
||||
|
||||
HROW: while (my $p = shift @queue) {
|
||||
if ($firstrun == 1) {
|
||||
|
@ -224,6 +170,9 @@ EOH
|
|||
if ($oname lt $p) {
|
||||
$count++;
|
||||
$oline =~ s/class="(even|odd)"/class="$parity{($count % 2)}"/;
|
||||
if ($options{timestamp_accuracy}==0) {
|
||||
$oline =~ s/<td>[0-9]{4}-[0-1][0-9]-[0-3][0-9].*<\/td>//;
|
||||
}
|
||||
print "$oline\n";
|
||||
} elsif ($oname eq $p) {
|
||||
$count++;
|
||||
|
@ -235,11 +184,12 @@ EOH
|
|||
}
|
||||
# Before breaking out of the loop, append all the packages from the queue that
|
||||
# are lexographically earlier than the current entry in the old html index.
|
||||
while (($queue[0]) and ($queue[0] lt $oname)) {
|
||||
# In the event of equality, the command-line arg takes precedence.
|
||||
while (($queue[0]) and ($queue[0] le $oname)) {
|
||||
$p = shift @queue;
|
||||
$followH{$p} = "$oline\n";
|
||||
$count++;
|
||||
htmlrow($count, $p);
|
||||
$followH{$p} = "$oline\n" if ($p lt $oname);
|
||||
}
|
||||
}
|
||||
# Either the old index has a successor to the current arg, or all remaining args
|
||||
|
@ -255,15 +205,17 @@ EOH
|
|||
# Decide whether to:
|
||||
# - print the next row of the old index.
|
||||
# - save it in the followH array where it will be printed later.
|
||||
# - ignore it (in the event of an exact match, the command-line arg takes precedence).
|
||||
if (@queue) {
|
||||
$fname = $followH{$p};
|
||||
$fname =~ s/.*a href="(http|https|ftp):[^>]*">([^<]*)<.*/$2/;
|
||||
if ($queue[0] gt $fname) {
|
||||
$count++;
|
||||
$followH{$p} =~ s/class="(even|odd)"/class="$parity{($count % 2)}"/;
|
||||
if ($options{timestamp_accuracy}==0) {
|
||||
$followH{$p} =~ s/<td>[0-9]{4}-[0-1][0-9]-[0-3][0-9].*<\/td>//;
|
||||
}
|
||||
print $followH{$p};
|
||||
} elsif ($queue[0] lt $fname) {
|
||||
} else {
|
||||
$followH{$queue[0]} = $followH{$p};
|
||||
}
|
||||
}
|
||||
|
@ -274,12 +226,16 @@ EOH
|
|||
if ($oline =~ m/class="(even|odd)"/) {
|
||||
$count++;
|
||||
$oline =~ s/class="(even|odd)"/class="$parity{($count % 2)}"/;
|
||||
if ($options{timestamp_accuracy}==0) {
|
||||
$oline =~ s/<td>[0-9]{4}-[0-1][0-9]-[0-3][0-9].*<\/td>//;
|
||||
}
|
||||
print $oline;
|
||||
}
|
||||
}
|
||||
($firstrun == 1) or close($oH);
|
||||
}
|
||||
else { # No individual ports specified, just process the entire collection
|
||||
tablehead();
|
||||
foreach my $port (@ports) {
|
||||
$count++;
|
||||
htmlrow($count, $port);
|
||||
|
@ -298,16 +254,35 @@ EOH
|
|||
close($fH);
|
||||
}
|
||||
|
||||
print " <p><em>Generated by portspage $version on " . isotime() . ".</em></p>\n";
|
||||
|
||||
print <<EOH;
|
||||
</body>
|
||||
</html>
|
||||
EOH
|
||||
print " <p><em>Generated by portspage $version on " . isotime() . ".</em></p>\n </body>\n</html>";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub tablehead {
|
||||
print " <table width=\"100%\" cellspacing=\"0\">\n";
|
||||
my $CWD = getcwd;
|
||||
my $repo = (split /\//, $CWD)[-1];
|
||||
my $pubkey = "/etc/ports/".$repo.".pub";
|
||||
if ( (-e $pubkey) and open(my $kH, $pubkey) ) {
|
||||
while (my $line = <$kH>) {
|
||||
chomp $line;
|
||||
if ($line !~ "untrusted comment") {
|
||||
print " <tr class=\"header\"><td colspan=\"4\">\n";
|
||||
print " <strong>Signify public key:</strong> $line\n";
|
||||
print " </td></tr>\n";
|
||||
}
|
||||
}
|
||||
close($kH);
|
||||
}
|
||||
print " <tr class=\"header\"><td><strong>Port</strong></td>";
|
||||
print "<td><strong>Version</strong></td><td><strong>Description</strong></td>";
|
||||
if ($options{timestamp_accuracy} > 0) {
|
||||
print "<td><strong>Last modified</strong></td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
sub htmlrow {
|
||||
my ($count, $p) = @_;
|
||||
my ($url, $version, $release, $pver, $desc, $date);
|
||||
|
@ -361,8 +336,7 @@ sub isotime {
|
|||
my $month = sprintf("%02d", $t[4] + 1);
|
||||
my $day = sprintf("%02d", $t[3]);
|
||||
|
||||
if ($accuracy == 1)
|
||||
{
|
||||
if ($accuracy == 1) {
|
||||
return "$year-$month-$day";
|
||||
}
|
||||
|
||||
|
|
|
@ -13,29 +13,29 @@
|
|||
# all necessary header information fields and an empty build() function.
|
||||
# The port name is the name of the current working directory.
|
||||
|
||||
template_dir="/usr/lib/prtcreate"
|
||||
template_dir="/usr/share/prtcreate"
|
||||
templates=()
|
||||
force_write=0
|
||||
|
||||
usage() {
|
||||
echo "invalid template: $1. Available build systems are:"
|
||||
ls -1 $template_dir | sed 's/^/ /'
|
||||
rm Pkgfile
|
||||
for t in "$template_dir"/*; do echo " ${t##*/}"; done
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-h) echo "Usage (in a new port directory): $0 [template]"
|
||||
echo "See /usr/lib/prtcreate for the available templates."
|
||||
exit 0 ;;
|
||||
-f) force_write=1 ;;
|
||||
*) if [ -f "$template_dir/$1" ]; then templates+=("$1");
|
||||
else usage "$1"; fi ;;
|
||||
-h|--help) echo "Usage (in a new port directory): $0 [template]"
|
||||
echo "See $template_dir for the available templates."
|
||||
exit 0 ;;
|
||||
-f|--force) force_write=1 ;;
|
||||
*) if [ -f "$template_dir/$1" ]; then templates+=("$1");
|
||||
else usage "$1"; fi ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -f Pkgfile ] && [ "$force_write" != 1 ]; then
|
||||
if [ -f Pkgfile ] && [ "$force_write" = 0 ]; then
|
||||
echo "Pkgfile exists! Use -f to overwrite."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -113,7 +113,7 @@ FNR==1 {
|
|||
if ((mode["CR"] == 1) && loglevel_ok(FATAL) && FILENAME ~ PKGFILE) {
|
||||
dir = gensub(/\/Pkgfile/,"","g",FILENAME)
|
||||
while ( ("ls -1 --color=none " dir) | getline f ) {
|
||||
if (f ~ /(\.(rar|svn|tgz|tar.(bz2|gz|xz)|zip)|CVS|REPO|index.html)$/)
|
||||
if (f ~ /(\.(rar|svn|tgz|tzst|tar.(bz2|gz|lz|xz|zst)|zip)|CVS|REPO|index.html)$/)
|
||||
perror(FATAL, "invalid file/directory: " f)
|
||||
}
|
||||
}
|
||||
|
|
26
share/portspage/style.html
Normal file
26
share/portspage/style.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Verdana, sans-serif;
|
||||
font-size: 85%;
|
||||
padding: 2em;
|
||||
}
|
||||
table {
|
||||
border: solid #CAD4E9 1px;
|
||||
font-size: 85%;
|
||||
}
|
||||
td { padding: 6px; }
|
||||
tr.header { background-color: #CAD4E9; }
|
||||
tr.odd { background-color: #ECF0F7; }
|
||||
tr.even { background-color: #F7F9FC; }
|
||||
a { color: black; }
|
||||
</style>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
</head>
|
||||
<body>
|
||||
<h2></h2>
|
13
share/prtcreate/perl
Normal file
13
share/prtcreate/perl
Normal file
|
@ -0,0 +1,13 @@
|
|||
# define Name to match the folder unpacked from the tarball,
|
||||
# sometimes simply ${name#p5-} transformed to CamelCase
|
||||
|
||||
cd $Name-$version
|
||||
|
||||
perl Makefile.PL INSTALLDIRS=vendor
|
||||
make OPTIMIZE="$CFLAGS"
|
||||
make DESTDIR="$PKG" install
|
||||
|
||||
find "$PKG" -type f \( -name '*.bs' \
|
||||
-o -name '*.packlist' \
|
||||
-o -name '*.pod' \) -delete
|
||||
find "$PKG" -depth -empty -delete
|
3
share/prtcreate/r
Normal file
3
share/prtcreate/r
Normal file
|
@ -0,0 +1,3 @@
|
|||
cd ${name#r4-}
|
||||
mkdir -p "$PKG"/usr/lib/R/library
|
||||
R CMD INSTALL . -l "$PKG"/usr/lib/R/library
|
Loading…
Reference in New Issue
Block a user