On 7 June 2013 13:26, eles <e...@eles.com> wrote: > Hello, > > What is the purpose of this code in setup-gcc.sh? > > # 1. Remove d sources from d_gccsrc if already exist > test -h "$d_gccsrc/gcc/d" && rm "$d_gccsrc/gcc/d" > test -d "$d_gccsrc/libphobos" && rm -r "$d_gccsrc/libphobos" > if test -e "$d_gccsrc/gcc/d" -o -e "$d_gccsrc/libphobos"; then > echo "error: cannot update gcc source, please remove D sources by hand." > exit 1 > fi > > For example, the line > > test -h "$d_gccsrc/gcc/d" && rm "$d_gccsrc/gcc/d" > > should return 0 if $d_gccsrc/gcc/d both exists and is a symlink. The command > fails if any of the two is not true, and the intended purpose is to remove > the original D sources from the gcc package (that is, when the "d" folder > exists, but is *not* a symlink). > > However, if the "d" folder exists and is *not* a symlink, the exit code of > "test" will be 1, that is the command will *not* succeed. > > In that case, the "rm" part will not be executed, which destroys the purpose > of it. > > Do I miss something? > > > More, why testing for symlink-ness in the first place? Existing sources (or > symlink towards them) should be deleted and, then, newly-provided sources > should be provided, that's all. What if an existing symlink exists, but > points to an outdated D source?
The gcc/d folder is symlinked to the gdc sources, so any updates in gdc will reflect in the gcc/d tree. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';