bash/get_version_number.sh
Dr. Werner Fink 9ce5cec29a Accepting request 1005780 from home:yecril71pl:branches:Base:System
- add checks
The check in the build section does not check anything because it overrides the test script.

OBS-URL: https://build.opensuse.org/request/show/1005780
OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=353
2022-09-27 07:37:07 +00:00

17 lines
1.0 KiB
Bash

#!/bin/bash
# Note: this file is used in the spec file, do not remove it
# Print the highest version number of the patches from the archive
sourcedir=$1
test -n "${sourcedir}" || sourcedir=$PWD
test -e ${sourcedir}/bash.spec || exit 1
version=$(sed -rn '/^%define[[:space:]]+bversion/{s/^%define[[:space:]]+bversion[[:space:]]+([0-9]+\.[0-9]+)(\.[^\.]+)?/\1/p}' ${sourcedir}/bash.spec) || exit 1
test -e ${sourcedir}/bash-${version}.tar.gz || exit 1
last=($(tar Oxf ${sourcedir}/bash-${version}.tar.gz bash-${version}/configure.ac | sed -rn '/^define.bashvers/{s/^define\(bashvers,[[:space:]]([0-9\.]+)\)/\1/p}')) || exit 1
test -e ${sourcedir}/bash-${version}-patches.tar.bz2 || echo ${last[0]}
tar --wildcards -tf ${sourcedir}/bash-${version}-patches.tar.bz2 '*/bash[0-9][0-9]-*[0-9]' &> /dev/null || echo ${last[0]}
OFS="$IFS"
IFS=-
last=($(tar --wildcards -tf ${sourcedir}/bash-${version}-patches.tar.bz2 '*/bash[0-9][0-9]-*[0-9]' | sed -r 's@\.patch$@@'| sort -t '-' -k 3,3 -n | tail -n 1))
IFS="$OFS"
echo ${last[3]/*0/}