diff --git a/ChangeLog b/ChangeLog index 7208c93..9754448 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,16 @@ Wed Apr 18 2012 Davide Madrisan Move code from spec-create to the new function 'git.create_tarball()' in libnetwork.lib. ++ bugfix + * lib/libnetwork.lib - Davide Madrisan: + repository.get_srpm_pckname_from_HTML(): make the function work again for + curl dumps of ftp sites. (Regression pointed out by Silvan Calarco). + ++ update + * lib/libnetwork.lib - Davide Madrisan: + Function renaming: repository.get_srpm_pckname_from_HTML() --> + repository.get_srpm_pckname_from_site(). + ------------------------------------------------------------------------------- Changes in version 1.9.4 diff --git a/lib/libnetwork.lib.in b/lib/libnetwork.lib.in index cbf5e64..2da0de0 100644 --- a/lib/libnetwork.lib.in +++ b/lib/libnetwork.lib.in @@ -42,9 +42,43 @@ function repository.is_reachable() { return $? } -# function repository.get_srpm_pckname_from_HTML() -# ... ADDME ... -function repository.get_srpm_pckname_from_HTML() { +# function repository.get_srpm_pckname_from_site() +# get the list of SRPM packages by looking at the curl dump of the +# ftp or html site +# args: +# --ftp | --html +# $1 : package name or regexpr to look for +# $2 : a (temporary) file containing the curl dump +# return value: +# the list of srpm files +function repository.get_srpm_pckname_from_site() { + local ARGS + ARGS=`LC_ALL=C getopt \ + -o fh --long ftp,html \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + local is_html="0" is_ftp="0" + + eval set -- "$ARGS" + while :; do + case "$1" in + -f|--ftp) + is_ftp="1" + ;; + -h|--html) + is_html="1" + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; + esac + shift + done + + [ "$is_ftp" != "$is_html" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"usage error (--ftp/--html)" + local pck_name="$(echo "$1" | tr A-Z a-z)" local infile="$2" @@ -64,12 +98,20 @@ function repository.get_srpm_pckname_from_HTML() { regexpr="^$pck_name-[^-]\+-[^-]\+$" || regexpr="$pck_name" notify.debug "$FUNCNAME: regexpr = \"$regexpr\"" - local pckname_from_HTML=($(tr A-Z a-z < $infile | \ - sed -n "# remove HTML tags --> get a better input - / get a better input + /