bueno, en un rato te lo paso<br><br><div class="gmail_quote">2010/7/4 Pablo Manuel Rizzo <span dir="ltr">&lt;<a href="mailto:info@pablorizzo.com">info@pablorizzo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Me los pasas como adjuntos en un correo directo? porque pegando de acá<br>
me quedó con errores<br>
<br>
<br>
<br>
<br>
2010/7/3 Diego Saravia &lt;<a href="mailto:dsa@unsa.edu.ar">dsa@unsa.edu.ar</a>&gt;:<br>
<div><div></div><div class="h5">&gt; dado que nos fuimos del mundial, te mando pablo un par de programas<br>
&gt;<br>
&gt; el primero es uno en perl que llama al segundo para ordenar un archivo que<br>
&gt; contiene una lista de archivos de ututo<br>
&gt;<br>
&gt; es un ls *.tbz2 efectuado en un /ututo/i686, o sea un repositorio de<br>
&gt; paquetes<br>
&gt;<br>
&gt; al segundo si le das un argumento lo &quot;canoniza&quot;<br>
&gt;<br>
&gt; o sea lo transforma en un nombre facilmente separable en sus variables y<br>
&gt; ordenable<br>
&gt;<br>
&gt; si le das dos argumentos, un paquete y un canonico los ordena, o sea da 1 si<br>
&gt; a&gt;b, 0 si son iguales y -1 si a&lt;b<br>
&gt;<br>
&gt; espero te sriva<br>
&gt;<br>
&gt;<br>
&gt; #!/usr/bin/perl<br>
&gt;<br>
&gt;<br>
&gt; sub first{<br>
&gt;    #my ($data2,$data1)=@_;<br>
&gt;     $data1=$a;<br>
&gt;     $data2=$b;<br>
&gt;    my $pack=`/home/dsa/dsatex/ubuild/scripts/upackname -o ${data2}.can<br>
&gt; $data1`;<br>
&gt;     #print &quot;/home/dsa/dsatex/ubuild/scripts/upackname -o ${data2}.can<br>
&gt; $data1&quot;;<br>
&gt;     #print &quot;pack:$pack&quot;;<br>
&gt;    my ($normresp,$order)=split(/ /,$pack);<br>
&gt;     #print &quot;O:$order&quot;;<br>
&gt;     return $order+0;<br>
&gt; }<br>
&gt; use Data::Dumper;<br>
&gt; open(FILE, &quot;/home/dsa/ubtest/listapack&quot;);<br>
&gt; while(&lt;FILE&gt;){<br>
&gt;<br>
&gt;     $count++;<br>
&gt;     if ($count&gt;10){last}<br>
&gt;     chomp $_;<br>
&gt;     $pack=`/home/dsa/dsatex/ubuild/scripts/upackname -o $_`;<br>
&gt;     chomp $pack;<br>
&gt;     ($nombre,$version,$release,$system,$ext)=split(/_/,$pack);<br>
&gt;     $datos=[$nombre,$version,$release,$system,$ext,$pack,$_];<br>
&gt;     print &quot;Pro: $nombre,$version,$release,$system,$ext\n&quot;;<br>
&gt;     $dat-&gt;{$nombre}=[@{$dat-&gt;{$nombre}},$datos];<br>
&gt;     $lista-&gt;{$nombre}=[@{$lista-&gt;{$nombre}},$pack];<br>
&gt; }<br>
&gt; close(FILE);<br>
&gt;<br>
&gt; #print&quot;hh&quot;, Dumper $dat;<br>
&gt;<br>
&gt; foreach my $nombre (keys %$dat){<br>
&gt;     print $nombre,&quot;\n&quot;;<br>
&gt;     $datacomp=$dat-&gt;{$nombre}-&gt;[0]-&gt;[5];<br>
&gt;      print &quot; ingresa: @{$lista-&gt;{$nombre}} \n&quot;;<br>
&gt;     @ordenada=sort first @{$lista-&gt;{$nombre}};<br>
&gt;     print &quot;ordenada: @ordenada \n&quot;;<br>
&gt;     foreach my $data (@{$dat-&gt;{$nombre}}){<br>
&gt;<br>
&gt;     ($n,$v,$r,$s,$e,$p,$o)=@$data;<br>
&gt;<br>
&gt;         $pack2=`/home/dsa/dsatex/ubuild/scripts/upackname -o $o $datacomp`;<br>
&gt;         #print &quot;BBBB$pack2\n&quot;;<br>
&gt;         ($normresp,$order)=split(/ /,$pack2);<br>
&gt;         ($nc,$vc,$rc,$sc,$ec)=split(/_/,$datacomp);<br>
&gt;     print &quot;   $v $r $s $e $p $o \n&quot;;<br>
&gt;     print &quot;   $vc $rc $sc $ec  - $normresp - $datacomp : $order \n&quot;;<br>
&gt;<br>
&gt; #$normresp - $datacomp - $order\n&quot;;<br>
&gt;     }<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; ######################################<br>
&gt;<br>
&gt; #!/bin/bash<br>
&gt;<br>
&gt; version(){<br>
&gt; cat &lt;&lt;EOF<br>
&gt; upackname $PROG_VERSION<br>
&gt; Copyright (C) 2010 Diego Saravia &lt;<a href="mailto:dsa@unsa.edu.ar">dsa@unsa.edu.ar</a>&gt;<br>
&gt; License: $PROG_LICENCE<br>
&gt; &lt;<a href="http://gnu.org/licenses/gpl.html" target="_blank">http://gnu.org/licenses/gpl.html</a>&gt;<br>
&gt; EOF<br>
&gt; }<br>
&gt;<br>
&gt; help(){<br>
&gt; cat &lt;&lt;EOF<br>
&gt;     upackname PACKAGE<br>
&gt;<br>
&gt;     Splits package string in name, version and extension<br>
&gt;<br>
&gt;     Prints<br>
&gt;     PACKSTRING:  Complete file name<br>
&gt;     PACKDIR:     Directories preceding file name<br>
&gt;     PACKTYPE:    NOEXT|UNKNOWNPKGEXT|BINPKGEXT|LISTEXT|METAEXT<br>
&gt;     PACKEXT:     Extension (rpm, deb, ebuild, tbz2, etc)<br>
&gt;     PACKSYSTEM:  i686, x86_64, hurd-i386, etc<br>
&gt;     PACKNAME:    Packname<br>
&gt;     PACKVERSION: Complete version<br>
&gt;     PACKSV:      Source Version<br>
&gt;     PACKRV:      Release Version<br>
&gt;     PACKRVORDER: Release Version in Gentoo transformed for comparisson.<br>
&gt;<br>
&gt;     PACKCOMPLETENAME:           without extension<br>
&gt;     PACKCOMPLETENORMALIZEDNAME: without extension in a normalized fashion<br>
&gt; EOF<br>
&gt; }<br>
&gt;<br>
&gt; usage(){<br>
&gt; cat &lt;&lt;EOF<br>
&gt; Usage:<br>
&gt;     upackname  PACKAGE<br>
&gt; EOF<br>
&gt; }<br>
&gt;<br>
&gt; extsep(){<br>
&gt;  for ext in $2 ; do<br>
&gt;    rext=`echo $ext | sed  &#39;s|\.|\\\.|&#39; `<br>
&gt;    first=`echo $1 | sed &quot;s/\.$rext\$//&quot;`<br>
&gt;    if test &quot;x$first&quot; != &quot;x$1&quot;; then<br>
&gt;       PACKEXT=$ext<br>
&gt;       PACKTYPE=$3<br>
&gt;       PACKNOEXT=$first<br>
&gt;       break<br>
&gt;    fi<br>
&gt;  done<br>
&gt; }<br>
&gt;<br>
&gt; PROG_VERSION=0.1<br>
&gt; PROG_LICENCE=&quot;AGPLv3+: GNU AGPL version 3 or later&quot;<br>
&gt; oneline=0<br>
&gt; while test $# -gt 0  ; do<br>
&gt;         case &quot;$1&quot; in<br>
&gt;         -h|--help)<br>
&gt;                 help<br>
&gt;         ;;<br>
&gt;         -v|-V|--version)<br>
&gt;             version<br>
&gt;                 ;;<br>
&gt;             -u|--usage)<br>
&gt;             usage<br>
&gt;         ;;<br>
&gt;             -o|--oneline)<br>
&gt;             oneline=1<br>
&gt;         ;;<br>
&gt;         *)<br>
&gt;                 FILES=$@<br>
&gt;                 break<br>
&gt;          ;;<br>
&gt;         esac<br>
&gt;     shift<br>
&gt; done<br>
&gt;<br>
&gt;<br>
&gt; if test x&quot;$1&quot; = x ; then<br>
&gt;   usage<br>
&gt;   exit<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; anachar(){<br>
&gt; local CADENA=$1<br>
&gt; local char=$2<br>
&gt;<br>
&gt;  estext=`expr &quot;$char&quot; : &#39;\([a-zA-Z0\.]\)&#39;`<br>
&gt;  if test x&quot;$estext&quot; != x ; then<br>
&gt;     #echo CHAR $char<br>
&gt;     ES=CHAR<br>
&gt;     saca=$char<br>
&gt;     nume= # no es necesario<br>
&gt;    else<br>
&gt;     nume=`expr &quot;$CADENA&quot; : &#39;\([0-9]\+\)&#39;`<br>
&gt;     if test x&quot;$nume&quot; = x ; then<br>
&gt;         saca=$char<br>
&gt;         # lo pongo como char<br>
&gt;         #ES=OTHER<br>
&gt;          ES=CHAR<br>
&gt;         #echo CHAR OTHER $char<br>
&gt;         # es al vicio, solo preguntar por numeros<br>
&gt;           #echo SEPARA $char<br>
&gt;         #char=&#39;&#39;<br>
&gt;        else<br>
&gt;          #echo NUM  $nume<br>
&gt;          ES=NUMB<br>
&gt;          saca=$nume<br>
&gt;     fi<br>
&gt;  fi<br>
&gt;<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; # ver caracter ~ en debian<br>
&gt; order(){<br>
&gt; # returns first as compared to second<br>
&gt; CADENA1=$1<br>
&gt; CADENA2=$2<br>
&gt; #echo 1: $CADENA1 - 2: $CADENA2<br>
&gt;<br>
&gt; while true ; do<br>
&gt;  char1=${CADENA1:0:1}<br>
&gt;  char2=${CADENA2:0:1}<br>
&gt;  #echo CHAR1: $char1 - CHAR2: $char2<br>
&gt;  if test x&quot;$char1&quot; = x -a  x&quot;$char2&quot; = x ; then<br>
&gt;   #echo SON IGUALES<br>
&gt;   ORDER=0<br>
&gt;   break<br>
&gt;  elif test x&quot;$char1&quot; = x -a  x&quot;$char2&quot; != x ; then<br>
&gt;   #echo CADENA1 PRIMERO T<br>
&gt;   ORDER=-1<br>
&gt;   break<br>
&gt;  elif test x&quot;$char1&quot; != x -a  x&quot;$char2&quot; = x ; then<br>
&gt;   #echo CADENA2 PRIMERO T<br>
&gt;   ORDER=1<br>
&gt;   break<br>
&gt;  fi<br>
&gt;<br>
&gt;  anachar $CADENA1 $char1<br>
&gt;  CADENA1=${CADENA1#$saca}<br>
&gt;  ES1=$ES<br>
&gt;  nume1=$nume<br>
&gt;<br>
&gt;  anachar $CADENA2 $char2<br>
&gt;  CADENA2=${CADENA2#$saca}<br>
&gt;  ES2=$ES<br>
&gt;  nume2=$nume<br>
&gt;  #RES=&quot;$ES1 - $ES2 - $char1 - $char2 - $nume1 - $nume2&quot;<br>
&gt;<br>
&gt;  if test x&quot;$ES1&quot; = xNUMB -a x&quot;$ES2&quot; = xNUMB ; then<br>
&gt;   if test x&quot;$nume1&quot; = x&quot;$nume2&quot; ; then<br>
&gt;     #echo continue IGUALES NUMB: $RES<br>
&gt;     continue<br>
&gt;    elif test $nume1 -gt $nume2; then<br>
&gt;     #echo &quot;CADENA2 PRI 2        : $RES&quot;<br>
&gt;     ORDER=1<br>
&gt;    else<br>
&gt;     #echo &quot;CADENA1 PRI 2        : $RES&quot;<br>
&gt;     ORDER=-1<br>
&gt;    fi<br>
&gt;   break<br>
&gt;<br>
&gt;  elif test x&quot;$ES1&quot; = xCHAR -a x&quot;$ES2&quot; = xCHAR ; then<br>
&gt;   if test x&quot;$char1&quot; = x&quot;$char2&quot; ; then<br>
&gt;    #echo continue IGUALES CHAR: $RES<br>
&gt;    continue<br>
&gt;   elif test $char1 &gt; $char2; then<br>
&gt;     #echo &quot;CADENA1 PRI 3        : $RES&quot;<br>
&gt;     ORDER=-1<br>
&gt;   else<br>
&gt;     #echo &quot;CADENA2 PRI 3        : $RES&quot;<br>
&gt;     ORDER=1<br>
&gt;   fi<br>
&gt;   break<br>
&gt;<br>
&gt; elif test x&quot;$ES1&quot; = xCHAR -a x&quot;$ES2&quot; = xNUMB ; then<br>
&gt;  if test x&quot;$char1&quot; = x0 ; then<br>
&gt;     #echo &quot;CADENA1 PRI 4 0      : $RES&quot;<br>
&gt;     ORDER=-1<br>
&gt;     break<br>
&gt;    else<br>
&gt;     #echo &quot;CADENA2 PRI 4        : $RES&quot;<br>
&gt;     ORDER=1<br>
&gt;   fi<br>
&gt;   break<br>
&gt; elif test x&quot;$ES1&quot; = xNUMB -a x&quot;$ES2&quot; = xCHAR ; then<br>
&gt;  if test x&quot;$char2&quot; = x0 ; then<br>
&gt;     #echo &quot;CADENA2 PRI 4 0      : $RES&quot;<br>
&gt;     ORDER=1<br>
&gt;    else<br>
&gt;     #echo &quot;CADENA1 PRI 4        : $RES&quot;<br>
&gt;     ORDER=-1<br>
&gt;    fi<br>
&gt;   break<br>
&gt; fi<br>
&gt;<br>
&gt; #echo lll $char - $nume - $EST - $estext - $CADENA1<br>
&gt; done<br>
&gt; }<br>
&gt;<br>
&gt; #order apo1002300.001.45g.ui67 apo1002300.001.45g.ui68b<br>
&gt;<br>
&gt; #echo OOO $ORDER<br>
&gt; #exit<br>
&gt;<br>
&gt;<br>
&gt; PACK=$1<br>
&gt; COMPPACK=$2<br>
&gt;<br>
&gt; #echo NNN $1 JJJ  $2 KKK<br>
&gt; #PACKSTRING=`basename $PACK`<br>
&gt; PACKSTRING=`echo $PACK | awk -F/ &#39;{print $NF}&#39;`<br>
&gt; PACKDIRPRE=${PACK%${PACKSTRING}} # en dos pasos por si no tiene /<br>
&gt;<br>
&gt; if test x&quot;$PACKDIRPRE&quot; = x/ ; then<br>
&gt;   PACKDIR=/<br>
&gt;  else<br>
&gt;   PACKDIR=${PACKDIRPRE%/}<br>
&gt; fi<br>
&gt;<br>
&gt; # 4 kind: file list (lf), metapacks (ebuild ubuild suma), binary packs,<br>
&gt; source packs<br>
&gt; METAEXT=&quot;ebuild ubuild summa&quot;<br>
&gt; LISTEXT=&quot;lf can&quot;<br>
&gt; # esto no es asi, cambiar<br>
&gt;<br>
&gt; #KNOWN:<br>
&gt; BINPKGEXT=&quot;tgz tbz2 deb rpm&quot;<br>
&gt; #SEE:<br>
&gt; PKGEXT=&quot;tar.gz tgz <a href="http://tar.bz" target="_blank">tar.bz</a> tar.bz2 tbz tbz2 ZIP sip jar gz Z z bz2 bz 7Z 7z<br>
&gt; RAR rar LHa LHA lha lzh a deb lzma xz rpm&quot;<br>
&gt;<br>
&gt; PACKTYPE=0 # EXIST EXTENSION<br>
&gt; PACKEXT=&quot;&quot;<br>
&gt; # packtype<br>
&gt; PACKNAMEVERS=$PACKSTRING<br>
&gt;<br>
&gt;<br>
&gt; ########################################3 test sobre archivos reales, ver<br>
&gt; que pasa si no se quiere esto<br>
&gt; # o sea proveer<br>
&gt;<br>
&gt;<br>
&gt; # basename?<br>
&gt;<br>
&gt; extsep $PACKSTRING &quot;$BINPKGEXT&quot; BINPKGEXT<br>
&gt;<br>
&gt; if test x&quot;$PACKEXT&quot; = x ; then<br>
&gt;    extsep $PACKSTRING &quot;$LISTEXT&quot; LISTEXT<br>
&gt; fi<br>
&gt; if test x&quot;$PACKEXT&quot; = x ; then<br>
&gt;    extsep $PACKSTRING &quot;$METAEXT&quot; METAEXT<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt; if test x&quot;$PACKEXT&quot; = x ; then<br>
&gt;   PACKEXT=`echo $PACKSTRING | awk -F. &#39;{print $NF}&#39;`<br>
&gt;   PACKNOEXT=${PACKSTRING%.${PACKEXT}}<br>
&gt;   PACKTYPE=UNKNOWNPKGEXT<br>
&gt; fi<br>
&gt; if test x&quot;$PACKEXT&quot; = x ; then<br>
&gt;     PACKNOEXT=$PACKSTRING<br>
&gt;     PACKTYPE=NOEXT<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt; #echo mmmmmmmmmmmmmmm $PACKEXT<br>
&gt; PACKERROR=&#39;&#39;<br>
&gt;<br>
&gt;<br>
&gt; case $PACKEXT in<br>
&gt; can)<br>
&gt;   `echo $PACKNOEXT| sed &#39;s/\(.*\)_\(.*\)_\(.*\)_\(.*\)_\(.*\)$/export<br>
&gt; PACKNAME\=\1 PACKSV\=\2 PACKRVORDER\=\3 PACKSYSTEM\=\4 PACKEXT\=\5&#39;/`<br>
&gt;<br>
&gt; #echo CAN $PACKNAME $PACKSV $PACKRVORDER $PACKEXT<br>
&gt; ;;<br>
&gt; ebuild|ubuild|tbz2)<br>
&gt; # en build info o ebuild  no parece haber info sobre nombre o version<br>
&gt;<br>
&gt;     #<a href="http://distfiles.gentoo.org/distfiles/pms-3.pdf" target="_blank">http://distfiles.gentoo.org/distfiles/pms-3.pdf</a><br>
&gt;<br>
&gt;     `echo $PACKNOEXT | sed -e<br>
&gt; &#39;s/\(.*\)-\(\([[:digit:]]\+\(\.[[:digit:]]\+\)*\+[a-z]\?\)\(\(_\(alpha\|beta\|pre\|rc\|p\)[[:digit:]]*\)*\(-r\([[:digit:]]\+\)\)\?\)\)$/export<br>
&gt; PACKNAME=\1 PACKVERSION=\2 PACKSV=\3 PACKRVPRE=\5 PACKGENTOOPRE=\6<br>
&gt; PACKGENTOORE=\8 PACKGENTOORENUM=\9/&#39;`<br>
&gt;<br>
&gt; if test x&quot;$PACKNAME&quot; = x ; then<br>
&gt;     echo ERROR, NO ES UN ARCHIVO GENTOO<br>
&gt;     PACKERROR=&quot;No es Gentoo&quot;<br>
&gt; fi<br>
&gt;<br>
&gt; if test x&quot;$PACKGENTOOPRE&quot; = x ; then<br>
&gt;   #PACKRV=${PACKRVPRE#-} # no porque a veces debbiera agregar _ y otras -<br>
&gt;  PACKSRORDER=5<br>
&gt;  else<br>
&gt;   #PACKRV=$PACKRVPRE<br>
&gt;  PACKSRORDERPRE=`echo $PACKGENTOOPRE| sed -r -e &quot;s/_alpha/1./&quot; \<br>
&gt;  -e &quot;s/_beta/2./&quot; \<br>
&gt;  -e &quot;s/_pre/3./&quot; \<br>
&gt;  -e &quot;s/_rc/4./&quot; \<br>
&gt;  -e &quot;s/_p/6./&quot; `<br>
&gt;<br>
&gt;  PACKSRORDER=`echo $PACKSRORDERPRE| sed  -e &#39;s/\.$//&#39; `<br>
&gt;<br>
&gt; fi<br>
&gt;<br>
&gt; PACKRV=$PACKRVPRE<br>
&gt;<br>
&gt; if test x&quot;$PACKGENTOORE&quot; = x ; then<br>
&gt;     PACKRVORDER=$PACKSRORDER.0<br>
&gt;   else<br>
&gt;     PACKRVORDER=$PACKSRORDER.$PACKGENTOORENUM<br>
&gt; fi<br>
&gt;<br>
&gt; #echo bbbbbbbbbbbbbbb $PACKGENTOOPRE  $PACKGENTOORE - $PACKGENTOORENUM -<br>
&gt; $PACKSRORDER -  $PACKSRORDERPRE<br>
&gt;<br>
&gt;<br>
&gt;     #PACKNAME=sed -e<br>
&gt; &#39;s/(.*\)\(-[[:digit:]]\+\(\.[[:digit:]]\+\)*\+[a-z]\?\(_\(alpha\|beta\|pre\|rc\|p\)[[:digit:]]*\)*\(-r[[:digit:]]\+\)\?\)$//&#39;`<br>
&gt;     #PACKVERSION=`echo $PACK|cut -d- -f2-`<br>
&gt;     #if test x&quot;$PACKVERSION&quot; =  x&quot;$PACKNAME&quot; ; then  # esto es raro,<br>
&gt;     #    PACKVERSION=&#39;&#39;<br>
&gt;     #    # que el cut ponga el primer campo si no hay segundo ver<br>
&gt;     #    #PACKVERSION=0<br>
&gt;     # fi<br>
&gt;<br>
&gt;     #sed &#39;s/-[0-9]\{1,\}.*$//&#39;<br>
&gt;     ;;<br>
&gt;<br>
&gt; #Ebuild file names consist of four logical subsections:<br>
&gt;<br>
&gt; #pkg-ver{_suf{#}}{-r#}.ebuild<br>
&gt;<br>
&gt; #Note: The brackets ({}) delineate optional fields and do not appear in the<br>
&gt; literal package name. # represents any non-zero positive integer.<br>
&gt;<br>
&gt; #The first subsection, pkg, is the package name, which should only contain<br>
&gt; lowercase letters, the digits 0-9, and any number of single hyphen (-),<br>
&gt; underscore (_) or plus (+) characters. Examples: util-linux, sysklogd and<br>
&gt; gtk+. We have some packages in Portage that don&#39;t follow these rules, but<br>
&gt; your packages should.<br>
&gt;<br>
&gt; #The second subsection, ver, is the version of the package, which should<br>
&gt; normally be same as the version on the main source tarball. The version is<br>
&gt; normally made up of two or three (or more) numbers separated by periods,<br>
&gt; such as 1.2 or 4.5.2, and may have a single letter immediately following the<br>
&gt; last digit; e.g., 1.4b or 2.6h. The package version is joined to the package<br>
&gt; name with a hyphen. For example: foo-1.0, bar-2.4.6.<br>
&gt;<br>
&gt; #Important: If you&#39;re thinking of using a trailing letter in your version<br>
&gt; string, note that the trailing letter should not be used to signify alpha or<br>
&gt; beta status for the package, since alphas and betas are prereleases and<br>
&gt; letter revisions are newer versions. This is an important distinction<br>
&gt; because Portage uses an ebuild&#39;s version number to determine if it is newer<br>
&gt; or older than other packages with the same category and name. It&#39;s very<br>
&gt; important that version numbers faithfully represent the version of the<br>
&gt; package so that Portage properly performs its dependency checking duties.<br>
&gt;<br>
&gt; #The third subsection, {_suf{#}}, is optional and may contain one of these<br>
&gt; predefined suffixes, listed in least-recent to most-recent order:<br>
&gt; #Suffix     Meaning<br>
&gt; #_alpha     Alpha release<br>
&gt; #_beta     Beta release<br>
&gt; #_pre     Prerelease<br>
&gt; #_rc     Release candidate<br>
&gt; #(none)     Normal release<br>
&gt; #_p     Patch level (normally accompanied by trailing integer)<br>
&gt;<br>
&gt; #Any of these suffixes may be immediately followed by a non-zero positive<br>
&gt; integer, e.g., linux-2.4.0_pre10. Assuming identical version parts, the<br>
&gt; suffixes are ordered as follows (lower means older): _alpha &lt; _beta &lt; _pre &lt;<br>
&gt; _rc &lt; (no suffix) &lt; _p.<br>
&gt;<br>
&gt; #When comparing identical suffixes with trailing integers, the one with the<br>
&gt; larger integer will be considered most recent. Example: foo-1.0_alpha4 is<br>
&gt; more recent than foo-1.0_alpha3.<br>
&gt;<br>
&gt; #The fourth subsection of the package name is the Gentoo Linux-specific<br>
&gt; revision number ({-r#}). This subsection, like the suffix, is also optional.<br>
&gt; # is a non-zero positive integer; e.g., package-4.5.3-r3.<br>
&gt;<br>
&gt; #This revision number is independent of the version of the source tarball<br>
&gt; and is used to inform people that a new and improved Gentoo Linux revision<br>
&gt; of a particular package is available. Initial releases of ebuilds must have<br>
&gt; no revision number; e.g., package-4.5.3 and are considered by Portage to<br>
&gt; have a revision number of zero. This means that counting goes as follows:<br>
&gt; 1.0 (initial version), 1.0-r1, 1.0-r2, etc.<br>
&gt;<br>
&gt; #If you make non-trivial improvements to an existing ebuild file, you should<br>
&gt; copy the ebuild file to a new file with the revision number incremented by<br>
&gt; 1. Remember to always make mentions of your changes in the ChangeLog when<br>
&gt; you bump a revision and in your CVS commit message; not doing so is against<br>
&gt; policy.<br>
&gt;<br>
&gt; #... and I suppose that we actually have a fifth section of the ebuild name<br>
&gt; as well -- the .ebuild extension itself.<br>
&gt;<br>
&gt; rpm)<br>
&gt; # spec si hay nombre, version y release, verificar que esto funcione bien al<br>
&gt; abrir cada paquete<br>
&gt;<br>
&gt; #    PACKNAME=`echo $PACKNOEXT |sed &#39;s/-[^-]*-[^-]*$//&#39;`<br>
&gt;     PACKNAME=`echo $PACKNOEXT |sed &#39;s/-[^-]*-.*$//&#39;`<br>
&gt;     PACKVERSIONPRE=${PACKNOEXT#${PACKNAME}} # primero el nombre por si es<br>
&gt; todo<br>
&gt;     PACKVERSIONSYS=${PACKVERSIONPRE#-}<br>
&gt;<br>
&gt; if test x&quot;$PACKNAME&quot; = x ; then<br>
&gt;     echo ERROR, NO ES UN ARCHIVO RPM<br>
&gt;     PACKERROR=&quot;No es RPM&quot;<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt; PACKVERSION=`echo $PACKVERSIONSYS | sed<br>
&gt; &#39;s/\.\(\(darwin\|freebsd\|netbsd\|kfreebsd\|knetbsd\|openbsd\|hurd\|gnu\|linux\)-\)\?\(noarch\|src\|i486\|i586\|i686\|athlon\|ppc\|x86_64\|i386\|ia64\|alpha\|amd64\|armeb\|arm\|hppa\|m32r\|m68k\|mips\|mipsel\|powerpc\|ppc64\|s390\|s390x\|sh3\|sh3eb\|sh4\|sh4eb\|sparc\)$//&#39;`<br>

&gt;     PACKSYSTEMPRE=${PACKVERSIONSYS#${PACKVERSION}} # primero el nombre por<br>
&gt; si es todo<br>
&gt;     PACKSYSTEM=${PACKSYSTEMPRE#.}<br>
&gt;<br>
&gt;     PACKNOSYSTEM=$PACKNAME-$PACKVERSION<br>
&gt;<br>
&gt;     `echo $PACKVERSION| sed &#39;s/\([^-]*\)-\(.*\)$/export PACKSV\=\1<br>
&gt; PACKRV\=\2/&#39;`<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #    echo KKKK $PACKSV   KKKKK $PACKSYSTEM KKKKKK $PACKRV<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     # `echo $PACKNOEXT | sed -e<br>
&gt; &#39;s/\([a-zA-Z0-9_\-\+]*\)-\([a-zA-Z0-9_\.]*\)-\([a-zA-Z0-9_\.]*\)\.\(noarch\|src\|i386\|i686\|athlon\|ppc\|x86_64\)$/export<br>
&gt; PACKNAME\=&quot;\1&quot;  PACKVERSION\=&quot;\2-\3.\4&quot;  PACKOV\=&quot;\2&quot; PACKRV\=&quot;\3&quot;<br>
&gt; PACKARCH\=&quot;\4&quot;/&#39;`<br>
&gt;<br>
&gt;     #older systems do not have arch part, see<br>
&gt;     #        my $name = $1;<br>
&gt;     #        my $version = $2;<br>
&gt;     #        my $release = $3;<br>
&gt;     #        my $arch = $4;<br>
&gt;<br>
&gt;     #$ rpm -qp --qf &#39;%{NAME}&#39; some.rpm<br>
&gt;<br>
&gt;     #rpm -qa|sed &#39;s/-[^-]*-[^-]*$//&#39;<br>
&gt;<br>
&gt;     #RPM &lt;name&gt;-&lt;version&gt;-&lt;release&gt;.&lt;architecture&gt;.rpm nano-0.98-2.i386.rpm<br>
&gt; libgnomeuimm-2.0-2.0.0-3.src.rpm<br>
&gt;<br>
&gt;     #A package label is contained within the file and does not necessarily<br>
&gt;     #need to match the name of the file.<br>
&gt;<br>
&gt;     #Additionally, libraries are distributed in two separate packages for<br>
&gt;     #each version. One contains the precompiled code, while the second one<br>
&gt;     #contains the development files such as headers, static library files,<br>
&gt;     #etc. for the library in question. Those packages have &quot;-devel&quot; appended<br>
&gt; to their name field. Users need to carefully check so that<br>
&gt;     #the version of the development package matches that of the binary<br>
&gt;     #package, otherwise the library may not work very well.<br>
&gt;     ;;<br>
&gt;<br>
&gt; deb)<br>
&gt;<br>
&gt; # en control parece haber info sobre el nombre, no sobre las versiones, usar<br>
&gt; para verificar<br>
&gt;<br>
&gt;     #DEB<br>
&gt; &lt;foo&gt;_&lt;VersionNumber&gt;-&lt;DebianRevisionNumber&gt;_&lt;DebianArchitecture&gt;.deb<br>
&gt;<br>
&gt;     PACKNAME=`echo $PACKNOEXT | awk -F_ &#39;{print $1}&#39;`<br>
&gt;     PACKVERSIONSYSPRE=${PACKNOEXT#${PACKNAME}}  # en dos pasos por si el<br>
&gt; nombre debian esta mal y no usa _<br>
&gt;     PACKVERSIONSYS=${PACKVERSIONSYSPRE#_}<br>
&gt;<br>
&gt; if test x&quot;$PACKNAME&quot; = x ; then<br>
&gt;     echo ERROR, NO ES UN ARCHIVO DEB<br>
&gt;     PACKERROR=&quot;No es deb&quot;<br>
&gt; fi<br>
&gt;<br>
&gt;     #echo MMMMM $PACKVERSION<br>
&gt;     #igual que el rpm con _ en vez de .<br>
&gt;     PACKVERSION=`echo $PACKVERSIONSYS | sed<br>
&gt; &#39;s/_\(\(darwin\|freebsd\|netbsd\|kfreebsd\|knetbsd\|openbsd\|hurd\|gnu\|linux\)-\)\?\(noarch\|src\|i486\|i586\|i686\|athlon\|ppc\|x86_64\|i386\|ia64\|alpha\|amd64\|armeb\|arm\|hppa\|m32r\|m68k\|mips\|mipsel\|powerpc\|ppc64\|s390\|s390x\|sh3\|sh3eb\|sh4\|sh4eb\|sparc\)$//&#39;`<br>

&gt;<br>
&gt; if test x&quot;$PACKVERSION&quot; = x ; then<br>
&gt;     echo ERROR, NO ES UN ARCHIVO DEB<br>
&gt;     PACKERROR=&quot;No es deb&quot;<br>
&gt; fi<br>
&gt;<br>
&gt;     PACKNOSYSTEM=$PACKNAME_$PACKVERSION<br>
&gt;   echo MMMMM $PACKVERSION  - $PACKNOSYSTEM<br>
&gt;     PACKSYSTEMPRE=${PACKVERSIONSYS#${PACKVERSION}} # primero el nombre por<br>
&gt; si es todo<br>
&gt;     PACKSYSTEM=${PACKSYSTEMPRE#_}<br>
&gt;<br>
&gt;     `echo $PACKVERSION| sed &#39;s/\([^-]*\)-\(.*\)$/export PACKSV\=\1<br>
&gt; PACKRV\=\2/&#39;`<br>
&gt;<br>
&gt; if test x&quot;$PACKSV&quot; = x ; then<br>
&gt;     echo ERROR, NO ES UN ARCHIVO DEB<br>
&gt;     PACKERROR=&quot;No es deb&quot;<br>
&gt; fi<br>
&gt;<br>
&gt;     # echo KKKK $PACKSV   KKKKK $PACKSYSTEM KKKKKK $PACKRV KKKK<br>
&gt; $PACKNOSYSTEM<br>
&gt;<br>
&gt;<br>
&gt; #\([a-z][a-z0-9\+\-\.]+\)_\([a-zA-Z0-9_\.]*\)-\([0-9a-zA-Z\+\.\~]+\)_\(noarch\|src\|noarch\|i386\|i686\|athlon\|ppc\|x86_64\)<br>
&gt;<br>
&gt;      #The name of the package itself (not the filename, just the name of the<br>
&gt; package) can contain lowercase letters, numbers, and the &quot;-&quot; and &quot;+&quot;<br>
&gt; characters.<br>
&gt;      #debian_revision<br>
&gt;<br>
&gt;      #This part of the version number specifies the version of the Debian<br>
&gt; package based on the upstream version.<br>
&gt;      #It may contain only alphanumerics and the characters + . ~ (plus, full<br>
&gt; stop, tilde) and is compared in the same way as the upstream_version is.<br>
&gt;      #It is optional; if it isn&#39;t present then the upstream_version may not<br>
&gt; contain a hyphen.<br>
&gt;      #This format represents the case where a piece of software was written<br>
&gt; specifically to be turned into a Debian package,<br>
&gt;      #and so there is only one &quot;debianisation&quot; of it and therefore no<br>
&gt; revision indication is required.<br>
&gt;      #It is conventional to restart the debian_revision at 1 each time the<br>
&gt; upstream_version is increased.<br>
&gt;      #The package management system will break the version number apart at<br>
&gt; the last hyphen in the string<br>
&gt;      #(if there is one) to determine the upstream_version and<br>
&gt; debian_revision. The absence of a debian_revision is equivalent to a<br>
&gt; debian_revision of 0<br>
&gt;<br>
&gt;      #The VVV component is the version number specified by the upstream<br>
&gt;      #developer. There are no standards in place here, so the version number<br>
&gt;      #may have formats as different as &quot;19990513&quot; and &quot;1.3.8pre1&quot;.<br>
&gt;<br>
&gt;      #The RRR component is the Debian revision number, and is specified by<br>
&gt;      #the Debian developer (or an individual user if he chooses to build the<br>
&gt;      #package himself). This number corresponds to the revision level of the<br>
&gt;      #Debian package, thus, a new revision level usually signifies changes<br>
&gt;      #in the Debian Makefile (debian/rules), the Debian control file<br>
&gt;      #(debian/control), the installation or removal scripts (debian/p*), or<br>
&gt;      #in the configuration files used with the package.<br>
&gt;<br>
&gt;      #The AAA component identifies the processor for which the package was<br>
&gt;      #built. This is commonly i386, which refers to chips compatible to<br>
&gt;      #Intel&#39;s 386 or later versions. For other possibilities review Debian&#39;s<br>
&gt;      #FTP directory structure at What are all those directories at the<br>
&gt;      #Debian FTP archives?, Section 6.7. For details, see the description of<br>
&gt;      #&quot;Debian architecture&quot; in the manual page dpkg-architecture(1).<br>
&gt;<br>
&gt;      #<br>
&gt;<br>
&gt;      #i386 ia64 alpha amd64 armeb arm hppa m32r m68k mips mipsel powerpc<br>
&gt; ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc darwin-i386 darwin-ia64<br>
&gt; darwin-alpha darwin-amd64 darwin-armeb darwin-arm darwin-hppa darwin-m32r<br>
&gt; darwin-m68k darwin-mips darwin-mipsel darwin-powerpc darwin-ppc64<br>
&gt; darwin-s390 darwin-s390x darwin-sh3 darwin-sh3eb darwin-sh4 darwin-sh4eb<br>
&gt; darwin-sparc freebsd-i386 freebsd-ia64 freebsd-alpha freebsd-amd64<br>
&gt; freebsd-armeb freebsd-arm freebsd-hppa freebsd-m32r freebsd-m68k<br>
&gt; freebsd-mips freebsd-mipsel freebsd-powerpc freebsd-ppc64 freebsd-s390<br>
&gt; freebsd-s390x freebsd-sh3 freebsd-sh3eb freebsd-sh4 freebsd-sh4eb<br>
&gt; freebsd-sparc kfreebsd-i386 kfreebsd-ia64 kfreebsd-alpha kfreebsd-amd64<br>
&gt; kfreebsd-armeb kfreebsd-arm kfreebsd-hppa kfreebsd-m32r kfreebsd-m68k<br>
&gt; kfreebsd-mips kfreebsd-mipsel kfreebsd-powerpc kfreebsd-ppc64 kfreebsd-s390<br>
&gt; kfreebsd-s390x kfreebsd-sh3 kfreebsd-sh3eb kfreebsd-sh4 kfreebsd-sh4eb<br>
&gt; kfreebsd-sparc knetbsd-i386 knetbsd-ia64 knetbsd-alpha knetbsd-amd64<br>
&gt; knetbsd-armeb knetbsd-arm knetbsd-hppa knetbsd-m32r knetbsd-m68k<br>
&gt; knetbsd-mips knetbsd-mipsel knetbsd-powerpc knetbsd-ppc64 knetbsd-s390<br>
&gt; knetbsd-s390x knetbsd-sh3 knetbsd-sh3eb knetbsd-sh4 knetbsd-sh4eb<br>
&gt; knetbsd-sparc netbsd-i386 netbsd-ia64 netbsd-alpha netbsd-amd64 netbsd-armeb<br>
&gt; netbsd-arm netbsd-hppa netbsd-m32r netbsd-m68k netbsd-mips netbsd-mipsel<br>
&gt; netbsd-powerpc netbsd-ppc64 netbsd-s390 netbsd-s390x netbsd-sh3 netbsd-sh3eb<br>
&gt; netbsd-sh4 netbsd-sh4eb netbsd-sparc openbsd-i386 openbsd-ia64 openbsd-alpha<br>
&gt; openbsd-amd64 openbsd-armeb openbsd-arm openbsd-hppa openbsd-m32r<br>
&gt; openbsd-m68k openbsd-mips openbsd-mipsel openbsd-powerpc openbsd-ppc64<br>
&gt; openbsd-s390 openbsd-s390x openbsd-sh3 openbsd-sh3eb openbsd-sh4<br>
&gt; openbsd-sh4eb openbsd-sparc hurd-i386 hurd-ia64 hurd-alpha hurd-amd64<br>
&gt; hurd-armeb hurd-arm hurd-hppa hurd-m32r hurd-m68k hurd-mips hurd-mipsel<br>
&gt; hurd-powerpc hurd-ppc64 hurd-s390 hurd-s390x hurd-sh3 hurd-sh3eb hurd-sh4<br>
&gt; hurd-sh4eb hurd-sparc ;;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     ;;<br>
&gt;<br>
&gt; esac<br>
&gt; #\(\(darwin\|freebsd\|netbsd\|kfreebsd\|knetbsd\|openbsd\|hurd\|gnu\|linux\)-\)\?<br>
&gt; ### aqui seguro tenemos PACKNOEXT<br>
&gt;<br>
&gt; ## si no tenemos PACKNOSYSTEM lo buscamos<br>
&gt; if test x&quot;$PACKSYSTEM&quot; = x ; then<br>
&gt;     PACKNOSYSTEM=`echo $PACKNOEXT | sed<br>
&gt; &#39;s/[\._-]\(noarch\|src\|i486\|i586\|i686\|athlon\|ppc\|x86_64\|i386\|ia64\|alpha\|amd64\|armeb\|arm\|hppa\|m32r\|m68k\|mips\|mipsel\|powerpc\|ppc64\|s390\|s390x\|sh3\|sh3eb\|sh4\|sh4eb\|sparc\)$//&#39;`<br>
&gt;<br>
&gt; # if apears something identifing origin as ubuntu, ututo, pacman etc must be<br>
&gt; extracted here<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #echo MMMM $PACKNAME - $PACKNOSYSTEM -$PACKNOEXT<br>
&gt;     PACKSYSTEMPRE=${PACKNOEXT#${PACKNOSYSTEM}} # primero el nombre por si es<br>
&gt; todo<br>
&gt;     PACKSYSTEMPRE3=${PACKSYSTEMPRE#-}<br>
&gt;     PACKSYSTEMPRE2=${PACKSYSTEMPRE3#_}<br>
&gt;     PACKSYSTEM=${PACKSYSTEMPRE2#.}<br>
&gt;<br>
&gt;<br>
&gt; fi<br>
&gt;<br>
&gt; if test x&quot;$PACKNOSYSTEM&quot; = x ; then<br>
&gt;    PACKNOSYSTEM=$PACKNOEXT<br>
&gt; fi<br>
&gt;<br>
&gt; # aqui seguro tenemos PACKNOSYSTEM<br>
&gt; # si no tenemos PACKVERSION (PACKNONAME) lo buscamos<br>
&gt;<br>
&gt; #echo MMMM $PACKNAME - $PACKNOSYSTEM -$PACKNOEXT<br>
&gt;<br>
&gt;<br>
&gt; if test x&quot;$PACKNAME&quot; = x ; then<br>
&gt;    PACKVERSION=`echo $PACKNOSYSTEM | awk -F- &#39;{print $NF}&#39;`<br>
&gt;     if test x&quot;$PACKVERSION&quot; = x&quot;$PACKNOSYSTEM&quot; ; then<br>
&gt;        PACKVERSION=&#39;&#39;<br>
&gt;     fi<br>
&gt;     PACKNAMEPRE=${PACKNOSYSTEM%${PACKVERSION}} # en dos pasos por si no<br>
&gt; tiene -<br>
&gt;     PACKNAME=${PACKNAMEPRE%-}<br>
&gt;<br>
&gt; #echo MMMM $PACKNAME<br>
&gt; fi<br>
&gt;<br>
&gt; ## si no conseguimos una PACKNAME diferente la buscamos de nuevo<br>
&gt; if test x&quot;$PACKNAME&quot; = x&quot;$PACKNOSYSTEM&quot; ; then<br>
&gt;    PACKVERSION=`echo $PACKNOSYSTEM | awk -F- &#39;{print $NF}&#39;`<br>
&gt;     if test x&quot;$PACKVERSION&quot; = x&quot;$PACKNOSYSTEM&quot; ; then<br>
&gt;        PACKVERSION=&#39;&#39;<br>
&gt;     fi<br>
&gt;     PACKNAMEPRE=${PACKNOSYSTEM%${PACKVERSION}} # en dos pasos por si no<br>
&gt; tiene -<br>
&gt;     PACKNAME=${PACKNAMEPRE%_}<br>
&gt; fi<br>
&gt;<br>
&gt; #echo MMM $PACKSV<br>
&gt; if test x&quot;$PACKSV&quot; = x -a x&quot;$PACKVERSION&quot; != x ; then<br>
&gt;<br>
&gt;     PACKRV=&#39;&#39;<br>
&gt;     PACKSV=`echo $PACKVERSION| sed &#39;s/_\(.*\)$//&#39;`<br>
&gt;     if test x&quot;$PACKVERSION&quot; = x&quot;$PACKSV&quot; ; then<br>
&gt;         ### PACKSV=&#39;&#39; # no better to have this as VERSION if not RV<br>
&gt;         :<br>
&gt;        else<br>
&gt;         PACKRVPRE=${PACKVERSION%$PACKSV}<br>
&gt;         PACKRV=${PACKRVPRE%$_}<br>
&gt;     fi<br>
&gt;<br>
&gt; fi<br>
&gt;<br>
&gt; if test x&quot;$PACKRVORDER&quot; = x ; then<br>
&gt;      PACKRVORDER=$PACKRV<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt; SLASH=_<br>
&gt; #if test x&quot;$PACKSV&quot; = x ; then<br>
&gt; #   SLASH=&#39;&#39;<br>
&gt; #fi<br>
&gt; SSLASH=_<br>
&gt; #if test x&quot;$PACKRVORDER&quot; = x ; then<br>
&gt; #   SSLASH=&#39;&#39;<br>
&gt; #fi<br>
&gt; PACKCOMPLETENORMALIZEDNAME=&quot;$PACKNAME$SLASH$PACKSV$SSLASH${PACKRVORDER}_${PACKSYSTEM}_$PACKEXT&quot;<br>
&gt;<br>
&gt; if test x&quot;$COMPPACK&quot; != x ; then<br>
&gt;     `echo $COMPPACK| sed &#39;s/\(.*\)_\(.*\)_\(.*\)_\(.*\)_\(.*\)$/export<br>
&gt; COMPPN\=\1 COMPPV\=\2 COMPPR\=\3 COMPPS\=\4 COMPPE\=\5&#39;/`<br>
&gt;<br>
&gt; #echo COMP $COMPPV  - $COMPPR<br>
&gt; #echo PACK $PACKSV - $PACKRVORDER<br>
&gt;<br>
&gt; order ${PACKSV}_$PACKRVORDER ${COMPPV}_$COMPPR<br>
&gt;<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt; if test x&quot;$oneline&quot; = x0 ; then<br>
&gt;<br>
&gt; echo &quot;PACKSTRING=&#39;$PACKSTRING&#39;&quot;<br>
&gt; echo &quot;PACKDIR=&#39;$PACKDIR&#39;&quot;<br>
&gt; echo &quot;PACKNAME=&#39;$PACKNAME&#39;&quot;<br>
&gt; echo &quot;PACKVERSION=&#39;$PACKVERSION&#39;&quot; #version and release<br>
&gt; # no: si no hay version , version debe ser 0<br>
&gt; echo &quot;PACKEXT=&#39;$PACKEXT&#39;&quot;<br>
&gt; echo &quot;PACKTYPE=&#39;$PACKTYPE&#39;&quot;<br>
&gt; echo &quot;PACKCOMPLETENAME=&#39;$PACKNOSYSTEM&#39;&quot; # without extension<br>
&gt;<br>
&gt;<br>
&gt; echo &quot;PACKSYSTEM=&#39;$PACKSYSTEM&#39;&quot;<br>
&gt; echo &quot;PACKSV=&#39;$PACKSV&#39;&quot;<br>
&gt; echo &quot;PACKRV=&#39;$PACKRV&#39;&quot;<br>
&gt; echo &quot;PACKERROR=&#39;$PACKERROR&#39;&quot;<br>
&gt; echo &quot;PACKRVORDER=&#39;$PACKRVORDER&#39;&quot;<br>
&gt;<br>
&gt; echo &quot;PACKCOMPLETENORMALIZEDNAME=&#39;$PACKCOMPLETENORMALIZEDNAME&#39;&quot; # without<br>
&gt; extension<br>
&gt; echo &quot;ORDER=&#39;$ORDER&#39;&quot;<br>
&gt; echo &quot;COMPPN=&#39;$COMPPN&#39;&quot;<br>
&gt; echo &quot;COMPPV=&#39;$COMPPV&#39;&quot;<br>
&gt; echo &quot;COMPPR=&#39;$COMPPR&#39;&quot;<br>
&gt; echo &quot;COMPPS=&#39;$COMPPS&#39;&quot;<br>
&gt; echo &quot;COMPPE=&#39;$COMPPE&#39;&quot;<br>
&gt; else<br>
&gt;<br>
&gt; #echo &quot;$PACKNAME:$PACKSV:$PACKRVORDER:$PACKTYPE&quot;<br>
&gt;  if test x&quot;$ORDER&quot; != x ; then<br>
&gt;    echo &quot;$PACKCOMPLETENORMALIZEDNAME $ORDER&quot;<br>
&gt;   else<br>
&gt;    echo &quot;$PACKCOMPLETENORMALIZEDNAME&quot;<br>
&gt;  fi<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #No me fije en otros sistemas, pero los paquetes versionados al estilo<br>
&gt; #gentoo tiene una dificultad cuando corresponden a releases,<br>
&gt; #prereleases, betas, etc. Salvo por eso, se ordenarían fácilmente con<br>
&gt; #ls -v , que compara versiones numéricas en los nombres de archivos.<br>
&gt; #Pero cuando las versiones son cosas como paquete-0.3.7-alpha1 y<br>
&gt; #paquete-0.3.7 allí falla.<br>
&gt;<br>
&gt; #Lo que hice para resolver eso es previamente hacer una lista de los<br>
&gt; #archivos a ordenar, en la lista reemplazar esas cosas por números,<br>
&gt; #para que el ls los pueda ordenar, así:<br>
&gt;<br>
&gt; #sed -r -e &quot;s/(-[0-9.]+)_alpha/\1_000_/&quot; \<br>
&gt; # -e &quot;s/(-[0-9.]+)_beta/\1_001_/&quot; \<br>
&gt; # -e &quot;s/(-[0-9.]+)_pre/\1_002_/&quot; \<br>
&gt; # -e &quot;s/(-[0-9.]+)_rc/\1_003_/&quot; \<br>
&gt; # -e &quot;s/(-[0-9.]+)_p/\1_004_/&quot;)<br>
&gt; #On Sunday 07 September 2008 08:28:11 Jim Meyering wrote:<br>
&gt; #&gt; IMHO, changing sort -V to produce more intuitively-correct results<br>
&gt; #&gt; is the way to go.<br>
&gt; #&gt;<br>
&gt; #&gt; With ls -v, I&#39;m willing to make the change as well, *assuming*<br>
&gt; #&gt; no one produces a counterargument.<br>
&gt; #&gt;<br>
&gt; #&gt; The question is what ordering function to use.<br>
&gt; #&gt; The more generally-useful the better.  i.e., I hope<br>
&gt; #&gt; it can be compatible with both the rpm and deb version sorters.<br>
&gt; #I made an investigation of existing functions which sort version strings:<br>
&gt; #strverscmp - from glibc (now with its equivalent in gnulib)<br>
&gt; #rpmvercmp - from rpm<br>
&gt; #ververcmp - from dpkg##<br>
&gt;<br>
&gt; #The main problem of all these functions is dealing with suffixes. So I<br>
&gt; #modified them to drop the suffixes. So it is 6 implementations together (3<br>
&gt; #original + 3 modified).<br>
&gt;<br>
&gt; #Then I ran a few series of tests with all implementations. I think the<br>
&gt; #modified version of ververcmp (from dpkg) gives the best results - consider<br>
&gt; #attached results of an example - results.tar.bz2#<br>
&gt;<br>
&gt; #So I propose a new function filevercmp (attachment filevercmp.c) as the<br>
&gt; #predicate function for new sort --version-sort.<br>
&gt;<br>
&gt; #In the attachment is also the whole &quot;testing framework&quot; which I used to<br>
&gt; #compare these functions - strverscmp.tar.bz2 - follow the steps in README<br>
&gt; #inside archive. It is developed a bit quickly but I hope it could be<br>
&gt; #useful :-)#<br>
&gt;<br>
&gt;<br>
&gt; #Kamil<br>
&gt; #<a href="http://www.opensubscriber.com/message/bug-coreutils@gnu.org/10201323.html" target="_blank">http://www.opensubscriber.com/message/bug-coreutils@gnu.org/10201323.html</a><br>
&gt;<br>
&gt; #<a href="http://old.nabble.com/Possible-bug-in-sort--V-td26804985.html" target="_blank">http://old.nabble.com/Possible-bug-in-sort--V-td26804985.html</a><br>
&gt;<br>
&gt; #&gt; cat a | /build/toolchain/lin32/coreutils-8.2/bin/sort -V<br>
&gt; #&gt; kernel-2.6.18-164.2.1.el5.x86_64.rpm<br>
&gt; #&gt; kernel-2.6.18-164.6.1.el5.x86_64.rpm<br>
&gt; #&gt; kernel-2.6.18-164.el5.x86_64.rpm<br>
&gt; #&gt;<br>
&gt; #&gt; The result should be<br>
&gt; #&gt; kernel-2.6.18-164.el5.x86_64.rpm<br>
&gt; #&gt; kernel-2.6.18-164.2.1.el5.x86_64.rpm<br>
&gt; #&gt; kernel-2.6.18-164.6.1.el5.x86_64.rpm<br>
&gt; #&gt;<br>
&gt; #&gt; Is it a bug is sort -V?<br>
&gt;<br>
&gt;<br>
&gt; #I agree the behavior is pretty awkward. Nevertheless the behavior<br>
&gt; #is well documented:<br>
&gt;<br>
&gt; #<a href="http://www.gnu.org/software/coreutils/manual/html_node/Details-about-version-sort.html" target="_blank">http://www.gnu.org/software/coreutils/manual/html_node/Details-about-version-sort.html</a><br>
&gt;<br>
&gt; #The &quot;bug&quot; is triggered by the underscore in &quot;x86_64&quot;. It&#39;s not treated as<br>
&gt; file<br>
&gt; #suffix in that case. However it works fairly well when you replace &quot;x86_64&quot;<br>
&gt; by<br>
&gt; #&quot;i686&quot;.<br>
&gt; #From 3069d50b766a2db8b86406904b7327e5de5e315f Mon Sep 17 00:00:00 2001<br>
&gt; #From: =?utf-8?q?P=C3=A1draig=20Brady?= &lt;P@...&gt;<br>
&gt; #Date: Thu, 17 Dec 2009 10:48:54 +0000<br>
&gt; #Subject: [PATCH] doc: enhance and reference info about version comparison<br>
&gt;<br>
&gt; #* doc/coreutils.texi (sort invocation): Reference the additional<br>
&gt; #info about filevercmp rather than the unused strverscmp.<br>
&gt; #(Details about version sort): Add some examples that are not<br>
&gt; #handled well by fileversmp.<br>
&gt; #* src/ls.c: Change a comment referencing the now unused strverscmp.<br>
&gt; #---<br>
&gt; # doc/coreutils.texi |   33 ++++++++++++++++++++++++---------<br>
&gt; # src/ls.c           |    2 +-<br>
&gt; # 2 files changed, 25 insertions(+), 10 deletions(-)<br>
&gt;<br>
&gt; #-This functionality is implemented using gnulib&#39;s @code{filevercmp}<br>
&gt; function.<br>
&gt; #-One result of that implementation decision is that @samp{ls -v}<br>
&gt; #-and @samp{sort -V} do not use the locale category, @env{LC_COLLATE},<br>
&gt; #-which means non-numeric prefixes are sorted as if @env{LC_COLLATE} were<br>
&gt; set<br>
&gt; #-to @samp{C}.<br>
&gt; #+This functionality is implemented using gnulib&#39;s @code{filevercmp}<br>
&gt; function,<br>
&gt; #+which has some caveats worth noting.<br>
&gt; #+<br>
&gt; #+@itemize @bullet<br>
&gt; #+@item @env{LC_COLLATE} is ignored, which means @samp{ls -v} and @samp{sort<br>
&gt; -V}<br>
&gt; #+will sort non-numeric prefixes as if the @env{LC_COLLATE} locale category<br>
&gt; #+was set to @samp{C}.<br>
&gt; #+@item Some suffixes will not be matched by the regular<br>
&gt; #+expression mentioned above.  Consequently these examples may<br>
&gt; #+not sort as you expect:<br>
&gt; #+<br>
&gt; #+@example<br>
&gt; #+abc-1.2.3.4.7z<br>
&gt; #+abc-1.2.3.7z<br>
&gt; #+@end example<br>
&gt; #+<br>
&gt; #+@example<br>
&gt; #+abc-1.2.3.4.x86_64.rpm<br>
&gt; #+abc-1.2.3.x86_64.rpm<br>
&gt; #+@end example<br>
&gt; #+@end itemize<br>
&gt;<br>
&gt; # @node General output formatting<br>
&gt; # @subsection General output formatting<br>
&gt; #diff --git a/src/ls.c b/src/ls.c<br>
&gt; #index aeaa584..5c7f6aa 100644<br>
&gt; #--- a/src/ls.c<br>
&gt; #+++ b/src/ls.c<br>
&gt; #@@ -3272,7 +3272,7 @@ DEFINE_SORT_FUNCTIONS (extension, cmp_extension)<br>
&gt; #    All the other sort options, in fact, need xstrcoll and strcmp variants,<br>
&gt; #    because they all use a string comparison (either as the primary or<br>
&gt; secondary<br>
&gt; #    sort key), and xstrcoll has the ability to do a longjmp if strcoll<br>
&gt; fails for<br>
&gt; #-   locale reasons.  Last, strverscmp is ALWAYS available in coreutils,<br>
&gt; #+   locale reasons.  Last, filevercmp is ALWAYS available in coreutils,<br>
&gt; #    thanks to the gnulib library. */<br>
&gt; # static inline int<br>
&gt; # cmp_version (struct fileinfo const *a, struct fileinfo const *b)<br>
&gt; #--<br>
&gt; #1.6.2.5<br>
&gt;<br>
&gt; #como compilar a partir de un ebuild, de un spec y de un control<br>
&gt; #category no esta en ebuild, si en ubuild<br>
&gt;<br>
&gt; #<a href="http://www.redhat.com/archives/rpm-list/2003-January/msg00006.html" target="_blank">http://www.redhat.com/archives/rpm-list/2003-January/msg00006.html</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #RES1=`echo &quot;.$CADENA1&quot; |sed -e &#39;s/[^0-9a-zA-Z]\+/./g&#39;| sed -e<br>
&gt; &#39;s/\([a-zA-Z]\+\)/\1:./g&#39; | sed -e &#39;s/\([0-9]\+\)/\1;./g&#39; | sed -e<br>
&gt; &#39;s/.\([0]\+\)/.\1:./g&#39;`<br>
&gt; #RES2=`echo &quot;.$CADENA2&quot; |sed -e &#39;s/[^0-9a-zA-Z]\+/./g&#39;| sed -e<br>
&gt; &#39;s/\([a-zA-Z]\+\)/\1:./g&#39; | sed -e &#39;s/\([0-9]\+\)/\1;./g&#39; | sed -e<br>
&gt; &#39;s/.\([0]\+\)/.\1:./g&#39;`<br>
&gt; #echo $RES1<br>
&gt; #echo $RES2<br>
&gt;<br>
&gt; #FIN=0<br>
&gt; ##IFS=.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #RES1=${RES1#.}<br>
&gt; #RES2=${RES2#.}<br>
&gt; #coma=`echo &quot;$RES1&quot; |sed -e &#39;s/\..\+$//&#39;`<br>
&gt; #RES1=${RES1#$coma}<br>
&gt;<br>
&gt; #comb=`echo &quot;$RES2&quot; |sed -e &#39;s/\..\+$//&#39;`<br>
&gt; #RES2=${RES2#$comb}<br>
&gt;<br>
&gt; #echo $coma $comb - $RES1 $RES2<br>
&gt; #if test x&quot;$coma&quot; != x&quot;$comb&quot; ; then<br>
&gt; #   echo SON DISTINTOS $coma $comb<br>
&gt; #   FIN=1<br>
&gt; #fi#<br>
&gt;<br>
&gt; #if test x&quot;$RES1&quot; = x -o x&quot;$RES2&quot; = x  ; then<br>
&gt; # echo junto termino: $coma - $comb<br>
&gt; #   FIN=1<br>
&gt; #fi<br>
&gt; #bbb=s<br>
&gt; #<br>
&gt; # if test x&quot;$item&quot; != x; then<br>
&gt; # echo $item<br>
&gt;<br>
&gt; # fi<br>
&gt;<br>
&gt; #done<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; El 1 de julio de 2010 17:26, Pablo Manuel Rizzo &lt;<a href="mailto:info@pablorizzo.com">info@pablorizzo.com</a>&gt;<br>
&gt; escribió:<br>
&gt;&gt;<br>
&gt;&gt; 2010/7/1 Diego Saravia &lt;<a href="mailto:dsa@unsa.edu.ar">dsa@unsa.edu.ar</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; hay que integrarlo con el programa que deduce las versiones, para eso lo<br>
&gt;&gt;&gt; escribi<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; no es mi idea generar un nuevo sort, con el tiempo el sort -V seguramente<br>
&gt;&gt;&gt; andara<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; solamente poder saber si un paquete es posterior o anterior a lo que ya<br>
&gt;&gt;&gt; esta instalado.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; supongo que el programa que dado un paquete indica su nombre y versiones,<br>
&gt;&gt;&gt; cuando le digas cual es la versin instalada de ese mismo paquete te dira<br>
&gt;&gt;&gt; adicionalmente si es anterior o posterior<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; esa es mi idea,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; se te ocurre algo mejor<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Ah, está bien, había entendido otra cosa.<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Pablo Manuel Rizzo<br>
&gt;&gt; -------------------------------<br>
&gt;&gt; <a href="http://pablorizzo.com" target="_blank">http://pablorizzo.com</a><br>
&gt;&gt; -------------------------------<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ________________________________________________<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Solar-General es una lista abierta a toda la comunidad, sin ninguna<br>
&gt;&gt; moderación, por lo que se apela a la tolerancia y al respeto mutuo.<br>
&gt;&gt; Las opiniones expresadas son responsabilidad exclusiva de sus<br>
&gt;&gt; respectivos/as autores/as. La Asociación Solar no se hace responsable por<br>
&gt;&gt; los mensajes vertidos, ni representan necesariamente el punto de vista de la<br>
&gt;&gt; Asociación Solar.<br>
&gt;&gt;<br>
&gt;&gt; <a href="mailto:Solar-general@lists.ourproject.org">Solar-general@lists.ourproject.org</a><br>
&gt;&gt; <a href="https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general" target="_blank">https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Diego Saravia<br>
&gt; <a href="mailto:Diego.Saravia@gmail.com">Diego.Saravia@gmail.com</a><br>
&gt; NO FUNCIONA-&gt;<a href="mailto:dsa@unsa.edu.ar">dsa@unsa.edu.ar</a><br>
&gt;<br>
&gt; ________________________________________________<br>
&gt;<br>
&gt;<br>
&gt; Solar-General es una lista abierta a toda la comunidad, sin ninguna<br>
&gt; moderación, por lo que se apela a la tolerancia y al respeto mutuo.<br>
&gt; Las opiniones expresadas son responsabilidad exclusiva de sus respectivos/as<br>
&gt; autores/as. La Asociación Solar no se hace responsable por los mensajes<br>
&gt; vertidos, ni representan necesariamente el punto de vista de la Asociación<br>
&gt; Solar.<br>
&gt;<br>
&gt; <a href="mailto:Solar-general@lists.ourproject.org">Solar-general@lists.ourproject.org</a><br>
&gt; <a href="https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general" target="_blank">https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general</a><br>
&gt;<br>
<br>
<br>
<br>
--<br>
Pablo Manuel Rizzo<br>
-------------------------------<br>
<a href="http://pablorizzo.com" target="_blank">http://pablorizzo.com</a><br>
-------------------------------<br>
<br>
________________________________________________<br>
<br>
<br>
Solar-General es una lista abierta a toda la comunidad, sin ninguna moderación, por lo que se apela a la tolerancia y al respeto mutuo.<br>
Las opiniones expresadas son responsabilidad exclusiva de sus respectivos/as autores/as. La Asociación Solar no se hace responsable por los mensajes vertidos, ni representan necesariamente el punto de vista de la Asociación Solar.<br>

<br>
<a href="mailto:Solar-general@lists.ourproject.org">Solar-general@lists.ourproject.org</a><br>
<a href="https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general" target="_blank">https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Diego Saravia<br><a href="mailto:Diego.Saravia@gmail.com">Diego.Saravia@gmail.com</a><br>NO FUNCIONA-&gt;<a href="mailto:dsa@unsa.edu.ar">dsa@unsa.edu.ar</a><br>