verify_version 1.19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#!/bin/sh

# Check that all files that should have the current version agree on it

MAK_PATH=Makefile
MAK_VERS=$(grep '^VERSION.*:=' $MAK_PATH |sed -e 's/^.*:=[[:space:]]*//')

DEB_PATH=debian/changelog
DEB_VERS=$(head -1 $DEB_PATH | sed -e 's/^.*(//' -e 's/).*$//')

11
RPM_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-mce}.spec
12 13
RPM_VERS=$(grep '^Version:' $RPM_PATH |sed -e 's/^.*:[[:space:]]*//')

14 15 16 17 18 19 20 21 22
# Remove initial part of rpm version  that equals with version from Makefile
RPM_XTRA=${RPM_VERS#$MAK_VERS}
# From that remove initial part that equals with version from spec-file
RPM_XTRA=${RPM_XTRA#$RPM_VERS}
# If the result is non-empty string, then OBS is doing
# delta-after-matching-tag kind of build, which is ok.
# But empty string means that spec and Makefile are completely
# out of sync, which is bad.

23 24 25 26 27 28 29 30
RES=0

if [ "$DEB_VERS" != "$MAK_VERS" ]; then
  echo >&2 "$MAK_PATH $MAK_VERS vs $DEB_PATH $DEB_VERS"
  RES=1
fi

if [ "$RPM_VERS" != "$MAK_VERS" ]; then
31 32 33 34 35 36
  if [ -z "$RPM_XTRA" ]; then
    echo >&2 "$MAK_PATH $MAK_VERS vs $RPM_PATH $RPM_VERS"
    RES=1
  else
    echo "(ignoring patch level in spec file: $RPM_XTRA)"
  fi
37 38 39 40 41 42 43
fi

if [ $RES != 0 ]; then
  echo >&2 "Conflicting package versions"
fi

exit $RES