X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=rpm%2Frvm-ruby.spec;h=68da4809955eead605009c5e163a1dfccf28c8e3;hb=1c4bd1c5196b88630603b358ddb516dc299167c9;hp=801cc139035653b542a31c204e802a306dc2ccbb;hpb=bb71cbcb22500589b982ea16a3b85748fb328234;p=rvm-ruby.git diff --git a/rpm/rvm-ruby.spec b/rpm/rvm-ruby.spec index 801cc13..68da480 100644 --- a/rpm/rvm-ruby.spec +++ b/rpm/rvm-ruby.spec @@ -152,12 +152,22 @@ slashes=$(printf "%s" "${ch// //}") find $br -type f -print0 | xargs -0 sed -i "s,$br,$slashes,g" # Fix symlinks with bad path -for f in $(find $br -type l |grep "$br"); do -# original version read like this -# ln -sfn $(readlink -f $f |sed "s,$br,,") $f -# however in the PL environment, readlink transforms /longbuildroot into /build, -# and then sed fails to do its job, so readlink does not seem such a good idea - ln -sfn $(echo $f | sed "s,^$br,,") $f +# the canonical path of the build root +brc=$(readlink -f $br) +for f in $(find $br -type l); do + # some symlinks are relative, in which case we want to preserve them + # do *not* mention -f here as it would always return an absolute path + dest=$(readlink $f) + # relative symlinks have $dest not starting with a / + first_step=$(echo $dest | cut -d / -f1) + # absolute paths have a void first_step + if [ -z "$first_step" ] ; then + # destination is an absolute path, let's fix it + # call readlink with -f so all symlinmks are solved + # and so we can reliably substitute $brc that is also canonicalized + destc=$(readlink -f $f | sed -e "s,^$brc,,") + ln -sfn $destc $f + fi done find $br -maxdepth 1 -name '.*' -exec rm -rf {} \; @@ -165,6 +175,9 @@ rm $br/usr/share/man/man1/rvm.1.gz %clean rm -rf %{buildroot} +# it appears that, because we build as root, rvm installs stuff in /etc on the build box +# which is not desirable, so let us get rid of that - don't worry if that fails +find /etc -name 'rvm*' | xargs rm || : %pre getent group %{rvm_group} >/dev/null || groupadd -r %{rvm_group}