pck-update (-a0): add support for regexpr

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-04-14 17:29:56 +02:00
parent 244e571a19
commit 041719d96e
4 changed files with 36 additions and 17 deletions

View File

@ -13,6 +13,16 @@ Changes in version 1.9.4 -
* templates/kde4 - Davide Madrisan: * templates/kde4 - Davide Madrisan:
Remove 'Patch0' and '#%patch0 -p1' directives. Remove 'Patch0' and '#%patch0 -p1' directives.
* lib/libnetwork.lib - Davide Madrisan:
repository.get_pckname_from_HTML: reworked to accept regular expessions.
* pck-update - Davide Madrisan:
Action 0: display the entire list of packages when the user query is a
regular expression.
* i18n - Davide Madrisan:
Updated.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 1.9.3 - April Fools' Day Release Changes in version 1.9.3 - April Fools' Day Release

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# libnetwork.lib -- @package@ library to get info from internet repositories # libnetwork.lib -- @package@ library to get info from internet repositories
# Copyright (C) 2008,2010 Davide Madrisan <davide.madrisan@gmail.com> # Copyright (C) 2008,2010,2012 Davide Madrisan <davide.madrisan@gmail.com>
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && [ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] &&
{ echo $"this script requires bash version 3 or better" >&2 && exit 1; } { echo $"this script requires bash version 3 or better" >&2 && exit 1; }
@ -56,7 +56,7 @@ function repository.get_pckname_from_HTML() {
/^$pck_name-[^-]\+-[^-]\+$/bm;be; /^$pck_name-[^-]\+-[^-]\+$/bm;be;
:m;/^$pck_name-[^-]\+-[^-]\+$/p;:e" $infile) ) :m;/^$pck_name-[^-]\+-[^-]\+$/p;:e" $infile) )
echo "$pckname_from_HTML" echo "${pckname_from_HTML[*]}"
} }
# function repository.resolveURL() # function repository.resolveURL()
@ -218,12 +218,12 @@ getting list of files from"" \`${NOTE}$currurl/${NORM}'..."
notify.debug "$FUNCNAME: pck_name = $pck_name" notify.debug "$FUNCNAME: pck_name = $pck_name"
if [ -s "${flist[$i]}" ]; then if [ -s "${flist[$i]}" ]; then
got_SPEC_FILENAME=$(\ got_SPEC_FILENAME=($(\
repository.get_pckname_from_HTML "$pck_name" "${flist[$i]}") repository.get_pckname_from_HTML "$pck_name" "${flist[$i]}"))
[ "$got_SPEC_FILENAME" ] && [ "$got_SPEC_FILENAME" ] &&
{ notify.debug "\ { notify.debug "\
$FUNCNAME: got_SPEC_FILENAME = $got_SPEC_FILENAME" $FUNCNAME: got_SPEC_FILENAME = ${got_SPEC_FILENAME[*]}"
got_SPEC_FILENAME_URL_LEVEL="$level" got_SPEC_FILENAME_URL_LEVEL="$level"
got_SPEC_FILENAME_URL="$currurl" got_SPEC_FILENAME_URL="$currurl"
break 2; } break 2; }

View File

@ -1179,10 +1179,14 @@ check for available versions in the $DISTRO repositories""${NORM}"
if [[ "$got_SPEC_FILENAME" ]]; then if [[ "$got_SPEC_FILENAME" ]]; then
[[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] && [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] &&
notify.warning $"found too many candidates" notify.warning $"several occurrences found"
notify.note \ notify.note \
$"Repository"" : ${NOTE}(#$ftp_server_download_num) ${got_SPEC_FILENAME_URL}${NORM}" $"Repository""\
notify.note $"Package(s)"" : ${NOTE}${got_SPEC_FILENAME[@]}${NORM}" : ${NOTE}(#$ftp_server_download_num) ${got_SPEC_FILENAME_URL}${NORM}"
for j in `seq 1 1 ${#got_SPEC_FILENAME[*]}`; do
notify.note \
$"Package: - ""${NOTE}${got_SPEC_FILENAME[$(($j-1))]}${NORM}"
done
else else
notify.warning $"\ notify.warning $"\
cannot find a matching SRPM package in the given repositories" cannot find a matching SRPM package in the given repositories"
@ -1199,11 +1203,13 @@ cannot find a matching SRPM package in the given repositories"
if [[ "$got_SPEC_FILENAME" ]]; then if [[ "$got_SPEC_FILENAME" ]]; then
[[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] && [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] &&
notify.warning $"found too many candidates" notify.warning $"several occurrences found"
notify.note \ notify.note \
$"Repository"" : ${NOTE}(#$(($i-1))) ${got_SPEC_FILENAME_URL}${NORM}" $"Repository"" : ${NOTE}(#$(($i-1))) ${got_SPEC_FILENAME_URL}${NORM}"
notify.note $"Package(s)"" : ${NOTE}${got_SPEC_FILENAME[@]}${NORM}" for j in `seq 1 1 ${#got_SPEC_FILENAME[*]}`; do
notify.note \
$"Package: - ""${NOTE}${got_SPEC_FILENAME[$(($j-1))]}${NORM}"
done
let "srpm_pck_found += 1" let "srpm_pck_found += 1"
fi fi
done done
@ -1233,7 +1239,7 @@ cannot find a matching SRPM package in the given repositories"
[[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] && [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] &&
notify.error $"\ notify.error $"\
found too many candidates"": $( too many packages found"": $(
for f in ${got_SPEC_FILENAME[*]}; do for f in ${got_SPEC_FILENAME[*]}; do
echo -en "\n * $f" echo -en "\n * $f"
done )" done )"
@ -2797,12 +2803,12 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
if [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]]; then if [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]]; then
if [ "$force_upload" = 1 ]; then if [ "$force_upload" = 1 ]; then
# FIXME : add some extra checks # FIXME : add some extra checks
notify.warning $"found too many candidates"": $( notify.warning $"too many packages found"": $(
for f in ${got_SPEC_FILENAME[*]}; do for f in ${got_SPEC_FILENAME[*]}; do
echo -en "\n * \`$f' " echo -en "\n * \`$f' "
done )" done )"
else else
notify.error $"found too many candidates"": $( notify.error $"too many packages found"": $(
for f in ${got_SPEC_FILENAME[*]}; do for f in ${got_SPEC_FILENAME[*]}; do
echo -en "\n * \`$f' " echo -en "\n * \`$f' "
done )" done )"

View File

@ -330,14 +330,17 @@ msgstr "aggiornamento del pacchetto ${NOTE}${pck_name##*/}${NORM} alla versione
msgid "updating package" msgid "updating package"
msgstr "aggiornamento del pacchetto" msgstr "aggiornamento del pacchetto"
msgid "found too many candidates" msgid "too many packages found"
msgstr "trovati troppi pacchetti candidati" msgstr "trovati troppi pacchetti candidati"
msgid "several occurrences found"
msgstr "trovati diversi pacchetti candidati"
msgid "Repository" msgid "Repository"
msgstr "Archivio" msgstr "Archivio"
msgid "Package(s)" msgid "Package: - "
msgstr "Pacchetto" msgstr "Pacchetto: "
msgid "cannot find a matching SRPM package in the given repositories" msgid "cannot find a matching SRPM package in the given repositories"
msgstr "impossibile trovare il pacchetto SRPM nei repository indicati" msgstr "impossibile trovare il pacchetto SRPM nei repository indicati"