File: CMakeVersion.bash

package info (click to toggle)
cmake 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 147,412 kB
  • sloc: ansic: 403,924; cpp: 290,826; sh: 4,091; python: 3,357; yacc: 3,106; lex: 1,189; f90: 532; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 230; perl: 217; objc: 215; xml: 198; makefile: 98; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (17 lines) | stat: -rwxr-xr-x 815 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash
# Update the version component if it looks like a date or -f is given.
version_file="${BASH_SOURCE%/*}/CMakeVersion.cmake"
if test "x$1" = "x-f"; then shift ; n='*' ; else n='\{8\}' ; fi
if test "$#" -gt 0; then echo 1>&2 "usage: CMakeVersion.bash [-f]"; exit 1; fi
sed -i -e '
s/\(^set(CMake_VERSION_PATCH\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/
' "$version_file"
# Update the copyright notice to match the version date's year.
if version_patch_line=$(grep -E '^set\(CMake_VERSION_PATCH [0-9]{8}\)' "$version_file"); then
  version_patch_year="${version_patch_line:24:4}"
  if [[ "$version_patch_year" =~ ^[0-9][0-9][0-9][0-9]$ ]] ; then
    sed -i -e '
      s/\(^Copyright 2000-\)[0-9][0-9][0-9][0-9]\( .*\)/\1'"$version_patch_year"'\2/
    ' "${BASH_SOURCE%/*}/../LICENSE.rst"
  fi
fi