mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
xbps-src: implement support to specify repo path in genindex.
You can use it now like: $ xbps-src.sh genindex ~/myrepo It will use XBPS_PACKAGESDIR if no specified. --HG-- extra : convert_revision : 7d1b17dd77b89387a5f568071b58478e68c4051d
This commit is contained in:
parent
6542132999
commit
d90419f36b
2 changed files with 17 additions and 13 deletions
|
@ -31,6 +31,7 @@ XBPS_PKGINDEX_VERSION="1.0" # Current version for pkgindex plist
|
||||||
#
|
#
|
||||||
write_repo_pkgindex()
|
write_repo_pkgindex()
|
||||||
{
|
{
|
||||||
|
local repodir="$1"
|
||||||
local propsf=
|
local propsf=
|
||||||
local pkgname=
|
local pkgname=
|
||||||
local pkgsum=
|
local pkgsum=
|
||||||
|
@ -39,25 +40,26 @@ write_repo_pkgindex()
|
||||||
local i=
|
local i=
|
||||||
local found=
|
local found=
|
||||||
|
|
||||||
[ ! -d $XBPS_PACKAGESDIR ] && exit 1
|
[ -z "$repodir" ] && repodir=$XBPS_PACKAGESDIR
|
||||||
|
[ ! -d $repodir ] && exit 1
|
||||||
|
|
||||||
found="$(echo $XBPS_PACKAGESDIR/*)"
|
found="$(echo $repodir/*)"
|
||||||
if $(echo $found|grep -vq .xbps); then
|
if $(echo $found|grep -vq .xbps); then
|
||||||
msg_error "couldn't find binary packages on $XBPS_PACKAGESDIR."
|
msg_error "couldn't find binary packages on $repodir."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pkgindexf=$(mktemp -t pkgidx.XXXXXXXXXX) || exit 1
|
pkgindexf=$(mktemp -t pkgidx.XXXXXXXXXX) || exit 1
|
||||||
tmppkgdir=$(mktemp -d -t pkgdir.XXXXXXXX) || exit 1
|
tmppkgdir=$(mktemp -d -t pkgdir.XXXXXXXX) || exit 1
|
||||||
|
|
||||||
# Write the header.
|
# Write the header.
|
||||||
msg_normal "Creating package index for $XBPS_PACKAGESDIR..."
|
msg_normal "Creating package index for $repodir..."
|
||||||
write_repo_pkgindex_header $pkgindexf
|
write_repo_pkgindex_header $pkgindexf $repodir
|
||||||
|
|
||||||
#
|
#
|
||||||
# Write pkg dictionaries from all packages currently available at
|
# Write pkg dictionaries from all packages currently available at
|
||||||
# XBPS_PACKAGESDIR.
|
# XBPS_PACKAGESDIR.
|
||||||
#
|
#
|
||||||
for i in $(echo $XBPS_PACKAGESDIR/*.xbps); do
|
for i in $(echo $repodir/*.xbps); do
|
||||||
pkgname="$(basename ${i%%-[0-9]*.*.$xbps_machine.xbps})"
|
pkgname="$(basename ${i%%-[0-9]*.*.$xbps_machine.xbps})"
|
||||||
propsf="./var/cache/xbps/metadata/$pkgname/props.plist"
|
propsf="./var/cache/xbps/metadata/$pkgname/props.plist"
|
||||||
cd $tmppkgdir && tar xfjp $i $propsf
|
cd $tmppkgdir && tar xfjp $i $propsf
|
||||||
|
@ -83,7 +85,7 @@ write_repo_pkgindex()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
msg_normal "Package index created (total pkgs: $pkgsum)."
|
msg_normal "Package index created (total pkgs: $pkgsum)."
|
||||||
cp -f $pkgindexf $XBPS_PACKAGESDIR/pkg-index.plist
|
cp -f $pkgindexf $repodir/pkg-index.plist
|
||||||
fi
|
fi
|
||||||
rm -f $pkgindexf
|
rm -f $pkgindexf
|
||||||
rm -rf $tmppkgdir
|
rm -rf $tmppkgdir
|
||||||
|
@ -95,8 +97,9 @@ write_repo_pkgindex()
|
||||||
write_repo_pkgindex_header()
|
write_repo_pkgindex_header()
|
||||||
{
|
{
|
||||||
local file="$1"
|
local file="$1"
|
||||||
|
local repo="$2"
|
||||||
|
|
||||||
[ -z "$file" ] && return 1
|
[ -z "$file" -o -z "$repo" ] && return 1
|
||||||
|
|
||||||
cat > $file <<_EOF
|
cat > $file <<_EOF
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
@ -106,7 +109,7 @@ write_repo_pkgindex_header()
|
||||||
<key>pkgindex-version</key>
|
<key>pkgindex-version</key>
|
||||||
<string>$XBPS_PKGINDEX_VERSION</string>
|
<string>$XBPS_PKGINDEX_VERSION</string>
|
||||||
<key>location-local</key>
|
<key>location-local</key>
|
||||||
<string>$XBPS_PACKAGESDIR</string>
|
<string>$repodir</string>
|
||||||
<key>available-packages</key>
|
<key>available-packages</key>
|
||||||
<array>
|
<array>
|
||||||
_EOF
|
_EOF
|
||||||
|
|
|
@ -49,9 +49,10 @@ Targets:
|
||||||
configure <pkg> Configure a package (fetch + extract + configure).
|
configure <pkg> Configure a package (fetch + extract + configure).
|
||||||
extract <pkg> Extract distribution file(s) into build directory.
|
extract <pkg> Extract distribution file(s) into build directory.
|
||||||
fetch <pkg> Download distribution file(s).
|
fetch <pkg> Download distribution file(s).
|
||||||
genindex Generate a package index for a directory containing
|
genindex [/path/dir] Generate a package index for a directory containing
|
||||||
binary packages. This uses the XBPS_PACKAGESDIR option
|
binary packages. If no path is specified, the
|
||||||
in the configuration file.
|
XBPS_PACKAGESDIR in the configuration file will be
|
||||||
|
used by default.
|
||||||
info <pkg> Show information about <pkg>.
|
info <pkg> Show information about <pkg>.
|
||||||
install-destdir <pkg> build + install into destdir.
|
install-destdir <pkg> build + install into destdir.
|
||||||
install <pkg> install-destdir + stow.
|
install <pkg> install-destdir + stow.
|
||||||
|
@ -263,7 +264,7 @@ extract|fetch|info)
|
||||||
;;
|
;;
|
||||||
genindex)
|
genindex)
|
||||||
. $XBPS_SHUTILSDIR/binpkg-genindex.sh
|
. $XBPS_SHUTILSDIR/binpkg-genindex.sh
|
||||||
write_repo_pkgindex
|
write_repo_pkgindex $2
|
||||||
;;
|
;;
|
||||||
install|install-destdir)
|
install|install-destdir)
|
||||||
[ -z "$2" ] && msg_error "missing package name after target."
|
[ -z "$2" ] && msg_error "missing package name after target."
|
||||||
|
|
Loading…
Add table
Reference in a new issue