public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones
@ 2016-07-21 18:15 Bernd Edlinger
  2016-07-22 22:28 ` Jeff Law
  0 siblings, 1 reply; 12+ messages in thread
From: Bernd Edlinger @ 2016-07-21 18:15 UTC (permalink / raw)
  To: Jeff Law, Eric Gallager; +Cc: gcc-patches

Hi,

 > So rather than relying on ln to remove the link, why don't we just
 > explicitly remove it with rm -f?

sounds good, I ran into similar issues already.

ln -nfs does not follow the target if it is a symlink

        -n, --no-dereference
               treat  LINK_NAME  as a normal file if it is a symbolic 
link to a
               directory


but I think a simple rm -f will do as well, and avoid potential
interoperability issues.

However wget has a similar issue, if the $MPFR.tar.gz file is already
there, maybe incomplete, the wget chooses a new name, so I'd suggest
to rm -f that file as well, and the whole $MPFR subtree while you are
already there.


Bernd.

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones
@ 2016-06-28  2:38 Eric Gallager
  2016-07-13 21:36 ` Jeff Law
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Gallager @ 2016-06-28  2:38 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

The last time I ran ./contrib/download_prerequisites, I already had
previous symlinks set up from a previous run of the script, so `ln`
followed the existing symlinks and created the new ones in the
directories to which the symlinks pointed. This patch should fix that
by removing the old symlinks before creating new ones. (For some
reason the `-f` flag to `ln` that was already there wasn't enough for
me.) Tested by running the script and ensuring that the new isl
symlink pointed to the correct directory, and that there were no bad
symlinks in the old isl directory. Could someone commit this trivial
patch for me, or something like it? I don't have write access.

Thanks,
Eric Gallager

[-- Attachment #2: patch_contrib_download_prerequisites.diff --]
[-- Type: text/plain, Size: 1107 bytes --]

 contrib/download_prerequisites | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
index 917ee23..6c6e02f 100755
--- a/contrib/download_prerequisites
+++ b/contrib/download_prerequisites
@@ -36,14 +36,17 @@ MPC=mpc-1.0.3
 
 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
 tar xjf $MPFR.tar.bz2 || exit 1
+if test -L mpfr; then unlink mpfr; fi
 ln -sf $MPFR mpfr || exit 1
 
 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
 tar xjf $GMP.tar.bz2  || exit 1
+if test -L gmp; then unlink gmp; fi
 ln -sf $GMP gmp || exit 1
 
 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
 tar xzf $MPC.tar.gz || exit 1
+if test -L mpc; then unlink mpc; fi
 ln -sf $MPC mpc || exit 1
 
 # Necessary to build GCC with the Graphite loop optimizations.
@@ -52,5 +55,6 @@ if [ "$GRAPHITE_LOOP_OPT" = "yes" ] ; then
 
   wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1
   tar xjf $ISL.tar.bz2  || exit 1
+  if test -L isl; then unlink isl; fi
   ln -sf $ISL isl || exit 1
 fi

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-08-03 16:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 18:15 [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones Bernd Edlinger
2016-07-22 22:28 ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2016-06-28  2:38 Eric Gallager
2016-07-13 21:36 ` Jeff Law
2016-07-14 10:57   ` Eric Gallager
2016-07-14 13:54     ` NightStrike
2016-07-14 17:24     ` Jeff Law
2016-07-14 19:57       ` Eric Gallager
2016-07-21 17:10         ` Jeff Law
2016-07-21 19:39           ` Eric Gallager
2016-08-03 16:12             ` Jeff Law
2016-07-14 13:53   ` NightStrike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).