From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28159 invoked from network); 6 May 2002 07:04:23 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 May 2002 07:04:23 -0000 Received: (qmail 1513 invoked by alias); 6 May 2002 07:04:14 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17075 Received: (qmail 1499 invoked from network); 6 May 2002 07:04:13 -0000 From: Borsenkow Andrej To: zsh-workers@sunsite.dk Subject: PATCH: _urpmi update Date: Mon, 6 May 2002 11:04:04 +0400 Message-ID: <6134254DE87BD411908B00A0C99B044F02E89A34@mowd019a.mow.siemens.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0026_01C1F4ED.BD8103E0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.3416 In-Reply-To: <20020423094513.GA20267@logica.com> x-mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal This is a multi-part message in MIME format. ------=_NextPart_000_0026_01C1F4ED.BD8103E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > > Looking over the rest it looks fine. The one thing I see that I would > do differently is to have a single tags loop in _urpmi_rpms instead > of the three consecutive _wanted calls. It also adds source and > binary rpms separately which means that directories get added twice. > I think it'd be better to add them together - a user can always > separate them with a file-patterns style. > Right. This also changes indentation (sorry, Sven, I just have 'set sw=4' in .vimrc as I happen to like it the most :-) -andrej ------=_NextPart_000_0026_01C1F4ED.BD8103E0 Content-Type: application/octet-stream; name="zsh-urpmi.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="zsh-urpmi.diff" Index: Completion/Mandrake/Command/_urpmi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvsroot/zsh/zsh/Completion/Mandrake/Command/_urpmi,v=0A= retrieving revision 1.5=0A= diff -u -r1.5 _urpmi=0A= --- Completion/Mandrake/Command/_urpmi 16 Jan 2002 16:29:52 -0000 = 1.5=0A= +++ Completion/Mandrake/Command/_urpmi 6 May 2002 07:00:20 -0000=0A= @@ -1,118 +1,170 @@=0A= -#compdef urpmi urpmi.addmedia urpmi.removemedia urpmi.update=0A= +#compdef urpme urpmi urpmi.addmedia urpmi.removemedia urpmi.update = urpmq=0A= =0A= _urpmi_cache_policy() {=0A= - local -a synthesis=0A= - local i=0A= - synthesis=3D(/var/lib/urpmi/synthesis.*)=0A= - for i in $synthesis; do=0A= - [[ -e "$1" && -e "$i" && "$1" -nt "$i" ]] && return 1=0A= - done=0A= - return 0=0A= + local -a synthesis=0A= + local i=0A= + synthesis=3D(/var/lib/urpmi/synthesis.*)=0A= + for i in $synthesis; do=0A= + [[ -e "$1" && -e "$i" && "$1" -nt "$i" ]] && return 1=0A= + done=0A= + return 0=0A= }=0A= =0A= +_urpmi_media() {=0A= + local source media brace expl=0A= + local -a all_sources=0A= +=0A= + [[ -f /etc/urpmi/urpmi.cfg ]] || return 1=0A= +=0A= + while read source media brace; do=0A= + [[ "$brace" !=3D "{" ]] && continue=0A= + all_sources=3D("$all_sources[@]" $source)=0A= + done < /etc/urpmi/urpmi.cfg=0A= +=0A= + _values -s , 'urpmi media' "$all_sources[@]"=0A= +}=0A= +=0A= +_urpmi_rpms() {=0A= + local pkg ret=3D1 expl=0A= +=0A= + _tags rpms files=0A= +=0A= + while _tags; do=0A= + if _requested rpms expl 'urpmi RPMs'; then=0A= + local -a synthesis pkgs=0A= + synthesis=3D(/var/lib/urpmi/synthesis.*(N))=0A= + if [[ $#synthesis -gt 0 ]]; then=0A= + if _cache_invalid _urpmi_rpms || ! _retrieve_cache _urpmi_rpms; = then=0A= + pkgs=3D($(zcat $synthesis | \=0A= + grep @info@ | cut -d @ -f 3 | sed -e 's/\.[^.]*$//'))=0A= + _store_cache _urpmi_rpms pkgs=0A= + fi=0A= + compadd "$expl[@]" -a pkgs && ret=3D0=0A= + fi=0A= + fi=0A= +=0A= + _requested files expl '(S)RPM files' \=0A= + _files -g '*.(#i)rpm' && ret=3D0=0A= + done=0A= +=0A= + return $ret=0A= +}=0A= +=0A= +_urpmi_media_url() {=0A= + local expl ret=3D1=0A= +=0A= + if compset -P file:// || compset -P removable://; then=0A= + _files "$@" -W / -/ && ret=3D0=0A= + elif [[ -prefix '(ftp|http)://' ]]; then=0A= + _urls "$@" && ret=3D0=0A= + else=0A= + _wanted mediatype expl 'type of media' \=0A= + compadd "$@" -- file:// http:// ftp:// removable:// && = ret=3D0=0A= + fi=0A= +=0A= + return $ret=0A= +}=0A= +=0A= +_urpme_package() {=0A= + local -a _rpms=0A= + _rpms=3D( $(_call_program packages rpm -qa 2>/dev/null) )=0A= + compadd "$@" -a -- _rpms=0A= +}=0A= +=0A= _urpmi() {=0A= - local expl state curcontext=3D"$curcontext" line ret=3D1=0A= - typeset -A opt_args=0A= + local state context line ret=3D1=0A= + typeset -A opt_args=0A= =0A= - case "$service" in=0A= - urpmi.addmedia )=0A= - _arguments -C -A '-*' \=0A= - "(--wget)--curl[use curl to retrieve distant files]" \=0A= - "(:)--distrib[automatically create all media from an installation = medium]:media URL:->media_url" \=0A= - "--update[mark as update media]" \=0A= - "(--curl)--wget[use wget to retrieve distant files]" \=0A= - "-c[clean headers cache directory]" \=0A= - "-f[force generation of hdlist files]" \=0A= - "-h[try to find and use synthesis or hdlist file]" \=0A= - "(--distrib):name of media: " \=0A= - "(--distrib):media URL:->media_url" \=0A= - "(--distrib): :(with)" \=0A= - "(--distrib):relative path to hdlist file: " \=0A= - && ret=3D0=0A= - ;;=0A= - urpmi.removemedia )=0A= - _arguments -C -A '-*' \=0A= - "(:)-a[select all media]" \=0A= - "(-a)"{,\*}": :->urpmi_media" \=0A= - && ret=3D0=0A= - ;;=0A= - urpmi.update )=0A= - _arguments -C -A '-*' \=0A= - "(--wget)--curl[use curl to retrieve distant files]" \=0A= - "(--curl)--wget[use wget to retrieve distant files]" \=0A= - "(:)-a[select all non-removable media]" \=0A= - "-c[clean /var/cache/urpmi/headers on exit]" \=0A= - "-d[force complete computation of depslist.ordered file]" \=0A= - "*-f[force generation of hdlist files]" \=0A= - "(-a)"{,\*}": :->urpmi_media" \=0A= - && ret=3D0=0A= - ;;=0A= - urpmi )=0A= - _arguments -C -A '-*' \=0A= - "(: -)--help[print usage information]" \=0A= - "(--help)--allow-medium-change[allow change of removable media]" = \=0A= - "(--help)--auto[do not ask any questions]" \=0A= - "(--help)--auto-select[select the packages to update]" \=0A= - "(--help -X)--best-output[automatically select text or X interface]" = \=0A= - "(--help)--complete[use parsehdlist server to complete selection]" = \=0A= - "(--help --wget)--curl[use curl to retrieve distant files]" \=0A= - "(--help)--force[proceed even when some packages do not exist]" \=0A= - "(--help)--update[use only update media]" \=0A= - "(--help --curl)--wget[use wget to retrieve distant files]" \=0A= - "(--help)-a[select all packages matching command line]" \=0A= - "(--help -m -M)-m[choose minimum closure of requires (default)]" = \=0A= - "(--help -m -M)-M[choose maximum closure of requires]" \=0A= - "(--help)-p[allow search in provides]" \=0A= - "(--help -q -v)-q[be quiet]" \=0A= - "(--help -q -v)-v[verbose mode]" \=0A= - "(--help --best-output)-X[use X interface]" \=0A= - "(--help)"{,\*}": :->urpmi_rpms" \=0A= - && ret=3D0=0A= - ;;=0A= - esac=0A= -=0A= - case "$state" in=0A= - media_url )=0A= - if compset -P file:// || compset -P removable://; then=0A= - _files -W / -/ && ret=3D0=0A= - elif [[ -prefix '(ftp|http)://' ]]; then=0A= - _urls && ret=3D0=0A= - else=0A= - _wanted urpmi_media_type expl 'type of media' \=0A= - compadd -- file:// http:// ftp:// removable:// && ret=3D0=0A= - fi=0A= - ;;=0A= - urpmi_media )=0A= - local source media brace ret=3D1=0A= - while read source media brace; do=0A= - [[ "$brace" !=3D "{" ]] && continue=0A= - _wanted urpmi_media expl 'available media' \=0A= - compadd -- "$source"=0A= - ret=3D0=0A= - done < /etc/urpmi/urpmi.cfg=0A= - ;;=0A= - urpmi_rpms )=0A= - local pkg foo expl=0A= - local -a pkgs=0A= - local -a synthesis=0A= - synthesis=3D(/var/lib/urpmi/synthesis.*(N))=0A= - (( $#synthesis > 0 )) && {=0A= - if _cache_invalid _urpmi_rpms || ! _retrieve_cache _urpmi_rpms; = then=0A= - pkgs=3D($(zcat $synthesis | \=0A= - grep @info@ | cut -d @ -f 3 | sed -e 's/\.[^.]*$//'))=0A= - _store_cache _urpmi_rpms pkgs=0A= - fi=0A= - }=0A= - (( $#pkgs > 0 )) && \=0A= - _wanted urpmi_rpms expl 'urpmi RPMs to install' \=0A= - compadd -a pkgs && ret=3D0=0A= - (( $EUID =3D=3D 0 )) && \=0A= - _wanted urpmi_files expl 'RPM files to install' \=0A= - _files -g '*.(#i)rpm' && ret=3D0=0A= - ;;=0A= - esac=0A= + case "$service" in=0A= + urpme )=0A= + _arguments -A '-*' \=0A= + "--auto[do not ask any question]" \=0A= + "-a[find all matches]" \=0A= + ": :_urpme_package"=0A= + ;;=0A= + urpmi.addmedia )=0A= + _arguments -A '-*' \=0A= + "(--wget)--curl[use curl to retrieve distant files]" \=0A= + "(:)--distrib[automatically create all media from an installation = medium]:media URL:_urpmi_media_url" \=0A= + "--update[mark as update media]" \=0A= + "(--curl)--wget[use wget to retrieve distant files]" \=0A= + "-c[clean headers cache directory]" \=0A= + "-f[force generation of hdlist files]" \=0A= + "-h[try to find and use synthesis or hdlist file]" \=0A= + "(--distrib):name of media: " \=0A= + "(--distrib):media URL:_urpmi_media_url" \=0A= + "(--distrib): :(with)" \=0A= + "(--distrib):relative path to hdlist file: " \=0A= + && ret=3D0=0A= + ;;=0A= + urpmi.removemedia )=0A= + _arguments -A '-*' \=0A= + "(:)-a[select all media]" \=0A= + "(-a)"{,\*}": :_urpmi_media" \=0A= + && ret=3D0=0A= + ;;=0A= + urpmi.update )=0A= + _arguments -A '-*' \=0A= + "(--wget)--curl[use curl to retrieve distant files]" \=0A= + "(--curl)--wget[use wget to retrieve distant files]" \=0A= + "(:)-a[select all non-removable media]" \=0A= + "-c[clean /var/cache/urpmi/headers on exit]" \=0A= + "-d[force complete computation of depslist.ordered file]" \=0A= + "*-f[force generation of hdlist files]" \=0A= + "(-a)"{,\*}": :_urpmi_media" \=0A= + && ret=3D0=0A= + ;;=0A= + urpmi )=0A= + _arguments -A '-*' \=0A= + "(: -)--help[print usage information]" \=0A= + "(--help)--allow-medium-change[allow change of removable media]" \=0A= + "(--help)--auto[do not ask any questions]" \=0A= + "(--help)--auto-select[select the packages to update]" \=0A= + "(--help -X)--best-output[automatically select text or X interface]" = \=0A= + "(--help)--complete[use parsehdlist server to complete selection]" = \=0A= + "(--help --wget)--curl[use curl to retrieve distant files]" \=0A= + "(--help)--force[proceed even when some packages do not exist]" \=0A= + "(--help --fuzzy -z)"{--fuzzy,-y}"[return all matches even if exact = match exists]" \=0A= + "(--help)--media[use only the media listed by comma]: :_urpmi_media" = \=0A= + "(--help)--noclean[do not clean RPM cache]" \=0A= + "(--help --src -s)"{--src,-s}"[next package is source package]" \=0A= + "(--help)--update[use only update media]" \=0A= + "(--help --curl)--wget[use wget to retrieve distant files]" \=0A= + "(--help)-a[select all packages matching command line]" \=0A= + "(--help -m -M)-m[choose minimum closure of requires (default)]" \=0A= + "(--help -m -M)-M[choose maximum closure of requires]" \=0A= + "(--help)-P[do not search in provides]" \=0A= + "(--help -q -v)-q[be quiet]" \=0A= + "(--help -q -v)-v[verbose mode]" \=0A= + "(--help --best-output)-X[use X interface]" \=0A= + "(--help)"{,\*}": :_urpmi_rpms" \=0A= + && ret=3D0=0A= + ;;=0A= + urpmq )=0A= + _arguments -A '-*' \=0A= + "(--help -h)--auto-select[automatically select packages for upgrading = the system]" \=0A= + "(--help -h)--force[ignore non-existent packages]" \=0A= + "(--help -h --fuzzy -z)"{--fuzzy,-y}"[return all matches even if = exact match exists]" \=0A= + "(--help -h)--headers[extract headers for package listed from urpmi = db to stdout]" \=0A= + "(--help -h)--media[use only the media listed by comma]: = :_urpmi_media" \=0A= + "(--help -h)--sources[show full path to package file]" \=0A= + "(--help -h --src -s)"{--src,-s}"[next package is source package]" = \=0A= + "(--help -h)--update[use only update media]" \=0A= + "(--help -h -c -p -P)-c[choose complete method for resolving requires = closure]" \=0A= + "(--help -h)-d[show package depndencies]" \=0A= + "(--help -h)-f[print version, release and arch with name]" \=0A= + "(--help -h)-g[print groups too with name]" \=0A= + "(--help -h -c -p -P)-p[allow search in provides to find package]" = \=0A= + "(--help -h -c -p -P)-P[do not search in provides to find package]" = \=0A= + "(--help -h)-r[print version and release too with name]" \=0A= + "(--help -h)-u[remove package if a better version is already = installed]" \=0A= + "(--help -h)-v[verbose mode]" \=0A= + "(--help -h)*:urpmi package name: " \=0A= + && ret=3D0=0A= + ;;=0A= + esac=0A= =0A= - return $ret=0A= + return $ret=0A= }=0A= =0A= local update_policy=0A= ------=_NextPart_000_0026_01C1F4ED.BD8103E0--