diff --git a/Makefile b/Makefile index b1169e5..259b15e 100644 --- a/Makefile +++ b/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 diff --git a/util/arch.sh b/util/arch.sh deleted file mode 100755 index 57ff957..0000000 --- a/util/arch.sh +++ /dev/null @@ -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 - diff --git a/util/cron.sh b/util/cron.sh index 47fdc4b..ae3f553 100755 --- a/util/cron.sh +++ b/util/cron.sh @@ -2,7 +2,7 @@ . ./common.sh -./arch.sh +./index.sh daily ./deb.sh ubuntu_active ./deb.sh debian_active echo "============ Updating SQL indices" diff --git a/util/index.sh b/util/index.sh new file mode 100755 index 0000000..87b355b --- /dev/null +++ b/util/index.sh @@ -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 +} + +$@ diff --git a/util/indexer b/util/indexer new file mode 120000 index 0000000..a15109f --- /dev/null +++ b/util/indexer @@ -0,0 +1 @@ +../indexer/target/release/indexer \ No newline at end of file