ecompressdir: fix ln -s for bug #418309
authorZac Medico <zmedico@gentoo.org>
Sat, 2 Jun 2012 02:36:52 +0000 (19:36 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 2 Jun 2012 02:36:52 +0000 (19:36 -0700)
This fixes parallel funk_up_dir decompress calls so that they don't
inappropriately compete with eachother to fix the same broken symlinks.

bin/ebuild-helpers/ecompressdir

index 7d5d4322b2b49af59fd9be46d686b1f38a120a58..f39f883f34d19bcb8b14b93bc198b30c584d3605 100755 (executable)
@@ -80,9 +80,13 @@ funk_up_dir() {
                        skip_dir_dest=${T}/ecompress-skip/${actual_dir#${ED}}/${brokenlink%/*}/${olddest}
                fi
                [[ -e ${skip_dir_dest} ]] && continue
-               [[ ${act} == "compress" ]] \
-                       && newdest="${olddest}${suffix}" \
-                       || newdest="${olddest%${suffix}}"
+               if [[ ${act} == "compress" ]] ; then
+                       newdest=${olddest}${suffix}
+               else
+                       [[ ${olddest} == *${suffix} ]] || continue
+                       newdest=${olddest%${suffix}}
+               fi
+               [[ -f ${newdest} ]] || continue
                rm -f "${brokenlink}"
                [[ ${act} == "compress" ]] \
                        && ln -snf "${newdest}" "${brokenlink}${suffix}" \