summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJeremy Huntwork <jhuntwork@lightcubesolutions.com>2012-05-23 03:18:42 +0000
committerDan McGee <dan@archlinux.org>2012-06-25 23:06:43 -0500
commit19c2347507fc0847572e30edd25809f5bc9a9ffb (patch)
tree3162c2dade22482c565a35c7920bbfcb5541b144 /scripts
parentda0dcc29cf038de7dee9b16987b508e45d56ae91 (diff)
downloadpacman-19c2347507fc0847572e30edd25809f5bc9a9ffb.tar.xz
Portability fixes for makepkg
Allow makepkg to work correctly when used with find from busybox. Fix handling of cross directory symlinks. Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am1
-rw-r--r--scripts/makepkg.sh.in51
2 files changed, 23 insertions, 29 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index b69763d8..6bb72198 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -51,6 +51,7 @@ edit = sed \
-e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \
+ -e "s|@INODECMD[@]|$(INODECMD)|g" \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \
-e 's|@DUPATH[@]|$(DUPATH)|g' \
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 718b4e9d..b0918ae3 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1057,37 +1057,30 @@ tidy_install() {
if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then
msg2 "$(gettext "Compressing man and info pages...")"
- local manpage ext file link hardlinks hl
- find ${MAN_DIRS[@]} -type f 2>/dev/null |
- while read manpage ; do
- ext="${manpage##*.}"
- file="${manpage##*/}"
- if [[ $ext != gz && $ext != bz2 ]]; then
- # update symlinks to this manpage
- find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null |
- while read link ; do
+ local file files inode link
+ while read -rd ' ' inode; do
+ read file
+ find ${MAN_DIRS[@]} -type l 2>/dev/null |
+ while read link ; do
+ if [[ "${file}" -ef "${link}" ]] ; then
rm -f "$link" "${link}.gz"
- ln -s -- "${file}.gz" "${link}.gz"
- done
-
- # check file still exists (potentially already compressed due to hardlink)
- if [[ -f ${manpage} ]]; then
- # find hard links and remove them
- # the '|| true' part keeps the script from bailing on the EOF returned
- # by read at the end of the find output
- mapfile -t hardlinks < \
- <(find ${MAN_DIRS[@]} ! -name "$file" -samefile "$manpage" 2>/dev/null)
- rm -f "${hardlinks[@]}"
- # compress the original
- gzip -9 "$manpage"
- # recreate hard links removed earlier
- for hl in "${hardlinks[@]}"; do
- ln "${manpage}.gz" "${hl}.gz"
- chmod 644 ${hl}.gz
- done
+ if [[ ${file%/*} = ${link%/*} ]]; then
+ ln -s -- "${file##*/}.gz" "${link}.gz"
+ else
+ ln -s -- "/${file}.gz" "${link}.gz"
+ fi
fi
+ done
+ if [[ -z ${files[$inode]} ]]; then
+ files[$inode]=$file
+ gzip -9 -f "$file"
+ else
+ rm -f "$file"
+ ln "${files[$inode]}.gz" "${file}.gz"
+ chmod 644 "${file}.gz"
fi
- done
+ done < <(find ${MAN_DIRS[@]} -type f \! -name "*.gz" \! -name "*.bz2" \
+ -exec @INODECMD@ '{}' + 2>/dev/null)
fi
if check_option "strip" "y"; then
@@ -1115,7 +1108,7 @@ tidy_install() {
if check_option "emptydirs" "n"; then
msg2 "$(gettext "Removing empty directories...")"
- find . -depth -type d -empty -delete
+ find . -depth -type d -exec rmdir '{}' + 2>/dev/null
fi
if check_option "upx" "y"; then