~phablet-team/libiphb/ubuntu

« back to all changes in this revision

Viewing changes to verify_version.sh

  • Committer: Matti Kosola
  • Date: 2013-06-06 07:03:44 UTC
  • mfrom: (29.1.2)
  • Revision ID: git-v1:588da8eb98c8525485762c991466d2cdc1e7e929
Merge pull request #3 from spiiroin/hbtest3

Add new utility for testing iphb timers

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# Check that all files that should have the current version agree on it
4
4
 
 
5
# The configure.ac is hand-edited, assume it must be sane
5
6
AC_PATH=configure.ac
6
7
AC_VERS=$(sed '/AC_INIT/!d; s/AC_INIT(libiphb, \(.*\))/\1/' $AC_PATH)
7
8
 
8
 
RPM_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libiphb}.spec
9
 
RPM_VERS=$(grep '^Version:' $RPM_PATH |sed -e 's/^.*:[[:space:]]*//')
10
 
 
 
9
RES=0
 
10
 
 
11
# The .spec is either in rpm subdir or where ever rpmbuild got it from
 
12
SPEC_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libiphb}.spec
 
13
SPEC_VERS=$(grep '^Version:' $SPEC_PATH |sed -e 's/^.*:[[:space:]]*//')
 
14
 
 
15
if [ "$SPEC_VERS" != "$AC_VERS" ]; then
 
16
  echo >&2 "$AC_PATH=$AC_VERS vs $SPEC_PATH=$SPEC_VERS"
 
17
 
 
18
  # When building untagged commits via obs the spec will have as
 
19
  # a version something like  "<previous_tag>+<branch>.<hash>".
 
20
  # Accept those, if version matches up to the first '+'.
 
21
  if [ "${SPEC_VERS%%+*}" = "$AC_VERS" ]; then
 
22
    echo >&2 "  (ignored - assuming $AC_VERS + work in progress)"
 
23
  else
 
24
    RES=1
 
25
  fi
 
26
fi
 
27
 
 
28
# The yaml file is included in the git tree, but might not be available
 
29
# when making package build via OBS ...
11
30
YAML_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libiphb}.yaml
12
 
YAML_VERS=$(grep '^Version:' $YAML_PATH |sed -e 's/^.*:[[:space:]]*//')
13
 
 
14
 
RES=0
15
 
 
16
 
if [ "$RPM_VERS" != "$AC_VERS" ]; then
17
 
  echo >&2 "$AC_PATH $AC_VERS vs $RPM_PATH $RPM_VERS"
18
 
  RES=1
19
 
fi
20
 
 
21
 
if [ "$RPM_VERS" != "$YAML_VERS" ]; then
22
 
  echo >&2 "$YAML_PATH $YAML_VERS vs $RPM_PATH $RPM_VERS"
23
 
  RES=1
 
31
 
 
32
if [ -f $YAML_PATH ]; then
 
33
  YAML_VERS=$(grep '^Version:' $YAML_PATH |sed -e 's/^.*:[[:space:]]*//')
 
34
  if [ "$YAML_VERS" != "$AC_VERS" ]; then
 
35
    echo >&2 "$AC_PATH=$AC_VERS vs $YAML_PATH=$YAML_VERS"
 
36
    RES=1
 
37
  fi
24
38
fi
25
39
 
26
40
if [ $RES != 0 ]; then
27
41
  echo >&2 "Conflicting package versions"
28
42
fi
29
43
 
 
44
# Stop the rpm-build ifthere were conflicts
30
45
exit $RES