* modeline fixes / reformatting

* formatting / indentation fixes
* makepkg:
    Dan McGee <dpmcgee@gmail.com> - integrity check fix
    Jürgen Hötzel <juergen@hoetzel.info> - EUID usage and "x$foo" check revamp
This commit is contained in:
Aaron Griffin 2006-12-21 01:53:40 +00:00
parent b1fbcd3ab5
commit 74e347f09b
14 changed files with 672 additions and 659 deletions

View File

@ -248,4 +248,4 @@ const char *alpm_db_get_url(pmdb_t *db)
return strdup(path);
}
/* vim: set noet: */
/* vim: set ts=2 sw=2 noet: */

View File

@ -413,3 +413,5 @@ char* _alpm_SHAFile(char *filename) {
return(NULL);
}
/* vim: set ts=2 sw=2 noet: */

View File

@ -58,3 +58,5 @@ struct sha_ctx
/* Needed for pacman */
char *_alpm_SHAFile (char *);
/* vim: set ts=2 sw=2 noet: */

View File

@ -1,5 +1,4 @@
#!/bin/bash
# vim: set ft=sh ts=2 sw=2
[ -f /etc/abs/abs.conf ] && source /etc/abs/abs.conf
@ -93,4 +92,4 @@ fi
update
exit 0
# vim: set ts=2 noet:
# vim: set ts=2 sw=2 noet:

View File

@ -22,3 +22,4 @@ rm -f $pkgname.tar.gz
cd $pkgname || die "Failed to cwd"
makepkg
# vim: set ts=2 sw=2 noet:

View File

@ -211,9 +211,9 @@ cd `dirname $2`
for file in `find $rootdir/* -name PKGBUILD`; do
source $file || die "errors parsing $file"
db_write_entry $file || die "error writing entry for $file"
else
else
echo "gensync: missing package: $pkgfile" >&2
fi
fi
done
echo "gensync: compressing to $destfile..." >&2
@ -223,4 +223,5 @@ tar c * | gzip -9 >$destfile
rm -rf $gstmpdir
exit 0
# vim: set ts=2 sw=2 noet:

View File

