diff --git a/Makefile b/Makefile index 8002cd9e2f5e2a18034ff96b610c5c2d1e197add..12dc6ee2b7193ddff8367b704bf350455153d5a2 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,7 @@ DESCRIPTION="$(shell sed -n -e "p;n;:next;/^##/Q;p;n;b next" CHANGES.md | perl - release: @echo "Proceed to release CAISAR with release version $(TAG)? (y/n)?" @read yesno; test "$$yesno" = y + @bash update_headers.sh @echo -n $(DESCRIPTION) @echo "Is the CHANGES.md correct for $(TAG) (y/n)?" @read yesno; test "$$yesno" = y diff --git a/update_headers.sh b/update_headers.sh index 7406ccd88c3191b98b695090979dcba9ecaa8bb6..54603c9ebea876a598521754a4a08f9c9f228fbc 100644 --- a/update_headers.sh +++ b/update_headers.sh @@ -1,5 +1,14 @@ #!/usr/bin/env bash -set -xe +# set -xe NEW_DATE=$(date "+%Y") -OLD_DATE=$(date -d '1 year ago' "+%Y") -find . \( -type d -name .git -prune \) \( -type d -name ._build -prune \) -o -type f -print0 | xargs -0 sed -i 's/(C) '${OLD_DATE}'/(C) '${NEW_DATE}'/g' \ No newline at end of file +OLD_DATE=$(sed "5q;d" src/main.ml | awk '{print $4}') + +if [ "$OLD_DATE" != "$NEW_DATE" ]; then + echo "Replacing $OLD_DATE by $NEW_DATE in headers." + find . \( -type d -name .git -prune \) \( -type d -name ._build -prune \) -o -type f -print0 | xargs -0 sed -i 's/(C) '${OLD_DATE}'/(C) '${NEW_DATE}'/g' + echo "Done." + exit 0 +else + echo "Year $OLD_DATE in header src/main.ml is current date, no need to update the headers." + exit 0 +fi