Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Apply a less strict version check for the spec file
Consider "1.0.0+devel.34.4.gc92e26c" = "1.0.0" to ease making test
builds in the OBS.

[verify_version] Apply a less strict version check for the spec file
  • Loading branch information
spiiroin committed Jun 5, 2013
1 parent dd97557 commit 8bcf64b
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions verify_version.sh
Expand Up @@ -2,29 +2,44 @@

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

# The configure.ac is hand-edited, assume it must be sane
AC_PATH=configure.ac
AC_VERS=$(sed '/AC_INIT/!d; s/AC_INIT(libiphb, \(.*\))/\1/' $AC_PATH)

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

YAML_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libiphb}.yaml
YAML_VERS=$(grep '^Version:' $YAML_PATH |sed -e 's/^.*:[[:space:]]*//')

RES=0

if [ "$RPM_VERS" != "$AC_VERS" ]; then
echo >&2 "$AC_PATH $AC_VERS vs $RPM_PATH $RPM_VERS"
RES=1
# The .spec is either in rpm subdir or where ever rpmbuild got it from
SPEC_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libiphb}.spec
SPEC_VERS=$(grep '^Version:' $SPEC_PATH |sed -e 's/^.*:[[:space:]]*//')

if [ "$SPEC_VERS" != "$AC_VERS" ]; then
echo >&2 "$AC_PATH=$AC_VERS vs $SPEC_PATH=$SPEC_VERS"

# When building untagged commits via obs the spec will have as
# a version something like "<previous_tag>+<branch>.<hash>".
# Accept those, if version matches up to the first '+'.
if [ "${SPEC_VERS%%+*}" = "$AC_VERS" ]; then
echo >&2 " (ignored - assuming $AC_VERS + work in progress)"
else
RES=1
fi
fi

if [ "$RPM_VERS" != "$YAML_VERS" ]; then
echo >&2 "$YAML_PATH $YAML_VERS vs $RPM_PATH $RPM_VERS"
RES=1
# The yaml file is included in the git tree, but might not be available
# when making package build via OBS ...
YAML_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libiphb}.yaml

if [ -f $YAML_PATH ]; then
YAML_VERS=$(grep '^Version:' $YAML_PATH |sed -e 's/^.*:[[:space:]]*//')
if [ "$YAML_VERS" != "$AC_VERS" ]; then
echo >&2 "$AC_PATH=$AC_VERS vs $YAML_PATH=$YAML_VERS"
RES=1
fi
fi

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

# Stop the rpm-build ifthere were conflicts
exit $RES

0 comments on commit 8bcf64b

Please sign in to comment.