[CentOS] rpm building and hyphens in Version tags
R P Herrold
herrold at centos.org
Tue Jun 8 00:23:20 UTC 2010
On Mon, 7 Jun 2010, Joseph L. Casale wrote:
> According to http://www.rpm.org/api/4.4.2.2/specfile.html a
> Version: tag can contain a hyphen, as the tarball for the source
> I am compiling is named 2.3-pre4 etc.
ehh?
Names must not include whitespace and may include a hyphen '-'
(unlike version and release tags).
That is, version and release are UNLIKE name. name MAY have a
hyphen. by inference (and as you have seen), version and
release may not.
The computational load from extracting this information from a
package with --querytags is VERY HIGH, compared to simple
textual processing
[herrold at new bin]$ time rpm -qp graphviz-2.8-1.sl.src.rpm --qf \
'%{name} \t %{version} \t %{release} \n' 2> /dev/null
graphviz 2.8 1.sl
real 0m0.030s
user 0m0.019s
sys 0m0.011s
[herrold at new bin]$ time ./split-rpm.sh graphviz-2.8-1.sl.src.rpm
Tgt.:
graphviz-2.8-1.sl.src.rpm
Name: graphviz
Ver.: 2.8
Rel.: 1.sl
real 0m0.017s
user 0m0.004s
sys 0m0.013s
[herrold at new bin]$
#!/bin/sh
#
# split-rpm.sh
# an RPH original released under GPLv3
# Copyright (c) 2010 R P Herrold, Columbus, OH
# info at owlriver.com
#
[ "x${1}" = "x" ] && {
echo "Usage: $0 (rpmpackage_name)" 1>&2
exit 1
}
REL=`echo "$1" | rev | cut -d- -f 1 | cut -d'.' -f 3- | rev `
VER=`echo "$1" | rev | cut -d- -f 2 | rev`
NAM=`echo "$1" | rev | cut -d- -f 3- | rev`
echo "Tgt.: ${1}"
echo "Name: ${NAM}"
echo "Ver.: ${VER}"
echo "Rel.: ${REL}"
#
-- Russ herrold
More information about the CentOS
mailing list