index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-04 23:48:38 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-04 23:48:38 -0500 |
commit | 6223f9fca6803d814ba026cb5b88c9c2ed48b540 (patch) | |
tree | 1fdec1424a55471032ac4edd5b08157b005720e3 /makechrootpkg.in | |
parent | 021653a0acecc8763e1bbe90dbb770b4e6df4390 (diff) | |
parent | 40ea1b3ca5c6f6fdbeda230f4048ac7934d68acf (diff) |
-rw-r--r-- | makechrootpkg.in | 49 |
diff --git a/makechrootpkg.in b/makechrootpkg.in index cbff882..052ab71 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -106,9 +106,14 @@ fi makepkg_args+=("$@") # See if -R was passed to makepkg -if in_array '-R' "${makepkg_args[@]}"; then - repack=true -fi +for arg in "${@:OPTIND}"; do + case ${arg%%=*} in + -*R*|--repackage) + repack=true + break 2 + ;; + esac +done if [[ -n $SUDO_USER ]]; then USER_HOME=$(eval echo ~$SUDO_USER) @@ -122,7 +127,7 @@ load_vars() { [[ -f $makepkg_conf ]] || return 1 - for var in {SRC,PKG,LOG}DEST MAKEFLAGS PACKAGER; do + for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do [[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf") done @@ -139,7 +144,7 @@ create_chroot() { slock 8 "$chrootdir/root.lock" "Locking clean chroot" stat_busy "Creating clean working copy [%s]" "$copy" - if [[ "$chroottype" == btrfs ]]; then + if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then if [[ -d $copydir ]]; then btrfs subvolume delete "$copydir" >/dev/null || die "Unable to delete subvolume %s" "$copydir" @@ -211,6 +216,11 @@ prepare_chroot() { echo 'PKGDEST="/pkgdest"' >> "$copydir/etc/makepkg.conf" fi + mkdir -p "$copydir/srcpkgdest" + if ! grep -q 'SRCPKGDEST="/srcpkgdest"' "$copydir/etc/makepkg.conf"; then + echo 'SRCPKGDEST="/srcpkgdest"' >> "$copydir/etc/makepkg.conf" + fi + mkdir -p "$copydir/logdest" if ! grep -q 'LOGDEST="/logdest"' "$copydir/etc/makepkg.conf"; then echo 'LOGDEST="/logdest"' >> "$copydir/etc/makepkg.conf" @@ -224,7 +234,7 @@ prepare_chroot() { echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf" fi - chown -R nobody "$copydir"/{build,pkgdest,logdest,srcdest,startdir} + chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir} if [[ -n $MAKEFLAGS ]]; then sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf" @@ -284,14 +294,16 @@ _chrootbuild() { ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* - # XXX: Keep svn sources writable + # XXX: Keep bzr and svn sources writable # Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink for dir in /srcdest /startdir; do - cd $dir - for svndir in */.svn; do - rm ${svndir%/.svn} - cp -a ${dir}_host/${svndir%/.svn} . - chown -R nobody ${svndir%/.svn} + for vcs in bzr svn; do + cd "$dir" + for vcsdir in */.$vcs; do + rm "${vcsdir%/.$vcs}" + cp -a "${dir}_host/${vcsdir%/.$vcs}" . + chown -R nobody "${vcsdir%/.$vcs}" + done done done @@ -328,9 +340,15 @@ move_products() { done for l in "$copydir"/logdest/*; do + [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" mv "$l" "$LOGDEST" done + + for s in "$copydir"/srcpkgdest/*; do + chown "$src_owner" "$s" + mv "$s" "$SRCPKGDEST" + done } # }}} @@ -340,9 +358,10 @@ load_vars /etc/makepkg.conf load_vars "$USER_HOME/.makepkg.conf" # Use PKGBUILD directory if these don't exist -[[ -d $PKGDEST ]] || PKGDEST=$PWD -[[ -d $SRCDEST ]] || SRCDEST=$PWD -[[ -d $LOGDEST ]] || LOGDEST=$PWD +[[ -d $PKGDEST ]] || PKGDEST=$PWD +[[ -d $SRCDEST ]] || SRCDEST=$PWD +[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD +[[ -d $LOGDEST ]] || LOGDEST=$PWD create_chroot |