Hi,
The last set of patches were made late at night and contain several
bugs. So I've redone them.
I've split the patches up a bit more as well to make the changes
clearer. The *-move.patch files just
move large chunks into functions, the *-cleanup.patch files remove the
fakeroot code. The number at the beginning denotes what order the
patches should be applied in.
I've tested these patches out against my base repo and all works as
expected. It should fix all the fakeroot problems people are having, how
ever I've never encountered the problem described on FS#6208.
Andrew
------------------------------------------------------------
revno: 4
committer: Andrew Fyfe
branch nick: feature-create_package
timestamp: Sun 2007-03-25 13:25:18 +0100
message:
* Moved create package commands into create_package()
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 19:34:35.489021785 +0100
+++ new/scripts/makepkg 2007-03-25 19:35:55.929605832 +0100
@@ -348,6 +348,95 @@
fi
}
+create_package () {
+ # get some package meta info
+ 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}')
+
+ # build a filelist - do this first to keep meta files out of the list
+ msg "Generating .FILELIST file..."
+ cd "$startdir/pkg"
+ tar cvf /dev/null * | sort >.FILELIST
+
+ # write the .PKGINFO file
+ msg "Generating .PKGINFO file..."
+ cd "$startdir/pkg"
+ echo "# Generated by makepkg $myver" >.PKGINFO
+ echo -n "# " >>.PKGINFO
+ date >>.PKGINFO
+ echo "pkgname = $pkgname" >>.PKGINFO
+ echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
+ echo "pkgdesc = $pkgdesc" >>.PKGINFO
+ echo "url = $url" >>.PKGINFO
+ echo "builddate = $builddate" >>.PKGINFO
+ echo "packager = $packager" >>.PKGINFO
+ echo "size = $size" >>.PKGINFO
+ 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
+ for it in "${groups[@]}"; do
+ echo "group = $it" >>.PKGINFO
+ done
+ for it in "${depends[@]}"; do
+ echo "depend = $it" >>.PKGINFO
+ done
+ for it in "${conflicts[@]}"; do
+ echo "conflict = $it" >>.PKGINFO
+ done
+ for it in "${provides[@]}"; do
+ echo "provides = $it" >>.PKGINFO
+ done
+ for it in "${backup[@]}"; do
+ echo "backup = $it" >>.PKGINFO
+ done
+
+ # TODO maybe remove this at some point
+ # warn if license array is not present or empty
+ if [ "$license" = "" ]; then
+ warning "Please add a license line to your $BUILDSCRIPT!"
+ plain "example for GPL'ed software: license=('GPL')."
+ fi
+
+ # check for an install script
+ if [ "$install" != "" ]; then
+ msg "Copying install script..."
+ cp "$startdir/$install" "$startdir/pkg/.INSTALL"
+ fi
+
+ # do we have a changelog?
+ have_changelog=0
+ if [ -f "$startdir/ChangeLog" ]; then
+ msg "Copying package changelog"
+ cp "$startdir/ChangeLog" "$startdir/pkg/.CHANGELOG"
+ have_changelog=1
+ fi
+
+ # tar it up
+ msg "Compressing package..."
+ cd "$startdir/pkg"
+
+ pkg_file="$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}.${PKGEXT}"
+ comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}"
+ [ $have_changelog -eq 1 ] && comp_files=".CHANGELOG $comp_files"
+
+ if ! tar czf $pkg_file $comp_files *; then
+ error "Failed to create package file."
+ exit 1
+ fi
+}
+
installpackage() {
if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then
msg "Installing package with pacman -U..."
@@ -974,92 +1063,7 @@
find -depth -type d -empty -delete;
fi
-# get some package meta info
-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}')
-
-# build a filelist - do this first to keep meta files out of the list
-msg "Generating .FILELIST file..."
-cd "$startdir/pkg"
-tar cvf /dev/null * | sort >.FILELIST
-
-# write the .PKGINFO file
-msg "Generating .PKGINFO file..."
-cd "$startdir/pkg"
-echo "# Generated by makepkg $myver" >.PKGINFO
-echo -n "# " >>.PKGINFO
-date >>.PKGINFO
-echo "pkgname = $pkgname" >>.PKGINFO
-echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
-echo "pkgdesc = $pkgdesc" >>.PKGINFO
-echo "url = $url" >>.PKGINFO
-echo "builddate = $builddate" >>.PKGINFO
-echo "packager = $packager" >>.PKGINFO
-echo "size = $size" >>.PKGINFO
-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
-for it in "${groups[@]}"; do
- echo "group = $it" >>.PKGINFO
-done
-for it in "${depends[@]}"; do
- echo "depend = $it" >>.PKGINFO
-done
-for it in "${conflicts[@]}"; do
- echo "conflict = $it" >>.PKGINFO
-done
-for it in "${provides[@]}"; do
- echo "provides = $it" >>.PKGINFO
-done
-for it in "${backup[@]}"; do
- echo "backup = $it" >>.PKGINFO
-done
-
-# TODO maybe remove this at some point
-# warn if license array is not present or empty
-if [ "$license" = "" ]; then
- warning "Please add a license line to your $BUILDSCRIPT!"
- plain "example for GPL'ed software: license=('GPL')."
-fi
-
-# check for an install script
-if [ "$install" != "" ]; then
- msg "Copying install script..."
- cp "$startdir/$install" "$startdir/pkg/.INSTALL"
-fi
-
-# do we have a changelog?
-have_changelog=0
-if [ -f "$startdir/ChangeLog" ]; then
- msg "Copying package changelog"
- cp "$startdir/ChangeLog" "$startdir/pkg/.CHANGELOG"
- have_changelog=1
-fi
-
-# tar it up
-msg "Compressing package..."
-cd "$startdir/pkg"
-
-pkg_file="$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}.${PKGEXT}"
-comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}"
-[ $have_changelog -eq 1 ] && comp_files=".CHANGELOG $comp_files"
-
-if ! tar czf $pkg_file $comp_files *; then
- error "Failed to create package file."
- exit 1
-fi
+create_package
cd "$startdir"
if [ "$CLEANUP" = "1" ]; then
------------------------------------------------------------
revno: 5
committer: Andrew Fyfe
branch nick: feature-create_package
timestamp: Sun 2007-03-25 13:35:09 +0100
message:
* cleaned up create_package()
=== modified file 'scripts/makepkg'
--- old/scripts/makepkg 2007-03-25 12:25:18 +0000
+++ new/scripts/makepkg 2007-03-25 12:35:09 +0000
@@ -349,26 +349,26 @@
}
create_package () {
+ cd "$startdir/pkg"
+ msg "Creating package..."
+
# get some package meta info
- builddate=$(LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y")
+ local builddate=$(LC_ALL= LANG= date -u "+%a %b %e %H:%M:%S %Y")
if [ "$PACKAGER" != "" ]; then
- packager="$PACKAGER"
+ local packager="$PACKAGER"
else
- packager="Arch Linux (http://www.archlinux.org)"
+ local packager="Arch Linux (http://www.archlinux.org)"
fi
- size=$(du -cb "$startdir/pkg" | tail -n 1 | awk '{print $1}')
+ local size=$(du -sb | awk '{print $1}')
# build a filelist - do this first to keep meta files out of the list
- msg "Generating .FILELIST file..."
- cd "$startdir/pkg"
- tar cvf /dev/null * | sort >.FILELIST
+ msg2 "Generating .FILELIST file..."
+ tar -cvf /dev/null * | sort >.FILELIST
# write the .PKGINFO file
- msg "Generating .PKGINFO file..."
- cd "$startdir/pkg"
+ msg2 "Generating .PKGINFO file..."
echo "# Generated by makepkg $myver" >.PKGINFO
- echo -n "# " >>.PKGINFO
- date >>.PKGINFO
+ echo "# $(LC_ALL= LANG= date -u)" >>.PKGINFO
echo "pkgname = $pkgname" >>.PKGINFO
echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
echo "pkgdesc = $pkgdesc" >>.PKGINFO
@@ -380,6 +380,7 @@
echo "arch = $CARCH" >>.PKGINFO
fi
+ local it
for it in "${license[@]}"; do
echo "license = $it" >>.PKGINFO
done
@@ -409,31 +410,31 @@
plain "example for GPL'ed software: license=('GPL')."
fi
+ local comp_files
+
# check for an install script
if [ "$install" != "" ]; then
- msg "Copying install script..."
- cp "$startdir/$install" "$startdir/pkg/.INSTALL"
+ msg2 "Copying install script..."
+ cp "$startdir/$install" .INSTALL
+ comp_files="$comp_files .INSTALL"
fi
# do we have a changelog?
- have_changelog=0
if [ -f "$startdir/ChangeLog" ]; then
- msg "Copying package changelog"
- cp "$startdir/ChangeLog" "$startdir/pkg/.CHANGELOG"
- have_changelog=1
+ msg2 "Copying package changelog"
+ cp "$startdir/ChangeLog" .CHANGELOG
+ comp_files="$comp_files .CHANGELOG"
fi
# tar it up
- msg "Compressing package..."
- cd "$startdir/pkg"
-
- pkg_file="$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}.${PKGEXT}"
- comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}"
- [ $have_changelog -eq 1 ] && comp_files=".CHANGELOG $comp_files"
-
- if ! tar czf $pkg_file $comp_files *; then
+ msg2 "Compressing package..."
+
+ local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}"
+ comp_files="$comp_files .PKGINFO .FILELIST"
+
+ if ! tar -czf "$pkg_file" $comp_files *; then
error "Failed to create package file."
- exit 1
+ exit 1 # TODO: error code
fi
}
------------------------------------------------------------
revno: 6
committer: Andrew Fyfe
branch nick: feature-tidy_install
timestamp: Sun 2007-03-25 13:44:23 +0100
message:
* moved the following into tidy_install()
- Remove info/doc files
- Move usr/share/man to usr/man
- Compress man pages
- Strip binaries and libraries
- Remove libtool files
- Remove empty directories
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 19:39:05.156389252 +0100
+++ new/scripts/makepkg 2007-03-25 19:39:28.349710962 +0100
@@ -348,6 +348,67 @@
fi
}
+tidy_install () {
+ if [ "$(check_option docs)" = "n" ]; then
+ # remove info/doc files
+ msg "Removing info/doc files..."
+ cd "$startdir/pkg"
+ #fix flyspray bug #5021
+ rm -rf ${DOC_DIRS[@]}
+ fi
+
+ # move /usr/share/man files to /usr/man
+ if [ -d $startdir/pkg/usr/share/man ]; then
+ cd "$startdir"
+ mkdir -p pkg/usr/man
+ cp -a pkg/usr/share/man/* pkg/usr/man/
+ rm -rf pkg/usr/share/man
+ 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
+ # 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"
+ fi
+ done
+
+ cd "$startdir"
+
+ # strip binaries
+ if [ "$(check_option strip)" = "y" ]; 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 \
+ | grep -v "No such file" | grep -v "format not recognized"
+ msg "Stripping symbols from binaries..."
+ find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \
+ -exec /usr/bin/strip '{}' \; 2>&1 \
+ | grep -v "No such file" | grep -v "format not recognized"
+ fi
+
+ # remove libtool (.la) files
+ if [ "$(check_option libtool)" = "n" ]; then
+ msg "Removing libtool .la files..."
+ find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
+ fi
+
+ # remove empty directories
+ if [ "$(check_option emptydirs)" = "n" ]; then
+ msg "Removing empty directories..."
+ cd "$startdir/pkg"
+ find -depth -type d -empty -delete;
+ fi
+}
+
create_package () {
cd "$startdir/pkg"
msg "Creating package..."
@@ -1005,64 +1066,7 @@
fi
fi
-if [ "$(check_option docs)" = "n" ]; then
- # remove info/doc files
- msg "Removing info/doc files..."
- cd "$startdir/pkg"
- #fix flyspray bug #5021
- rm -rf ${DOC_DIRS[@]}
-fi
-
-# move /usr/share/man files to /usr/man
-if [ -d $startdir/pkg/usr/share/man ]; then
- cd "$startdir"
- mkdir -p pkg/usr/man
- cp -a pkg/usr/share/man/* pkg/usr/man/
- rm -rf pkg/usr/share/man
-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
- # 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"
- fi
-done
-
-cd "$startdir"
-
-# strip binaries
-if [ "$(check_option strip)" = "y" ]; 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 \
- | grep -v "No such file" | grep -v "format not recognized"
- msg "Stripping symbols from binaries..."
- find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \
- -exec /usr/bin/strip '{}' \; 2>&1 \
- | grep -v "No such file" | grep -v "format not recognized"
-fi
-
-# remove libtool (.la) files
-if [ "$(check_option libtool)" = "n" ]; then
- msg "Removing libtool .la files..."
- find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
-fi
-
-# remove empty directories
-if [ "$(check_option emptydirs)" = "n" ]; then
- msg "Removing empty directories..."
- cd "$startdir/pkg"
- find -depth -type d -empty -delete;
-fi
+tidy_install
create_package
------------------------------------------------------------
revno: 7
committer: Andrew Fyfe
branch nick: feature-tidy_install
timestamp: Sun 2007-03-25 13:53:16 +0100
message:
* cleaned up tidy_install()
* added 'LC_ALL=C LANG=C' to stip bin/lib find commands.
On non en_US locales the greps can fail.
=== modified file 'scripts/makepkg'
--- old/scripts/makepkg 2007-03-25 12:44:23 +0000
+++ new/scripts/makepkg 2007-03-25 12:53:16 +0000
@@ -349,62 +349,59 @@
}
tidy_install () {
+ cd "$startdir/pkg"
+ msg "Tidying install..."
+
if [ "$(check_option docs)" = "n" ]; then
- # remove info/doc files
- msg "Removing info/doc files..."
- cd "$startdir/pkg"
+ msg2 "Removing info/doc files..."
#fix flyspray bug #5021
rm -rf ${DOC_DIRS[@]}
fi
- # move /usr/share/man files to /usr/man
- if [ -d $startdir/pkg/usr/share/man ]; then
- cd "$startdir"
- mkdir -p pkg/usr/man
- cp -a pkg/usr/share/man/* pkg/usr/man/
- rm -rf pkg/usr/share/man
+ if [ -d usr/share/man ]; then
+ msg2 "Moving usr/share/man files to usr/man"
+ mkdir -p usr/man
+ cp -a usr/share/man/* usr/man/
+ rm -rf usr/share/man
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##*/}"
+ msg2 "Compressing man pages..."
+ local manpage ext file link
+ find {usr{,/local},opt/*}/man -type f 2>/dev/null | while read manpage ; do
+ ext="${manpage##*.}"
+ file="${manpage##*/}"
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"
+ find {usr{,/local},opt/*}/man -lname "$file" 2>/dev/null | while read link ; do
+ rm -f "$link"
+ ln -sf "${file}.gz" "${link}.gz"
done
# compress the original
- gzip -9 "$i"
+ gzip -9 "$manpage"
fi
done
- cd "$startdir"
-
- # strip binaries
if [ "$(check_option strip)" = "y" ]; then
- msg "Stripping debugging symbols from libraries..."
- find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \
+ msg2 "Stripping debugging symbols from libraries..."
+ LC_ALL=C LANG=C \
+ find {.,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \
-exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
| grep -v "No such file" | grep -v "format not recognized"
- msg "Stripping symbols from binaries..."
- find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \
+
+ msg2 "Stripping symbols from binaries..."
+ LC_ALL=C LANG=C \
+ find {.,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \
-exec /usr/bin/strip '{}' \; 2>&1 \
| grep -v "No such file" | grep -v "format not recognized"
fi
- # remove libtool (.la) files
if [ "$(check_option libtool)" = "n" ]; then
- msg "Removing libtool .la files..."
- find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
+ msg2 "Removing libtool .la files..."
+ find -type f -name "*.la" -exec rm -f -- '{}' \;
fi
- # remove empty directories
if [ "$(check_option emptydirs)" = "n" ]; then
- msg "Removing empty directories..."
- cd "$startdir/pkg"
+ msg2 "Removing empty directories..."
find -depth -type d -empty -delete;
fi
}
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 19:42:10.990979362 +0100
+++ new/scripts/makepkg 2007-03-25 19:47:52.000000000 +0100
@@ -348,6 +348,68 @@
fi
}
+run_build () {
+ # use distcc if it is requested (check buildenv and PKGBUILD opts)
+ if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
+ [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
+ elif [ "$(check_option distcc)" = "n" ]; then
+ # if it is not wanted, clear the makeflags too
+ export MAKEFLAGS=""
+ fi
+
+ # use ccache if it is requested (check buildenv and PKGBUILD opts)
+ if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
+ [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
+ fi
+
+ # clear user-specified makeflags if requested
+ if [ "$(check_option makeflags)" = "n" ]; then
+ export MAKEFLAGS=""
+ fi
+
+ # build
+ msg "Starting build()..."
+
+ # some applications (eg, blackbox) will not build with some languages
+ unset LC_ALL LANG
+ umask 0022
+
+ #check for "exit on syntax error" shell option
+ echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
+ set_e=$?
+
+ ret=0
+ if [ "$LOGGING" = "1" ]; then
+ BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
+ if [ -f "$BUILDLOG" ]; then
+ i=1
+ while true; do
+ if [ -f "$BUILDLOG.$i" ]; then
+ i=$(($i +1))
+ else
+ break
+ fi
+ done
+ mv "$BUILDLOG" "$BUILDLOG.$i"
+ fi
+
+ #use 'errexit' to bail on syntax error
+ [ $set_e -eq 1 ] && set -e
+ build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
+ [ $set_e -eq 1 ] && set +e
+ else
+ #use 'errexit' to bail on syntax error
+ [ $set_e -eq 1 ] && set -e
+ build 2>&1 || ret=$?
+ [ $set_e -eq 1 ] && set +e
+ fi
+ if [ $ret -gt 0 ]; then
+ error "Build Failed. Aborting..."
+ removedeps
+ exit 2
+ fi
+}
+
tidy_install () {
cd "$startdir/pkg"
msg "Tidying install..."
@@ -1002,65 +1064,7 @@
fi
mkdir -p "$startdir/pkg"
- # use distcc if it is requested (check buildenv and PKGBUILD opts)
- if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
- [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
- elif [ "$(check_option distcc)" = "n" ]; then
- # if it is not wanted, clear the makeflags too
- export MAKEFLAGS=""
- fi
-
- # use ccache if it is requested (check buildenv and PKGBUILD opts)
- if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
- [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
- fi
-
- # clear user-specified makeflags if requested
- if [ "$(check_option makeflags)" = "n" ]; then
- export MAKEFLAGS=""
- fi
-
- # build
- msg "Starting build()..."
-
- # some applications (eg, blackbox) will not build with some languages
- unset LC_ALL LANG
- umask 0022
-
- #check for "exit on syntax error" shell option
- echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
- set_e=$?
-
- ret=0
- if [ "$LOGGING" = "1" ]; then
- BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
- if [ -f "$BUILDLOG" ]; then
- i=1
- while true; do
- if [ -f "$BUILDLOG.$i" ]; then
- i=$(($i +1))
- else
- break
- fi
- done
- mv "$BUILDLOG" "$BUILDLOG.$i"
- fi
-
- #use 'errexit' to bail on syntax error
- [ $set_e -eq 1 ] && set -e
- build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
- [ $set_e -eq 1 ] && set +e
- else
- #use 'errexit' to bail on syntax error
- [ $set_e -eq 1 ] && set -e
- build 2>&1 || ret=$?
- [ $set_e -eq 1 ] && set +e
- fi
- if [ $ret -gt 0 ]; then
- error "Build Failed. Aborting..."
- removedeps
- exit 2
- fi
+ run_build
fi
tidy_install
------------------------------------------------------------
revno: 9
committer: Andrew Fyfe
branch nick: feature-run_build
timestamp: Sun 2007-03-25 14:13:21 +0100
message:
* cleaned up run_build.
* restore LC_ALL and LANG after running build().
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 20:13:25.241786827 +0100
+++ new/scripts/makepkg 2007-03-25 20:14:20.008907829 +0100
@@ -369,20 +369,22 @@
# build
msg "Starting build()..."
+ cd "$startdir/src"
# some applications (eg, blackbox) will not build with some languages
- unset LC_ALL LANG
+ local _LC_ALL="$LC_ALL" ; LC_ALL='C'
+ local _LANG="$LANG" ; LANG='C'
umask 0022
#check for "exit on syntax error" shell option
echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
set_e=$?
- ret=0
+ local ret=0
if [ "$LOGGING" = "1" ]; then
BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
if [ -f "$BUILDLOG" ]; then
- i=1
+ local i=1
while true; do
if [ -f "$BUILDLOG.$i" ]; then
i=$(($i +1))
@@ -403,10 +405,15 @@
build 2>&1 || ret=$?
[ $set_e -eq 1 ] && set +e
fi
+
+ # restore locales
+ export LC_ALL="$_LC_ALL"
+ export LANG="$_LANG"
+
if [ $ret -gt 0 ]; then
error "Build Failed. Aborting..."
removedeps
- exit 2
+ exit 2 # TODO: error code
fi
}
------------------------------------------------------------
revno: 10
committer: Andrew Fyfe
branch nick: feature-fakeroot
timestamp: Sun 2007-03-25 14:31:05 +0100
message:
* reduced use fakeroot to
- run_build()
- tidy_install()
- create_package()
* added check for inproper use of '-F'.
* added yn_question() function.
* added warning about running makepkg as root.
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 19:55:48.273553640 +0100
+++ new/scripts/makepkg 2007-03-25 19:56:02.738377944 +0100
@@ -41,6 +41,7 @@
DEP_SRC=0
SUDO=0
FORCE=0
+INFAKEROOT=0
GENINTEG=0
INSTALL=0
NOBUILD=0
@@ -52,14 +53,6 @@
PACMAN_OPTS=
-#determine if we are running with fakeroot
-if [ "$1" = "-F" ]; then
- INFAKEROOT=1
- shift
-else
- INFAKEROOT=0
-fi
-
### SUBROUTINES ###
plain() {
@@ -102,6 +95,24 @@
fi
}
+yn_question () {
+ if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
+ echo -en " \033[1;1m$1\033[1;0m " >&2
+ else
+ echo -n " $1 " >&2
+ fi
+
+ local answer
+ read answer
+ answer="$(echo $answer | tr [:upper:] [:lower:])"
+
+ if [ "$answer" = 'y' -o "$answer" = 'yes' ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
strip_url() {
echo "$1" | sed 's|^.*://.*/||g'
}
@@ -675,7 +686,7 @@
exit 1
;;
-*)
- while getopts "bcCdefghiLmop:rRsS-" opt; do
+ while getopts "bcCdefFghiLmop:rRsS-" opt; do
case $opt in
b) DEP_SRC=1 ;;
c) CLEANUP=1 ;;
@@ -683,6 +694,7 @@
d) NODEPS=1 ;;
e) NOEXTRACT=1 ;;
f) FORCE=1 ;;
+ F) INFAKEROOT=1 ;;
g) GENINTEG=1 ;;
h)
usage
@@ -751,6 +763,46 @@
fi
fi
+if [ "$INFAKEROOT" = "0" ]; then
+ if [ $EUID -eq 0 ]; then
+ # Warn those who like to live dangerously.
+ warning "Running makepkg as root is a \033[1;31mBAD\033[1;37m idea!"
+ plain ""
+ plain "Running makepkg as root can result in permanent, catastropic damage to "
+ plain "your system."
+ plain ""
+ if ! yn_question "Are you sure you want to continue? [N/y]"; then
+ error "Aborting..."
+ exit 1 # $E_USER_ABORT
+ fi
+ elif [ "$(check_buildenv fakeroot)" = "y" ]; then
+ if [ ! $(type -p fakeroot) ]; then
+ warning "Fakeroot is not installed. Building as an unprivileged user"
+ plain "will result in non-root ownership of the packaged files. Install"
+ plain "the fakeroot package to correctly build as a non-root user."
+ plain ""
+ if ! yn_question "Are you sure you want to continue? [N/y]"; then
+ error "Aborting..."
+ exit 1 # $E_USER_ABORT
+ fi
+ fi
+ else
+ warning "Running makepkg as an unprivileged user will result in non-root"
+ plain "ownership of the packaged files. Try using the fakeroot environment by"
+ plain "placing 'fakeroot' in the BUILDENV array in /etc/makepkg.conf"
+ plain ""
+ if ! yn_question "Are you sure you want to continue? [N/y]"; then
+ error "Aborting..."
+ exit 1 # $E_USER_ABORT
+ fi
+ fi
+else
+ if [ "$FAKEROOTKEY" = "" ]; then
+ error "Do not use the '-F' option. This option is only for use by makepkg."
+ exit 1 # TODO: error code
+ fi
+fi
+
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
unset replaces depends conflicts backup source install build makedepends
unset options noextract
@@ -810,29 +862,20 @@
fi
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 [ "$EUID" != "0" ]; then
- if [ "$(check_buildenv fakeroot)" = "y" ]; then
- if [ $(type -p fakeroot) ]; then
- msg "Entering fakeroot environment"
- fakeroot -- $0 -F $ARGLIST
- exit $?
- else
- warning "Fakeroot is not installed. Building as an unprivileged user"
- plain "will result in non-root ownership of the packaged files. Install"
- plain "the fakeroot package to correctly build as a non-root user."
- plain ""
- sleep 1
- fi
+# Run the bear minimum in fakeroot
+# fix flyspray bug 6208 -- using makepkg with fakeroot gives an error
+if [ "$INFAKEROOT" = "1" ]; then
+ if [ "$REPKG" = "1" ]; then
+ warning "Skipping build."
else
- warning "Running makepkg as an unprivileged user will result in non-root"
- plain "ownership of the packaged files. Try using the fakeroot environment"
- plain "by placing 'fakeroot' in the BUILDENV array in makepkg.conf."
- plain ""
- sleep 1
- fi
+ run_build
+ tidy_install
+ fi
+
+ create_package
+
+ msg "Leaveing fakeroot environment."
+ exit 0 # $E_OK
fi
msg "Making package: $pkgname $pkgver-$pkgrel ($(date))"
@@ -1061,22 +1104,34 @@
if [ "$NOBUILD" = "1" ]; then
msg "Sources are ready."
exit 0
-elif [ "$REPKG" = "1" ]; then
- warning "Skipping build"
else
# check for existing pkg directory
- if [ -d "$startdir/pkg" ]; then
+ if [ -d "$startdir/pkg" -a "$REPKG" = "0" ]; then
msg "Removing existing pkg/ directory..."
rm -rf "$startdir/pkg"
fi
mkdir -p "$startdir/pkg"
- run_build
-fi
+ if [ $EUID -eq 0 ]; then
+ if [ "$REPKG" = "1" ]; then
+ warning "Skipping build."
+ else
+ run_build
+ tidy_install
+ fi
+
+ create_package
+ else
+ msg "Entering fakeroot environment..."
+ cd "$startdir"
-tidy_install
+ ret=0
+ fakeroot -- $0 -F $ARGLIST || ret=$?
+ [ $ret -ne 0 ] && exit $ret
-create_package
+ unset ret
+ fi
+fi
cd "$startdir"
if [ "$CLEANUP" = "1" ]; then
------------------------------------------------------------
revno: 11
committer: Andrew Fyfe
branch nick: feature-fakeroot
timestamp: Sun 2007-03-25 14:38:17 +0100
message:
* removed fakeroot hacks from
- handledeps()
- removedeps()
- installpackage()
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 19:57:18.006667240 +0100
+++ new/scripts/makepkg 2007-03-25 19:59:19.305579669 +0100
@@ -207,7 +207,7 @@
local depstrip=""
local striplist=""
local haveperm=0
- if [ \( "$EUID" = "0" -a "$INFAKEROOT" != "1" \) -o "$SUDO" = 1 ]; then
+ if [ "$EUID" = "0" -o "$SUDO" = 1 ]; then
haveperm=1
fi
@@ -220,21 +220,11 @@
if [ "$DEP_BIN" = "1" -a "$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 $PACMAN_OPTS -S $striplist
if [ $? -eq 1 ]; then
error "Pacman failed to install missing dependencies."
exit 1
fi
- if [ "$INFAKEROOT" = "1" ]; then
- export FAKEROOTKEY=$FAKEROOTKEY2
- unset FAKEROOTKEY2
- fi
elif [ "$DEP_BIN" = "1" ]; then
# install missing deps from binary packages (using pacman -S)
msg "Installing missing dependencies..."
@@ -344,15 +334,7 @@
if [ "$RMDEPS" = "1" -a "$SUDO" = "1" -a -n "$deplist" ]; then
msg "Removing installed dependencies..."
- if [ "$INFAKEROOT" = "1" ]; then
- export FAKEROOTKEY2=$FAKEROOTKEY
- unset FAKEROOTKEY
- fi
sudo pacman $PACMAN_OPTS -Rs $striplist
- if [ "$INFAKEROOT" = "1" ]; then
- export FAKEROOTKEY=$FAKEROOTKEY2
- unset FAKEROOTKEY2
- fi
elif [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a -n "$deplist" ]; then
msg "Removing installed dependencies..."
pacman $PACMAN_OPTS -Rs $striplist
@@ -579,16 +561,8 @@
installpackage() {
if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then
msg "Installing package with pacman -U..."
- if [ "$INFAKEROOT" = "1" ]; then
- FAKEROOTKEY2=$FAKEROOTKEY
- unset FAKEROOTKEY
- fi
sudo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}
local exitcode=$?
- if [ "$INFAKEROOT" = "1" ]; then
- export FAKEROOTKEY=$FAKEROOTKEY2
- unset FAKEROOTKEY2
- fi
exit $exitcode
elif [ "$INSTALL" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
msg "Installing package with pacman -U..."
------------------------------------------------------------
revno: 12
committer: Andrew Fyfe
branch nick: feature-fake_install
timestamp: Sun 2007-03-25 14:46:38 +0100
message:
* modify run_build() to run other functions.
* add fake_install() support.
diff -Naur old/scripts/makepkg new/scripts/makepkg
--- old/scripts/makepkg 2007-03-25 23:15:12.538842433 +0100
+++ new/scripts/makepkg 2007-03-25 23:16:46.192179436 +0100
@@ -342,6 +342,12 @@
}
run_build () {
+ if [ "$(type -t $1)" != "function" ]; then
+ error "Unknown function '${1}'."
+ error "Aborting..."
+ exit 1 # TODO: error code
+ fi
+
# use distcc if it is requested (check buildenv and PKGBUILD opts)
if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
[ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
@@ -361,7 +367,7 @@
fi
# build
- msg "Starting build()..."
+ msg "Starting ${1}()..."
cd "$startdir/src"
# some applications (eg, blackbox) will not build with some languages
@@ -375,7 +381,7 @@
local ret=0
if [ "$LOGGING" = "1" ]; then
- BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
+ BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}-${1}.log"
if [ -f "$BUILDLOG" ]; then
local i=1
while true; do
@@ -390,12 +396,12 @@
#use 'errexit' to bail on syntax error
[ $set_e -eq 1 ] && set -e
- build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
+ $1 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
[ $set_e -eq 1 ] && set +e
else
#use 'errexit' to bail on syntax error
[ $set_e -eq 1 ] && set -e
- build 2>&1 || ret=$?
+ $1 2>&1 || ret=$?
[ $set_e -eq 1 ] && set +e
fi
@@ -842,7 +848,12 @@
if [ "$REPKG" = "1" ]; then
warning "Skipping build."
else
- run_build
+ if [ "$(type -t fake_install)" != "function" ]; then
+ run_build build
+ else
+ run_build fake_install
+ fi
+
tidy_install
fi
@@ -1090,12 +1101,17 @@
if [ "$REPKG" = "1" ]; then
warning "Skipping build."
else
- run_build
+ run_build build
+ [ "$(type -t fake_install)" = "function" ] && run_build fake_install
tidy_install
fi
create_package
else
+ if [ "$REPKG" = "0" -a "$(type -t fake_install)" = "function" ]; then
+ run_build build
+ fi
+
msg "Entering fakeroot environment..."
cd "$startdir"
@@ -1111,7 +1127,7 @@
if [ "$CLEANUP" = "1" ]; then
msg "Cleaning up..."
rm -rf src pkg
- rm -rf ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log*
+ rm -f ${pkgname}-${pkgver}-${pkgrel}-${CARCH}-{build,fake_install}.log*
fi
removedeps