libspec.lib: reworked sed expressions to get SPEC_SOURCE0_PCKNAME from SPEC_SOURCE0

This commit is contained in:
Silvan Calarco 2013-01-07 13:55:01 +01:00
parent 76440538a6
commit 644f634393
2 changed files with 15 additions and 15 deletions

View File

@ -10,7 +10,10 @@ Changes in version 1.16.3 - Christmas Release
Bug introduced in version 1.16.2 while creating 'specfile.check_syntax()'. Bug introduced in version 1.16.2 while creating 'specfile.check_syntax()'.
* lib/libspec.lib - Davide Madrisan: * lib/libspec.lib - Davide Madrisan:
Fix initialization of SPEC_SOURCE0 and SPEC_SOURCE0_VERBATIM". Fix initialization of SPEC_SOURCE0 and SPEC_SOURCE0_VERBATIM.
* lib/libspec.lib - Silvan Calarco:
Reworked sed expressions to get SPEC_SOURCE0_PCKNAME from SPEC_SOURCE0
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@ -914,26 +914,23 @@ $FUNCNAME: SPEC_SOURCE0_VERBATIM = \"$SPEC_SOURCE0_VERBATIM\""
[ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION [ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION
[ "$SPEC_SOURCE0" ] || specfile.getvars -s "$specfile" SPEC_SOURCE0 [ "$SPEC_SOURCE0" ] || specfile.getvars -s "$specfile" SPEC_SOURCE0
SPEC_SOURCE0_PCKNAME=$(echo $SPEC_SOURCE0 | sed -n "\ SPEC_SOURCE0_PCKNAME=$(echo $SPEC_SOURCE0 | sed "\
s,%[{]*name[}]*,$SPEC_NAME,
s,%[{]*version[}]*,$SPEC_VERSION,
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, ...)
# <pck_name><pck_ver> # <pck_name><pck_ver>
/^${SPEC_NAME}${SPEC_VERSION}$/{s,$SPEC_VERSION,,p;q} /^${SPEC_NAME}${SPEC_VERSION}$/{s,$SPEC_VERSION,,;q}
/[^-\.][0-9]\./{s/\(.*[^-\.]\)[0-9]\..*/\1/p;q}
# <pck_name>-<pck_ver> # <pck_name>-<pck_ver>
/^${SPEC_NAME}\-${SPEC_VERSION}$/{s,\-${SPEC_VERSION},,p;q} /^.*\-${SPEC_VERSION}.*/{s,\-${SPEC_VERSION}.*,,;q}
/-[0-9]\+/{s/-[0-9].*//p;q}
# <pck_name>_<pck_ver> # <pck_name>_<pck_ver>
/^${SPEC_NAME}_${SPEC_VERSION}$/{s,_${SPEC_VERSION},,p;q} /^.*_${SPEC_VERSION}.*/{s,_${SPEC_VERSION}.*,,;q}
/_[0-9]\+/{s/_[0-9].*//p;q}
# <pck_name>.<pck_ver> # <pck_name>.<pck_ver>
/^${SPEC_NAME}\.${SPEC_VERSION}$/{s,\.${SPEC_VERSION},,p;q} /^.*\.${SPEC_VERSION}.*/{s,\.${SPEC_VERSION}.*,,;q}
/^[a-zA-Z0-9_]\+\.[0-9\.]\+$/{s,\(^[a-zA-Z0-9_]\+\)\.[0-9\.]\+$,\1,p;q} # name ending with -<something_looking_like_a_version>
/^[a-zA-Z0-9]\+$/{p;q} # <pck_name> (with no version) /^.*-[0-9][0-9.]*[0-9]/{s,\-[0-9][0-9.]*[0-9],,;q}
# <pck_name> (no version, but <pck_name> can end with numbers) # <pck_name> (not matching version but with <pck_name> ending with numbers)
/^[^0-9]*[0-9]*$/p") /^[^0-9]*[0-9]*$/{s,[0-9]*$,,;q}
# <pck_name> (with no version)
/^[a-zA-Z0-9]\+$/{q}")
notify.debug "$FUNCNAME: $var = \"$SPEC_SOURCE0_PCKNAME\"" notify.debug "$FUNCNAME: $var = \"$SPEC_SOURCE0_PCKNAME\""
;; ;;
SPEC_SOURCE) SPEC_SOURCE)