spec-create: fix version detection of tarballs created via a git clone command

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2013-02-17 15:48:41 +01:00
parent ef3b9277ae
commit 88242edea8
2 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,10 @@ Changes in version 1.16.3 - Christmas Release
* plugins/spec-create - Silvan Calarco: * plugins/spec-create - Silvan Calarco:
Fix regexp to detect names starting with 'lib' (sample failing case: lilv) Fix regexp to detect names starting with 'lib' (sample failing case: lilv)
* plugins/spec-create - Davide Madrisan:
Fix package version detection of source tarballs that have been created by
'git.create_tarball'.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Changes in version 1.16.2 - Christmas Release Changes in version 1.16.2 - Christmas Release

View File

@ -518,6 +518,7 @@ function specfile.create() {
--destdir="$source_dir" "$2" --destdir="$source_dir" "$2"
spec_source="$2/${git_branch:-master}/$spec_source" spec_source="$2/${git_branch:-master}/$spec_source"
pck_tarball="$source_dir/${spec_source##*/}"
;; ;;
http://*|https://*|ftp://*) http://*|https://*|ftp://*)
pck_tarball="${2##*/}" pck_tarball="${2##*/}"
@ -546,7 +547,7 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \
notify.error $"cannot find the package $pck_tarball" notify.error $"cannot find the package $pck_tarball"
# get the package name from the tarball name # get the package name from the tarball name
[ "$pck_name" ] || pck_name=${3:-`echo $2 | sed -n "\ [ "$pck_name" ] || pck_name=${3:-`echo $pck_tarball | sed -n "\
s/.*\/// # remove directory name, if any s/.*\/// # remove directory name, if any
s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...)
/-[0-9]*/{s/-[0-9].*//p;q} # <pck_name>-<pck_ver> /-[0-9]*/{s/-[0-9].*//p;q} # <pck_name>-<pck_ver>
@ -560,7 +561,7 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \
[[ "${pck_newver//[0-9\.]/}" ]] && [[ "${pck_newver//[0-9\.]/}" ]] &&
notify.error $"invalid version number"" -- \`$pck_newver'" notify.error $"invalid version number"" -- \`$pck_newver'"
[ "$pck_version" ] || pck_version=${4:-`echo $2 | sed -n "\ [ "$pck_version" ] || pck_version=${4:-`echo $pck_tarball | sed -n "\
/[0-9]/!q # return nothing if no number is found in the package name /[0-9]/!q # return nothing if no number is found in the package name
s,.*/,, # remove directory name, if any s,.*/,, # remove directory name, if any
s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...)