Added and indexed FreeBSD 1.0

This commit is contained in:
Yorhel 2012-07-26 11:42:00 +02:00
parent 36301e1ffd
commit 2f288c9eeb
4 changed files with 92 additions and 17 deletions

View file

@ -87,7 +87,8 @@ INSERT INTO systems (id, name, release, short, relorder) VALUES
(25, 'Debian', '3.1', 'debian-sarge', 7),
(26, 'Debian', '4.0', 'debian-etch', 8),
(27, 'Debian', '5.0', 'debian-lenny', 9),
(28, 'Debian', '6.0', 'debian-squeeze', 10);
(28, 'Debian', '6.0', 'debian-squeeze', 10),
(29, 'FreeBSD', '1.0', 'freebsd-1.0', 0);
-- Removes any path components and compression extensions from the filename.

View file

@ -11,20 +11,6 @@ SYSID=1
. ./common.sh
# Returns 0 if the package is already in the database or if an error occured.
# Otherwise adds the package, sets PKGID to the new ID, and returns 1.
PKGID=
add_pkginfo() { # cat name ver date
RES=`echo "SELECT id FROM package WHERE system = :'sysid' AND name = :'name' AND version = :'ver'"\
| $PSQL -v "sysid=$SYSID" -v "name=$2" -v "ver=$3"`
[ "$?" -ne 0 -o -n "$RES" ] && return 0
RES=`echo "INSERT INTO package (system, category, name, version, released) VALUES(:'sysid',:'cat',:'name',:'ver',:'rel') RETURNING id"\
| $PSQL -v "sysid=$SYSID" -v "cat=$1" -v "name=$2" -v "ver=$3" -v "rel=$4"`
[ "$?" -ne 0 ] && return 0
PKGID=$RES
return 1
}
checkpkg() {
REPO=$1
@ -54,7 +40,7 @@ checkpkg() {
fi
BUILDDATE=`date -d "@$BUILDDATE" '+%F'`
add_pkginfo "$REPO" "$NAME" "$VERSION" "$BUILDDATE"
add_pkginfo $SYSID "$REPO" "$NAME" "$VERSION" "$BUILDDATE"
if [ "$?" -eq 0 ]; then
$DEBUG && echo "===> $FN"
$DEBUG && echo "Already up-to-date"

View file

@ -8,6 +8,21 @@ TMP=`mktemp -d manned.XXXXXX`
trap "rm -rf $TMP" EXIT
# Usage: add_pkginfo sysid category name version date
# Returns 0 if the package is already in the database or if an error occured.
# Otherwise adds the package, sets PKGID to the new ID, and returns 1.
PKGID=
add_pkginfo() {
RES=`echo "SELECT id FROM package WHERE system = :'sysid' AND name = :'name' AND version = :'ver'"\
| $PSQL -v "sysid=$1" -v "name=$3" -v "ver=$4"`
[ "$?" -ne 0 -o -n "$RES" ] && return 0
RES=`echo "INSERT INTO package (system, category, name, version, released) VALUES(:'sysid',:'cat',:'name',:'ver',:'rel') RETURNING id"\
| $PSQL -v "sysid=$1" -v "cat=$2" -v "name=$3" -v "ver=$4" -v "rel=$5"`
[ "$?" -ne 0 ] && return 0
PKGID=$RES
return 1
}
# Usage: add_tar <file> <pkgid> <flags>
# Requires a recent GNU tar for compression autodetect and xz support.
@ -15,7 +30,7 @@ trap "rm -rf $TMP" EXIT
# error.
add_tar() {
DIR=`mktemp -d "$TMP/tar.XXXXXXX"`
tar --warning=no-unknown-keyword -C "$DIR" $3 -xf "$1" --wildcards '*/man/*'\
tar --warning=no-unknown-keyword -C "$DIR" $3 -xf "$1" --wildcards '*man/*'\
&& ./add_dir.pl "$DIR" "$2"
RET=$?
rm -rf "$DIR"

73
util/freebsd.sh Executable file
View file

@ -0,0 +1,73 @@
#!/bin/sh
. ./common.sh
add_splittar() { # <url-prefix> <last-sequence> <pkgid> <flags>
$CURL "$1{"`perl -le "print join ',', 'aa'..'$2'"`'}' | add_tar - $3 $4
}
# Check whether we already have a core file in the DB, otherwise add it.
# (The version we use for the core file is the same as its date)
# If <last-sequence> is set, add_splittar() is used. Otherwise the file is
# assumed to be a regular tar.gz.
check_dist() { # <sysid> <url-prefix> <pkgname> <date> <last-sequence>
add_pkginfo $1 core "$3" "$4" "$4" && return
echo "===> $3"
if [ -n "$5" ]; then
add_splittar "$2" "$5" $PKGID -z
else
$CURL "$2" | add_tar - $PKGID -z
fi
}
# Adds a FreeBSD 1.0 package. These lack version information and categories and
# are in general not as well organized the package repositories in the later
# versions.
check_oldpkg() { # <sysid> <url> <pkgname> <date>
add_pkginfo $1 "packages" "$3" "$4" "$4" && return
echo "===> $3"
$CURL "$2" | add_tar - $PKGID -z
}
f1_0() {
MIR="http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE"
echo "============ $MIR"
# Core distribution
check_dist 29 "$MIR/tarballs/bindist/bin_tgz." "core-bindist" "1993-11-15" dc
check_dist 29 "$MIR/tarballs/xfree86/doc.tgz" "core-xfree86-doc" "1993-10-25"
check_dist 29 "$MIR/tarballs/xfree86/fontserv.tgz" "core-xfree86-fontserv" "1993-10-21"
check_dist 29 "$MIR/tarballs/xfree86/man.tgz" "core-xfree86-man" "1993-10-20"
check_dist 29 "$MIR/tarballs/xfree86/pex.tgz" "core-xfree86-pex" "1993-10-21"
# A few packages
check_oldpkg 29 "$MIR/packages/emacs-19-19_bin.tgz" "emacs-19-19_bin" "1993-09-13"
check_oldpkg 29 "$MIR/packages/f2c_bin.tgz" "f2c_bin" "1993-10-01"
check_oldpkg 29 "$MIR/packages/fileutils_bin.tgz" "fileutils_bin" "1993-10-06"
check_oldpkg 29 "$MIR/packages/ghostscript_bin.tgz" "ghostscript_bin" "1993-10-02"
check_oldpkg 29 "$MIR/packages/gopher_bin.tgz" "gopher_bin" "1993-10-15"
check_oldpkg 29 "$MIR/packages/info-zip_bin.tgz" "info-zip_bin" "1993-09-04"
check_oldpkg 29 "$MIR/packages/jpeg_bin.tgz" "jpeg_bin" "1993-09-04"
check_oldpkg 29 "$MIR/packages/kermit_bin.tgz" "kermit_bin" "1993-09-04"
check_oldpkg 29 "$MIR/packages/ksh_bin.tgz" "ksh_bin" "1993-09-04"
check_oldpkg 29 "$MIR/packages/miscutils_bin.tgz" "miscutils_bin" "1993-09-06"
check_oldpkg 29 "$MIR/packages/mtools_bin.tgz" "mtools_bin" "1993-08-30"
check_oldpkg 29 "$MIR/packages/pbmplus_bin.tgz" "pbmplus_bin" "1993-10-05"
check_oldpkg 29 "$MIR/packages/pkg_install.tar.gz" "pkg_install" "1993-10-10"
check_oldpkg 29 "$MIR/packages/shellutils_bin.tgz" "shellutils_bin" "1993-10-06"
check_oldpkg 29 "$MIR/packages/tcl_bin.tgz" "tcl_bin" "1993-09-18"
check_oldpkg 29 "$MIR/packages/tcsh_bin.tgz" "tcsh_bin" "1993-09-04"
check_oldpkg 29 "$MIR/packages/textutils_bin.tgz" "textutils_bin" "1993-09-05"
check_oldpkg 29 "$MIR/packages/tk_bin.tgz" "tk_bin" "1993-09-18"
check_oldpkg 29 "$MIR/packages/urt_bin.tgz" "urt_bin" "1993-10-05"
check_oldpkg 29 "$MIR/packages/xlock_bin.tgz" "xlock_bin" "1993-09-04"
check_oldpkg 29 "$MIR/packages/xv_bin.tgz" "xv_bin" "1993-09-06"
check_oldpkg 29 "$MIR/packages/xview32b.tgz" "xview32b" "1993-09-16"
check_oldpkg 29 "$MIR/packages/zsh_bin.tgz" "zsh_bin" "1993-09-04"
}
f1_0