]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/make-tar.sh
ncurses 6.3 - patch 20221119
[ncurses.git] / test / make-tar.sh
index 9eaf40b040e12b5f691581b9def70a3e16cc4c7f..df4b66aadab6ca18e2b931e7e9638574c2773282 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
-# $Id: make-tar.sh,v 1.18 2021/10/12 21:12:16 tom Exp $
+# $Id: make-tar.sh,v 1.21 2022/11/05 19:41:33 tom Exp $
 ##############################################################################
-# Copyright 2019-2020,2021 Thomas E. Dickey                                  #
+# Copyright 2019-2021,2022 Thomas E. Dickey                                  #
 # Copyright 2010-2015,2017 Free Software Foundation, Inc.                    #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
@@ -42,6 +42,12 @@ TARGET=`pwd`
 : "${DESTDIR:=$TARGET}"
 : "${TMPDIR:=/tmp}"
 
+# make timestamps of generated files predictable
+same_timestamp() {
+       [ -f ../NEWS ] || echo "OOPS $1"
+       touch -r ../NEWS "$1"
+}
+
 grep_assign() {
        grep_assign=`grep -E "^$2\>" "$1" | sed -e "s/^$2[      ]*=[    ]*//" -e 's/"//g'`
        eval "$2"=\""$grep_assign"\"
@@ -62,6 +68,7 @@ edit_specfile() {
                -e "s/\\<YYYYMMDD\\>/$NCURSES_PATCH/g" "$1" >"$1.new"
        chmod u+w "$1"
        mv "$1.new" "$1"
+       same_timestamp "$1"
 }
 
 make_changelog() {
@@ -73,6 +80,7 @@ make_changelog() {
 
  -- `head -n 1 "$HOME"/.signature`  `date -R`
 EOF
+       same_timestamp "$1"
 }
 
 # This can be run from either the subdirectory, or from the top-level
@@ -84,7 +92,8 @@ fi
 SOURCE=`cd ..;pwd`
 
 BUILD=$TMPDIR/make-tar$$
-trap "cd /; rm -rf $BUILD; exit 0" EXIT INT QUIT TERM HUP
+trap "cd /; rm -rf $BUILD; exit 1" 1 2 3 15
+trap "cd /; rm -rf $BUILD; exit 0" 0
 
 umask 077
 if ! ( mkdir $BUILD )
@@ -123,6 +132,7 @@ cp -p "$SOURCE/NEWS" "$BUILD/$ROOTNAME"
 
 touch $BUILD/$ROOTNAME/MANIFEST
 ( cd $BUILD/$ROOTNAME && find . -type f -print | "$SOURCE/misc/csort" >MANIFEST )
+same_timestamp $BUILD/$ROOTNAME/MANIFEST
 
 cd $BUILD || exit
 
@@ -141,7 +151,10 @@ find . -name "*.gz" -exec rm -rf {} \;
 # Make the files writable...
 chmod -R u+w .
 
-tar cf - $ROOTNAME | gzip >"$DESTDIR/$ROOTNAME.tar.gz"
+# Cleanup timestamps
+[ -n "$TOUCH_DIRS" ] && "$TOUCH_DIRS" "$ROOTNAME"
+
+tar cf - $TAR_OPTIONS $ROOTNAME | gzip >"$DESTDIR/$ROOTNAME.tar.gz"
 cd "$DESTDIR" || exit
 
 pwd