[Solar-general] divisor de nombres de paquetes
Diego Saravia
dsa en unsa.edu.ar
Mar Jun 22 02:05:24 CEST 2010
pablo, me parece que hay algunos problemitas en lo que me mandaste
en particular puede haber numeros despues de alpha, beta, etc
luego si el elemento no tiene esa parte, debe ser ordenado entre pre y p
creo que te falta la opcion p
y el r puede o no estar independientemente de lo otro
no se fijate, en el programa esta el url de las normas sobre el orden en gentoo
de cualquier forma lo que me enviaste me sirvio mucho
ahi mando una version que genera versiones separadas de la version
fuente y el release, y en el caso de gentoo produce una cadena que se
puede ordenar
El día 19 de junio de 2010 22:18, Pablo Manuel Rizzo
<info en pablorizzo.com> escribió:
> 2010/6/19 Diego Saravia <dsa en unsa.edu.ar>:
>> una cosa que tengo que hacer es comparar versiones, quizas alguien
>> tenga una idea como hacerlo facil
>
> No me fije en otros sistemas, pero los paquetes versionados al estilo
> gentoo tiene una dificultad cuando corresponden a releases,
> prereleases, betas, etc. Salvo por eso, se ordenarían fácilmente con
> ls -v , que compara versiones numéricas en los nombres de archivos.
> Pero cuando las versiones son cosas como paquete-0.3.7-alpha1 y
> paquete-0.3.7 allí falla.
> Lo que hice para resolver eso es previamente hacer una lista de los
> archivos a ordenar, en la lista reemplazar esas cosas por números,
> para que el ls los pueda ordenar, así:
>
> sed -r -e "s/(-[0-9.]+)_alpha/\1_000_/" \
> -e "s/(-[0-9.]+)_beta/\1_001_/" \
> -e "s/(-[0-9.]+)_pre/\1_002_/" \
> -e "s/(-[0-9.]+)_rc/\1_003_/" \
> -e "s/(-[0-9.]+)_r[0-9]/\1_004_/")
>
> --
> Pablo Manuel Rizzo
> -------------------------------
> http://pablorizzo.com
> -------------------------------
>
> ________________________________________________
>
>
> 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.
> 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.
>
> Solar-general en lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/solar-general
>
#!/bin/bash
version(){
cat <<EOF
upackname $PROG_VERSION
Copyright (C) 2010 Diego Saravia <dsa en unsa.edu.ar>
License: $PROG_LICENCE
<http://gnu.org/licenses/gpl.html>
EOF
}
help(){
cat <<EOF
upackname PACKAGE
Splits package string in name, version and extension
Prints
PACKSTRING: Complete file name
PACKDIR: Directories preceding file name
PACKTYPE: NOEXT|UNKNOWNPKGEXT|BINPKGEXT|LISTEXT|METAEXT
PACKEXT: Extension (rpm, deb, ebuild, tbz2, etc)
PACKSYSTEM: i686, x86_64, hurd-i386, etc
PACKNAME: Packname
PACKVERSION: Complete version
PACKSV: Source Version
PACKRV: Release Version
PACKRVORDER: Release Version in Gentoo transformed for comparisson.
PACKCOMPLETENAME: without extension
PACKCOMPLETENORMALIZEDNAME: without extension in a normalized fashion
EOF
}
usage(){
cat <<EOF
Usage:
upackname PACKAGE
EOF
}
extsep(){
for ext in $2 ; do
rext=`echo $ext | sed 's|\.|\\\.|' `
first=`echo $1 | sed "s/\.$rext\$//"`
if test "x$first" != "x$1"; then
PACKEXT=$ext
PACKTYPE=$3
PACKNOEXT=$first
break
fi
done
}
PROG_VERSION=0.1
PROG_LICENCE="AGPLv3+: GNU AGPL version 3 or later"
while test $# -gt 0 ; do
case "$1" in
-h|--help)
help
;;
-v|-V|--version)
version
;;
-u|--usage)
usage
;;
*)
FILES=$@
break
;;
esac
shift
done
if test x"$1" = x ; then
usage
exit
fi
PACK=$1
#PACKSTRING=`basename $PACK`
PACKSTRING=`echo $PACK | awk -F/ '{print $NF}'`
PACKDIRPRE=${PACK%${PACKSTRING}} # en dos pasos por si no tiene /
if test x"$PACKDIRPRE" = x/ ; then
PACKDIR=/
else
PACKDIR=${PACKDIRPRE%/}
fi
# 4 kind: file list (lf), metapacks (ebuild ubuild suma), binary
packs, source packs
METAEXT="ebuild ubuild summa"
LISTEXT="lf"
#KNOWN:
BINPKGEXT="tgz tbz2 deb rpm"
#SEE:
PKGEXT="tar.gz tgz tar.bz tar.bz2 tbz tbz2 ZIP sip jar gz Z z bz2 bz
7Z 7z RAR rar LHa LHA lha lzh a deb lzma xz rpm"
PACKTYPE=0 # EXIST EXTENSION
PACKEXT=""
# packtype
PACKNAMEVERS=$PACKSTRING
########################################3 test sobre archivos reales,
ver que pasa si no se quiere esto
# o sea proveer
# basename?
extsep $PACKSTRING "$BINPKGEXT" BINPKGEXT
if test x"$PACKEXT" = x ; then
extsep $PACKSTRING "$LISTEXT" LISTEXT
fi
if test x"$PACKEXT" = x ; then
extsep $PACKSTRING "$METAEXT" METAEXT
fi
if test x"$PACKEXT" = x ; then
PACKEXT=`echo $PACKSTRING | awk -F. '{print $NF}'`
PACKNOEXT=${PACKSTRING%.${PACKEXT}}
PACKTYPE=UNKNOWNPKGEXT
fi
if test x"$PACKEXT" = x ; then
PACKNOEXT=$PACKSTRING
PACKTYPE=NOEXT
fi
#echo mmmmmmmmmmmmmmm $PACKEXT
PACKERROR=''
case $PACKEXT in
ebuild|ubuild|tbz2)
# en build info o ebuild no parece haber info sobre nombre o version
#http://distfiles.gentoo.org/distfiles/pms-3.pdf
`echo $PACKNOEXT | sed -e
's/\(.*\)-\(\([[:digit:]]\+\(\.[[:digit:]]\+\)*\+[a-z]\?\)\(\(_\(alpha\|beta\|pre\|rc\|p\)[[:digit:]]*\)*\(-r\([[:digit:]]\+\)\)\?\)\)$/export
PACKNAME=\1 PACKVERSION=\2 PACKSV=\3 PACKRVPRE=\5 PACKGENTOOPRE=\6
PACKGENTOORE=\8 PACKGENTOORENUM=\9/'`
if test x"$PACKNAME" = x ; then
echo ERROR, NO ES UN ARCHIVO GENTOO
PACKERROR="No es Gentoo"
fi
if test x"$PACKGENTOOPRE" = x ; then
#PACKRV=${PACKRVPRE#-} # no porque a veces debbiera agregar _ y otras -
PACKSRORDER=5
else
#PACKRV=$PACKRVPRE
PACKSRORDERPRE=`echo $PACKGENTOOPRE| sed -r -e "s/_alpha/1./" \
-e "s/_beta/2./" \
-e "s/_pre/3./" \
-e "s/_rc/4./" \
-e "s/_p/6./" `
PACKSRORDER=`echo $PACKSRORDERPRE| sed -e 's/\.$//' `
fi
PACKRV=$PACKRVPRE
if test x"$PACKGENTOORE" = x ; then
PACKRVORDER=$PACKSRORDER.0
else
PACKRVORDER=$PACKSRORDER.$PACKGENTOORENUM
fi
#echo bbbbbbbbbbbbbbb $PACKGENTOOPRE $PACKGENTOORE - $PACKGENTOORENUM
- $PACKSRORDER - $PACKSRORDERPRE
#PACKNAME=sed -e
's/(.*\)\(-[[:digit:]]\+\(\.[[:digit:]]\+\)*\+[a-z]\?\(_\(alpha\|beta\|pre\|rc\|p\)[[:digit:]]*\)*\(-r[[:digit:]]\+\)\?\)$//'`
#PACKVERSION=`echo $PACK|cut -d- -f2-`
#if test x"$PACKVERSION" = x"$PACKNAME" ; then # esto es raro,
# PACKVERSION=''
# # que el cut ponga el primer campo si no hay segundo ver
# #PACKVERSION=0
# fi
#sed 's/-[0-9]\{1,\}.*$//'
;;
#Ebuild file names consist of four logical subsections:
#pkg-ver{_suf{#}}{-r#}.ebuild
#Note: The brackets ({}) delineate optional fields and do not appear
in the literal package name. # represents any non-zero positive
integer.
#The first subsection, pkg, is the package name, which should only
contain lowercase letters, the digits 0-9, and any number of single
hyphen (-), underscore (_) or plus (+) characters. Examples:
util-linux, sysklogd and gtk+. We have some packages in Portage that
don't follow these rules, but your packages should.
#The second subsection, ver, is the version of the package, which
should normally be same as the version on the main source tarball. The
version is normally made up of two or three (or more) numbers
separated by periods, such as 1.2 or 4.5.2, and may have a single
letter immediately following the last digit; e.g., 1.4b or 2.6h. The
package version is joined to the package name with a hyphen. For
example: foo-1.0, bar-2.4.6.
#Important: If you're thinking of using a trailing letter in your
version string, note that the trailing letter should not be used to
signify alpha or beta status for the package, since alphas and betas
are prereleases and letter revisions are newer versions. This is an
important distinction because Portage uses an ebuild's version number
to determine if it is newer or older than other packages with the same
category and name. It's very important that version numbers faithfully
represent the version of the package so that Portage properly performs
its dependency checking duties.
#The third subsection, {_suf{#}}, is optional and may contain one of
these predefined suffixes, listed in least-recent to most-recent
order:
#Suffix Meaning
#_alpha Alpha release
#_beta Beta release
#_pre Prerelease
#_rc Release candidate
#(none) Normal release
#_p Patch level (normally accompanied by trailing integer)
#Any of these suffixes may be immediately followed by a non-zero
positive integer, e.g., linux-2.4.0_pre10. Assuming identical version
parts, the suffixes are ordered as follows (lower means older): _alpha
< _beta < _pre < _rc < (no suffix) < _p.
#When comparing identical suffixes with trailing integers, the one
with the larger integer will be considered most recent. Example:
foo-1.0_alpha4 is more recent than foo-1.0_alpha3.
#The fourth subsection of the package name is the Gentoo
Linux-specific revision number ({-r#}). This subsection, like the
suffix, is also optional. # is a non-zero positive integer; e.g.,
package-4.5.3-r3.
#This revision number is independent of the version of the source
tarball and is used to inform people that a new and improved Gentoo
Linux revision of a particular package is available. Initial releases
of ebuilds must have no revision number; e.g., package-4.5.3 and are
considered by Portage to have a revision number of zero. This means
that counting goes as follows: 1.0 (initial version), 1.0-r1, 1.0-r2,
etc.
#If you make non-trivial improvements to an existing ebuild file, you
should copy the ebuild file to a new file with the revision number
incremented by 1. Remember to always make mentions of your changes in
the ChangeLog when you bump a revision and in your CVS commit message;
not doing so is against policy.
#... and I suppose that we actually have a fifth section of the ebuild
name as well -- the .ebuild extension itself.
rpm)
# spec si hay nombre, version y release, verificar que esto funcione
bien al abrir cada paquete
# PACKNAME=`echo $PACKNOEXT |sed 's/-[^-]*-[^-]*$//'`
PACKNAME=`echo $PACKNOEXT |sed 's/-[^-]*-.*$//'`
PACKVERSIONPRE=${PACKNOEXT#${PACKNAME}} # primero el nombre por si es todo
PACKVERSIONSYS=${PACKVERSIONPRE#-}
if test x"$PACKNAME" = x ; then
echo ERROR, NO ES UN ARCHIVO RPM
PACKERROR="No es RPM"
fi
PACKVERSION=`echo $PACKVERSIONSYS | sed
'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\)$//'`
PACKSYSTEMPRE=${PACKVERSIONSYS#${PACKVERSION}} # primero el nombre
por si es todo
PACKSYSTEM=${PACKSYSTEMPRE#.}
PACKNOSYSTEM=$PACKNAME-$PACKVERSION
`echo $PACKVERSION| sed 's/\([^-]*\)-\(.*\)$/export PACKSV\=\1 PACKRV\=\2/'`
# echo KKKK $PACKSV KKKKK $PACKSYSTEM KKKKKK $PACKRV
# `echo $PACKNOEXT | sed -e
's/\([a-zA-Z0-9_\-\+]*\)-\([a-zA-Z0-9_\.]*\)-\([a-zA-Z0-9_\.]*\)\.\(noarch\|src\|i386\|i686\|athlon\|ppc\|x86_64\)$/export
PACKNAME\="\1" PACKVERSION\="\2-\3.\4" PACKOV\="\2" PACKRV\="\3"
PACKARCH\="\4"/'`
#older systems do not have arch part, see
# my $name = $1;
# my $version = $2;
# my $release = $3;
# my $arch = $4;
#$ rpm -qp --qf '%{NAME}' some.rpm
#rpm -qa|sed 's/-[^-]*-[^-]*$//'
#RPM <name>-<version>-<release>.<architecture>.rpm
nano-0.98-2.i386.rpm libgnomeuimm-2.0-2.0.0-3.src.rpm
#A package label is contained within the file and does not necessarily
#need to match the name of the file.
#Additionally, libraries are distributed in two separate packages for
#each version. One contains the precompiled code, while the second one
#contains the development files such as headers, static library files,
#etc. for the library in question. Those packages have "-devel"
appended to their name field. Users need to carefully check so that
#the version of the development package matches that of the binary
#package, otherwise the library may not work very well.
;;
deb)
# en control parece haber info sobre el nombre, no sobre las
versiones, usar para verificar
#DEB <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
PACKNAME=`echo $PACKNOEXT | awk -F_ '{print $1}'`
PACKVERSIONSYSPRE=${PACKNOEXT#${PACKNAME}} # en dos pasos por si
el nombre debian esta mal y no usa _
PACKVERSIONSYS=${PACKVERSIONSYSPRE#_}
if test x"$PACKNAME" = x ; then
echo ERROR, NO ES UN ARCHIVO DEB
PACKERROR="No es deb"
fi
#echo MMMMM $PACKVERSION
#igual que el rpm con _ en vez de .
PACKVERSION=`echo $PACKVERSIONSYS | sed
'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\)$//'`
if test x"$PACKVERSION" = x ; then
echo ERROR, NO ES UN ARCHIVO DEB
PACKERROR="No es deb"
fi
PACKNOSYSTEM=$PACKNAME_$PACKVERSION
echo MMMMM $PACKVERSION - $PACKNOSYSTEM
PACKSYSTEMPRE=${PACKVERSIONSYS#${PACKVERSION}} # primero el nombre
por si es todo
PACKSYSTEM=${PACKSYSTEMPRE#_}
`echo $PACKVERSION| sed 's/\([^-]*\)-\(.*\)$/export PACKSV\=\1 PACKRV\=\2/'`
if test x"$PACKSV" = x ; then
echo ERROR, NO ES UN ARCHIVO DEB
PACKERROR="No es deb"
fi
# echo KKKK $PACKSV KKKKK $PACKSYSTEM KKKKKK $PACKRV KKKK $PACKNOSYSTEM
#\([a-z][a-z0-9\+\-\.]+\)_\([a-zA-Z0-9_\.]*\)-\([0-9a-zA-Z\+\.\~]+\)_\(noarch\|src\|noarch\|i386\|i686\|athlon\|ppc\|x86_64\)
#The name of the package itself (not the filename, just the name
of the package) can contain lowercase letters, numbers, and the "-"
and "+" characters.
#debian_revision
#This part of the version number specifies the version of the
Debian package based on the upstream version.
#It may contain only alphanumerics and the characters + . ~
(plus, full stop, tilde) and is compared in the same way as the
upstream_version is.
#It is optional; if it isn't present then the upstream_version
may not contain a hyphen.
#This format represents the case where a piece of software was
written specifically to be turned into a Debian package,
#and so there is only one "debianisation" of it and therefore no
revision indication is required.
#It is conventional to restart the debian_revision at 1 each time
the upstream_version is increased.
#The package management system will break the version number
apart at the last hyphen in the string
#(if there is one) to determine the upstream_version and
debian_revision. The absence of a debian_revision is equivalent to a
debian_revision of 0
#The VVV component is the version number specified by the upstream
#developer. There are no standards in place here, so the version number
#may have formats as different as "19990513" and "1.3.8pre1".
#The RRR component is the Debian revision number, and is specified by
#the Debian developer (or an individual user if he chooses to build the
#package himself). This number corresponds to the revision level of the
#Debian package, thus, a new revision level usually signifies changes
#in the Debian Makefile (debian/rules), the Debian control file
#(debian/control), the installation or removal scripts (debian/p*), or
#in the configuration files used with the package.
#The AAA component identifies the processor for which the package was
#built. This is commonly i386, which refers to chips compatible to
#Intel's 386 or later versions. For other possibilities review Debian's
#FTP directory structure at What are all those directories at the
#Debian FTP archives?, Section 6.7. For details, see the description of
#"Debian architecture" in the manual page dpkg-architecture(1).
#
#i386 ia64 alpha amd64 armeb arm hppa m32r m68k mips mipsel
powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc darwin-i386
darwin-ia64 darwin-alpha darwin-amd64 darwin-armeb darwin-arm
darwin-hppa darwin-m32r darwin-m68k darwin-mips darwin-mipsel
darwin-powerpc darwin-ppc64 darwin-s390 darwin-s390x darwin-sh3
darwin-sh3eb darwin-sh4 darwin-sh4eb darwin-sparc freebsd-i386
freebsd-ia64 freebsd-alpha freebsd-amd64 freebsd-armeb freebsd-arm
freebsd-hppa freebsd-m32r freebsd-m68k freebsd-mips freebsd-mipsel
freebsd-powerpc freebsd-ppc64 freebsd-s390 freebsd-s390x freebsd-sh3
freebsd-sh3eb freebsd-sh4 freebsd-sh4eb freebsd-sparc kfreebsd-i386
kfreebsd-ia64 kfreebsd-alpha kfreebsd-amd64 kfreebsd-armeb
kfreebsd-arm kfreebsd-hppa kfreebsd-m32r kfreebsd-m68k kfreebsd-mips
kfreebsd-mipsel kfreebsd-powerpc kfreebsd-ppc64 kfreebsd-s390
kfreebsd-s390x kfreebsd-sh3 kfreebsd-sh3eb kfreebsd-sh4 kfreebsd-sh4eb
kfreebsd-sparc knetbsd-i386 knetbsd-ia64 knetbsd-alpha knetbsd-amd64
knetbsd-armeb knetbsd-arm knetbsd-hppa knetbsd-m32r knetbsd-m68k
knetbsd-mips knetbsd-mipsel knetbsd-powerpc knetbsd-ppc64 knetbsd-s390
knetbsd-s390x knetbsd-sh3 knetbsd-sh3eb knetbsd-sh4 knetbsd-sh4eb
knetbsd-sparc netbsd-i386 netbsd-ia64 netbsd-alpha netbsd-amd64
netbsd-armeb netbsd-arm netbsd-hppa netbsd-m32r netbsd-m68k
netbsd-mips netbsd-mipsel netbsd-powerpc netbsd-ppc64 netbsd-s390
netbsd-s390x netbsd-sh3 netbsd-sh3eb netbsd-sh4 netbsd-sh4eb
netbsd-sparc openbsd-i386 openbsd-ia64 openbsd-alpha openbsd-amd64
openbsd-armeb openbsd-arm openbsd-hppa openbsd-m32r openbsd-m68k
openbsd-mips openbsd-mipsel openbsd-powerpc openbsd-ppc64 openbsd-s390
openbsd-s390x openbsd-sh3 openbsd-sh3eb openbsd-sh4 openbsd-sh4eb
openbsd-sparc hurd-i386 hurd-ia64 hurd-alpha hurd-amd64 hurd-armeb
hurd-arm hurd-hppa hurd-m32r hurd-m68k hurd-mips hurd-mipsel
hurd-powerpc hurd-ppc64 hurd-s390 hurd-s390x hurd-sh3 hurd-sh3eb
hurd-sh4 hurd-sh4eb hurd-sparc ;;
;;
esac
#\(\(darwin\|freebsd\|netbsd\|kfreebsd\|knetbsd\|openbsd\|hurd\|gnu\|linux\)-\)\?
### aqui seguro tenemos PACKNOEXT
## si no tenemos PACKNOSYSTEM lo buscamos
if test x"$PACKSYSTEM" = x ; then
PACKNOSYSTEM=`echo $PACKNOEXT | sed
'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\)$//'`
# if apears something identifing origin as ubuntu, ututo, pacman etc
must be extracted here
#echo MMMM $PACKNAME - $PACKNOSYSTEM -$PACKNOEXT
PACKSYSTEMPRE=${PACKNOEXT#${PACKNOSYSTEM}} # primero el nombre por
si es todo
PACKSYSTEMPRE3=${PACKSYSTEMPRE#-}
PACKSYSTEMPRE2=${PACKSYSTEMPRE3#_}
PACKSYSTEM=${PACKSYSTEMPRE2#.}
fi
if test x"$PACKNOSYSTEM" = x ; then
PACKNOSYSTEM=$PACKNOEXT
fi
# aqui seguro tenemos PACKNOSYSTEM
# si no tenemos PACKVERSION (PACKNONAME) lo buscamos
#echo MMMM $PACKNAME - $PACKNOSYSTEM -$PACKNOEXT
if test x"$PACKNAME" = x ; then
PACKVERSION=`echo $PACKNOSYSTEM | awk -F- '{print $NF}'`
if test x"$PACKVERSION" = x"$PACKNOSYSTEM" ; then
PACKVERSION=''
fi
PACKNAMEPRE=${PACKNOSYSTEM%${PACKVERSION}} # en dos pasos por si no tiene -
PACKNAME=${PACKNAMEPRE%-}
#echo MMMM $PACKNAME
fi
## si no conseguimos una PACKNAME diferente la buscamos de nuevo
if test x"$PACKNAME" = x"$PACKNOSYSTEM" ; then
PACKVERSION=`echo $PACKNOSYSTEM | awk -F- '{print $NF}'`
if test x"$PACKVERSION" = x"$PACKNOSYSTEM" ; then
PACKVERSION=''
fi
PACKNAMEPRE=${PACKNOSYSTEM%${PACKVERSION}} # en dos pasos por si no tiene -
PACKNAME=${PACKNAMEPRE%_}
fi
#echo MMM $PACKSV
if test x"$PACKSV" = x -a x"$PACKVERSION" != x ; then
PACKRV=''
PACKSV=`echo $PACKVERSION| sed 's/_\(.*\)$//'`
if test x"$PACKVERSION" = x"$PACKSV" ; then
### PACKSV='' # no better to have this as VERSION if not RV
:
else
PACKRVPRE=${PACKVERSION%$PACKSV}
PACKRV=${PACKRVPRE%$_}
fi
fi
if test x"$PACKRVORDER" = x ; then
PACKRVORDER=$PACKRV
fi
echo "PACKSTRING='$PACKSTRING'"
echo "PACKDIR='$PACKDIR'"
echo "PACKNAME='$PACKNAME'"
echo "PACKVERSION='$PACKVERSION'" #version and release
# no: si no hay version , version debe ser 0
echo "PACKEXT='$PACKEXT'"
echo "PACKTYPE='$PACKTYPE'"
echo "PACKCOMPLETENAME='$PACKNOSYSTEM'" # without extension
echo "PACKSYSTEM='$PACKSYSTEM'"
echo "PACKSV='$PACKSV'"
echo "PACKRV='$PACKRV'"
echo "PACKERROR='$PACKERROR'"
echo "PACKRVORDER='$PACKRVORDER'"
SLASH=-
if test x"$PACKSV" = x ; then
SLASH=''
fi
SSLASH=_
if test x"$PACKRV" = x ; then
SSLASH=''
fi
echo "PACKCOMPLETENORMALIZEDNAME='$PACKNAME$SLASH$PACKSV$SSLASH$PACKRV'"
# without extension
#No me fije en otros sistemas, pero los paquetes versionados al estilo
#gentoo tiene una dificultad cuando corresponden a releases,
#prereleases, betas, etc. Salvo por eso, se ordenarían fácilmente con
#ls -v , que compara versiones numéricas en los nombres de archivos.
#Pero cuando las versiones son cosas como paquete-0.3.7-alpha1 y
#paquete-0.3.7 allí falla.
#Lo que hice para resolver eso es previamente hacer una lista de los
#archivos a ordenar, en la lista reemplazar esas cosas por números,
#para que el ls los pueda ordenar, así:
#sed -r -e "s/(-[0-9.]+)_alpha/\1_000_/" \
# -e "s/(-[0-9.]+)_beta/\1_001_/" \
# -e "s/(-[0-9.]+)_pre/\1_002_/" \
# -e "s/(-[0-9.]+)_rc/\1_003_/" \
# -e "s/(-[0-9.]+)_p/\1_004_/")
#On Sunday 07 September 2008 08:28:11 Jim Meyering wrote:
#> IMHO, changing sort -V to produce more intuitively-correct results
#> is the way to go.
#>
#> With ls -v, I'm willing to make the change as well, *assuming*
#> no one produces a counterargument.
#>
#> The question is what ordering function to use.
#> The more generally-useful the better. i.e., I hope
#> it can be compatible with both the rpm and deb version sorters.
#I made an investigation of existing functions which sort version strings:
#strverscmp - from glibc (now with its equivalent in gnulib)
#rpmvercmp - from rpm
#ververcmp - from dpkg##
#The main problem of all these functions is dealing with suffixes. So I
#modified them to drop the suffixes. So it is 6 implementations together (3
#original + 3 modified).
#Then I ran a few series of tests with all implementations. I think the
#modified version of ververcmp (from dpkg) gives the best results - consider
#attached results of an example - results.tar.bz2#
#So I propose a new function filevercmp (attachment filevercmp.c) as the
#predicate function for new sort --version-sort.
#In the attachment is also the whole "testing framework" which I used to
#compare these functions - strverscmp.tar.bz2 - follow the steps in README
#inside archive. It is developed a bit quickly but I hope it could be
#useful :-)#
#Kamil
#http://www.opensubscriber.com/message/[email protected]/10201323.html
#http://old.nabble.com/Possible-bug-in-sort--V-td26804985.html
#> cat a | /build/toolchain/lin32/coreutils-8.2/bin/sort -V
#> kernel-2.6.18-164.2.1.el5.x86_64.rpm
#> kernel-2.6.18-164.6.1.el5.x86_64.rpm
#> kernel-2.6.18-164.el5.x86_64.rpm
#>
#> The result should be
#> kernel-2.6.18-164.el5.x86_64.rpm
#> kernel-2.6.18-164.2.1.el5.x86_64.rpm
#> kernel-2.6.18-164.6.1.el5.x86_64.rpm
#>
#> Is it a bug is sort -V?
#I agree the behavior is pretty awkward. Nevertheless the behavior
#is well documented:
#http://www.gnu.org/software/coreutils/manual/html_node/Details-about-version-sort.html
#The "bug" is triggered by the underscore in "x86_64". It's not treated as file
#suffix in that case. However it works fairly well when you replace "x86_64" by
#"i686".
#From 3069d50b766a2db8b86406904b7327e5de5e315f Mon Sep 17 00:00:00 2001
#From: =?utf-8?q?P=C3=A1draig=20Brady?= <P en ...>
#Date: Thu, 17 Dec 2009 10:48:54 +0000
#Subject: [PATCH] doc: enhance and reference info about version comparison
#* doc/coreutils.texi (sort invocation): Reference the additional
#info about filevercmp rather than the unused strverscmp.
#(Details about version sort): Add some examples that are not
#handled well by fileversmp.
#* src/ls.c: Change a comment referencing the now unused strverscmp.
#---
# doc/coreutils.texi | 33 ++++++++++++++++++++++++---------
# src/ls.c | 2 +-
# 2 files changed, 25 insertions(+), 10 deletions(-)
#-This functionality is implemented using gnulib's @code{filevercmp} function.
#-One result of that implementation decision is that @samp{ls -v}
#-and @samp{sort -V} do not use the locale category, @env{LC_COLLATE},
#-which means non-numeric prefixes are sorted as if @env{LC_COLLATE} were set
#-to @samp{C}.
#+This functionality is implemented using gnulib's @code{filevercmp} function,
#+which has some caveats worth noting.
#+
#+ en itemize @bullet
#+ en item @env{LC_COLLATE} is ignored, which means @samp{ls -v} and @samp{sort -V}
#+will sort non-numeric prefixes as if the @env{LC_COLLATE} locale category
#+was set to @samp{C}.
#+ en item Some suffixes will not be matched by the regular
#+expression mentioned above. Consequently these examples may
#+not sort as you expect:
#+
#+ en example
#+abc-1.2.3.4.7z
#+abc-1.2.3.7z
#+ en end example
#+
#+ en example
#+abc-1.2.3.4.x86_64.rpm
#+abc-1.2.3.x86_64.rpm
#+ en end example
#+ en end itemize
# @node General output formatting
# @subsection General output formatting
#diff --git a/src/ls.c b/src/ls.c
#index aeaa584..5c7f6aa 100644
#--- a/src/ls.c
#+++ b/src/ls.c
#@@ -3272,7 +3272,7 @@ DEFINE_SORT_FUNCTIONS (extension, cmp_extension)
# All the other sort options, in fact, need xstrcoll and strcmp variants,
# because they all use a string comparison (either as the primary
or secondary
# sort key), and xstrcoll has the ability to do a longjmp if
strcoll fails for
#- locale reasons. Last, strverscmp is ALWAYS available in coreutils,
#+ locale reasons. Last, filevercmp is ALWAYS available in coreutils,
# thanks to the gnulib library. */
# static inline int
# cmp_version (struct fileinfo const *a, struct fileinfo const *b)
#--
#1.6.2.5
#como compilar a partir de un ebuild, de un spec y de un control
#category no esta en ebuild, si en ubuild
--
Diego Saravia
Diego.Saravia en gmail.com
NO FUNCIONA->dsa en unsa.edu.ar
Más información sobre la lista de distribución Solar-general