Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2005-10-20 20:46:35 +0000
committerJudd Vinet <judd@archlinux.org>2005-10-20 20:46:35 +0000
commit6851ce24abf07ac8bfe1406944351608ab0cfb1b (patch)
tree372ddef9e88e91e13b5a24fdc8ce469102537b79
parente37bc739bd704d5d0ac22d28d9f5a9334c61707e (diff)
copied up-to-date scripts from pacman 2.9.7
-rwxr-xr-xscripts/gensync26
-rwxr-xr-xscripts/makepkg85
-rwxr-xr-xscripts/makeworld4
-rwxr-xr-xscripts/pacman-optimize114
-rwxr-xr-xscripts/updatesync26
5 files changed, 210 insertions, 45 deletions
diff --git a/scripts/gensync b/scripts/gensync
index 7c3420fd..3cfcbcaa 100755
--- a/scripts/gensync
+++ b/scripts/gensync
@@ -2,7 +2,7 @@
#
# gensync
#
-# Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
#
# 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
@@ -20,7 +20,7 @@
# USA.
#
-myver='2.9.2'
+myver='2.9.7'
usage() {
echo "gensync $myver"
@@ -100,6 +100,17 @@ db_write_entry()
done
echo "" >>desc
fi
+ if [ ${#replaces[*]} -gt 0 ]; then
+ echo "%REPLACES%" >>desc
+ for it in "${replaces[@]}"; do
+ echo "$it" >>desc
+ done
+ echo "" >>desc
+ fi
+ if [ "$force" = "y" -o "$force" = "Y" ]; then
+ echo "%FORCE%" >>desc
+ echo "" >>desc
+ fi
# depends
: >depends
if [ ${#depends[*]} -gt 0 ]; then
@@ -123,17 +134,6 @@ db_write_entry()
done
echo "" >>depends
fi
- if [ ${#replaces[*]} -gt 0 ]; then
- echo "%REPLACES%" >>depends
- for it in "${replaces[@]}"; do
- echo "$it" >>depends
- done
- echo "" >>depends
- fi
- if [ "$force" = "y" -o "$force" = "Y" ]; then
- echo "%FORCE%" >>depends
- echo "" >>depends
- fi
# preserve the modification time
touch -r $1 desc depends
}
diff --git a/scripts/makepkg b/scripts/makepkg
index 19d4e6b2..6b578524 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -2,7 +2,7 @@
#
# makepkg
#
-# Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
#
# 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
@@ -20,7 +20,7 @@
# USA.
#
-myver='2.9.2'
+myver='2.9.7'
startdir=`pwd`
PKGDEST=$startdir
USE_COLOR="n"
@@ -108,7 +108,7 @@ handledeps() {
local missingdeps=0
local deplist="$*"
local haveperm=0
- if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
+ if [ \( "`id -u`" = "0" -a "$INFAKEROOT" != "1" \) -o "$DEP_SUDO" = 1 ]; then
haveperm=1
fi
@@ -122,6 +122,25 @@ handledeps() {
exit 1
fi
# TODO: check deps again to make sure they were resolved
+ elif [ "$DEP_SUDO" = "1" ]; then
+ # install missing deps from binary packages (using pacman -S and sudo)
+ msg "Installing missing dependencies..."
+ if [ "$INFAKEROOT" = "1" ]; then
+ # kinda hacky, but we need to make pacman think that we're NOT
+ # in fakeroot so it will go ahead and install the dependencies.
+ FAKEROOTKEY2=$FAKEROOTKEY
+ unset FAKEROOTKEY
+ fi
+ sudo pacman -D $deplist
+ if [ "$INFAKEROOT" = "1" ]; then
+ FAKEROOTKEY=$FAKEROOTKEY2
+ unset FAKEROOTKEY2
+ fi
+ if [ "$?" = "127" ]; then
+ error "Failed to install missing dependencies."
+ exit 1
+ fi
+ # TODO: check deps again to make sure they were resolved
elif [ "$DEP_SRC" = "1" ]; then
# install missing deps by building them from source.
# we look for each package name in $ABSROOT and build it.
@@ -163,8 +182,8 @@ handledeps() {
fi
elif [ "$deplist" != "" -a $haveperm -eq 0 ]; then
if [ "$DEP_SRC" = "1" -o "$DEP_BIN" = "1" ]; then
- warning "Cannot auto-install missing dependencies as a normal user!"
- plain "Run makepkg as root to resolve dependencies automatically."
+ warning "Cannot auto-install missing dependencies as a normal user without sudo!"
+ plain "Run makepkg as root or with -S to resolve dependencies automatically."
fi
missingdeps=1
fi
@@ -176,6 +195,7 @@ usage() {
echo "usage: $0 [options]"
echo "options:"
echo " -b, --builddeps Build missing dependencies from source"
+ echo " -B, --noccache Do not use ccache during build"
echo " -c, --clean Clean up work files after build"
echo " -C, --cleancache Clean up source files from the cache"
echo " -d, --nodeps Skip all dependency checks"
@@ -191,6 +211,7 @@ usage() {
echo " -p <buildscript> Use an alternate build script (instead of PKGBUILD)"
echo " -r, --rmdeps Remove installed dependencies after a successful build"
echo " -s, --syncdeps Install missing dependencies with pacman"
+ echo " -S, --sudosync Install missing dependencies with pacman and sudo"
echo " -w <destdir> Write package to <destdir> instead of the working dir"
echo
echo " if -p is not specified, makepkg will look for a PKGBUILD"
@@ -200,19 +221,21 @@ usage() {
# Options
+BUILDSCRIPT="./PKGBUILD"
CLEANUP=0
CLEANCACHE=0
-INSTALL=0
-GENMD5=0
DEP_BIN=0
DEP_SRC=0
-NODEPS=0
+DEP_SUDO=0
FORCE=0
+GENMD5=0
+INSTALL=0
+NOBUILD=0
+NOCCACHE=0
+NODEPS=0
NOEXTRACT=0
NOSTRIP=0
-NOBUILD=0
RMDEPS=0
-BUILDSCRIPT="./PKGBUILD"
ARGLIST=$@
@@ -221,7 +244,9 @@ while [ "$#" -ne "0" ]; do
--clean) CLEANUP=1 ;;
--cleancache) CLEANCACHE=1 ;;
--syncdeps) DEP_BIN=1 ;;
+ --sudosync) DEP_SUDO=1 ;;
--builddeps) DEP_SRC=1 ;;
+ --noccache) NOCCACHE=1 ;;
--nodeps) NODEPS=1 ;;
--noextract) NOEXTRACT=1 ;;
--install) INSTALL=1 ;;
@@ -240,11 +265,12 @@ while [ "$#" -ne "0" ]; do
exit 1
;;
-*)
- while getopts "cCsbdehifgj:mnorp:w:-" opt; do
+ while getopts "bBcCdefghij:mnop:rsSw:-" opt; do
case $opt in
+ b) DEP_SRC=1 ;;
+ B) NOCCACHE=1 ;;
c) CLEANUP=1 ;;
C) CLEANCACHE=1 ;;
- b) DEP_SRC=1 ;;
d) NODEPS=1 ;;
e) NOEXTRACT=1 ;;
f) FORCE=1 ;;
@@ -261,6 +287,7 @@ while [ "$#" -ne "0" ]; do
p) BUILDSCRIPT=$OPTARG ;;
r) RMDEPS=1 ;;
s) DEP_BIN=1 ;;
+ S) DEP_SUDO=1 ;;
w) PKGDEST=$OPTARG ;;
-)
OPTIND=0
@@ -280,6 +307,12 @@ while [ "$#" -ne "0" ]; do
shift
done
+# check for sudo
+if [ "$DEP_SUDO" = "1" -a ! "`type -p sudo`" ]; then
+ error "Cannot find the sudo binary! Is sudo installed?"
+ exit 1
+fi
+
# convert a (possibly) relative path to absolute
cd $PKGDEST 2>/dev/null
if [ $? -ne 0 ]; then
@@ -320,6 +353,10 @@ if [ `echo $pkgrel | grep '-'` ]; then
error "pkgrel is not allowed to contain hyphens."
exit 1
fi
+if [ "$install" -a ! -f "$install" ]; then
+ error "install scriptlet ($install) does not exist."
+ exit 1
+fi
if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" -a "$GENMD5" = "0" ]; then
if [ "$INSTALL" = "1" ]; then
@@ -553,7 +590,9 @@ if [ "$NOBUILD" = "1" ]; then
fi
# use ccache if it's available
-[ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
+if [ "$NOCCACHE" = "0" ]; then
+ [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
+fi
# build
msg "Starting build()..."
@@ -567,6 +606,7 @@ fi
cd $startdir
rm -rf pkg/usr/info pkg/usr/share/info
rm -rf pkg/usr/doc pkg/usr/share/doc
+rm -rf pkg/{usr,opt/gnome}/share/gtk-doc
# move /usr/share/man files to /usr/man
if [ -d pkg/usr/share/man ]; then
@@ -631,9 +671,6 @@ echo "pkgname = $pkgname" >>.PKGINFO
echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
echo "pkgdesc = $pkgdesc" >>.PKGINFO
echo "url = $url" >>.PKGINFO
-for it in "${license[@]}"; do
- echo "license = $it" >>.PKGINFO
-done
echo "builddate = $builddate" >>.PKGINFO
echo "packager = $packager" >>.PKGINFO
echo "size = $size" >>.PKGINFO
@@ -641,6 +678,9 @@ if [ "$CARCH" != "" ]; then
echo "arch = $CARCH" >>.PKGINFO
fi
+for it in "${license[@]}"; do
+ echo "license = $it" >>.PKGINFO
+done
for it in "${replaces[@]}"; do
echo "replaces = $it" >>.PKGINFO
done
@@ -687,9 +727,20 @@ if [ "$CLEANUP" = "1" ]; then
rm -rf src pkg filelist
fi
-if [ "$RMDEPS" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
+if [ "$RMDEPS" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then
msg "Removing installed dependencies..."
pacman -R $makedeplist $deplist
+elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then
+ msg "Removing installed dependencies..."
+ if [ "$INFAKEROOT" = "1" ]; then
+ FAKEROOTKEY2=$FAKEROOTKEY
+ unset FAKEROOTKEY
+ fi
+ sudo pacman -R $makedeplist $deplist
+ if [ "$INFAKEROOT" = "1" ]; then
+ FAKEROOTKEY=$FAKEROOTKEY2
+ unset FAKEROOTKEY2
+ fi
fi
msg "Finished making: $pkgname (`date`)"
diff --git a/scripts/makeworld b/scripts/makeworld
index ef2c94b1..7d4c762c 100755
--- a/scripts/makeworld
+++ b/scripts/makeworld
@@ -2,7 +2,7 @@
#
# makeworld
#
-# Copyright (c) 2002-2004 by Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
#
# 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
@@ -20,8 +20,8 @@
# USA.
#
+version="2.9.7"
toplevel=`pwd`
-version="2.9.2"
usage() {
echo "makeworld version $version"
diff --git a/scripts/pacman-optimize b/scripts/pacman-optimize
new file mode 100755
index 00000000..34a2667a
--- /dev/null
+++ b/scripts/pacman-optimize
@@ -0,0 +1,114 @@
+#!/bin/bash
+#
+# pacman-optimize
+#
+# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
+#
+# 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+# USA.
+#
+
+myver='2.9.7'
+
+usage() {
+ echo "pacman-optimize $myver"
+ echo "usage: $0 [pacman_db_root]"
+ echo
+ echo "pacman-optimize is a little hack that should improve the performance"
+ echo "of pacman when reading/writing to its filesystem-based database."
+ echo
+ echo "Because pacman uses many small files to keep track of packages,"
+ echo "there is a tendency for these files to become fragmented over time."
+ echo "This script attempts to relocate these small files into one"
+ echo "contiguous location on your hard drive. The result is that the hard"
+ echo "drive should be able to read them faster, since the hard drive head"
+ echo "does not have to move around the disk as much."
+ echo
+}
+
+die() {
+ echo "pacman-optimize: $*" >&2
+ exit 1
+}
+
+die_r() {
+ rm -f /tmp/pacman.lck
+ die $*
+}
+
+
+dbroot="/var/lib/pacman"
+
+if [ "$1" != "" ]; then
+ if [ "$1" = "-h" -o "$1" = "--help" ]; then
+ usage
+ exit 0
+ fi
+ dbroot=$1
+fi
+
+if [ "`id -u`" != 0 ]; then
+ die "You must be root to optimize the database"
+fi
+
+# make sure pacman isn't running
+if [ -f /tmp/pacman.lck ]; then
+ die "Pacman lockfile was found. Cannot run while pacman is running."
+fi
+
+if [ ! -d $dbroot ]; then
+ die "$dbroot does not exist or is not a directory"
+fi
+
+# don't let pacman run while we do this
+touch /tmp/pacman.lck
+
+# step 1: sum the old db
+echo "==> md5sum'ing the old database..."
+find $dbroot -type f | sort | xargs md5sum >/tmp/pacsums.old
+
+# step 1: copy the entire db directory to a new one
+echo "==> copying $dbroot..."
+cp -a $dbroot $dbroot.new || die_r "error copying $dbroot"
+
+# step 2: switch the directory names and sum the new one
+echo "==> md5sum'ing the new database..."
+mv $dbroot $dbroot.bak || die_r "error renaming $dbroot"
+mv $dbroot.new $dbroot || die_r "error renaming $dbroot.new"
+find $dbroot -type f | sort | xargs md5sum >/tmp/pacsums.new
+
+# step 3: compare sums
+echo "==> checking integrity..."
+diff /tmp/pacsums.old /tmp/pacsums.new >/dev/null 2>&1
+if [ $? -ne 0 ]; then
+ # failed, move the old one back into place
+ rm -rf $dbroot
+ mv $dbroot.bak $dbroot
+ die_r "integrity check FAILED, reverting to old database"
+fi
+
+# step 4: remove the backup
+echo "==> removing old database..."
+rm -rf $dbroot.bak || die_r "error removing backup $dbroot.bak"
+
+# remove the lock and sum files
+rm -f /tmp/pacman.lck /tmp/pacsums.old /tmp/pacsums.new
+
+echo
+echo "Finished. Your pacman database has been optimized."
+echo
+
+exit 0
+
diff --git a/scripts/updatesync b/scripts/updatesync
index 10614d5b..5385ed66 100755
--- a/scripts/updatesync
+++ b/scripts/updatesync
@@ -3,7 +3,7 @@
# updatesync
#
# Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
-# Derived from gensync (c) 2002-2004 Judd Vinet <jvinet@zeroflux.org>
+# Derived from gensync (c) 2002-2005 Judd Vinet <jvinet@zeroflux.org>
#
# 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
@@ -21,7 +21,7 @@
# USA.
#
-myver='2.9.2'
+myver='2.9.7'
usage() {
echo "updatesync $myver"
@@ -103,6 +103,17 @@ db_write_entry()
done
echo "" >>desc
fi
+ if [ ${#replaces[*]} -gt 0 ]; then
+ echo "%REPLACES%" >>desc
+ for it in "${replaces[@]}"; do
+ echo "$it" >>desc
+ done
+ echo "" >>desc
+ fi
+ if [ "$force" = "y" -o "$force" = "Y" ]; then
+ echo "%FORCE%" >>desc
+ echo "" >>desc
+ fi
# depends
: >depends
if [ ${#depends[*]} -gt 0 ]; then
@@ -126,17 +137,6 @@ db_write_entry()
done
echo "" >>depends
fi
- if [ ${#replaces[*]} -gt 0 ]; then
- echo "%REPLACES%" >>depends
- for it in "${replaces[@]}"; do
- echo "$it" >>depends
- done
- echo "" >>depends
- fi
- if [ "$force" = "y" -o "$force" = "Y" ]; then
- echo "%FORCE%" >>depends
- echo "" >>depends
- fi
}
delete_entry()