Commit f51b62c5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

wide use rhas instead echo | grep -q

parent fdb9aea2
......@@ -80,7 +80,7 @@ else
# see install in Korinf, need concatenate
BUILDREQ="$BUILDREQ make gcc\n$FIXPATCHFUZZ"
if [ "$BUILDARCH" = "x86_64" ] && echo $BUILDNAME | grep -q wine ; then
if [ "$BUILDARCH" = "x86_64" ] && rhas "$BUILDNAME" wine ; then
[ "$DISTRNAME" = "Debian" ] && BUILDREQ="$BUILDREQ ia32-libs" && ADDREQUIRES="$ADDREQUIRES ia32-libs"
[ "$DISTRNAME" = "Ubuntu" ] && ! version_more_version $DISTRVERSION 12.04 ] && BUILDREQ="$BUILDREQ ia32-libs" && ADDREQUIRES="$ADDREQUIRES ia32-libs"
[ "$DISTRNAME" = "CentOS" ] && version_more_version $DISTRVERSION 6 ] && BUILDREQ="$BUILDREQ glibc-devel.i686"
......@@ -129,7 +129,7 @@ if [ "$PKGVENDOR" = "freebsd" ] ; then
fi
# HACK need only for wine on x86_64
if [ "$BUILDARCH" = "x86_64" ] && echo $SPECNAME | grep -q wine ; then
if [ "$BUILDARCH" = "x86_64" ] && rhas "$SPECNAME" wine ; then
test -z "$VERBOSE" || echo "Add remove_optflags -m64"
ADDFIXCOMMAND="$ADDFIXCOMMAND
%remove_optflags -m64"
......@@ -482,7 +482,7 @@ export IGNOREGEAR=1
for i in $LISTBUILT ; do
uni_rpminstall $i
# remove primary src.rpm only if src.rpm was not primary
echo $LISTNAMES | grep -q $i || rm -f $i
rhas "$LISTNAMES" "$i" || rm -f $i
SPECNAME=$RPMTOPDIR/SPECS/$(spec_by_srpm $i)
test -f "$SPECNAME" || fatal "Spec $SPECNAME is not found"
......
......@@ -76,7 +76,7 @@ fi
# FIXME: не обрабатывает два пропускаемых вместе параметра
pack_src_rpm $COMMIT $(drop_args "$LISTRPMARGS" s u i c l f a A)
if echo "$LISTNAMES" | grep -q spec ; then
if rhas "$LISTNAMES" spec ; then
set_specdir $LISTNAMES
fi
......
......@@ -68,7 +68,7 @@ toalt_grprepl()
for i in $GRPREPLBASE/grprepl.fedora $GRPREPLBASE/grprepl.rpm $GRPREPLBASE/grprepl.* ; do
test -r "$i" || continue
# altbug #24724 (FIXME: check again for cyclic)
echo $i | grep -q "grprepl.alt" && continue
rhas "$i" "grprepl.alt" && continue
REPLRULE=`grep -v "^#" "$i" 2>/dev/null | grep -- "$1\$" | sed -e "$WARULES" | sed -e "s/^\(.*\)|\(.*\)\$/\2|\1/g" | head -n1`
# For broken rule
echo $REPLRULE | grep "^|" >/dev/null && REPLRULE=""
......
......@@ -19,7 +19,7 @@ load_systems_list()
local line
while read line ; do
# skip comments
echo $line | grep -q "^#" && continue
rhas "$line" "^#" && continue
SYSNAME[$IDX]=${line/ *.*/}
#FTP[$IDX]=${line/.* \+/}
SYSURL[$IDX]=$(echo $line | sed -e "s|.* \+||g")
......@@ -27,7 +27,7 @@ load_systems_list()
done < $ETERBUILDETC/repos/srpms
while read name url ; do
echo $name | grep -q "^#" && continue
rhas "$name" "^#" && continue
SYSNAME[$IDX]="git$name"
SYSURL[$IDX]=$url
IDX=$(($IDX+1))
......@@ -79,7 +79,7 @@ get_list()
mkdir -p $OURTMPDIR/etersoft-build-utils/
LIST=$OURTMPDIR/etersoft-build-utils/rpmgpall-$SYS
if [ ! -f "$LIST" ] || [ "$FORCE" = "force" ] ; then
if echo $SYS | grep -q ^git ; then
if rhas "$SYS" "^git" ; then
get_git_list $SYS $URL $LIST
return
fi
......@@ -89,7 +89,7 @@ get_list()
$CURL -l $URL/ | tee $LIST.tmp | html_filter >$LIST
# check if there is letter subdirs (Fedora)
for i in $(cat $LIST.tmp) ; do
echo $i | grep -q rpm && break
rhas "$i" rpm && break
[ -n "$(echo $i | cut -c2-)" ] && continue
echo "Try get $URL/$i"
$CURL -l $URL/$i/ | html_filter | sed -e "s|^|$i/|g" >>$LIST
......@@ -388,7 +388,7 @@ if [ -n "$CHECKONLINE" ] ; then
SRCRPM=$NAMESRPMIN
PKGNAME=$(get_pkgname_from_filename $SRCRPM)
else
if echo $PKGNAME | grep -q "\.rpm" ; then
if rhas "$PKGNAME" "\.rpm" ; then
# possible it is rpm package name
SRCRPM=$PKGNAME
PKGNAME=$(get_pkgname_from_filename $SRCRPM)
......
......@@ -381,7 +381,7 @@ parse_cmd_pre_spec()
[ "$1" = "--help" ] && mygetopts -h
# hack for check spec or src.rpm presence in command line: skip spec detecting
if echo $@ | grep -q \.spec || echo $@ | grep -q \.src.rpm ; then
if rhas "$@" "\.(spec|src.rpm)" ; then
parse_cmd_pre "$@"
else
local SPEC=$(get_gear_spec)
......@@ -423,7 +423,7 @@ cd_to_realcwd()
# check if path is server:/path
is_ssh_target()
{
echo "$1" | grep -q ":"
rhas "$1" ":"
}
enable_ccache()
......
......@@ -21,7 +21,7 @@ get_etersoft_srpm_path()
SOURCEFTP=$(dirname "$SOURCEFTP")
# FIXME: pass foreign path, needs to handle proto:// separately from ftp.eter:/path
if ! echo $SOURCEFTP | grep -q $COMPANYFTP && ! echo $SOURCEFTP | grep -q ":" && ! echo $SOURCEFTP | grep -q "^/"; then
if ! rhas "$SOURCEFTP" "$COMPANYFTP" && ! rhas "$SOURCEFTP" ":" && ! rhas "$SOURCEFTP" "^/"; then
# if source if not known target, or not ssh dest, or local local path,
# just return empty
# TODO: we can use table for URL translating
......@@ -29,7 +29,7 @@ get_etersoft_srpm_path()
fi
# remove tarball if exists at the end of line (our struct)
echo $SOURCEFTP | grep -q "tarball\$" && SOURCEFTP=$(dirname "$SOURCEFTP")
rhas $SOURCEFTP "tarball\$" && SOURCEFTP=$(dirname "$SOURCEFTP")
# translate ftp to local path
SOURCE=$(echo "$SOURCEFTP" | sed -e "s|.*://.*$COMPANYFTP|$TARGETFTPBASE|g")
......@@ -43,7 +43,7 @@ get_etersoft_srpm_path()
ALPHA=unstable
BSOURCE=$(dirname $SOURCE)
BNSOURCE=$(basename $BSOURCE)
if [ "$BNSOURCE" = "last" ] || echo "$BNSOURCE" | grep -q "^[0-9.]\+" ; then
if [ "$BNSOURCE" = "last" ] || rhas "$BNSOURCE" "^[0-9.]+" ; then
SOURCE=$(dirname $BSOURCE)/$ALPHA/sources
fi
fi
......@@ -55,9 +55,9 @@ set_last_link()
{
local LASTNAME="$1/../last"
# do not change last if testing publish
echo $1 | grep -q /testing/sources && return
rhas "$1" /testing/sources && return
# do not change last if unstable publish
echo $1 | grep -q /unstable/sources && return
rhas "$1" /unstable/sources && return
# do not create last link to last
[ "$2" = "last" ] && return
rm -f "$LASTNAME" && ln -s "$2" "$LASTNAME"
......
......@@ -55,7 +55,7 @@ get_remote_git_list()
# Check if $1 like git.alt or git.eter, git.something
is_girar_name()
{
echo "$1" | grep -q "^git\."
rhas "$1" "^git\."
}
is_one_girar_name()
......
......@@ -60,7 +60,7 @@ print_tmp_sourceslist()
local SLIST
test -r "$1" || fatal "$1 is missed"
# Note: /etc/apt and /etc/eterbuild/apt is supported
if echo $1 | grep -q "^/etc" ; then
if rhas "$1" "^/etc" ; then
SLIST=`cat "$1" | \
grep "/sources.list" | sed -e 's|.*"\(.*\)".*|\1|g'`
else
......
......@@ -18,31 +18,31 @@ add_32bit_requires()
[ -z "$1" ] && return
# Only for build wine on x86_64
if [ "$BUILDARCH" = "x86_64" ] && echo $BUILDNAME | grep -q wine ; then
if [ "$BUILDARCH" = "x86_64" ] && rhas "$BUILDNAME" wine ; then
if [ "$DISTRNAME" = "Fedora" ] || [ "$DISTRNAME" = "Scientific" ] || [ "$DISTRNAME" = "CentOS" -a "$DISTRVERSION" != 5 ]; then
# http://www.rpm.org/wiki/PackagerDocs/ArchDependencies
# add (x86-32) to all -devel packages
for i in $* ; do
echo $i | grep -q -- "-devel$" && echo "$i $i(x86-32)" && continue
rhas $i "-devel$" && echo "$i $i(x86-32)" && continue
echo "$i"
done | xargs -n 1000 echo
elif [ "$DISTRNAME" = "Ubuntu" ] && version_more_version $DISTRVERSION 12.04 || [ "$DISTRNAME" = "Debian" ] && version_more_version $DISTRVERSION 7.0 ; then
# i386 on Debian/Ubuntu: # add :i386 to all -dev packages
for i in $* ; do
echo $i | grep -q -- "-dev$" && echo "$i $i:i386" && continue
rhas $i "-dev$" && echo "$i $i:i386" && continue
echo "$i"
done | xargs -n 1000 echo
elif [ "$DISTRNAME" = "ArchLinux" ] ; then
# i386 on ArchLinux: add lib32- to all lib packages
for i in $* ; do
echo $i | grep -q -- "^lib" && echo "lib32-$i" && continue
rhas $i "^lib" && echo "lib32-$i" && continue
echo "$i"
done | xargs -n 1000 echo
elif [ "$DISTRNAME" = "SUSE" ] ; then
# i386 on SUSE: # add -32bit to all lib packages
for i in $* ; do
echo $i | grep -q -- "^liberation" && echo "$i" && continue
echo $i | grep -q -- "^lib" && echo "$i-32bit" && continue
rhas $i "^liberation" && echo "$i" && continue
rhas $i "^lib" && echo "$i-32bit" && continue
echo "$i"
done | xargs -n 1000 echo
else
......
......@@ -136,7 +136,7 @@ get_pkgname_from_filename()
#fi
# for DEB
if echo $FN | grep -q "deb$" ; then
if rhas "$FN" "deb$" ; then
echo ${FN/_[0-9]*/}
return
fi
......
......@@ -51,7 +51,7 @@ estrlist()
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
rhas()
{
echo "$1" | egrep -q "$2"
echo "$1" | egrep -q -- "$2"
}
......@@ -76,5 +76,5 @@ initial_letter()
is_dirpath()
{
[ "$1" = "." ] && return $?
echo "$1" | grep -q "/"
rhas "$1" "/"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment