SHA256
3
0
forked from pool/bash

get_version_number

OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=333
This commit is contained in:
Dr. Werner Fink 2021-07-26 08:58:19 +00:00 committed by Git OBS Bridge
parent 358dfce800
commit 87126db1e5
4 changed files with 24 additions and 1 deletions

View File

@ -1,4 +1,6 @@
targettype x86 package bash
+^/usr/bin/bash$
+^/usr/bin/sh$
+^/bin/bash$
+^/bin/sh$
prereq -glibc-x86

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Jul 26 08:03:24 UTC 2021 - Dr. Werner Fink <werner@suse.de>
- Use a get_version_number.sh script
-------------------------------------------------------------------
Fri Jul 23 12:18:48 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>

View File

@ -18,7 +18,7 @@
%define bextend %{nil}
%define bversion 5.1
%define bpatchlvl %(tar -jtf %{_sourcedir}/bash-%{bversion}-patches.tar.bz2 | tail -n 1 | cut -d '/' -f 2 | cut -d '-' -f 2 | tr -d 0)
%define bpatchlvl %(bash %{_sourcedir}/get_version_number.sh %{_sourcedir})
%global _incdir %{_includedir}
%global _ldldir %{_libdir}/bash
%global _minsh 0
@ -37,6 +37,7 @@ URL: https://www.gnu.org/software/bash/bash.html
# Git: http://git.savannah.gnu.org/cgit/bash.git
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bversion}%{bextend}.tar.gz
Source1: bash-%{bversion}-patches.tar.bz2
Source2: get_version_number.sh
Source4: run-tests
Source5: dot.bashrc
Source6: dot.profile

15
get_version_number.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Note: this file is used in the spec file, do not remove it
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 -tf ${sourcedir}/bash-${version}-patches.tar.bz2 | sed -r 's@\.patch$@@'| sort -t '-' -k 3,3 -n | tail -n 1))
IFS="$OFS"
echo ${last[3]/*0/}