@ -26,7 +26,7 @@
#
myver='3.0.0'
startdir=`pwd`
startdir=$(pwd)
PKGDEST=$startdir
BUILDSCRIPT="PKGBUILD"
@ -106,8 +106,8 @@ strip_url() {
check_option() {
local i
for i in ${options[@]}; do
local uc=`echo $i | tr [:lower:] [:upper:]`
local lc=`echo $i | tr [:upper:] [:lower:]`
local uc=$(echo $i | tr [:lower:] [:upper:])
local lc=$(echo $i | tr [:upper:] [:lower:])
if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
echo $1
return
@ -131,7 +131,7 @@ checkdeps() {
[ $# -gt 0 ] || return
missdep=`pacman $PACMAN_OPTS -T $*`
missdep=$(pacman $PACMAN_OPTS -T $*)
ret=$?
if [ "$ret" != "0" ]; then
if [ "$ret" = "127" ]; then
@ -144,7 +144,7 @@ checkdeps() {
nl=0
echo -ne "\n" >&2
# add this dep to the list
depname=`echo $dep | sed 's|=.*$||' | sed 's|>.*$||' | sed 's|<.*$||'`
depname=$(echo $dep | sed 's|=.*$||' | sed 's|>.*$||' | sed 's|<.*$||')
deplist="$deplist $depname"
continue
fi
@ -163,7 +163,7 @@ handledeps() {
local missingdeps=0
local deplist="$*"
local haveperm=0
if [ \( "`id -u`" = "0" -a "$INFAKEROOT" != "1" \) -o "$DEP_SUDO" = 1 ]; then
if [ \( "$EUID" = "0" -a "$INFAKEROOT" != "1" \) -o "$DEP_SUDO" = 1 ]; then
haveperm=1
fi
@ -305,10 +305,10 @@ fi
while [ "$#" -ne "0" ]; do
case $1 in
# pacman
# pacman
--noconfirm) PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;;
--noprogressbar) PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;;
# makepkg
# makepkg
--clean) CLEANUP=1 ;;
--cleancache) CLEANCACHE=1 ;;
--syncdeps) DEP_BIN=1 ;;
@ -381,7 +381,7 @@ while [ "$#" -ne "0" ]; do
done
# check for sudo
if [ "$DEP_SUDO" = "1" -a ! "`type -p sudo`" ]; then
if [ "$DEP_SUDO" = "1" -a ! "$(type -p sudo)" ]; then
error "Cannot find the sudo binary! Is sudo installed?"
exit 1
fi
@ -392,7 +392,7 @@ if [ $? -ne 0 ]; then
error "Package destination directory does not exist or permission denied."
exit 1
fi
PKGDEST=`pwd`
PKGDEST=$(pwd)
cd $OLDPWD
if [ "$CLEANCACHE" = "1" ]; then
@ -402,7 +402,7 @@ if [ "$CLEANCACHE" = "1" ]; then
rm -rf "${SRCDEST}"/*
exit 0
else
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
if [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
msg "Cleaning up source files from the cache."
rm -rf /var/cache/pacman/src/*
exit 0
@ -424,13 +424,13 @@ umask 0022
if [ ! -f $BUILDSCRIPT ]; then
error "$BUILDSCRIPT does not exist."
exit 1
#TODO this is an attempt at a generic way to unset all package specific
#variables in a PKGBUILD
#else
# #this is fun.... we'll unset
# for var in $(grep "=" $BUILDSCRIPT | sed "s|.*\(\<.*\>\)=.*|\1|g"); do
# unset $var
# done
#TODO this is an attempt at a generic way to unset all package specific
#variables in a PKGBUILD
#else
# #this is fun.... we'll unset
# for var in $(grep "=" $BUILDSCRIPT | sed "s|.*\(\<.*\>\)=.*|\1|g"); do
# unset $var
# done
fi
source $BUILDSCRIPT
@ -478,9 +478,9 @@ fi
# Enter the fakeroot environment if necessary. This will call the makepkg script again
# as the fake root user. We detect this by passing a sentinel option (-F) to makepkg
if [ "`id -u`" != "0" ]; then
if [ "$EUID" != "0" ]; then
if [ "$USE_FAKEROOT" = "y" -o "$USE_FAKEROOT" = "Y" ]; then
if [ `type -p fakeroot` ]; then
if [ $(type -p fakeroot) ]; then
msg "Entering fakeroot environment"
fakeroot -- $0 -F $ARGLIST
exit $?
@ -501,25 +501,25 @@ if [ "`id -u`" != "0" ]; then
fi
fi
msg "Making package: $pkgname $pkgver-$pkgrel (`date`)"
msg "Making package: $pkgname $pkgver-$pkgrel ($(date))"
unset deplist makedeplist
# fix flyspray bug #5973 - Dan McGee <dpmcgee@gmail.com>
if [ `type -p pacman` -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then
if [ $(type -p pacman) -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then
msg "Checking Runtime Dependencies..."
deplist=`checkdeps ${depends[@]}`
deplist=$(checkdeps ${depends[@]})
handledeps $deplist
if [ $? -gt 0 ]; then
exit 1
fi
# check deps again to make sure they were resolved
deplist=`checkdeps ${depends[@]}`
deplist=$(checkdeps ${depends[@]})
if [ ! -z "$deplist" ]; then
error "Failed to install missing dependencies."
exit 1
fi
msg "Checking Buildtime Dependencies..."
makedeplist=`checkdeps ${makedepends[@]}`
makedeplist=$(checkdeps ${makedepends[@]})
handledeps $makedeplist
if [ $? -gt 0 ]; then
exit 1
@ -554,9 +554,9 @@ for netfile in ${source[@]}; do
msg "Aborting..."
exit 1
fi
ftpclient=`echo $FTPAGENT | awk {'print $1'}`
ftpclient=$(echo $FTPAGENT | awk {'print $1'})
if [ ! -x "$ftpclient" ]; then
error "ftpclient `basename $ftpclient` is not installed."
error "ftpclient $(basename $ftpclient) is not installed."
msg "Aborting..."
exit 1
fi
@ -577,11 +577,11 @@ for netfile in ${source[@]}; do
exit 1
exit 1
fi
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
if [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src
if [ -n "$SRCDEST" ]; then
mkdir -p $SRCDEST && cp "$file" $SRCDEST
elif [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
elif [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
mkdir -p /var/cache/pacman/src && cp "$file" /var/cache/pacman/src
else
cp "$file" ..
@ -593,7 +593,6 @@ done
if [ "$NOEXTRACT" = "1" ]; then
warning "Skipping source extraction -- using existing src/ tree"
warning "Skipping source integrity checks -- using existing src/ tree"
else
for integ in ${INTEGRITY_CHECK[@]}; do
@ -619,7 +618,7 @@ else
newline=0
numsrc=${#source[@]}
for netfile in "${source[@]}"; do
file=`strip_url "$netfile"`
file=$(strip_url "$netfile")
sum=$(eval "$integrity_name '$file' | cut -d' ' -f 1")
if [ $ct -eq 0 ]; then
echo -n "${integrity_name}s=("
@ -636,7 +635,6 @@ else
fi
done
plain ""
exit 0
#Validate integrity checks
else
integrity_sums=($(eval echo \${${integrity_name}s[@]}))
@ -662,17 +660,26 @@ else
exit 1
fi
else
warning "Integrity checks ($INTEGRITY_CHECK) are missing or incomplete."
warning "Integrity checks ($integ) are missing or incomplete."
fi
fi
done
if [ "$GENINTEG" = "1" ]; then
exit 0
fi
fi
#Extract sources
if [ "$NOEXTRACT" = "1" ]; then
warning "Skipping source extraction -- using existing src/ tree"
else
msg "Extracting Sources..."
for netfile in "${source[@]}"; do
unziphack=0
file=`strip_url "$netfile"`
file=$(strip_url "$netfile")
unset cmd
case "`echo $file |tr "A-Z" "a-z"`" in
case "$(echo $file |tr "A-Z" "a-z")" in
*.tar.gz|*.tar.z|*.tgz)
cmd="tar --use-compress-program=gzip -xf $file" ;;
*.tar.bz2|*.tbz2)
@ -706,7 +713,7 @@ else
done
fi
if [ "`id -u`" = "0" ]; then
if [ "$EUID" = "0" ]; then
# chown all source files to root.root
chown -R root.root $startdir/src
fi
@ -718,18 +725,18 @@ if [ -d $startdir/pkg ]; then
fi
mkdir -p $startdir/pkg
if [ "x$NOBUILD" = "1" ]; then
if [ "$NOBUILD" = "1" ]; then
msg "Sources are ready."
exit 0
fi
# use distcc if requested
if [ "x$USE_DISTCC" = "y" ]; then
if [ "$USE_DISTCC" = "y" ]; then
[ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
fi
# use ccache if it's available
if [ "x$USE_CCACHE" = "1" ]; then
if [ "$USE_CCACHE" = "1" ]; then
[ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
fi
@ -740,7 +747,7 @@ msg "Starting build()..."
echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
set_e=$?
if [ "x$LOGGING" = "1" ]; then
if [ "$LOGGING" = "1" ]; then
BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
if [ -f "$BUILDLOG" ]; then
i=1
@ -774,7 +781,7 @@ else
fi
fi
if [ ! "`check_option KEEPDOCS`" -a "$KEEPDOCS" = "0" ]; then
if [ ! "$(check_option KEEPDOCS)" -a "$KEEPDOCS" = "0" ]; then
# remove info/doc files
msg "Removing info/doc files..."
cd $startdir
@ -790,33 +797,26 @@ if [ -d pkg/usr/share/man ]; then
rm -rf pkg/usr/share/man
fi
# remove /usr/share directory if empty
if [ -d pkg/usr/share ]; then
if [ -z "`ls -1 pkg/usr/share`" ]; then
rm -r pkg/usr/share
fi
fi
# compress man pages
msg "Compressing man pages..."
find $startdir/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do
ext="${i##*.}"
fn="${i##*/}"
if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
ext="${i##*.}"
fn="${i##*/}"
if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
# update symlinks to this manpage
find $startdir/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do
rm -f "$ln"
ln -sf "${fn}.gz" "${ln}.gz"
done
# compress the original
gzip -9 "$i"
done
# compress the original
gzip -9 "$i"
fi
done
cd $startdir
# strip binaries
if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
if [ ! "$(check_option NOSTRIP)" -a "$NOSTRIP" = "0" ]; then
msg "Stripping debugging symbols from libraries..."
find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \
-exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
@ -828,25 +828,25 @@ if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
fi
# remove libtool (.la) files
if [ "`check_option NOLIBTOOL`" -a "x$NOLIBTOOL" = "1" ]; then
if [ "$(check_option NOLIBTOOL)" -a "$NOLIBTOOL" = "1" ]; then
msg "Removing libtool .la files..."
find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
fi
# remove empty directories
if [ "`check_option NOEMPTYDIRS`" -a "x$NOEMPTYDIRS" = 1 ]; then
if [ "$(check_option NOEMPTYDIRS)" -a "$NOEMPTYDIRS" = 1 ]; then
msg "Removing empty directories..."
find pkg -depth -type d -empty -delete;
fi
# get some package meta info
builddate=`LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y"`
builddate=$(LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y")
if [ "$PACKAGER" != "" ]; then
packager="$PACKAGER"
else
packager="Arch Linux (http://www.archlinux.org)"
fi
size=`du -cb $startdir/pkg | tail -n 1 | awk '{print $1}'`
size=$(du -cb $startdir/pkg | tail -n 1 | awk '{print $1}')
# write the .PKGINFO file
msg "Generating .PKGINFO file..."
@ -920,7 +920,7 @@ if [ "$CLEANUP" = "1" ]; then
rm -rf ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log*
fi
if [ "$RMDEPS" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then
if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then
msg "Removing installed dependencies..."
pacman $PACMAN_OPTS -R $makedeplist $deplist
elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then
@ -936,9 +936,9 @@ elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then
fi
fi
msg "Finished making: $pkgname (`date`)"
msg "Finished making: $pkgname ($(date))"
if [ "$INSTALL" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
if [ "$INSTALL" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
msg "Installing package with pacman -U..."
pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}
exit $?
@ -956,3 +956,5 @@ elif [ "$INSTALL" = "1" -a "$DEP_SUDO" = "1" ]; then
fi
exit 0
# vim: set ts=2 sw=2 noet:

View File

@ -58,10 +58,10 @@ fi
MAKEPKG_OPTS=
for arg in $*; do
case $arg in
# pacman
# pacman
--noconfirm) MAKEPKG_OPTS="$MAKEPKG_OPTS --noconfirm" ;;
--noprogressbar) MAKEPKG_OPTS="$MAKEPKG_OPTS --noprogressbar" ;;
# makepkg
# makepkg
--clean) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
--install) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
--syncdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;;
@ -155,3 +155,5 @@ echo " started: $sd" >>$toplevel/build.log
echo " finished: $ed" >>$toplevel/build.log
exit 0
# vim: set ts=2 sw=2 noet:

