Compare commits
19 Commits
release-0.
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
3224209ff7 | ||
44f3da7c5a | |||
1697d4af31 | |||
1e7a63f5b3 | |||
719575d0fb | |||
38c9a5ef1d | |||
79b47c2223 | |||
47ca04508a | |||
5d700a78e9 | |||
252c46d87e | |||
07429271a3 | |||
c81645af30 | |||
d22ab2d47a | |||
eb5169ddad | |||
9ed253de71 | |||
57f3b29e2e | |||
f769b5251e | |||
|
98a2df234e | ||
|
d9c3b9a04b |
12
ChangeLog
12
ChangeLog
|
@ -1,5 +1,17 @@
|
|||
ChangeLog for pkg-get
|
||||
|
||||
0.4.8 - Fix doscript() to accommodate rootfs other than "/",
|
||||
and ports with dashes in their names
|
||||
- Consolidate code
|
||||
- Do more tasks in parallel when generating the metadata
|
||||
- Update the html index too, when individual packages are passed to
|
||||
pkg-repgen
|
||||
- Use native Perl routines to reduce the number of external processes
|
||||
- Replace wget by curl, to avoid depending on packages outside 'core'
|
||||
- Update man-pages and README
|
||||
|
||||
0.4.7 - Fix man-page location
|
||||
|
||||
0.4.6 - Fixed warnings on output of diff command
|
||||
- Use compression-mode defined in pkgmk.conf
|
||||
- pkg-repgen.pl: Improved prt-get commands and added --prtdir switch
|
||||
|
|
24
Makefile
24
Makefile
|
@ -1,33 +1,27 @@
|
|||
NAME=pkg-get
|
||||
VERSION="0.4.6"
|
||||
VERSION="0.4.8"
|
||||
|
||||
PREFIX=/usr
|
||||
CFGDIR=/etc
|
||||
MANDIR=/usr/share/man
|
||||
|
||||
all:
|
||||
@echo "Use 'make install' to install pkg-get"
|
||||
|
||||
man:
|
||||
#makeman doc/pkg-get.8.txt
|
||||
#makeman doc/pkg-repgen.8.txt
|
||||
#man2ps doc/pkg-get.8 | ps2pdf14 - > doc/pkg-get.pdf
|
||||
|
||||
dist: man
|
||||
dist:
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
mkdir ${NAME}-${VERSION}
|
||||
cp -r doc scripts Makefile ChangeLog COPYING README TODO ${NAME}-${VERSION}
|
||||
rm -f ${NAME}-${VERSION}/doc/*.txt
|
||||
rm -f ${NAME}-${VERSION}/doc/*.pdf
|
||||
mkdir -p ${NAME}-${VERSION}/doc
|
||||
cp -r scripts Makefile ChangeLog COPYING README TODO ${NAME}-${VERSION}
|
||||
cp doc/*.8 ${NAME}-${VERSION}/doc
|
||||
cp doc/*.conf ${NAME}-${VERSION}/doc
|
||||
tar cvzf ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION}
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
|
||||
install:
|
||||
|
||||
install -D -m 755 scripts/pkg-get.pl ${PREFIX}/bin/pkg-get
|
||||
install -D -m 755 scripts/pkg-repgen.pl ${PREFIX}/bin/pkg-repgen
|
||||
install -D -m 755 scripts/pkg-get.pl ${PREFIX}/bin/pkg-get
|
||||
install -D -m 644 doc/pkg-get.8 ${PREFIX}/man/man8/pkg-get.8
|
||||
install -D -m 644 doc/pkg-repgen.8 ${MANDIR}/man8/pkg-repgen.8
|
||||
install -D -m 644 doc/pkg-get.8 ${MANDIR}/man8/pkg-get.8
|
||||
install -D -m 644 doc/pkg-get.conf ${CFGDIR}/pkg-get.conf
|
||||
install -D -m 644 doc/pkg-repgen.8 ${PREFIX}/man/man8/pkg-repgen.8
|
||||
install -D -m 644 doc/pkg-get.8 ${PREFIX}/man/man8/pkg-get.8
|
||||
|
||||
|
|
104
README
104
README
|
@ -1,8 +1,8 @@
|
|||
INTRODUCTION
|
||||
----------------------------------------------------------------------------
|
||||
pkg-get is a package / repository management tool for CRUX Linux.
|
||||
Syntax and features are very close (often a carbon copy)
|
||||
to the ones found in the port management tool 'prt-get'
|
||||
Syntax and features are very close to (often a carbon copy of)
|
||||
the ones found in the port management tool 'prt-get'
|
||||
by Johannes Winkelmann.
|
||||
In fact pkg-get was developed as a prt-get/ports drop-in replacement
|
||||
for systems in which it is preferable to handle binary packages instead
|
||||
|
@ -11,10 +11,10 @@ of compiling ports.
|
|||
|
||||
ARCHITECTURE
|
||||
----------------------------------------------------------------------------
|
||||
The local machines sync metadata files (available packages,
|
||||
readme files, dependencies, etc) from a remote (http or ftp)
|
||||
The client machines sync metadata files (available packages,
|
||||
readme files, dependencies, etc) from a remote server (http or ftp)
|
||||
OR a local path.
|
||||
Once the metadata is present on the local machine, the usual
|
||||
Once the metadata files are on the client machine, the usual
|
||||
operations of installing, removing, getting info on packages
|
||||
are available.
|
||||
|
||||
|
@ -24,15 +24,17 @@ QUICK START
|
|||
Server:
|
||||
A repository can be generated using 'pkg-repgen' in a
|
||||
dir containing packages. It will take a while since md5sums
|
||||
have to be calculated.
|
||||
have to be calculated. Alternatively, you can pass one or
|
||||
more arguments to 'pkg-repgen', indicating the individual
|
||||
packages for which metadata will be created.
|
||||
|
||||
Client:
|
||||
Adjust settings in /etc/pkg-get.conf, then use the 'pkg-get sync'
|
||||
command to gather metadata from the server (if remote). You can now
|
||||
use the commands as described in the manual, i.e.:
|
||||
use the commands as described in the manual, e.g.:
|
||||
|
||||
pkg-get info apache
|
||||
pkg-get depinst kdebase
|
||||
pkg-get depinst qt6-base
|
||||
pkg-get listinst
|
||||
|
||||
See the manual page for a detailed list of commands and options.
|
||||
|
@ -40,5 +42,89 @@ See the manual page for a detailed list of commands and options.
|
|||
|
||||
REQUIREMENTS
|
||||
----------------------------------------------------------------------------
|
||||
For the client nothing outside the CRUX 'core' collection
|
||||
For the client, nothing outside the CRUX 'core' collection
|
||||
For the server, prt-get
|
||||
|
||||
|
||||
LIMITATIONS
|
||||
----------------------------------------------------------------------------
|
||||
The client and the server must be configured to use the same
|
||||
pkgmk compression mode, otherwise the client will try to download
|
||||
a tarball with the wrong suffix. This is only a problem if you sometimes
|
||||
compile ports on the client machine and prefer a different compression mode
|
||||
(better suited to its less-powerful hardware?). By allowing you to maintain
|
||||
your client machine solely with binary packages, pkg-get makes the contents
|
||||
of /etc/pkgmk.conf mostly irrelevant, so you can simply put a verbatim copy
|
||||
of the server's pkgmk.conf on the client machine.
|
||||
|
||||
The pkg-get configuration file does not offer as many settings as the one
|
||||
for prt-get. In particular, you cannot change "addcommand", "rmcommand", or
|
||||
"runscriptscommand"; these are hard-coded as /usr/bin/pkgadd, /usr/bin/pkgrm,
|
||||
and /bin/bash, respectively.
|
||||
|
||||
There is also no intelligent version comparator as in prt-get; the
|
||||
repository and html index are sorted lexographically according to the
|
||||
current setting for $LANG. When multiple versions of a package are found
|
||||
within the active collections, pkg-get will install the latest version in
|
||||
the first collection that contains any such package. This behaviour is akin
|
||||
to how prt-get handles dups, but with additional logic to account for
|
||||
different versions of the built package within the same collection.
|
||||
|
||||
'pkg-get depends' and 'prt-get quickdep' do not handle more than one port,
|
||||
unlike the corresponding commands in prt-get. Therefore it is not as
|
||||
straightforward to preview the list of packages that would be installed,
|
||||
before running a 'depinst' operation with multiple targets.
|
||||
|
||||
The limitation above would have been mitigated by a --test switch.
|
||||
Alas, such a switch is also absent from the design of pkg-get. Use
|
||||
the --test switch with prt-get itself, for the closest preview
|
||||
of what would happen during a 'pkg-get depinst' operation.
|
||||
|
||||
'pkg-get dependent' does not support the --recursive option. Other
|
||||
useful prt-get commands (grpinst, fsearch, deptree, listorphans, ls,
|
||||
cat, edit, cache) have no counterpart in pkg-get. Of these omissions,
|
||||
only the 'grpinst' command is of possible interest for binary package
|
||||
management; the unimplemented commands and options are better handled
|
||||
by prt-get itself. If you want a Perl implementation that does provide
|
||||
these missing commands, consider the script written by user farkuhar [1].
|
||||
|
||||
pkg-get only makes use of the hard dependencies listed by the port
|
||||
maintainer, not any of the eager linking that might have occurred on the
|
||||
build machine. As a result, 'pkg-get depinst $foo' might omit some of the
|
||||
packages needed by $foo. User ppetrov^ has contributed some helper scripts
|
||||
to facilitate the fixing of these broken binaries; visit the site [2] to
|
||||
download them.
|
||||
|
||||
Further omissions related to dependencies are the absence of any mechanism
|
||||
for declaring aliases (e.g., package openjdk16-bin can serve as a drop-in
|
||||
replacement for the listed dependency openjdk16), and the lack of an --ignore
|
||||
switch (to exclude certain packages from being installed in a 'depinst'
|
||||
operation). You can work around these omissions by avoiding 'depinst'
|
||||
entirely, and manually performing the desired 'install' transactions (once
|
||||
you have a clear sense of what the actual runtime dependencies are).
|
||||
|
||||
These gaps in pkg-get's design highlight an awkward fact about trying to
|
||||
erect an infrastructure for binary package management upon a foundation
|
||||
designed for compiling source code (the ports tree). Inheriting the
|
||||
Pkgfile's lack of separation between build-time and runtime dependencies,
|
||||
pkg-get will unwittingly recurse through all the dependencies (in a 'depinst'
|
||||
transaction) and install packages that you might not really need. Hence the
|
||||
suggestion to consider avoiding 'depinst'. But pairing 'install' with the
|
||||
helper script written by ppetrov^ [2] might not be enough to ensure zero
|
||||
breakage, since revdep does not detect every runtime dependency. In the
|
||||
end, you might have to manually interpolate between the (maximal) footprint
|
||||
recommended by 'pkg-get depinst' and the (minimal) footprint recommended by
|
||||
'revlibpkg' [2].
|
||||
|
||||
In handling any new hard dependencies added by the maintainer since
|
||||
the previous version of a package, pkg-get performs a sysup in the same
|
||||
manner as the original prt-get (i.e., new dependencies are not injected
|
||||
by default). With binary packages there's no need to carry out the
|
||||
installation in any particular order, so the lack of dependency injection is
|
||||
actually less of a problem for pkg-get than it was for prt-get. Combining
|
||||
'pkg-get depends $foo | grep "\[ \]"' with the output of 'revlibpkg $foo'
|
||||
should help identify the packages you will need to install to fix any
|
||||
breakage in $foo.
|
||||
|
||||
[1] https://git.sdf.org/jmq/Documentation/src/branch/master/scripts/prt-auf
|
||||
[2] https://github.com/slackalaxy/depsck
|
||||
|
|
15
TODO
15
TODO
|
@ -4,8 +4,17 @@ TODO file for pkg-get
|
|||
|
||||
- add more commands:
|
||||
- deptree (?)
|
||||
- lock/unlock/listlocked (?)
|
||||
- grpinst (?)
|
||||
|
||||
- optimize the pkg-repgen script
|
||||
- allow 'depends' and 'quickdep' to process multiple arguments
|
||||
|
||||
- improve pkg-get help information
|
||||
- let the user control whether pkg-repgen prints the metadata only for the
|
||||
latest built package, or for all the versions in the directory
|
||||
|
||||
- allow 'sysup' to inject new dependencies (?)
|
||||
|
||||
- add a --test switch (?)
|
||||
|
||||
- add an --ignore switch (?)
|
||||
|
||||
- switch from MD5 to a different hash function (?)
|
||||
|
|
162
doc/pkg-get.8
162
doc/pkg-get.8
|
@ -1,75 +1,78 @@
|
|||
." Text automatically generated by txt2man-1.4.7
|
||||
.TH pkg-get 8 "July 13, 2006" "" ""
|
||||
.SH NAME
|
||||
\fBpkg-get \fP- a package management tool for CRUX Linux
|
||||
\fBpkg\-get \fP- a package management tool for CRUX Linux
|
||||
\fB
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.fam C
|
||||
\fBpkg-get\fP \fIcommand\fP <arguments> [\fIoptions\fP]
|
||||
\fBpkg\-get\fP \fIcommand\fP <arguments> [\fIoptions\fP]
|
||||
.fam T
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
\fBpkg-get\fP is a simple package management tool for CRUX Linux.
|
||||
\fBpkg\-get\fP is a simple package management tool for CRUX Linux.
|
||||
It tries to replicate some of the most useful features of the
|
||||
port management tool \fBprt-get\fP(8) to be used with binary packages.
|
||||
\fBpkg-get\fP requires a remote or local package repository that
|
||||
port management tool \fBprt\-get\fP(8) to be used with binary packages.
|
||||
\fBpkg\-get\fP requires a remote or local package repository that
|
||||
can be generated by repository maintainers with the
|
||||
\fBpkg-repgen\fP(8) script.
|
||||
\fBpkg\-repgen\fP(8) script.
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
.B
|
||||
install <package1> [<package2>..<packageN>]
|
||||
Install given packages,
|
||||
download if necessary.
|
||||
Install given packages, download if necessary.
|
||||
.TP
|
||||
.B
|
||||
update <package1> [<package2>..<packageN>]
|
||||
Update given packages,
|
||||
download if necessary.
|
||||
Update given packages, download if necessary.
|
||||
.TP
|
||||
.B
|
||||
diff [\fB--all\fP]
|
||||
Show a list of outdated packages. The \fB--all\fP option also displays locked packages.
|
||||
diff [\fB\-\-all\fP]
|
||||
Show a list of outdated packages.
|
||||
The \fB\-\-all\fP option also displays locked packages.
|
||||
.TP
|
||||
.B
|
||||
quickdiff
|
||||
Show a compact list of outdated packages.
|
||||
.TP
|
||||
.B
|
||||
sysup
|
||||
Update all outdated packages. Download if necessary.
|
||||
sysup [\fB--all\fP]
|
||||
Update all outdated packages, download if necessary.
|
||||
Locked packages are excluded from the operation
|
||||
unless \fB--all\fP is passed.
|
||||
.TP
|
||||
.B
|
||||
depinst <package1> [<package2>..<packageN>]
|
||||
Install given packages
|
||||
and relative dependencies.
|
||||
Install given packages and relative dependencies.
|
||||
.TP
|
||||
.B
|
||||
depends <package>
|
||||
Show a recursive list of dependencies for package
|
||||
Show a recursive list of dependencies for <package>
|
||||
and their installation status.
|
||||
.TP
|
||||
.B
|
||||
dependent <package> [\fB--all\fP]
|
||||
Show installed (or all with the \fB--all\fP option) packages
|
||||
that depend from package.
|
||||
quickdep <package>
|
||||
Show a brief list of dependencies for <package>.
|
||||
.TP
|
||||
.B
|
||||
quickdep <package>
|
||||
Show a brief list of dependencies for package.
|
||||
dependent <package> [\fB\-\-all\fP]
|
||||
Show installed (or all with the \fB\-\-all\fP option) packages
|
||||
that depend on <package>.
|
||||
.TP
|
||||
.B
|
||||
path <package>
|
||||
Show local path of <package>.
|
||||
.TP
|
||||
.B
|
||||
info <package>
|
||||
Show information about package.
|
||||
Show information about <package>.
|
||||
.TP
|
||||
.B
|
||||
current <package>
|
||||
Show currently installed version of package.
|
||||
.TP
|
||||
.B
|
||||
path <package>
|
||||
Show local path of package.
|
||||
isinst <package>
|
||||
Display whether a package is installed.
|
||||
.TP
|
||||
.B
|
||||
readme <package>
|
||||
|
@ -77,33 +80,29 @@ Print README information (if available) for the package.
|
|||
.TP
|
||||
.B
|
||||
list
|
||||
List all packages in the repository.
|
||||
List all packages in the active repositories.
|
||||
.TP
|
||||
.B
|
||||
listinst
|
||||
List all installed packages.
|
||||
.TP
|
||||
.B
|
||||
isinst <package>
|
||||
Display whether a package is installed.
|
||||
.TP
|
||||
.B
|
||||
dsearch <string>
|
||||
Search for packages which name or description contain <string>.
|
||||
Search for packages whose name or description contains <string>.
|
||||
.TP
|
||||
.B
|
||||
search <string>
|
||||
Search for packages which name contains <string>.
|
||||
Search for packages whose name contains <string>.
|
||||
.TP
|
||||
.B
|
||||
dup
|
||||
List all duplicates ports (present in more than one repository).
|
||||
List all duplicate ports (present in more than one repository).
|
||||
.TP
|
||||
.B
|
||||
printf <format string1> [\fB--filter\fP=<filter>]
|
||||
Description blatantly
|
||||
stolen from prt-get man file. Print formatted port list. Format string can
|
||||
contain variables, which are replaced like this:
|
||||
printf <format string1> [\fB\-\-filter\fP=<filter>]
|
||||
Description blatantly stolen from \fBprt\-get\fP(8).
|
||||
Print formatted port list. Format string can contain variables,
|
||||
which are replaced like this:
|
||||
.RS
|
||||
.IP \(bu 3
|
||||
%n -> name
|
||||
|
@ -126,9 +125,9 @@ contain variables, which are replaced like this:
|
|||
.IP \(bu 3
|
||||
%O -> post-install script ("yes"/"no")
|
||||
.IP \(bu 3
|
||||
%M -> "Nobody". for compatibility with prt-get
|
||||
%M -> "None". for compatibility with prt-get
|
||||
.IP \(bu 3
|
||||
%P -> "Nobody". for compatibility with prt-get
|
||||
%P -> "None". for compatibility with prt-get
|
||||
.IP \(bu 3
|
||||
%l -> is locked ("yes"/"no")
|
||||
.IP \(bu 3
|
||||
|
@ -138,13 +137,13 @@ repository.
|
|||
.RE
|
||||
.PP
|
||||
Use "\\n" and "\\t" to format your output (no additional format
|
||||
specified suported). The optional format string2 can contain the
|
||||
codes suported). The optional format string2 can contain the
|
||||
same variables as format string1 and is used to sort the output.
|
||||
You can specify a wildcard filter to filter by package name.
|
||||
.TP
|
||||
.B
|
||||
lock <package1> [<package2>..<packageN>]
|
||||
Lock a package (ignore updates).
|
||||
Lock a package (exclude it from being updated in a \fBsysup\fP).
|
||||
.TP
|
||||
.B
|
||||
unlock <package1> [<package2>..<packageN>]
|
||||
|
@ -160,54 +159,71 @@ Syncronize local packages with the ones from the remote repository.
|
|||
If the repository is local, this \fIcommand\fP does nothing.
|
||||
.TP
|
||||
.B
|
||||
sysup
|
||||
Update all outdated packages.
|
||||
.TP
|
||||
.B
|
||||
help
|
||||
Display brief help screen.
|
||||
Display brief help screen.
|
||||
.TP
|
||||
.B
|
||||
version
|
||||
Show \fBpkg-get\fP version.
|
||||
.SH OPTIONS
|
||||
Show \fBpkg\-get\fP version.
|
||||
.SH OPTIONSB
|
||||
.TP
|
||||
.B
|
||||
\fB-r\fP <root>
|
||||
Use <root> directory when wrapping pkgadd. Note that
|
||||
this only works with update / install !
|
||||
\fB\-do\fP
|
||||
Download only. Applicable to: sysup, install, depinst, update.
|
||||
.TP
|
||||
.B
|
||||
\fB-do\fP
|
||||
Download only. Applicable to: sysup, depinst, install, update.
|
||||
.TP
|
||||
.B
|
||||
\fB-f\fP
|
||||
\fB\-f\fP
|
||||
Force installing / upgrading. This is passed to \fBpkgadd\fP(8).
|
||||
.TP
|
||||
.B
|
||||
\fB-im\fP
|
||||
\fB\-im\fP
|
||||
Ignore md5sum mismatches.
|
||||
.TP
|
||||
.B
|
||||
\fB--aargs\fP="arguments"
|
||||
pass the specified arguments to \fBpkgadd\fP(8).
|
||||
\fB\-\-aargs\fP="arguments"
|
||||
Pass the specified arguments to \fBpkgadd\fP(8).
|
||||
.TP
|
||||
.B
|
||||
\fB--config\fP=/path/to/file
|
||||
\fB\-\-config\fP=/path/to/file
|
||||
Use the specified configuration file.
|
||||
.TP
|
||||
.B
|
||||
\fB--pre-install\fP
|
||||
executes pre-install script if available.
|
||||
\fB\-r\fP <root>
|
||||
Use <root> directory for operations involving the package database
|
||||
(install, depinst, update, isinst, current, listinst, diff, quickdiff, sysup).
|
||||
This option does not affect the directories from which \fBpkg\-get\fP loads the
|
||||
metadata or tarballs; those settings are still governed by the entries in
|
||||
the configuration file.
|
||||
|
||||
When using \fB\-r\fP <root>, the relevant pkgadd.conf is the one on the
|
||||
target filesystem, not the one where \fBpkg\-get\fP is running. Any custom
|
||||
directives in your pkgadd.conf should be copied to the corresponding
|
||||
location under the new root, or else you should pass the \fB\-\-aargs\fP
|
||||
option to tell \fBpkgadd\fP to read its configuration from a non-standard
|
||||
location.
|
||||
|
||||
When combined with \fB\-\-pre\-install\fP or \fB\-\-post\-install\fP or
|
||||
\fB\-\-install\-scripts\fP, setting a root directory other than '/' has the
|
||||
side effect of copying the PKGINST shell script into the corresponding
|
||||
location under the new root. This action (and the subsequent chroot command)
|
||||
is the most direct way to accommodate the user's intention. Unfortunately it
|
||||
clutters the mounted volume with a small fragment of shell script. If such
|
||||
clutter is not desired, the option \fB\-r\fP <root> should always be paired
|
||||
with the configuration setting 'runscripts no', leaving it up to the
|
||||
administrator of the mounted volume to perform any pre- or post-install
|
||||
tasks separately.
|
||||
.TP
|
||||
.B
|
||||
\fB--post-install\fP
|
||||
executes post-install script if available.
|
||||
\fB\-\-pre\-install\fP
|
||||
Execute pre-install script if available.
|
||||
.TP
|
||||
.B
|
||||
\fB--install-scripts\fP
|
||||
executes pre-install and post-install
|
||||
\fB\-\-post\-install\fP
|
||||
Execute post-install script if available.
|
||||
.TP
|
||||
.B
|
||||
\fB\-\-install\-scripts\fP
|
||||
Execute pre-install and post-install
|
||||
scripts if available.
|
||||
.RE
|
||||
.PP
|
||||
|
@ -218,17 +234,17 @@ Configuration is handled by the /etc/pkg-get.conf file,
|
|||
.SH EXAMPLES
|
||||
.TP
|
||||
.B
|
||||
\fBpkg-get\fP install sqlite pysqlite
|
||||
\fBpkg\-get\fP install sqlite pysqlite
|
||||
Install sqlite and pysqlite.
|
||||
.TP
|
||||
.B
|
||||
\fBpkg-get\fP depinst kdebase \fB-f\fP
|
||||
Install kdebase and all its dependencies, forcing upgrade.
|
||||
\fBpkg\-get\fP depinst qt6-base \fB\-f\fP
|
||||
Install qt6-base and all its dependencies, forcing upgrade.
|
||||
.TP
|
||||
.B
|
||||
\fBpkg-get\fP sysup \fB-do\fP
|
||||
\fBpkg\-get\fP sysup \fB\-do\fP
|
||||
Download new releases of all the outdated packages.
|
||||
.SH AUTHORS
|
||||
Simone Rota <sip@varlock.com>
|
||||
Simone Rota <sip@varlock.com>, John McQuah <jmcquah@disroot.org>
|
||||
.SH SEE ALSO
|
||||
\fBpkgadd\fP(8), \fBprt-get\fP(8)
|
||||
\fBpkgadd\fP(8), \fBprt\-get\fP(8), \fBpkg\-repgen\fP(8)
|
||||
|
|
|
@ -1,101 +1,209 @@
|
|||
pkg-get(8)
|
||||
|
||||
NAME
|
||||
pkg-get - a package management tool for CRUX Linux
|
||||
pkg-get - a package management tool for CRUX Linux
|
||||
|
||||
SYNOPSIS
|
||||
pkg-get command <arguments> [options]
|
||||
pkg-get command <arguments> [options]
|
||||
|
||||
DESCRIPTION
|
||||
pkg-get is a simple package management tool for CRUX Linux.
|
||||
It tries to replicate some of the most useful features of the
|
||||
port management tool prt-get(8) to be used with binary packages.
|
||||
pkg-get requires a remote or local package repository that
|
||||
can be generated by repository maintainers with the
|
||||
pkg-repgen(8) script.
|
||||
pkg-get is a simple package management tool for CRUX Linux. It
|
||||
tries to replicate some of the most useful features of the port
|
||||
management tool prt-get(8) to be used with binary packages.
|
||||
pkg-get requires a remote or local package repository that can be
|
||||
generated by repository maintainers with the pkg-repgen(8) script.
|
||||
|
||||
COMMANDS
|
||||
install <package1> [<package2>..<packageN>] Install given packages,
|
||||
download if necessary.
|
||||
update <package1> [<package2>..<packageN>] Update given packages,
|
||||
download if necessary.
|
||||
diff [--all] Show a list of outdated packages. The --all option also displays locked packages.
|
||||
quickdiff Show a compact list of outdated packages.
|
||||
sysup Update all outdated packages. Download if necessary.
|
||||
depinst <package1> [<package2>..<packageN>] Install given packages
|
||||
and relative dependencies.
|
||||
depends <package> Show a recursive list of dependencies for package
|
||||
and their installation status.
|
||||
dependent <package> [--all] Show installed (or all with the --all option) packages
|
||||
that depend from package.
|
||||
quickdep <package> Show a brief list of dependencies for package.
|
||||
info <package> Show information about package.
|
||||
current <package> Show currently installed version of package.
|
||||
path <package> Show local path of package.
|
||||
readme <package> Print README information (if available) for the package.
|
||||
list List all packages in the repository.
|
||||
listinst List all installed packages.
|
||||
isinst <package> Display whether a package is installed.
|
||||
dsearch <string> Search for packages which name or description contain <string>.
|
||||
search <string> Search for packages which name contains <string>.
|
||||
dup List all duplicates ports (present in more than one repository).
|
||||
printf <format string1> [--filter=<filter>] Description blatantly
|
||||
stolen from prt-get man file. Print formatted port list. Format string can
|
||||
contain variables, which are replaced like this:
|
||||
- %n -> name
|
||||
- %p -> path
|
||||
- %v -> version
|
||||
- %r -> release
|
||||
- %d -> description
|
||||
- %e -> dependencies
|
||||
- %u -> url
|
||||
- %R -> Readme ("yes"/"no")
|
||||
- %E -> pre-install script ("yes"/"no")
|
||||
- %O -> post-install script ("yes"/"no")
|
||||
- %M -> "Nobody". for compatibility with prt-get
|
||||
- %P -> "Nobody". for compatibility with prt-get
|
||||
- %l -> is locked ("yes"/"no")
|
||||
- %i -> "no" if not installed, "yes" if it's installed and up to
|
||||
date and "diff" if it's installed and a new version is in the
|
||||
repository.
|
||||
|
||||
Use "\\n" and "\\t" to format your output (no additional format
|
||||
specified suported). The optional format string2 can contain the
|
||||
same variables as format string1 and is used to sort the output.
|
||||
You can specify a wildcard filter to filter by package name.
|
||||
install <package1> [<package2>..<packageN>]
|
||||
Install given packages, download if necessary.
|
||||
|
||||
lock <package1> [<package2>..<packageN>] Lock a package (ignore updates).
|
||||
unlock <package1> [<package2>..<packageN>] Unlock a package.
|
||||
listlocked Display a list of locked packages.
|
||||
sync Syncronize local packages with the ones from the remote repository.
|
||||
If the repository is local, this command does nothing.
|
||||
sysup Update all outdated packages.
|
||||
help Display brief help screen.
|
||||
version Show pkg-get version.
|
||||
|
||||
OPTIONS
|
||||
-r <root> Use <root> directory when wrapping pkgadd. Note that
|
||||
this only works with update / install !
|
||||
-do Download only. Applicable to: sysup, depinst, install, update.
|
||||
-f Force installing / upgrading. This is passed to pkgadd(8).
|
||||
-im Ignore md5sum mismatches.
|
||||
--aargs="arguments" pass the specified arguments to pkgadd(8).
|
||||
--config=/path/to/file Use the specified configuration file.
|
||||
--pre-install executes pre-install script if available.
|
||||
--post-install executes post-install script if available.
|
||||
--install-scripts executes pre-install and post-install
|
||||
scripts if available.
|
||||
update <package1> [<package2>..<packageN>]
|
||||
Update given packages, download if necessary.
|
||||
|
||||
diff [--all]
|
||||
Show a list of outdated packages. The --all option
|
||||
also dis‐ plays locked packages.
|
||||
|
||||
quickdiff
|
||||
Show a compact list of outdated packages.
|
||||
|
||||
sysup [--all]
|
||||
Update all outdated packages, download if necessary.
|
||||
Locked packages are excluded from the operation unless
|
||||
--all is passed.
|
||||
|
||||
depinst <package1> [<package2>..<packageN>]
|
||||
Install given packages and relative dependencies.
|
||||
|
||||
depends <package>
|
||||
Show a recursive list of dependencies for <package>
|
||||
and their installation status.
|
||||
|
||||
quickdep <package>
|
||||
Show a brief list of dependencies for <package>.
|
||||
|
||||
dependent <package> [--all]
|
||||
Show installed (or all with the --all option) packages
|
||||
that de‐ pend on <package>.
|
||||
|
||||
path <package>
|
||||
Show local path of <package>.
|
||||
|
||||
info <package>
|
||||
Show information about <package>.
|
||||
|
||||
current <package>
|
||||
Show currently installed version of package.
|
||||
|
||||
isinst <package>
|
||||
Display whether a package is installed.
|
||||
|
||||
readme <package>
|
||||
Print README information (if available) for the package.
|
||||
|
||||
list List all packages in the active repositories.
|
||||
|
||||
listinst
|
||||
List all installed packages.
|
||||
|
||||
dsearch <string>
|
||||
Search for packages whose name or description contains
|
||||
<string>.
|
||||
|
||||
search <string>
|
||||
Search for packages whose name contains <string>.
|
||||
|
||||
dup List all duplicate ports (present in more than one
|
||||
repository).
|
||||
|
||||
printf <format string1> [--filter=<filter>]
|
||||
Description blatantly stolen from prt-get(8). Print
|
||||
formatted port list. Format string can contain variables,
|
||||
which are re‐ placed like this:
|
||||
|
||||
• %n -> name
|
||||
|
||||
• %p -> path
|
||||
|
||||
• %v -> version
|
||||
|
||||
• %r -> release
|
||||
|
||||
• %d -> description
|
||||
|
||||
• %e -> dependencies
|
||||
|
||||
• %u -> url
|
||||
|
||||
• %R -> Readme ("yes"/"no")
|
||||
|
||||
• %E -> pre-install script ("yes"/"no")
|
||||
|
||||
• %O -> post-install script ("yes"/"no")
|
||||
|
||||
• %M -> "None". for compatibility with prt-get
|
||||
|
||||
• %P -> "None". for compatibility with prt-get
|
||||
|
||||
• %l -> is locked ("yes"/"no")
|
||||
|
||||
• %i -> "no" if not installed, "yes" if it's installed
|
||||
and up to date and "diff" if it's installed and a new
|
||||
version is in the repository.
|
||||
|
||||
Use "\n" and "\t" to format your output (no additional format
|
||||
codes supported). The optional format string2 can contain the
|
||||
same variables as format string1 and is used to sort the output.
|
||||
You can specify a wildcard filter to filter by package name.
|
||||
|
||||
lock <package1> [<package2>..<packageN>]
|
||||
Lock a package (exclude it from being updated in a sysup).
|
||||
|
||||
unlock <package1> [<package2>..<packageN>]
|
||||
Unlock a package.
|
||||
|
||||
listlocked
|
||||
Display a list of locked packages.
|
||||
|
||||
sync Syncronize local packages with the ones from the remote
|
||||
repository. If the repository is local, this command does
|
||||
nothing.
|
||||
|
||||
help Display brief help screen.
|
||||
|
||||
version
|
||||
Show pkg-get version.
|
||||
|
||||
OPTIONSB
|
||||
-do Download only. Applicable to: sysup, install, depinst,
|
||||
update.
|
||||
|
||||
-f Force installing / upgrading. This is passed to pkgadd(8).
|
||||
|
||||
-im Ignore md5sum mismatches.
|
||||
|
||||
--aargs="arguments"
|
||||
Pass the specified arguments to pkgadd(8).
|
||||
|
||||
--config=/path/to/file
|
||||
Use the specified configuration file.
|
||||
|
||||
-r <root>
|
||||
Use <root> directory for operations involving the package
|
||||
database (install, depinst, update, isinst, current,
|
||||
listinst, diff, quickdiff, sysup). This option does
|
||||
not affect the directories from which pkg-get loads the
|
||||
metadata or tarballs; those settings are still
|
||||
governed by the entries in the configuration file.
|
||||
|
||||
When using -r <root>, the relevant pkgadd.conf is the one
|
||||
on the target filesystem, not the one where pkg-get is
|
||||
running. Any custom directives in your pkgadd.conf should
|
||||
be copied to the corresponding location under the
|
||||
new root, or else you should pass the --aargs option to
|
||||
tell pkgadd to read its configuration from a non-standard
|
||||
location.
|
||||
|
||||
When combined with --pre-install or --post-install
|
||||
or --install-scripts, setting a root directory other
|
||||
than '/' has the side effect of copying the PKGINST
|
||||
shell script into the corresponding location under
|
||||
the new root. This action (and the subsequent chroot
|
||||
command) is the most direct way to accommodate the user's
|
||||
intention. Unfortunately it clutters the mounted volume
|
||||
with a small fragment of shell script. If such clutter
|
||||
is not desired, the option -r <root> should always be
|
||||
paired with the configuration setting 'runscripts no',
|
||||
leaving it up to the administrator of the mounted volume
|
||||
to perform any pre- or post- install tasks separately.
|
||||
|
||||
--pre-install
|
||||
Execute pre-install script if available.
|
||||
|
||||
--post-install
|
||||
Execute post-install script if available.
|
||||
|
||||
--install-scripts
|
||||
Execute pre-install and post-install scripts if available.
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
Configuration is handled by the /etc/pkg-get.conf file,
|
||||
options are explained in the file itself.
|
||||
|
||||
Configuration is handled by the /etc/pkg-get.conf file, options
|
||||
are explained in the file itself.
|
||||
|
||||
EXAMPLES
|
||||
pkg-get install sqlite pysqlite Install sqlite and pysqlite.
|
||||
pkg-get depinst kdebase -f Install kdebase and all its dependencies, forcing upgrade.
|
||||
pkg-get sysup -do Download new releases of all the outdated packages.
|
||||
pkg-get install sqlite pysqlite
|
||||
Install sqlite and pysqlite.
|
||||
|
||||
pkg-get depinst qt6-base -f
|
||||
Install qt6-base and all its dependencies, forcing upgrade.
|
||||
|
||||
pkg-get sysup -do
|
||||
Download new releases of all the outdated packages.
|
||||
|
||||
AUTHORS
|
||||
Simone Rota <sip@varlock.com>
|
||||
Simone Rota <sip@varlock.com>, John McQuah <jmcquah@disroot.org>
|
||||
|
||||
SEE ALSO
|
||||
pkgadd(8), prt-get(8)
|
||||
pkgadd(8), prt-get(8), pkg-repgen(8)
|
||||
|
||||
July 13, 2006 pkg-get(8)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# pkg-get configuration file
|
||||
|
||||
# package repositories (remote)
|
||||
# The first two are remote repoistories, the last is a local one
|
||||
# The first two are remote repositories, the last is a local one
|
||||
pkgdir /usr/packages/server|http://www.somesite.com/packages
|
||||
pkgdir /usr/packages/java|http://www.foobar.com/java
|
||||
pkgdir /usr/packages/games
|
||||
|
|
|
@ -1,47 +1,45 @@
|
|||
." Text automatically generated by txt2man-1.4.7
|
||||
.TH pkg-repgen 8 "July 13, 2006" "" ""
|
||||
.TH pkg-repgen 8 "September 12, 2023" "" ""
|
||||
.SH NAME
|
||||
\fBpkg-repgen \fP- generate a package repository for pkg-get
|
||||
\fBpkg\-repgen \fP- generate a package repository for pkg-get
|
||||
\fB
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.fam C
|
||||
\fBpkg-repgen\fP [options][package1\.\.\.packageN]
|
||||
\fBpkg\-repgen\fP [options] [directory [package1\.\.\.packageN]]
|
||||
.fam T
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
\fBpkg-repgen\fP generates files needed by a \fBpkg-get\fP(8) package
|
||||
\fBpkg\-repgen\fP generates files needed by a \fBpkg\-get\fP(8) package
|
||||
repository. It also generates a html index of the packages.
|
||||
.SH USAGE
|
||||
run \fBpkg-repgen\fP from the directory containing packages to
|
||||
generate the whole repository.
|
||||
Specify a list of package names to update only those packages
|
||||
(this is expecially useful with large repositories).
|
||||
Note that the html index is not updated when single
|
||||
packages are specified.
|
||||
Run \fBpkg\-repgen\fP \fI<dir>\fP to generate the whole repository of packages
|
||||
found in \fI<dir>\fP. Or to accomplish the same, \fBcd\fP \fI<dir>\fP \fB&&
|
||||
pkg\-repgen\fP. Any additional arguments after \fI<dir>\fP will be interpreted
|
||||
as the specific package names you want updated (this is especially useful with
|
||||
large repositories). Even when individual packages are specified, the entire
|
||||
directory is still processed to collect all the readmes and {pre,post}-install
|
||||
scripts.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B
|
||||
\fB--header\fP=FILE
|
||||
\fB\-\-header\fP=FILE
|
||||
insert FILE at the beginning of the html index
|
||||
.TP
|
||||
.B
|
||||
\fB--header\fP=FILE
|
||||
insert FILE at the beginning of the html index
|
||||
.TP
|
||||
.B
|
||||
\fB--title\fP=title
|
||||
\fB\-\-title\fP=title
|
||||
use the specified title for the index page
|
||||
.TP
|
||||
.B
|
||||
\fB--prtdir\fP=DIR
|
||||
\fB\-\-prtdir\fP=DIR
|
||||
use alternative prtdir for prt-get commands
|
||||
.SH EXAMPLES
|
||||
\fBpkg-repgen\fP
|
||||
\fBpkg\-repgen\fP
|
||||
.PP
|
||||
\fBpkg-repgen\fP kdebase kdelibs
|
||||
\fBpkg\-repgen\fP /home/sip/packages
|
||||
.PP
|
||||
\fBpkg\-repgen\fP . qt6-base qt6-tools
|
||||
.SH AUTHORS
|
||||
Simone Rota <sip@varlock.com>
|
||||
Simone Rota <sip@varlock.com>, John McQuah <jmcquah@disroot.org>
|
||||
index generation code adapted from Jukka Heino's portspage
|
||||
.SH SEE ALSO
|
||||
\fBpkg-get\fP(8), \fBprt-get\fP(8)
|
||||
\fBpkg\-get\fP(8), \fBprt\-get\fP(8)
|
||||
|
|
|
@ -1,35 +1,46 @@
|
|||
pkg-repgen(8)
|
||||
|
||||
NAME
|
||||
pkg-repgen - generate a package repository for pkg-get
|
||||
pkg-repgen - generate a package repository for pkg-get
|
||||
|
||||
SYNOPSIS
|
||||
pkg-repgen [options][package1...packageN]
|
||||
pkg-repgen [options] [directory [package1...packageN]]
|
||||
|
||||
DESCRIPTION
|
||||
pkg-repgen generates files needed by a pkg-get(8) package
|
||||
repository. It also generates a html index of the packages.
|
||||
pkg-repgen generates files needed by a pkg-get(8) package
|
||||
repository. It also generates a html index of the packages.
|
||||
|
||||
USAGE
|
||||
run pkg-repgen from the directory containing packages to
|
||||
generate the whole repository.
|
||||
Specify a list of package names to update only those packages
|
||||
(this is expecially useful with large repositories).
|
||||
Note that the html index is not updated when single
|
||||
packages are specified.
|
||||
Run pkg-repgen <dir> to generate the whole repository of packages
|
||||
found in <dir>. Or to accomplish the same, cd <dir> && pkg-repgen.
|
||||
Any additional arguments after <dir> will be interpreted as the
|
||||
specific package names you want updated (this is especially useful
|
||||
with large repositories). Even when individual packages are specified,
|
||||
the entire directory is still processed to collect all the readmes
|
||||
and {pre,post}-install scripts.
|
||||
|
||||
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
|
||||
--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
|
||||
|
||||
pkg-repgen kdebase kdelibs
|
||||
pkg-repgen
|
||||
|
||||
pkg-repgen /home/sip/packages
|
||||
|
||||
pkg-repgen . qt6-base qt6-tools
|
||||
|
||||
AUTHORS
|
||||
Simone Rota <sip@varlock.com>
|
||||
index generation code adapted from Jukka Heino's portspage
|
||||
Simone Rota <sip@varlock.com>, John McQuah <jmcquah@disroot.org>
|
||||
index generation code adapted from Jukka Heino's portspage
|
||||
|
||||
SEE ALSO
|
||||
pkg-get(8), prt-get(8)
|
||||
pkg-get(8), prt-get(8)
|
||||
|
||||
September 12, 2023 pkg-repgen(8)
|
||||
|
|
1648
scripts/pkg-get.pl
1648
scripts/pkg-get.pl
File diff suppressed because it is too large
Load Diff
|
@ -6,12 +6,13 @@
|
|||
#
|
||||
# html index generation code adapted from Jukka Heino's portspage
|
||||
#
|
||||
# usage: pkg-repgen [<pkgname1>..<pkgnameN>]
|
||||
# usage: pkg-repgen [options] [directory [pkgname1..pkgnameN]]
|
||||
#
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Digest::file qw(digest_file_hex);
|
||||
|
||||
our $prtget = "/usr/bin/prt-get"; our $prtdir;
|
||||
our $title = "CRUX Packages"; our $header; our $footer;
|
||||
|
@ -21,238 +22,379 @@ GetOptions("prtdir=s"=>\$prtdir, "title=s"=>\$title, "header=s"=>\$header, "foot
|
|||
our $compress = "gz";
|
||||
open CONFIG, "/etc/pkgmk.conf" or die "Could not open /etc/pkgmk.conf";
|
||||
while (<CONFIG>) {
|
||||
$compress = $1 if m/^PKGMK_COMPRESSION_MODE="(.*)"\n/;
|
||||
$compress = $1 if m/^PKGMK_COMPRESSION_MODE=(.*)(\#|$)/;
|
||||
}
|
||||
close CONFIG;
|
||||
$compress =~ s/["' ]//g;
|
||||
|
||||
if ($#ARGV >= 0) { # single packages
|
||||
pkgrepo_single();
|
||||
pkgdeps_single();
|
||||
pkgread();
|
||||
pkginst();
|
||||
} else {
|
||||
if ($prtdir) {
|
||||
$prtget = "$prtget --no-std-config --config-set=\"prtdir $prtdir\"";
|
||||
}
|
||||
pkgrepo();
|
||||
pkgdeps();
|
||||
pkgread();
|
||||
pkginst();
|
||||
}
|
||||
$prtget .= " --no-std-config --config-set=\"prtdir $prtdir\"" if ($prtdir);
|
||||
|
||||
######################## single packages ########################
|
||||
my @packages; my %isDup;
|
||||
|
||||
# generate dependencies
|
||||
sub pkgdeps_single {
|
||||
print "+ Generating dependencies\n";
|
||||
my $hasnew = 0;
|
||||
foreach my $p (@ARGV) {
|
||||
my @packages = glob("$p#*.pkg.tar.$compress");
|
||||
if ($#packages == 0) {
|
||||
my $found = 0;
|
||||
my $package = $packages[0];
|
||||
$package =~ s/#.*//;
|
||||
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.
|
||||
open (my $fh, '>>PKGDEPS');
|
||||
printf $fh "%-30s : %-s\n", $package, $deps;
|
||||
close $fh;
|
||||
$hasnew = 1;
|
||||
} else {
|
||||
system("sed -i \"/^$p /s/: .*\$/: $deps/\" PKGDEPS");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
print "Package '$p' not found or duplicate\n"
|
||||
}
|
||||
sub pkg_mtime {
|
||||
my $aName = $a; my $bName = $b;
|
||||
my $aTime; my $bTime;
|
||||
$aName =~ s/#.*//;
|
||||
$bName =~ s/#.*//;
|
||||
if ($aName lt $bName) { return -1; }
|
||||
elsif ($aName gt $bName) { return 1; }
|
||||
else {
|
||||
$aTime = (stat $a)[9];
|
||||
$bTime = (stat $b)[9];
|
||||
}
|
||||
if ($hasnew == 1){system("sort -o PKGDEPS PKGDEPS")};
|
||||
if ($aTime le $bTime) { return -1; }
|
||||
else { return 1; }
|
||||
}
|
||||
|
||||
# generate the main repository file
|
||||
sub pkgrepo_single {
|
||||
print "+ Generating repository\n";
|
||||
my $hasnew = 0;
|
||||
foreach my $p (@ARGV) {
|
||||
my @packages = glob("$p#*.pkg.tar.$compress");
|
||||
if ($#packages == 0) {
|
||||
my $found = 0;
|
||||
my $package = $packages[0];
|
||||
my $name = $package;
|
||||
$name =~ s/#.*//;
|
||||
my $du = (-s $package);
|
||||
my $md5 = `md5sum $package`;
|
||||
$md5 =~ s/ .*$|\n//g;
|
||||
my $des=`$prtget printf %d --filter="$name"`;
|
||||
$des =~ s/:/ /g;
|
||||
if ($des eq ""){$des = "N.A."};
|
||||
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
|
||||
open (my $fh, '>>PKGREPO');
|
||||
printf $fh "%-s:%-s:%-s:%-s:%-s\n", $package,$du,$md5,$des,$flags;
|
||||
close $fh;
|
||||
$hasnew = 1;
|
||||
} else {
|
||||
my $newp = "$package:$du:$md5:$des:$flags";
|
||||
system("sed -i \"s/^$p#.*\$/$newp/\" PKGREPO");
|
||||
}
|
||||
#printf $fh "%-s:%-s:%-s:%-s\n", $du,$md5,$des,$flags;
|
||||
} else {
|
||||
print "Package '$p' not found or duplicate\n"
|
||||
}
|
||||
my $pkgdir = shift @ARGV; my $quickMode=0;
|
||||
if (($pkgdir) and (! -d "$pkgdir")) {
|
||||
print "usage: pkg-repgen [options] [directory [pkgname1..pkgnameN]]\n";
|
||||
exit 1;
|
||||
}
|
||||
my @dirlist = ("$pkgdir") ? glob("$pkgdir/*.pkg.tar.$compress") : glob("*.pkg.tar.$compress");
|
||||
@dirlist = sort pkg_mtime @dirlist;
|
||||
%isDup = map { $_ => 0 } @dirlist;
|
||||
|
||||
if (@ARGV) { # individual packages
|
||||
$quickMode=1;
|
||||
my @updates = sort @ARGV;
|
||||
while (my $name = shift @updates) {
|
||||
push @packages, grep { m/$name#.*\.pkg/ } @dirlist;
|
||||
}
|
||||
if ($hasnew == 1){system("sort -o PKGREPO PKGREPO")};
|
||||
} else { # the entire directory
|
||||
@packages = @dirlist;
|
||||
}
|
||||
|
||||
# hashes to determine the package name ...
|
||||
our %pname = map { $_ => (split /\//, $_)[-1] } @dirlist;
|
||||
foreach my $p (@dirlist) { $pname{$p} =~ s/\#.*//; }
|
||||
|
||||
# ... or to look up the successor when merging old metadata files
|
||||
my %followR; my %followH; my %followD; my @queue = @dirlist;
|
||||
while (my $q = shift @queue) {
|
||||
($#queue < 0) or ($pname{$q} ne $pname{$queue[0]}) or $isDup{$q} = 1;
|
||||
}
|
||||
|
||||
# Populate some other hashes using a single run of prt-get
|
||||
our %path; our %depends; our %descrip; our %flags;
|
||||
my @validkeys = map { (split /\//, $_)[-1] } @dirlist;
|
||||
map { s/\#.*// } @validkeys;
|
||||
my %printme = map { $_ => 1 } @validkeys;
|
||||
open (my $ppf, "$prtget printf '%n^%p^%e^%d^%E:%O:%R\n' |");
|
||||
while (<$ppf>) {
|
||||
chomp;
|
||||
my ($name,$repo,$deps,$desc,$prepostread) = split /\^/;
|
||||
next if (! $printme{$name});
|
||||
$path{$name} = $repo . "/" . $name;
|
||||
$depends{$name} = $deps;
|
||||
$desc =~ s/\:/ /g;
|
||||
$descrip{$name} = $desc;
|
||||
$flags{$name} = $prepostread;
|
||||
}
|
||||
close ($ppf);
|
||||
|
||||
# Needed for alternating colors in the html index
|
||||
my %parity = ( 0 => "even", 1 => "odd" );
|
||||
|
||||
# Generate the metadata files
|
||||
($quickMode) ? pkg_single() : pkg_dir();
|
||||
|
||||
# Generate README and PKGINST
|
||||
pkgreadscripts();
|
||||
|
||||
###################### individual packages ##########################
|
||||
sub pkg_single {
|
||||
my ($oR, $oD, $oH, $nR, $nD, $nH, $oline, $oname);
|
||||
my $count = 0; # needed for the html index
|
||||
my @dep_packages = @packages;
|
||||
my @idx_packages = @packages;
|
||||
|
||||
my %firstrun = map { $_ => 0 } ("PKGREPO", "PKGDEPS", "index.html");
|
||||
open ($oR, "$pkgdir/PKGREPO") or $firstrun{"PKGREPO"} = 1;
|
||||
open ($oD, "$pkgdir/PKGDEPS") or $firstrun{"PKGDEPS"} = 1;
|
||||
open ($oH, "$pkgdir/index.html") or $firstrun{"index.html"} = 1;
|
||||
|
||||
open ($nR, ">$pkgdir/PKGREPO.new");
|
||||
print "+ Updating specified entries in repository\n";
|
||||
RPKG: while (my $p =shift @packages) {
|
||||
my ($basename, $du, $md5, $ppr) = repodata($p);
|
||||
my $desc = (! $descrip{$pname{$p}}) ? "N.A." : $descrip{$pname{$p}};
|
||||
if ($firstrun{"PKGREPO"}==1) {
|
||||
printf $nR "%-s:%-s:%-s:%-s:%-s\n",$basename, $du, $md5, $desc, $ppr;
|
||||
next RPKG;
|
||||
}
|
||||
|
||||
# Shift entries from the old repository until we find
|
||||
# a successor to the current package.
|
||||
while ( (! $followR{$pname{$p}}) and $oline = <$oR> ) {
|
||||
chomp($oline); $oname = $oline;
|
||||
$oname =~ s/\#.*//;
|
||||
print $nR "$oline\n" if ($oname lt $pname{$p});
|
||||
|
||||
# before breaking out of the loop, append all the packages
|
||||
# from the globbed queue that are lexographically earlier
|
||||
# than the current entry in the old repository.
|
||||
while ($pname{$p} le $oname) {
|
||||
printf $nR "%-s:%-s:%-s:%-s:%-s\n", $basename, $du, $md5, $desc, $ppr;
|
||||
next RPKG if (! $isDup{$p});
|
||||
$p = shift @packages;
|
||||
($basename, $du, $md5, $ppr) = repodata($p);
|
||||
$desc = (! $descrip{$pname{$p}}) ? "N.A." : $descrip{$pname{$p}};
|
||||
|
||||
# save what got shifted from the repository if we're not going to
|
||||
# print it now, but don't save packages that match the same glob.
|
||||
$followR{$pname{$p}} = "$oline\n" if ($pname{$p} lt $oname);
|
||||
}
|
||||
}
|
||||
|
||||
# if the current package comes after everything in the old repository,
|
||||
# just append its metadata
|
||||
($followR{$pname{$p}}) or printf $nR "%-s:%-s:%-s:%-s:%-s\n", $basename, $du, $md5, $desc, $ppr;
|
||||
|
||||
next RPKG if (($isDup{$p}) or (! $followR{$pname{$p}}));
|
||||
|
||||
# Arriving here means the current package is not a dup, and
|
||||
# definitely has a successor in the old repository. But the
|
||||
# next globbed package might be a more immediate successor.
|
||||
# Decide which of the two possible successors comes first.
|
||||
# By defining a successor for the next package in the queue,
|
||||
# we delay shifting entries off the old repo.
|
||||
if ((@packages) and ($pname{$packages[0]} le $followR{$pname{$p}})) {
|
||||
$followR{$pname{$packages[0]}} = $followR{$pname{$p}};
|
||||
next RPKG;
|
||||
} else {
|
||||
print $nR $followR{$pname{$p}};
|
||||
}
|
||||
|
||||
# Shift another package from the queue
|
||||
}
|
||||
|
||||
# Likewise for the html index
|
||||
printheader(1);
|
||||
open ($nH, ">>$pkgdir/index.html.new");
|
||||
|
||||
print "+ Updating specified entries in the html index\n";
|
||||
HPKG: while (my $p =shift @idx_packages) {
|
||||
my ($url, $pver, $desc, $date) = htmldata($p);
|
||||
|
||||
if ($firstrun{"index.html"} == 1) {
|
||||
$count++;
|
||||
htmlrow($nH,$count,$pname{$p},$url,$pver,$desc,$date);
|
||||
next HPKG;
|
||||
}
|
||||
# Shift entries from the old html index until we find
|
||||
# a successor to the current package.
|
||||
while ( (! $followH{$pname{$p}}) and $oline=<$oH> ) {
|
||||
chomp($oline);
|
||||
# no need to copy the header, it should already be there
|
||||
next if ($oline !~ m/^<tr class="(odd|even)"/);
|
||||
|
||||
$oname = $oline;
|
||||
$oname =~ s/.*a href="(.*)"/$1/; $oname =~ s/\%23.*//;
|
||||
if ($oname lt $pname{$p}) { $count++; print $nH "$oline\n"; }
|
||||
|
||||
# before breaking out of the loop, append all the packages
|
||||
# from the globbed queue that are lexographically earlier
|
||||
# than the current entry in the old html index.
|
||||
while ($pname{$p} le $oname) {
|
||||
$count++;
|
||||
htmlrow($nH,$count,$pname{$p},$url,$pver,$desc,$date);
|
||||
next HPKG if (! $isDup{$p});
|
||||
$p = shift @idx_packages;
|
||||
($url, $pver, $desc, $date) = htmldata($p);
|
||||
|
||||
# save what got shifted from the index if we're not going to print
|
||||
# it now, but ignore packages that match the same glob.
|
||||
$followH{$pname{$p}} = "$oline\n" if ($pname{$p} lt $oname);
|
||||
}
|
||||
}
|
||||
|
||||
# if the current package comes after everything in the old html index,
|
||||
# just append its metadata
|
||||
if (! $followH{$pname{$p}}) {
|
||||
$count++;
|
||||
htmlrow($nH,$count,$pname{$p},$url,$pver,$desc,$date);
|
||||
}
|
||||
|
||||
next HPKG if (($isDup{$p}) or (! $followH{$pname{$p}}));
|
||||
|
||||
# Arriving here means the current package is not a dup, and
|
||||
# definitely has a successor in the old html index. But the
|
||||
# next globbed package might be a more immediate successor.
|
||||
# Decide which of the two possible successors comes first. If the
|
||||
# globbed package is the more immediate successor, use its name
|
||||
# as a key to retain the most recent entry from the html index.
|
||||
if ((@packages) and ($pname{$packages[0]} le $followH{$pname{$p}})) {
|
||||
$followH{$pname{$packages[0]}} = $followH{$pname{$p}};
|
||||
next HPKG;
|
||||
} else {
|
||||
$count++;
|
||||
$followH{$pname{$p}} =~ s/class="(even|odd)"/class="$parity{($count %2)}"/;
|
||||
print $nH $followH{$pname{$p}};
|
||||
}
|
||||
|
||||
# Shift another package from the queue
|
||||
}
|
||||
|
||||
# Likewise for the dependency map, but avoid creating duplicate entries
|
||||
open ($nD, ">$pkgdir/PKGDEPS.new");
|
||||
|
||||
print "+ Updating specified entries in the depmap\n";
|
||||
DPKG: while (my $p =shift @dep_packages) {
|
||||
if ($firstrun{"PKGDEPS"}==1) {
|
||||
(! $depends{$pname{$p}}) or ($isDup{$p})
|
||||
or printf $nD "%-30s : %-s\n", $pname{$p}, $depends{$pname{$p}};
|
||||
next DPKG;
|
||||
}
|
||||
# Shift entries from the old depmap until we find a successor
|
||||
# to the current package
|
||||
while ( (! $followD{$pname{$p}}) and $oline = <$oD> ) {
|
||||
chomp($oline); $oname = $oline;
|
||||
$oname =~ s/\s*\:.*//;
|
||||
print $nD "$oline\n" if ($oname lt $pname{$p});
|
||||
while ($pname{$p} le $oname) {
|
||||
if (! $isDup{$p}) {
|
||||
printf $nD "%-30s : %-s\n", $pname{$p}, $depends{$pname{$p}};
|
||||
next DPKG;
|
||||
} else {
|
||||
$p = shift @dep_packages;
|
||||
}
|
||||
# save what got shifted from the depmap if we're not going to print
|
||||
# it now, but ignore packages that match the same glob.
|
||||
$followD{$pname{$p}} = $oline if ($pname{$p} lt $oname);
|
||||
}
|
||||
}
|
||||
|
||||
# if the current package comes after everything in the old depmap
|
||||
# and is not a dup, just append its metadata
|
||||
($followD{$pname{$p}}) or ($isDup{$p}) or (! $depends{$pname{$p}})
|
||||
or printf $nD "%-30s : %-s\n", $pname{$p}, $depends{$pname{$p}};
|
||||
|
||||
next DPKG if (($isDup{$p}) or (! $followD{$pname{$p}}));
|
||||
|
||||
# Arriving here means the current package is not a dup, and
|
||||
# definitely has a successor entry in the old depmap.
|
||||
# But the next globbed package might be a more immediate successor.
|
||||
# Decide which of the two possible successors comes first. If it's the
|
||||
# globbed package that comes next, save the old depmap entry.
|
||||
if ((@packages) and ($pname{$packages[0]} le $followD{$pname{$p}})) {
|
||||
$followD{$pname{$packages[0]}} = $followD{$pname{$p}};
|
||||
next DPKG;
|
||||
} else {
|
||||
printf $nD $followD{$pname{$p}};
|
||||
}
|
||||
|
||||
# Shift another package from the queue
|
||||
}
|
||||
|
||||
# Done with all the packages that match command-line arguments.
|
||||
# Now append the tails of the old metadata files to their new counterparts.
|
||||
while ($firstrun{"index.html"}==0 and $oline = <$oH>) {
|
||||
$count++;
|
||||
$oline =~ s/class="(even|odd)"/class="$parity{($count % 2)}"/;
|
||||
print $nH $oline;
|
||||
}
|
||||
while ($firstrun{"PKGDEPS"}==0 and $oline = <$oD>) { print $nD $oline; }
|
||||
while ($firstrun{"PKGREPO"}==0 and $oline = <$oR>) { print $nR $oline; }
|
||||
|
||||
close($nH);
|
||||
close($nD);
|
||||
close($nR);
|
||||
($firstrun{"PKGREPO"}==1) or close($oR);
|
||||
($firstrun{"PKGDEPS"}==1) or close($oD);
|
||||
($firstrun{"index.html"}==1) or close($oH);
|
||||
|
||||
foreach my $db (keys %firstrun) { rename("$pkgdir/$db.new", "$pkgdir/$db"); }
|
||||
printfooter($count) if ($firstrun{"index.html"} == 1);
|
||||
}
|
||||
|
||||
######################## full repository ########################
|
||||
|
||||
# generate dependencies
|
||||
sub pkgdeps {
|
||||
sub pkg_dir {
|
||||
print "+ Generating dependencies\n";
|
||||
my @packages = glob("*#*.pkg.tar.$compress");
|
||||
open (my $fh, '>PKGDEPS');
|
||||
foreach my $package (@packages) {
|
||||
$package =~ s/#.*//;
|
||||
my $deps = `$prtget printf "%e" --filter="$package"`;
|
||||
if ($deps ne "") {
|
||||
printf $fh "%-30s : %-s\n", $package, $deps;
|
||||
}
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# generate the main repository file and index page
|
||||
sub pkgrepo {
|
||||
open (my $iD, ">$pkgdir/PKGDEPS");
|
||||
print "+ Generating repository\n";
|
||||
my @packages = glob("*#*.pkg.tar.$compress");
|
||||
our $odd = "odd";
|
||||
my $count = 0;
|
||||
open (my $fh, '>PKGREPO');
|
||||
printheader();
|
||||
open (my $ih, '>>index.html');
|
||||
foreach my $package (@packages) {
|
||||
my $date = (stat($package))[9];
|
||||
$count++;
|
||||
$package =~ s/\n//g;
|
||||
my $name = $package;
|
||||
$name =~ s/#.*//;
|
||||
my $du = (-s $package);
|
||||
my $md5 = `md5sum $package`;
|
||||
$md5 =~ s/ .*$|\n//g;
|
||||
my $des=`$prtget printf %d --filter="$name"`;
|
||||
$des =~ s/:/ /g;
|
||||
if ($des eq ""){$des = "N.A."};
|
||||
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;
|
||||
$version =~ s/^.*\#//;
|
||||
$version =~ s/\.pkg\.tar\.[gbx]z*//;
|
||||
print $ih "<tr class=\"$odd\">";
|
||||
print $ih "<td>$name</td>";
|
||||
my $url = $package;
|
||||
$url =~ s/\#/\%23/;
|
||||
print $ih "<td><a href=\"$url\">$version</a></td>";
|
||||
print $ih "<td>$des</td>";
|
||||
print $ih "<td>" . isotime($date, 1) . "</td>";
|
||||
print $ih "</tr>\n";
|
||||
|
||||
if ($odd eq "odd") { $odd = "even"; }
|
||||
else { $odd = "odd"; }
|
||||
open (my $iR, ">$pkgdir/PKGREPO");
|
||||
printheader(0);
|
||||
my $count = 0;
|
||||
open (my $ih, ">>$pkgdir/index.html");
|
||||
foreach my $p (@packages) {
|
||||
my ($basename, $du, $md5, $ppr) = repodata($p);
|
||||
my ($url, $pver, $desc, $date) = htmldata($p);
|
||||
(! $depends{$pname{$p}}) or ($isDup{$p})
|
||||
or printf $iD "%-30s : %-s\n", $pname{$p}, $depends{$pname{$p}};
|
||||
printf $iR "%-s:%-s:%-s:%-s:%-s\n", $basename,$du,$md5,$desc,$ppr;
|
||||
$count++;
|
||||
htmlrow($ih,$count,$pname{$p},$url,$pver,$desc,$date);
|
||||
}
|
||||
close $fh;
|
||||
close $ih;
|
||||
printfooter($count);
|
||||
close($ih);
|
||||
printfooter($count);
|
||||
close($iR);
|
||||
close($iD);
|
||||
}
|
||||
|
||||
# generate README file
|
||||
sub pkgread {
|
||||
# consolidate all the README and install scripts for the available packages
|
||||
sub pkgreadscripts {
|
||||
print "+ Generating README\n";
|
||||
my @packages = glob("*#*.pkg.tar.$compress");
|
||||
open (my $fh, '>PKGREAD');
|
||||
print $fh "# README files for repository. Do NOT remove this line.\n";
|
||||
foreach my $package (@packages) {
|
||||
$package =~ s/#.*//;
|
||||
my $path = `$prtget path $package`;
|
||||
$path =~ s/\n//g;
|
||||
if (-f "$path/README"){
|
||||
print $fh "##### PKGREADME: $package\n";
|
||||
open(my $readme, "$path/README");
|
||||
while (<$readme>){
|
||||
my $line = $_;
|
||||
print $fh $line;
|
||||
}
|
||||
open (my $fR, ">$pkgdir/PKGREAD");
|
||||
print $fR "# README files for repository. Do NOT remove this line.\n";
|
||||
|
||||
print "+ Generating scripts\n";
|
||||
open (my $fS, ">$pkgdir/PKGINST");
|
||||
print $fS '#!/usr/bin/env bash
|
||||
#
|
||||
# PKGINST: pre- and post-install scripts for CRUX packages
|
||||
#
|
||||
run_script() {
|
||||
case "$1" in
|
||||
';
|
||||
|
||||
my %seen;
|
||||
foreach my $name (@dirlist) {
|
||||
$name =~ s/\#.*//; $name = (split /\//, $name)[-1];
|
||||
next if ($seen{$name});
|
||||
$seen{$name} = 1;
|
||||
next if (! $path{$name});
|
||||
if (-f "$path{$name}/README"){
|
||||
print $fR "##### PKGREADME: $name\n";
|
||||
open(my $readme, "$path{$name}/README");
|
||||
while (<$readme>){ print $fR $_; }
|
||||
close($readme);
|
||||
}
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# generate pre-post install scripts file
|
||||
sub pkginst {
|
||||
print "+ Generating scripts\n";
|
||||
open (my $fh, '>PKGINST');
|
||||
print $fh
|
||||
"
|
||||
#!/bin/bash
|
||||
#
|
||||
# PKGINST: pre-post install scripts for CRUX packages
|
||||
";
|
||||
my @packages = glob("*#*.pkg.tar.$compress");
|
||||
foreach my $package (@packages) {
|
||||
$package =~ s/#.*//;
|
||||
my $path = `$prtget path $package`;
|
||||
$path =~ s/\n//g;
|
||||
my $normal= $package;
|
||||
$normal =~ s/[^[:alnum:]]/_/g;
|
||||
if (-f "$path/pre-install"){
|
||||
print $fh "${normal}_pre_install() {\n";
|
||||
open(my $pre, "$path/pre-install");
|
||||
while (<$pre>){
|
||||
my $line = $_;
|
||||
print $fh $line;
|
||||
foreach my $when ("pre", "post") {
|
||||
if (-f "$path{$name}/${when}-install"){
|
||||
print $fS " $name.$when)\n";
|
||||
open(my $rs, "$path{$name}/${when}-install");
|
||||
while (<$rs>){
|
||||
chomp;
|
||||
(m/^\#(!.*sh|\s*EOF|\s*End)/) or print $fS " $_\n";
|
||||
}
|
||||
close($rs);
|
||||
print $fS " ;;\n";
|
||||
}
|
||||
close($pre);
|
||||
print $fh "}\n\n";
|
||||
}
|
||||
if (-f "$path/post-install"){
|
||||
print $fh "${normal}_post_install() {\n";
|
||||
open(my $post, "$path/post-install");
|
||||
while (<$post>){
|
||||
my $line = $_;
|
||||
print $fh $line;
|
||||
}
|
||||
close($post);
|
||||
print $fh "}\n\n";
|
||||
}
|
||||
}
|
||||
print $fh "\n\n";
|
||||
print $fh 'if [ ! -z "$1" ]; then $1; fi';
|
||||
print $fh "\n";
|
||||
close $fh;
|
||||
print $fS " esac\n}\n\n";
|
||||
print $fS '[ "$1" ] && [[ "$2" == @(pre|post) ]] && run_script "$1.$2"';
|
||||
print $fS "\n";
|
||||
close $fS;
|
||||
close $fR;
|
||||
}
|
||||
|
||||
|
||||
######################## html index subs ########################
|
||||
|
||||
sub printheader {
|
||||
open (my $ih, '>index.html');
|
||||
print $ih <<EOH;
|
||||
my $isTemp = shift; my $ih;
|
||||
($isTemp == 0) ? open ($ih, ">$pkgdir/index.html") : open ($ih, ">$pkgdir/index.html.new");
|
||||
print $ih <<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 $ih " <title>$title</title>\n";
|
||||
print $ih " <title>$title</title>\n";
|
||||
|
||||
print $ih <<EOH;
|
||||
print $ih <<EOH;
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
|
@ -291,55 +433,72 @@ EOH
|
|||
<body>
|
||||
EOH
|
||||
|
||||
print $ih " <h2>$title</h2>\n";
|
||||
if ($header) {
|
||||
open(FILE, $header) or die "Couldn't open header file";
|
||||
while (<FILE>) {
|
||||
print $ih " " . $_;
|
||||
}
|
||||
close(FILE);
|
||||
}
|
||||
print $ih " <h2>$title</h2>\n";
|
||||
if ($header) {
|
||||
open(FILE, $header) or die "Couldn't open header file";
|
||||
while (<FILE>) { print $ih " " . $_; }
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
print $ih " <table width=\"100%\" cellspacing=\"0\">\n";
|
||||
print $ih " <tr class=\"header\"><td><b>Port</b></td><td><b>Version</b></td><td><b>Description</b></td>";
|
||||
print $ih "<td><b>Last modified</b></td>";
|
||||
print $ih "</tr>\n";
|
||||
close($ih);
|
||||
print $ih " <table width=\"100%\" cellspacing=\"0\">\n";
|
||||
print $ih " <tr class=\"header\"><td><b>Port</b></td><td><b>Version</b></td><td><b>Description</b></td>";
|
||||
print $ih "<td><b>Last modified</b></td>";
|
||||
print $ih "</tr>\n";
|
||||
close($ih);
|
||||
}
|
||||
|
||||
sub htmlrow {
|
||||
my ($ih, $count, $name, $url, $version, $desc, $date) = @_;
|
||||
print $ih "<tr class=\"$parity{($count % 2)}\"><td>$name</td>";
|
||||
print $ih "<td><a href=\"$url\">$version</a></td>";
|
||||
print $ih "<td>$desc</td><td>$date</td></tr>\n";
|
||||
}
|
||||
|
||||
sub printfooter {
|
||||
my $count = $_[0];
|
||||
open (my $ih, '>>index.html');
|
||||
print $ih " </table>\n";
|
||||
print $ih " <p><b>$count packages</b></p>\n";
|
||||
if ($footer) {
|
||||
open(FILE, $footer) or die "Couldn't open footer file";
|
||||
while (<FILE>) {
|
||||
print $ih " " . $_;
|
||||
}
|
||||
close(FILE);
|
||||
}
|
||||
print $ih " <p><i>Generated by <a href=\"http://www.varlock.com\">pkg-repgen</a> on " . isotime() . ".</i></p>\n";
|
||||
print $ih <<EOH;
|
||||
my $count = shift;
|
||||
open (my $ih, ">>$pkgdir/index.html");
|
||||
print $ih " </table>\n";
|
||||
print $ih " <p><b>$count packages</b></p>\n";
|
||||
if ($footer) {
|
||||
open(FILE, $footer) or die "Couldn't open footer file";
|
||||
while (<FILE>) { print $ih " " . $_; }
|
||||
close(FILE);
|
||||
}
|
||||
print $ih " <p><i>Generated by <a href=\"http://www.varlock.com\">pkg-repgen</a> on " . isotime() . ".</i></p>\n";
|
||||
print $ih <<EOH;
|
||||
</body>
|
||||
</html>
|
||||
EOH
|
||||
close($ih);
|
||||
close($ih);
|
||||
}
|
||||
|
||||
sub htmldata {
|
||||
my $p = shift;
|
||||
my ($pver, $url) = ($p, $p);
|
||||
$pver =~ s/.*\#//; $pver =~ s/\.pkg\.tar.*//;
|
||||
$url = (split /\//, $p)[-1]; $url =~ s/\#/\%23/;
|
||||
my $date = isotime( (stat($p))[9], 1);
|
||||
my $desc = (! $descrip{$pname{$p}}) ? "N.A." : $descrip{$pname{$p}};
|
||||
return $url, $pver, $desc, $date;
|
||||
}
|
||||
|
||||
sub repodata {
|
||||
my $p = shift;
|
||||
my $basename = (split /\//, $p)[-1];
|
||||
my $du = (-s $p);
|
||||
my $md5 = digest_file_hex($p,"MD5");
|
||||
my $ppr = (! $flags{$pname{$p}}) ? "no:no:no" : $flags{$pname{$p}};
|
||||
return $basename, $du, $md5, $ppr;
|
||||
}
|
||||
|
||||
sub isotime {
|
||||
my $time = (shift or time);
|
||||
my $accuracy = (shift or 2);
|
||||
my @t = gmtime ($time);
|
||||
my $year = $t[5] + 1900;
|
||||
my $month = sprintf("%02d", $t[4] + 1);
|
||||
my $day = sprintf("%02d", $t[3]);
|
||||
my $time = (shift or time);
|
||||
my $accuracy = (shift or 2);
|
||||
my @t = gmtime ($time);
|
||||
my $year = $t[5] + 1900;
|
||||
my $month = sprintf("%02d", $t[4] + 1);
|
||||
my $day = sprintf("%02d", $t[3]);
|
||||
|
||||
if ($accuracy == 1) {
|
||||
return "$year-$month-$day";
|
||||
}
|
||||
|
||||
return "$year-$month-$day " . sprintf("%02d:%02d:%02d UTC", $t[2], $t[1], $t[0]);
|
||||
return "$year-$month-$day" if ($accuracy == 1);
|
||||
return "$year-$month-$day " . sprintf("%02d:%02d:%02d UTC", $t[2], $t[1], $t[0]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user