File: version.sh

package info (click to toggle)
xmds2 3.1.0%2Bdfsg2-10
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 42,580 kB
  • sloc: python: 64,048; cpp: 4,868; ansic: 1,463; makefile: 144; sh: 54; javascript: 8
file content (26 lines) | stat: -rwxr-xr-x 1,064 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

# Find out the latest revision
REVISION="\"HEAD\""
if [ -d "../.svn" ]; then
  REVISION=\""r`svn info . | sed -n 's/Revision: //p'`"\"
elif [ -d "../.git" ]; then
  REVISION=\""r`git log -1 | sed -n 's/.*xpdeint@\([0-9]*\).*/\1/p'`"\"
  # If we don't have a revision, then we must have git commits after the last SVN revision.
  # So mark the revision number as the last SVN revision with '+git' appended.
  if [ "$REVISION" = "\"r\"" ]; then
    REVISION=\""r`git log | grep git-svn-id | head -1 | sed -n 's/.*xpdeint@\([0-9]*\).*/\1/p'`+git"\"
  fi
elif [ -f "Version.py" ]; then
  # File exists, let's not change the version
  exit
fi
if [ -f ../debian/changelog ] ; then
    REVISION=$(head --lines=1 ../debian/changelog)
    REVISION=${REVISION##*\(}
    REVISION="\"Debian package ${REVISION%%\)*}\""
fi
echo "#!/usr/bin/env python3" > Version.py
echo "# encoding: utf-8" >> Version.py
echo "\"\"\"This is generated by the makefile via the shell program \'version.sh\'\"\"\"" >> Version.py
echo "subversionRevisionString =$REVISION" >> Version.py