index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | scripts/makepkg.sh.in | 11 | ||||
-rw-r--r-- | scripts/repo-add.sh.in | 27 |
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index b844c65f..98bed3e2 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -518,7 +518,7 @@ download_sources() { local file=$(get_filepath "$netfile" || true) if [[ -n "$file" ]]; then msg2 "$(gettext "Found %s")" "${file##*/}" - rm -f "$srcdir/$file" + rm -f "$srcdir/${file##*/}" ln -s "$file" "$srcdir/" continue fi @@ -1562,7 +1562,7 @@ devel_check() { newpkgver=$(date +%Y%m%d) elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then if ! type -p git >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "git "git" + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "git" "git" return 0 fi msg "$(gettext "Determining latest %s revision...")" 'git' @@ -1576,7 +1576,7 @@ devel_check() { newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then if ! type -p bzr >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "bzr" bzr" + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "bzr" "bzr" return 0 fi msg "$(gettext "Determining latest %s revision...")" 'bzr' @@ -1829,8 +1829,9 @@ else exit 1 # $E_CONFIG_ERROR fi -# Source user-specific makepkg.conf overrides -if [[ -r ~/.makepkg.conf ]]; then +# Source user-specific makepkg.conf overrides, but only if no override config +# file was specified +if [[ $MAKEPKG_CONF = "$confdir/makepkg.conf" && -r ~/.makepkg.conf ]]; then source ~/.makepkg.conf fi diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 17b32aab..0500b48c 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -100,7 +100,7 @@ format_entry() { find_pkgentry() { local pkgname=$1 local pkgentry - for pkgentry in $tmpdir/$pkgname*; do + for pkgentry in $tmpdir/tree/$pkgname*; do name=${pkgentry##*/} if [[ ${name%-*-*} = $pkgname ]]; then echo $pkgentry @@ -285,7 +285,7 @@ db_write_entry() { return 1 fi - pushd "$tmpdir" >/dev/null + pushd "$tmpdir/tree" >/dev/null if [[ -d $pkgname-$pkgver ]]; then warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver" else @@ -350,7 +350,7 @@ db_write_entry() { # create files file if wanted if (( WITHFILES )); then msg2 "$(gettext "Creating '%s' db entry...")" 'files' - local files_path="$tmpdir/$pkgname-$pkgver/files" + local files_path="$tmpdir/tree/$pkgname-$pkgver/files" echo "%FILES%" >$files_path bsdtar --exclude='^.*' -tf "$pkgfile" >>$files_path fi @@ -381,7 +381,7 @@ db_remove_entry() { while [[ -n $pkgentry ]]; do notfound=0 if [[ -f $pkgentry/deltas ]]; then - mv "$pkgentry/deltas" "$tmpdir/$pkgname.deltas" + mv "$pkgentry/deltas" "$tmpdir/tree/$pkgname.deltas" fi msg2 "$(gettext "Removing existing entry '%s'...")" \ "${pkgentry##*/}" @@ -443,7 +443,7 @@ check_repo_db() { fi verify_signature "$REPO_DB_FILE" msg "$(gettext "Extracting database to a temporary location...")" - bsdtar -xf "$REPO_DB_FILE" -C "$tmpdir" + bsdtar -xf "$REPO_DB_FILE" -C "$tmpdir/tree" else case "$cmd" in repo-remove) @@ -509,7 +509,7 @@ remove() { msg "$(gettext "Searching for package '%s'...")" "$pkgname" if db_remove_entry "$pkgname"; then - rm -f "$tmpdir/$pkgname.deltas" + rm -f "$tmpdir/tree/$pkgname.deltas" return 0 else error "$(gettext "Package matching '%s' not found.")" "$pkgname" @@ -561,6 +561,7 @@ fi tmpdir=$(mktemp -d /tmp/repo-tools.XXXXXXXXXX) || (\ error "$(gettext "Cannot create temp directory for database building.")"; \ exit 1) +mkdir $tmpdir/tree trap 'clean_up' EXIT trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT @@ -628,12 +629,18 @@ if (( success )); then TAR_OPT=$(verify_repo_extension "$REPO_DB_FILE") filename=${REPO_DB_FILE##*/} - pushd "$tmpdir" >/dev/null - # strip the './' off filenames; this also allows us to tar an empty dir - bsdtar -s %^./%% -c${TAR_OPT}f "$REPO_DB_FILE" ./ - create_signature "$filename" + pushd "$tmpdir/tree" >/dev/null + if ( shopt -s nullglob; files=(*); (( ${#files[*]} )) ); then + bsdtar -c${TAR_OPT}f "$tmpdir/$filename" * + else + # we have no packages remaining? zip up some emptyness + warning "$(gettext "No packages remain, creating empty database.")" + bsdtar -c${TAR_OPT}f "$tmpdir/$filename" -T /dev/null + fi popd >/dev/null + create_signature "$tmpdir/$filename" + [[ -f $REPO_DB_FILE ]] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old" [[ -f $REPO_DB_FILE.sig ]] && rm -f "$REPO_DB_FILE.sig" [[ -f $tmpdir/$filename ]] && mv "$tmpdir/$filename" "$REPO_DB_FILE" |