Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-06-15 16:02:22 +1000
committerDan McGee <dan@archlinux.org>2011-06-15 09:20:52 -0500
commitd21f6ca4aa3209938fa312f29ac03446f57e6a66 (patch)
tree7c581aa57c7b9d75673ab2dcc645bf5b99899b12 /scripts
parent06cb713f3915cc858de0388b0a5232326101a9fa (diff)
makepkg: create source package inside fakeroot
Create source package files inside the fakeroot environment to ensure reasonable ownership of files within the archive. Fixes FS#24330. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in65
1 files changed, 40 insertions, 25 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 5de10718..dfb79768 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -188,6 +188,16 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
# 1) "filename::http://path/to/file"
# 2) "http://path/to/file"
+enter_fakeroot() {
+ msg "$(gettext "Entering fakeroot environment...")"
+
+ if [[ -n $newpkgver ]]; then
+ fakeroot -- $0 --forcever $newpkgver -F "${ARGLIST[@]}" || exit $?
+ else
+ fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
+ fi
+}
+
# Return the absolute filename of a source entry
#
# This function accepts a source entry or the already extracted filename of a
@@ -1214,23 +1224,6 @@ create_signature() {
}
create_srcpackage() {
- cd "$startdir"
-
- # Get back to our src directory so we can begin with sources.
- mkdir -p "$srcdir"
- chmod a-s "$srcdir"
- cd "$srcdir"
- if (( ! SKIPINTEG || SOURCEONLY == 2 )); then
- download_sources
- fi
- if (( ! SKIPINTEG )); then
- # We can only check checksums if we have all files.
- check_checksums
- else
- warning "$(gettext "Skipping integrity checks.")"
- fi
- cd "$startdir"
-
msg "$(gettext "Creating source package...")"
local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)"
mkdir "${srclinks}"/${pkgbase}
@@ -2006,6 +1999,12 @@ fi
# Run the bare minimum in fakeroot
if (( INFAKEROOT )); then
+ if (( SOURCEONLY )); then
+ create_srcpackage
+ msg "$(gettext "Leaving fakeroot environment.")"
+ exit 0 # $E_OK
+ fi
+
if (( ! SPLITPKG )); then
if (( ! PKGFUNC )); then
if (( ! REPKG )); then
@@ -2041,7 +2040,29 @@ if (( SOURCEONLY )); then
error "$(gettext "A source package has already been built. (use -f to overwrite)")"
exit 1
fi
- create_srcpackage
+
+ # Get back to our src directory so we can begin with sources.
+ mkdir -p "$srcdir"
+ chmod a-s "$srcdir"
+ cd "$srcdir"
+ if (( ! SKIPINTEG || SOURCEONLY == 2 )); then
+ download_sources
+ fi
+ if (( ! SKIPINTEG )); then
+ # We can only check checksums if we have all files.
+ check_checksums
+ else
+ warning "$(gettext "Skipping integrity checks.")"
+ fi
+ cd "$startdir"
+
+ # if we are root or if fakeroot is not enabled, then we don't use it
+ if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then
+ create_srcpackage
+ else
+ enter_fakeroot
+ fi
+
msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
exit 0
fi
@@ -2158,13 +2179,7 @@ else
cd "$startdir"
fi
- msg "$(gettext "Entering fakeroot environment...")"
-
- if [[ -n $newpkgver ]]; then
- fakeroot -- $0 --forcever $newpkgver -F "${ARGLIST[@]}" || exit $?
- else
- fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
- fi
+ enter_fakeroot
fi
fi