View File

@ -112,3 +112,4 @@ echo
exit 0
# vim: set ts=2 sw=2 noet:

View File

@ -110,4 +110,4 @@ if __name__ == "__main__":
for i in items[0:numToShow]:
print i[1], ':', i[0]
# vim: set ts=4 sw=4 sta et sts ai:
# vim: set ts=4 sw=4 et:

View File

@ -25,15 +25,13 @@
#TODO
# * Check for md5 changes in backup lines and change pkgrel
pacinfo ()
{
pacinfo () {
[ $# -ne 2 ] && return 1
#use echo to strip spaces
echo $(pacman -Qi ${1} | grep "${2}" | cut -d: -f2-)
}
make_pkginfo ()
{
make_pkginfo () {
echo "# Generated by re-pacman 1.0.0"
echo "# On $(date)"
echo "pkgname =$(pacinfo ${1} Name)"
@ -77,3 +75,5 @@ echo ${flist} | tr ' ' '\n' | tar czf "${1}-${ver}.pkg.tar.gz" -T - 2>/dev/null
rm -f .PKGINFO .FILELIST
echo ":: Package '${1}-${ver}.pkg.tar.gz' is now ready for installation"
# vim: set ts=2 sw=2 noet:

View File

@ -81,7 +81,7 @@ db_write_entry()
OLDIFS="$IFS"
#gross... IFS == new line
IFS='
'
'
for i in $(tar xOf "$pkgfile" .PKGINFO | grep -v "^#" |sed 's|\(\w*\)\s*=\s*\(.*\)|\1="\2"|'); do
eval "${i}"
case "$i" in
@ -234,3 +234,5 @@ if [ $# -gt 1 ]; then
fi
[ -d "$gstmpdir" ] && rm -rf $gstmpdir
# vim: set ts=2 sw=2 noet:

View File

@ -248,3 +248,4 @@ cd $curdir
rm -rf $ustmpdir
exit 0
# vim: set ts=2 sw=2 noet: