Imported from pacman-1.22.tar.gz

This commit is contained in:
Judd Vinet 2002-04-12 19:34:34 +00:00
parent b656d1fe59
commit 4c3842d42b
9 changed files with 114 additions and 57 deletions

View file

@ -1,5 +1,9 @@
VERSION DESCRIPTION VERSION DESCRIPTION
------------------------------------------------------------------ ------------------------------------------------------------------
1.22 - Some manpage typo fixes
- Added --root switch to pacsync
- Added --help and ability to specify a PKGBUILD to makepkg
- Switched default downloader to snarf
1.21 - Added better backup control -- upgrade/add and remove 1.21 - Added better backup control -- upgrade/add and remove
do different things with the -n switch do different things with the -n switch
1.2 - Added wildcard handling 1.2 - Added wildcard handling

View file

@ -27,7 +27,7 @@ BINDIR = /usr/bin
MANDIR = /usr/man MANDIR = /usr/man
ETCDIR = /etc ETCDIR = /etc
VERSION = 1.21 VERSION = 1.22
LIBTAR_VERSION = 1.2.4 LIBTAR_VERSION = 1.2.4
CXX = gcc CXX = gcc

16
README
View file

@ -13,15 +13,15 @@ DESCRIPTION:
upgrade packages in the system, and it will allow you to query the upgrade packages in the system, and it will allow you to query the
package database for installed packages, files and owners. package database for installed packages, files and owners.
Although the package manager itself is quite simple, the pacman tarball Although the package manager itself is quite simple, the pacman tarball
also comes with scripts that help automate building and installing also comes with scripts that help automate building and installing
packages. These are used extensively in the Arch Build System (ABS), packages. These are used extensively in the Arch Build System (ABS),
used in Arch Linux <http://www.archlinux.org>. See ABS.txt for more used in Arch Linux <http://www.archlinux.org>. See ABS.txt for more
information. information.
As of version 1.2, pacsync is included as well. This performs an apt-like As of version 1.2, pacsync is included as well. This performs an
function, keeping your system's packages in sync with the packages on apt-like function, keeping your system's packages in sync with the
a remote server. packages on a remote server.
Plans exist for dependency checking as I approach version 2.0. Plans exist for dependency checking as I approach version 2.0.
See TODO for more info. See TODO for more info.

8
TODO
View file

@ -1,19 +1,11 @@
Some of these items kinda belong on more of a wishlist than a todo list. ;)
> make sure program consistently returns a non-zero return code on
error, so scripts can rely on it
- add a [sibling] option to .PKGINFO -- used when only one of - add a [sibling] option to .PKGINFO -- used when only one of
the siblings can be installed at a time (eg, bsdinit,sysvinit) the siblings can be installed at a time (eg, bsdinit,sysvinit)
> handle wildcards on the command line
- sort packages by package name in pacman.db - sort packages by package name in pacman.db
? manage conditional file installs (ie, 'info' pages) ? manage conditional file installs (ie, 'info' pages)
- maybe add a 'confirm every action' option for doing paranoid installs - maybe add a 'confirm every action' option for doing paranoid installs
- add a consistency check operation - add a consistency check operation
- change char[xxx] to char[PATH_MAX]
- add file locking to db - add file locking to db
- add a --dbpath option - add a --dbpath option
+ dependency checking + dependency checking
+ fetch files via ftp
- need to manage foreign package lists like apt
- upgrade currently does a double db backup; not really desirable - upgrade currently does a double db backup; not really desirable

50
makepkg
View file

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
me=`basename $0` myver='1.22'
myver='1.21'
startdir=`pwd` startdir=`pwd`
[ -f /etc/makepkg.conf ] && . /etc/makepkg.conf [ -f /etc/makepkg.conf ] && . /etc/makepkg.conf
@ -10,12 +9,34 @@ strip_url() {
echo $1 | sed 's|^.*://.*/||g' echo $1 | sed 's|^.*://.*/||g'
} }
if [ ! -f $startdir/PKGBUILD ]; then if [ "$1" = "--help" -o "$1" = "-h" ]; then
echo "error: $startdir/PKGBUILD does not exist!" >&2 shift
echo "makepkg version $myver"
echo "usage: $0 [build_script]"
echo
echo " if build_script is not specified, makepkg will look for a PKGBUILD"
echo " file in the current directory."
echo
exit 1 exit 1
fi fi
. $startdir/PKGBUILD BUILDSCRIPT="`pwd`/PKGBUILD"
if [ "$1" != "" ]; then
BUILDSCRIPT=$1
fi
if [ ! -f $BUILDSCRIPT ]; then
echo "==> ERROR: $BUILDSCRIPT does not exist!" >&2
exit 1
fi
. $BUILDSCRIPT
# check for no-no's
if [ `echo $pkgver | grep '-'` ]; then
echo "==> ERROR: pkgver is not allowed to contain hyphens." >&2
exit 1
fi
echo echo
d=`date` d=`date`
@ -34,8 +55,25 @@ for netfile in ${source[@]}; do
echo "==> Using local copy of $file" >&2 echo "==> Using local copy of $file" >&2
cp /var/cache/pacman/src/$file . cp /var/cache/pacman/src/$file .
else else
proto=`echo $netfile | sed 's|://.*||'`
if [ "$proto" != "ftp" -a "$proto" != "http" ]; then
echo "==> ERROR: $netfile was not found in the build directory and is not a proper URL."
echo "==> Aborting..." >&2
exit 1
fi
# check for a download utility
if [ -x /usr/bin/snarf ]; then
ftpagent="/usr/bin/snarf"
elif [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then
ftpagent="/usr/bin/lftpget"
elif [ -x /usr/bin/wget ]; then
ftpagent="/usr/bin/wget --passive-ftp --tries=3 --waitretry=3"
else
echo "==> ERROR: You need an ftp client installed (snarf/lftp/wget) in /usr/bin" >&2
exit 1
fi
echo "==> Downloading $file" >&2 echo "==> Downloading $file" >&2
wget --passive-ftp --no-directories --tries=3 --waitretry=3 $netfile 2>&1 $ftpagent $netfile 2>&1
if [ ! -f $file ]; then if [ ! -f $file ]; then
echo "==> ERROR: Failed to download $file" >&2 echo "==> ERROR: Failed to download $file" >&2
echo "==> Aborting..." >&2 echo "==> Aborting..." >&2

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
toplevel=`pwd` toplevel=`pwd`
version="1.21" version="1.22"
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "makepkg version $version" echo "makepkg version $version"

View file

@ -21,7 +21,7 @@
#ifndef PACMAN_H #ifndef PACMAN_H
#define PACMAN_H #define PACMAN_H
#define VERSION "1.21" #define VERSION "1.22"
#define PKGEXT ".tar.gz" #define PKGEXT ".tar.gz"
#define PKGDB "/var/lib/pacman/pacman.db" #define PKGDB "/var/lib/pacman/pacman.db"

85
pacsync
View file

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
version="1.21" version="1.22"
tanpath="/var/lib/pacman" tanpath="/var/lib/pacman"
tandb="pacsync.db" tandb="pacsync.db"
errors=0 errors=0
upgrade=0 upgrade=0
INSTALL_ROOT="/"
message() { message() {
echo "==> $1" >&2 echo "==> $1" >&2
@ -12,7 +13,7 @@ message() {
usage() { usage() {
echo "pacsync version $version" echo "pacsync version $version"
echo "usage: $0 <operation> [package]" echo "usage: $0 [--root <root>] <operation> [package]"
echo "" echo ""
echo "operations:" echo "operations:"
echo " sync Download a fresh package list from the server" echo " sync Download a fresh package list from the server"
@ -25,7 +26,7 @@ usage() {
} }
checkdb() { checkdb() {
if [ ! -f $tanpath/$tandb ]; then if [ ! -f $INSTALL_ROOT/$tanpath/$tandb ]; then
message "missing package list. (use \"sync\" first)" message "missing package list. (use \"sync\" first)"
exit 1 exit 1
fi fi
@ -39,9 +40,9 @@ download() {
cl="$cl $SYNC_SERVER/$file" cl="$cl $SYNC_SERVER/$file"
done done
message "Downloading $targ" message "Downloading $targ"
$ftpagent $cl $ftpagent $cl 2>&1
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
message "ERROR: could not download $targ" message "error: could not download $targ"
return 1 return 1
fi fi
return 0 return 0
@ -53,8 +54,8 @@ dosync() {
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
exit 1 exit 1
fi fi
rm -f $tanpath/$tandb rm -f $INSTALL_ROOT/$tanpath/$tandb
mv /tmp/$tandb $tanpath/$tandb mv /tmp/$tandb $INSTALL_ROOT/$tanpath/$tandb
message "Done." message "Done."
} }
@ -62,19 +63,19 @@ doinstall() {
pkg2dl= pkg2dl=
pkg2inst= pkg2inst=
for pkgname in $*; do for pkgname in $*; do
line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $tanpath/$tandb` line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $INSTALL_ROOT/$tanpath/$tandb`
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
message "package $pkgname not found" message "package $pkgname not found"
exit 1 exit 1
fi fi
pacman=`pacman -Q $pkgname 2>/dev/null` pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null`
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
message "$pkgname is already installed (try using \"upgrade\")" message "$pkgname is already installed (try using \"upgrade\")"
exit 1 exit 1
fi fi
filename=`echo $line | sed 's|^[a-z]*/||g'` filename=`echo $line | sed 's|^[a-z]*/||g'`
pkg2inst="$pkg2inst $filename" pkg2inst="$pkg2inst $filename"
if [ ! -f /var/cache/pacman/pkg/$filename ]; then if [ ! -f $INSTALL_ROOT/var/cache/pacman/pkg/$filename ]; then
pkg2dl="$pkg2dl $filename" pkg2dl="$pkg2dl $filename"
fi fi
done done
@ -85,19 +86,19 @@ doinstall() {
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
exit 1 exit 1
fi fi
if [ `pwd` != "/var/cache/pacman/pkg" ]; then if [ `pwd` != "$INSTALL_ROOT/var/cache/pacman/pkg" ]; then
# move downloaded files into cache # move downloaded files into cache
mkdir -p /var/cache/pacman/pkg mkdir -p $INSTALL_ROOT/var/cache/pacman/pkg
mv $pkg2dl /var/cache/pacman/pkg/ mv $pkg2dl $INSTALL_ROOT/var/cache/pacman/pkg/
fi fi
fi fi
# install packages # install packages
message "Installing packages" message "Installing packages"
cd /var/cache/pacman/pkg cd $INSTALL_ROOT/var/cache/pacman/pkg
pacman -A $pkg2inst pacman -A -r $INSTALL_ROOT $pkg2inst
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo "ERROR: some packages failed to install" message "error: some packages failed to install"
exit 1 exit 1
fi fi
@ -109,12 +110,12 @@ doupgrade() {
pkg2dl= pkg2dl=
pkg2up= pkg2up=
for pkgname in $*; do for pkgname in $*; do
line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $tanpath/$tandb` line=`egrep "^[a-z]+/$pkgname-[a-zA-Z0-9\.]+-[0-9]+\.pkg\.tar\.gz$" $INSTALL_ROOT/$tanpath/$tandb`
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
message "package $pkgname not found" message "package $pkgname not found"
exit 1 exit 1
fi fi
pacman=`pacman -Q $pkgname 2>/dev/null` pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null`
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
message "$pkgname is not installed (use \"install\" first)" message "$pkgname is not installed (use \"install\" first)"
exit 1 exit 1
@ -128,7 +129,7 @@ doupgrade() {
message "$pkgname is already up to date (skipping)" message "$pkgname is already up to date (skipping)"
else else
pkg2up="$pkg2up $filename" pkg2up="$pkg2up $filename"
if [ ! -f /var/cache/pacman/pkg/$filename ]; then if [ ! -f $INSTALL_ROOT/var/cache/pacman/pkg/$filename ]; then
pkg2dl="$pkg2dl $filename" pkg2dl="$pkg2dl $filename"
fi fi
fi fi
@ -140,20 +141,20 @@ doupgrade() {
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
exit 1 exit 1
fi fi
if [ `pwd` != "/var/cache/pacman/pkg" ]; then if [ `pwd` != "$INSTALL_ROOT/var/cache/pacman/pkg" ]; then
# move downloaded files into cache # move downloaded files into cache
mkdir -p /var/cache/pacman/pkg mkdir -p $INSTALL_ROOT/var/cache/pacman/pkg
mv $pkg2dl /var/cache/pacman/pkg/ mv $pkg2dl $INSTALL_ROOT/var/cache/pacman/pkg/
fi fi
fi fi
# install packages # install packages
if [ "$pkg2up" != "" ]; then if [ "$pkg2up" != "" ]; then
message "Upgrading packages" message "Upgrading packages"
cd /var/cache/pacman/pkg cd $INSTALL_ROOT/var/cache/pacman/pkg
pacman -U $pkg2up pacman -U -r $INSTALL_ROOT $pkg2up
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo "ERROR: some packages failed to upgrade" message "error: some packages failed to upgrade"
exit 1 exit 1
fi fi
message "Done" message "Done"
@ -164,10 +165,11 @@ doupgrade() {
doreport() { doreport() {
headers=0 headers=0
newkernel=0
pkg2up= pkg2up=
for pkgfile in `cat $tanpath/$tandb | sed "s|^[a-z]*/||g"`; do for pkgfile in `cat $INTALL_ROOT/$tanpath/$tandb | sed "s|^[a-z]*/||g"`; do
pkgname=`echo $pkgfile | sed 's|-[a-zA-Z0-9\.]*-[0-9]*\.pkg\.tar\.gz||g'` pkgname=`echo $pkgfile | sed 's|-[a-zA-Z0-9\.]*-[0-9]*\.pkg\.tar\.gz||g'`
pacman=`pacman -Q $pkgname 2>/dev/null` pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null`
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
# skip this one, it's not installed # skip this one, it's not installed
continue continue
@ -180,6 +182,10 @@ doreport() {
# this package is up to date # this package is up to date
continue continue
else else
if [ `echo "$locfile" | egrep '^kernel-[a-zA-Z0-9\.]+-[0-9]+$'` ]; then
newkernel=1
continue
fi
if [ "$headers" = "0" ]; then if [ "$headers" = "0" ]; then
echo "+--------------------------------------+--------------------------------------+" echo "+--------------------------------------+--------------------------------------+"
echo "| LOCAL | REMOTE |" echo "| LOCAL | REMOTE |"
@ -198,6 +204,15 @@ doreport() {
echo "+--------------------------------------+--------------------------------------+" echo "+--------------------------------------+--------------------------------------+"
fi fi
if [ "$newkernel" = "1" ]; then
echo
echo "NOTICE: A new kernel is available for upgrade, but this process will not"
echo " upgrade it for you. If you wish to upgrade, you must explicitly"
echo " request it by running 'pacsync upgrade kernel'. If you choose to"
echo " upgrade, make sure you re-run 'lilo' as well!"
echo
fi
# do we upgrade? # do we upgrade?
if [ "$upgrade" = "1" -a "$pkg2up" != "" ]; then if [ "$upgrade" = "1" -a "$pkg2up" != "" ]; then
echo "" echo ""
@ -217,21 +232,29 @@ if [ $# -lt 1 ]; then
exit 0 exit 0
fi fi
if [ "$1" = "--root" ]; then
shift
INSTALL_ROOT=$1
shift
fi
if [ -f /etc/pacsync.conf ]; then if [ -f /etc/pacsync.conf ]; then
. /etc/pacsync.conf . /etc/pacsync.conf
else else
message "error: missing configuration file!" message "error: Missing /etc/pacsync.conf configuration file!"
exit 1 exit 1
fi fi
proto=`echo $SYNC_SERVER | sed 's|://.*||'` proto=`echo $SYNC_SERVER | sed 's|://.*||'`
# check for a download utility # check for a download utility
if [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then if [ -x /usr/bin/snarf ]; then
ftpagent="/usr/bin/snarf"
elif [ -x /usr/bin/lftpget -a "$proto" = "ftp" ]; then
ftpagent="/usr/bin/lftpget" ftpagent="/usr/bin/lftpget"
elif [ -x /usr/bin/wget ]; then elif [ -x /usr/bin/wget ]; then
ftpagent="/usr/bin/wget --passive-ftp --tries=3 --waitretry=3" ftpagent="/usr/bin/wget --passive-ftp --tries=3 --waitretry=3"
else else
message "error: you need an ftp client installed (lftp or wget) in /usr/bin" message "error: you need an ftp client installed (snarf/lftp/wget) in /usr/bin"
exit 1 exit 1
fi fi
@ -272,7 +295,7 @@ case $op in
;; ;;
clean) clean)
message "Removing packages from cache" message "Removing packages from cache"
rm -f /var/cache/pacman/pkg/* rm -f $INSTALL_ROOT/var/cache/pacman/pkg/*
;; ;;
*) *)
message "error: invalid operation" message "error: invalid operation"

View file

@ -2,7 +2,7 @@
.SH NAME .SH NAME
pacsync \- package update frontend for pacman pacsync \- package update frontend for pacman
.SH SYNOPSIS .SH SYNOPSIS
\fBpacsync <operation> [package] [package] ...\fP \fBpacsync [--root <root>] <operation> [package] [package] ...\fP
.SH DESCRIPTION .SH DESCRIPTION
\fBpacsync\fP is a \fIpackage update\fP frontend for the \fBpacsync\fP is a \fIpackage update\fP frontend for the
\fIpacman\fP package manager. It keeps track of the versions \fIpacman\fP package manager. It keeps track of the versions