From db57b964eb77cb6498e9abad5c523c85aa120a1b Mon Sep 17 00:00:00 2001 From: Jason Pierce Date: Thu, 31 Jan 2008 17:26:15 -0600 Subject: [PATCH] Create clean tool branch. Signed-off-by: Jason Pierce --- abs | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ abs.conf | 13 +++++ pkgvers.php | 99 ++++++++++++++++++++++++++++++++++ sync-repos.sh | 8 +++ 4 files changed, 287 insertions(+) create mode 100755 abs create mode 100644 abs.conf create mode 100755 pkgvers.php create mode 100755 sync-repos.sh diff --git a/abs b/abs new file mode 100755 index 0000000..c21e96f --- /dev/null +++ b/abs @@ -0,0 +1,167 @@ +#!/bin/bash -e +# +# abs - download a PKGBUILD tree from a CVS repository +# +# Copyright (c) 2002-2007 by Judd Vinet +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +## +# Script Exit Reasons +# ------------------- +# E_OK : Everything worked :) +# E_MISSING_PROGRAM : A program the script depends on is not installed. +# E_CONFIG_ERROR : Missing/incorrect configuration. +# E_INVALID_OPTION : User has passed unknown/invalid option to script. +## + +myver='1.0' +BUG_REPORT_EMAIL='pacman-dev@archlinux.org' +eval CONFDIR="~/abs/conf" +PASSIVE='m' + +# Source config files +if [ -r "$CONFDIR/abs.conf" ]; then + source "$CONFDIR/abs.conf" +fi + +# User based overrides +if [ -r ~/.abs.conf ]; then + source ~/.abs.conf +fi + + +msg() { + local mesg=$1; shift + printf "==> ${mesg}\n" "$@" >&2 +} + +error() { + local mesg=$1; shift + printf "==> ERROR: ${mesg}\n" "$@" >&2 +} + + +usage() { + printf "abs (pacman) %s - download a PKGBUILD tree from a CVS repository\n\n" "$myver" + printf "Usage %s [options] [repository...]\n\n" "$0" + printf "Options:\n" + printf " -p, --passive The connection is opened in passive mode.\n" + echo + printf " -h, --help Display this help message then exit.\n" + printf " -V, --version Display version information then exit.\n" + echo + printf "\ +abs will synchronize build scripts from the CVS repository\n\ +into %s. You can follow different package trees by\n\ +editing %s files. If no argument is given, abs\n\ +will synchronize from supfiles specified in %s.\n\n" \ + "$ABSROOT" "$CONFDIR/supfile.*" "$CONFDIR/abs.conf" + printf "Report bugs to <%s>.\n" "$BUG_REPORT_EMAIL" +} + +version() { + printf "abs (pacman) %s\n" "$myver" + printf "\ +Copyright (C) 2002-2007 Judd Vinet .\n\n\ +This is free software; see the source for copying conditions.\n\ +There is NO WARRANTY, to the extent permitted by law.\n" +} + + +## +# Signal Traps +## +trap 'error "TERM signal caught. Exiting..."; exit 1' TERM HUP QUIT +trap 'error "Aborted by user! Exiting..."; exit 1' INT +trap 'error "An unknown error has occured. Exiting..."; exit 1' ERR + + +# Parse Command Line Options. +OPT_SHORT="hpV" +OPT_LONG="help,passive,version" +OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')" +if echo "$OPT_TEMP" | grep -q 'GETOPT GO BANG!'; then + # This is a small hack to stop the script bailing with 'set -e' + echo; usage; exit 1 # E_INVALID_OPTION; +fi +eval set -- "$OPT_TEMP" +unset OPT_SHORT OPT_LONG OPT_TEMP + +while true; do + case "$1" in + -p|--passive) PASSIVE='-';; + + -h|--help) usage; exit 0;; # E_OK + -V|--version) version; exit 0;; # E_OK + + --) OPT_IND=0; shift; break;; + *) usage; exit 1;; # E_INVALID_OPTION + esac + shift +done + +if [ $# -gt 0 ]; then + SUPFILES=("$@") +fi + + +# Check permissions and programs. +if [ ! -d "$ABSROOT" ]; then + error "%s does not exist or is not a directory." "$ABSROOT" + exit 1 # E_CONFIG_ERROR +elif [ ! -w "$ABSROOT" ]; then + error "You do not have write permissions in %s." "$ABSROOT" + exit 1 # E_CONFIG_ERROR +fi + + +if [ "$(type -p csup)" ]; then + CVSUP="csup" +elif [ "$(type -p cvsup)" ]; then + CVSUP="cvsup" +else + error "Missing CVS synchronization utility. Install csup or cvsup." + exit 1 # E_MISSING_PROGRAM +fi + + +# Begin script. +for sup in ${SUPFILES[@]}; do + case "$sup" in + testing) + if [ ! -d "$ABSROOT/$sup" ]; then + mkdir "$ABSROOT/$sup" + fi + workdir="$ABSROOT/$sup" + ;; + + *) + if [ "$sup" != "${sup#!}" ]; then + continue + fi + workdir="$ABSROOT" + ;; + esac + + msg "Updating %s..." "$sup" + cd "$workdir" + echo $CVSUP -L 1 -r 0 -g -b "$workdir" -P "$PASSIVE" -c .sup "$CONFDIR/supfile.$sup" + $CVSUP -L 1 -r 0 -g -b "$workdir" -P "$PASSIVE" -c .sup "$CONFDIR/supfile.$sup" +done + +exit 0 # E_OK + +# vim: set ts=2 sw=2 noet: diff --git a/abs.conf b/abs.conf new file mode 100644 index 0000000..5707f4d --- /dev/null +++ b/abs.conf @@ -0,0 +1,13 @@ +# +# /etc/abs/abs.conf +# + +# the top-level directory of all your PKGBUILDs +[ "$ABSROOT" = "" ] && eval ABSROOT="~/abs/pkgbuild/" + +# +# Supfiles to be parsed by abs (in this order) +# (prefix a module with a ! to disable it) +# +SUPFILES=(core !extra !unstable !community !testing) + diff --git a/pkgvers.php b/pkgvers.php new file mode 100755 index 0000000..7add6a1 --- /dev/null +++ b/pkgvers.php @@ -0,0 +1,99 @@ +#!/usr/bin/php + \ No newline at end of file diff --git a/sync-repos.sh b/sync-repos.sh new file mode 100755 index 0000000..6e7a032 --- /dev/null +++ b/sync-repos.sh @@ -0,0 +1,8 @@ +#!/bin/sh +repo='~/repo'; + +echo rsync -avz --delete rsync.archlinux.org::current ${repo}/current +echo rsync -avz --delete rsync.archlinux.org::abs ${repo}abs + +#rsync -avz --delete rsync.archlinux.org::ftp/testing /mnt/arch +#rsync -avz --delete rsync.archlinux.org::extra /mnt/arch/extra \ No newline at end of file -- 2.11.4.GIT