File: release.sh

package info (click to toggle)
r-cran-rnetcdf 2.9-2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: ansic: 9,725; xml: 210; sh: 102; makefile: 12
file content (66 lines) | stat: -rwxr-xr-x 1,755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
# Prepare for new RNetCDF release

set -e
set -u

# Check inputs:
if [[ $# -ne 1 ]]; then
  echo "Usage: $0 x.y-z" >&2
  exit 1
fi

newver="$1"
if ! echo "$newver" | grep -q '^[0-9]\+.[0-9]\+-[0-9]\+$' ; then
  echo "ERROR: invalid format of release string" >&2
  exit 1
fi

# Set working directory to base directory of package:
thisdir="$( dirname "$0" )"
cd "$thisdir/.."

# Use GNU versions of some utilities:
kernel=$( uname )
if [[ "$kernel" == Darwin ]]; then
  alias date=gdate # MacPorts coreutils
  alias find=gfind # MacPorts findutils
  alias sed=gsed   # MacPorts gsed
fi

# Define function to convert date formats:
DATEFMT() {
  date -d "$1" +%Y%m%d%H%M.%S
}

# Check that package changes have been committed to git:
if test -n "$( git status --porcelain )"; then
  echo "WARNING: uncommitted changes in package" >&2
fi

# Ensure that generated files are up-to-date:
tools/update-configure.sh
tools/update-convert-c.sh

# Check that NEWS contains a description of the release:
if ! grep -q "$newver" NEWS; then
  echo "WARNING: NEWS has no entry for release $newver" >&2
fi

# Get existing version string:
oldver="$( grep 'Version: ' DESCRIPTION | awk '{ print $2 }' )"

# Define copyright line:
year=$( date +%Y )
copyright="Copyright (C) 2004-$year Pavel Michna and Milton Woods."

# Replace version string in all files (excluding hidden files).
find . -mindepth 1 -name '.*' -prune -o -type f \
  ! -name NEWS ! -name release.sh -print | while read file; do
    sed -i "/RNetCDF\|[Vv][Ee][Rr][Ss][Ii][Oo][Nn]/ s|$oldver|$newver|g;
            /Copyright.*Michna/ s|\(.*\)Copyright.*|\1$copyright|" "$file"
  done

# Update release date in DESCRIPTION:
newdate="$( date +%Y-%m-%d )"
sed -i "s|Date:.*|Date: $newdate|" DESCRIPTION