]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgo/merge.sh
[Ada] Fix typos
[thirdparty/gcc.git] / libgo / merge.sh
index 24f63d9df6bdf745855e18a91212ffbc55cea6e8..bddb1320098b340401b6a974c15552cd18bafd3d 100755 (executable)
@@ -71,14 +71,16 @@ merge() {
   elif test -f ${old}; then
     # The file exists in the old version.
     if ! test -f ${libgo}; then
-      echo "merge.sh: $name: skipping: exists in old and new git, but not in libgo"
-      continue
+      if ! cmp -s ${old} ${new}; then
+        echo "merge.sh: $name: skipping: exists in old and new git, but not in libgo"
+      fi
+      return
     fi
     if cmp -s ${old} ${libgo}; then
       # The libgo file is unchanged from the old version.
       if cmp -s ${new} ${libgo}; then
         # File is unchanged from old to new version.
-        continue
+       return
       fi
       # Update file in libgo.
       echo "merge.sh: $name: updating"
@@ -99,8 +101,7 @@ merge() {
         mv ${libgo}.tmp ${libgo}
         ;;
       *)
-        echo 1>&2 "merge.sh: $name: diff3 failure"
-        exit 1
+        echo 1>&2 "merge.sh: $name: DIFF3 FAILURE"
         ;;
       esac
     fi
@@ -122,43 +123,51 @@ merge() {
   fi
 }
 
-merge_c() {
-  from=$1
-  to=$2
-  oldfile=${OLDDIR}/src/runtime/$from
-  if test -f ${oldfile}; then
-    sed -e 's/·/_/g' < ${oldfile} > ${oldfile}.tmp
-    oldfile=${oldfile}.tmp
-    newfile=${NEWDIR}/src/runtime/$from
-    sed -e 's/·/_/g' < ${newfile} > ${newfile}.tmp
-    newfile=${newfile}.tmp
-    libgofile=runtime/$to
-    merge $from ${oldfile} ${newfile} ${libgofile}
-  fi
-}
+echo ${rev} > VERSION
 
-if test -f VERSION; then
-  if ! cmp -s ${NEWDIR}/VERSION VERSION; then
-    cp ${NEWDIR}/VERSION .
-  fi
-else
-  if test -f ${NEWDIR}/VERSION; then
-    cp ${NEWDIR}/VERSION .
+(cd ${NEWDIR}/src && find . -name '*.go' -print) | while read f; do
+  skip=false
+  case "$f" in
+  ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/testjson/* | ./cmd/vet/* | ./cmd/internal/browser/* | ./cmd/internal/buildid/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | ./cmd/internal/testj2on/* | ./cmd/internal/sys/* | ./cmd/vendor/golang.org/x/tools/* | ./cmd/vendor/golang.org/x/mod/* | ./cmd/vendor/golang.org/x/xerrors/* | ./cmd/vendor/golang.org/x/crypto/ed25519)
+    ;;
+  ./cmd/*)
+    skip=true
+    ;;
+  ./runtime/race/*)
+    skip=true
+    ;;
+  esac
+  if test "$skip" = "true"; then
+    continue
   fi
-fi
 
-(cd ${NEWDIR}/src && find . -name '*.go' -print) | while read f; do
   oldfile=${OLDDIR}/src/$f
   newfile=${NEWDIR}/src/$f
-  libgofile=go/$f
+  libgofile=go/`echo $f | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
   merge $f ${oldfile} ${newfile} ${libgofile}
 done
 
 (cd ${NEWDIR}/src && find . -name testdata -print) | while read d; do
+  skip=false
+  case "$d" in
+  ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/testjson/* | ./cmd/vet/* | ./cmd/internal/browser/* | ./cmd/internal/buildid/* | ./cmd/internal/diff/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | ./cmd/internal/testj2on/* | ./cmd/internal/sys/* | ./cmd/vendor/golang.org/x/tools/*)
+    ;;
+  ./cmd/*)
+    skip=true
+    ;;
+  ./runtime/race/* | ./runtime/cgo/*)
+    skip=true
+    ;;
+  esac
+  if test "$skip" = "true"; then
+    continue
+  fi
+
   oldtd=${OLDDIR}/src/$d
   newtd=${NEWDIR}/src/$d
-  libgotd=go/$d
+  libgotd=go/`echo $d | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
   if ! test -d ${oldtd}; then
+    echo "merge.sh: $d: NEWDIR"
     continue
   fi
   (cd ${oldtd} && git ls-files .) | while read f; do
@@ -173,15 +182,13 @@ done
   done
 done
 
-runtime="chan.goc chan.h cpuprof.goc env_posix.c heapdump.c lock_futex.c lfstack.goc lock_sema.c mcache.c mcentral.c mfixalloc.c mgc0.c mgc0.h mheap.c msize.c netpoll.goc netpoll_epoll.c netpoll_kqueue.c netpoll_stub.c panic.c print.c proc.c race.h rdebug.goc runtime.c runtime.h signal_unix.c signal_unix.h malloc.h malloc.goc mprof.goc parfor.c runtime1.goc sema.goc sigqueue.goc string.goc time.goc"
-for f in $runtime; do
-  # merge_c $f $f
-  true
+(cd ${NEWDIR}/misc/cgo && find . -type f -print) | while read f; do
+  oldfile=${OLDDIR}/misc/cgo/$f
+  newfile=${NEWDIR}/misc/cgo/$f
+  libgofile=misc/cgo/$f
+  merge $f ${oldfile} ${newfile} ${libgofile}
 done
 
-# merge_c os_linux.c thread-linux.c
-# merge_c mem_linux.c mem.c
-
 (cd ${OLDDIR}/src && find . -name '*.go' -print) | while read f; do
   oldfile=${OLDDIR}/src/$f
   newfile=${NEWDIR}/src/$f
@@ -197,5 +204,20 @@ done
   git rm ${libgofile}
 done
 
+(cd ${OLDDIR}/misc/cgo && find . -type f -print) | while read f; do
+  oldfile=${OLDDIR}/misc/cgo/$f
+  newfile=${NEWDIR}/misc/cgo/$f
+  libgofile=misc/cgo/$f
+  if test -f ${newfile}; then
+    continue
+  fi
+  if ! test -f ${libgofile}; then
+    continue
+  fi
+  echo "merge.sh: ${libgofile}: REMOVED"
+  rm -f ${libgofile}
+  git rm ${libgofile}
+done
+
 (echo ${new_rev}; sed -ne '2,$p' MERGE) > MERGE.tmp
 mv MERGE.tmp MERGE