Replace old Arch Linux scripts with new indexer
This commit is contained in:
parent
1ca43665a1
commit
5e39af459f
5 changed files with 33 additions and 79 deletions
11
Makefile
11
Makefile
|
|
@ -1,4 +1,6 @@
|
|||
.PHONY: ManUtils
|
||||
.PHONY: ManUtils indexer clean
|
||||
|
||||
all: ManUtils indexer
|
||||
|
||||
ManUtils: lib/ManUtils/Build
|
||||
cd lib/ManUtils && perl Build.PL && ./Build install --install-base=inst
|
||||
|
|
@ -6,7 +8,12 @@ ManUtils: lib/ManUtils/Build
|
|||
lib/ManUtils/Build: lib/ManUtils/Build.PL
|
||||
cd lib/ManUtils && perl Build.PL
|
||||
|
||||
indexer: indexer/target/release/indexer
|
||||
|
||||
indexer/target/release/indexer: indexer/Cargo.toml indexer/src/*.rs
|
||||
cd indexer && cargo build --release
|
||||
|
||||
clean:
|
||||
cd lib/ManUtils && ./Build distclean
|
||||
rm -rf lib/ManUtils/inst
|
||||
|
||||
cd indexer && cargo clean
|
||||
|
|
|
|||
76
util/arch.sh
76
util/arch.sh
|
|
@ -1,76 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Usage: ./arch.sh
|
||||
# Synchronises the database with an Arch mirror, fetching any packages that
|
||||
# aren't yet in the database and may have man pages.
|
||||
|
||||
MIRROR=http://ftp.nluug.nl/pub/os/Linux/distr/archlinux
|
||||
REPOS="core extra community"
|
||||
DEBUG=false
|
||||
SYSID=1
|
||||
|
||||
. ./common.sh
|
||||
|
||||
|
||||
checkpkg() {
|
||||
REPO=$1
|
||||
FN=$2
|
||||
D="$TMP/$REPO/$FN"
|
||||
if [ ! \( -d "$D" -a -f "$D/files" -a -f "$D/desc" \) ]; then
|
||||
echo "===> $FN"
|
||||
echo "Invalid item, ignoring"
|
||||
return
|
||||
fi
|
||||
grep -q /man/ "$D/files"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
$DEBUG && echo "===> $FN"
|
||||
$DEBUG && echo "No mans"
|
||||
return
|
||||
fi
|
||||
|
||||
# Somewhat inefficient description parsing
|
||||
FILENAME=`grep -A 1 '%FILENAME%' "$D/desc" | tail -n 1`
|
||||
NAME=`grep -A 1 '%NAME%' "$D/desc" | tail -n 1`
|
||||
VERSION=`grep -A 1 '%VERSION%' "$D/desc" | tail -n 1`
|
||||
BUILDDATE=`grep -A 1 '%BUILDDATE%' "$D/desc" | tail -n 1`
|
||||
if [ -z "$FILENAME" -o -z "$NAME" -o -z "$VERSION" -o -z "$BUILDDATE" ]; then
|
||||
echo "===> $FN"
|
||||
echo "Invalid/missing description info"
|
||||
return
|
||||
fi
|
||||
BUILDDATE=`date -d "@$BUILDDATE" '+%F'`
|
||||
|
||||
add_pkginfo $SYSID "$REPO" "$NAME" "$VERSION" "$BUILDDATE"
|
||||
if [ "$?" -eq 0 ]; then
|
||||
$DEBUG && echo "===> $FN"
|
||||
$DEBUG && echo "Already up-to-date"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "===> $FN"
|
||||
F="$TMP/$REPO/$FILENAME"
|
||||
$CURL "$MIRROR/$REPO/os/i686/$FILENAME" -o "$F" || return
|
||||
add_tar "$F" "$PKGID"
|
||||
rm -f "$F"
|
||||
}
|
||||
|
||||
|
||||
syncrepo() {
|
||||
REPO=$1
|
||||
F="$TMP/$REPO/repo.tar.gz"
|
||||
echo "============ $MIRROR $REPO"
|
||||
$CURL "$MIRROR/$REPO/os/i686/$REPO.files.tar.gz" -o "$F" || return 1
|
||||
tar -C "$TMP/$REPO" -xf "$F" || return 1
|
||||
rm -f "$F"
|
||||
for fn in "$TMP/$REPO"/*; do
|
||||
checkpkg "$REPO" `basename "$fn"`
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
for r in $REPOS; do
|
||||
mkdir "$TMP/$r"
|
||||
syncrepo $r
|
||||
rm -rf "$TMP/$r"
|
||||
done
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
. ./common.sh
|
||||
|
||||
./arch.sh
|
||||
./index.sh daily
|
||||
./deb.sh ubuntu_active
|
||||
./deb.sh debian_active
|
||||
echo "============ Updating SQL indices"
|
||||
|
|
|
|||
22
util/index.sh
Executable file
22
util/index.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
if test -f .config; then
|
||||
source .config
|
||||
fi
|
||||
|
||||
INDEX="./indexer -vv"
|
||||
|
||||
set -x
|
||||
|
||||
arch() {
|
||||
local MIRROR=http://ftp.nluug.nl/pub/os/Linux/distr/archlinux
|
||||
local REPOS="core extra community"
|
||||
for REPO in $REPOS; do
|
||||
$INDEX arch --sys arch --mirror $MIRROR --repo $REPO
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
daily() {
|
||||
arch
|
||||
}
|
||||
|
||||
$@
|
||||
1
util/indexer
Symbolic link
1
util/indexer
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../indexer/target/release/indexer
|
||||
Loading…
Add table
Add a link
Reference in a new issue