Commit b66cf143 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update estrlist using

parent a172d9d2
......@@ -37,7 +37,7 @@ rpmreqs_to_apt()
{
local REQLIST="$@"
local PACKAGES=`$SUDO apt-get install --print-uris $REQLIST | grep "is already the newest version" | cut -f1 -d" " | sort -u`
do_exclude_list "$ALREADYHANDLEDAPT" "$PACKAGES"
estrlist exclude "$ALREADYHANDLEDAPT" "$PACKAGES"
}
install_by_requires()
......@@ -54,7 +54,7 @@ install_by_requires()
fi
echog "Autoskip $SKIPPACKAGES, try again..."
RLIST=$(do_exclude_list "$SKIPPACKAGES" "$RLIST")
RLIST=$(estrlist exclude "$SKIPPACKAGES" "$RLIST")
install_by_requires "$RLIST"
fi
}
......@@ -71,7 +71,7 @@ install_packages()
docmd $SUDO apt-get install $LIST
ALREADYHANDLEDAPT="$ALREADYHANDLEDAPT $LIST"
REQLIST="$($ETERBUILDBIN/rpmreqs $LIST)"
REQLIST=$(regexp_exclude_list "$ALREADYHANDLEDRPM" "$REQLIST")
REQLIST=$(estrlist regexp_exclude "$ALREADYHANDLEDRPM" "$REQLIST")
test -n "$REQLIST" || { echog "There is no more req packages to install" ; return ; }
install_by_requires $REQLIST
......
......@@ -102,7 +102,7 @@ fi
# if ok and test install is requested, do it
if [ "$RESULT" = "0" ] && [ -n "$INSTALLPKG" ] ; then
BINPACKAGES=$($ETERBUILDBIN/myhsh $MENVARG -b $LISTBUILT | estrlist reg_exclude debuginfo -) || fatal "Can't get binary packages for $LISTBUILT"
BINPACKAGES=$($ETERBUILDBIN/myhsh $MENVARG -b $LISTBUILT | estrlist reg_exclude ".*debuginfo.*" -) || fatal "Can't get binary packages for $LISTBUILT"
estrlist isempty "$BINPACKAGES" && fatal "There is no binary packages after build"
......
......@@ -263,7 +263,7 @@ if [ -n "$UPDATECACHE" ] ; then
exit 0
fi
PKGNAME=$(strip_spaces $LISTRPMARGS $LISTNAMES)
PKGNAME=$(estrlist strip_spaces $LISTRPMARGS $LISTNAMES)
if [ -z "$ALLSYSTEM$UPDATECACHE" ] ; then
test -z "$PKGNAME" && fatal "Please run with spec/package name"
......
......@@ -66,10 +66,10 @@ trans_rpmdeps_to_pkgname_ldv()
local ALREADYHANDLEDRPM="rpmlib.* rtld libgcc_s\..* libstdc\+\+.* libc\.so.* ld-linux\.so.* libpthread\.so.* librt\.so.*"
local REQLIST="$@"
REQLIST=$(regexp_exclude_list "$ALREADYHANDLEDRPM" "$REQLIST")
REQLIST=$(estrlist regexp_exclude "$ALREADYHANDLEDRPM" "$REQLIST")
REALPKGNAMELIST=$(regexp_exclude_list ". /*" "$REQLIST")
REQCONVLIST=$(do_exclude_list "$REALPKGNAMELIST" "$REQLIST")
REALPKGNAMELIST=$(estrlist regexp_exclude ". /*" "$REQLIST")
REQCONVLIST=$(estrlist exclude "$REALPKGNAMELIST" "$REQLIST")
set_hasherdir
HASHERDIR=$HASHERDIR-pkgreqs
......@@ -114,7 +114,7 @@ common-licenses
librpmbuild
passwdqc-control"
REQLIST=$(estrlist union $(convert_pkgfile_to_pkgname $PKGFILES) $REALPKGNAMELIST)
REQLIST=$(regexp_exclude_list "$ALREADYHANDLEDRPM" "$REQLIST" )
REQLIST=$(estrlist regexp_exclude "$ALREADYHANDLEDRPM" "$REQLIST" )
estrlist union $REQLIST
}
......@@ -129,17 +129,17 @@ trans_rpmdeps_to_pkgname_lav()
local ALREADYHANDLEDRPM="rpmlib.* rtld libgcc_s\..* libstdc\+\+.* libc\.so.* libm\.so.* ld-linux\.so.* ld-linux-x86-64\.so.* libpthread\.so.* librt\.so.* libdl\.so.*"
local REQLIST="$@"
REQLIST=$(estrlist reg_wordexclude "$ALREADYHANDLEDRPM" "$REQLIST")
REQLIST=$(estrlist reg_exclude "$ALREADYHANDLEDRPM" "$REQLIST")
# FIXME: strange regexp for drop libNAME.so.NUM and perl(Package) and /bin/sh
REALPKGNAMELIST=$(estrlist reg_exclude "\.so\. /.* (.*" "$REQLIST")
REALPKGNAMELIST=$(estrlist reg_exclude ".*\.so\..* .*/.* .*(.*" "$REQLIST")
# FIXME: external list? Set priorities/
REQCONVLIST=$(estrlist exclude "$REALPKGNAMELIST" "$REQLIST" | filter_multiple_provides | sed -e "s|(64bit)|.*(64bit)|g")
# partially copied from aptU
#VIRTREQ=$(LANG=C apt-get install --print-uris $REQLIST 2>&1 | grep "is a virtual package provided by" | cut -f2 -d" " | sort -u)
#FIXME: f.i., we got /usr/bin/lpstat in VIRTREQ (select cups or lprng package?). Skip now
#REQLIST=$(regexp_exclude_list "VIRTREQ" "$REQLIST")
#REQLIST=$(estrlist regexp_exclude "VIRTREQ" "$REQLIST")
# TODO: we have store_output function
TFILE=$(make_temp_file)
PKGFILES=
......@@ -199,7 +199,7 @@ common-licenses
librpmbuild
passwdqc-control"
REQLIST=$(estrlist union $PKGFILES $REALPKGNAMELIST)
REQLIST=$(estrlist reg_wordexclude "$ALREADYHANDLEDRPM" "$REQLIST" )
REQLIST=$(estrlist reg_exclude "$ALREADYHANDLEDRPM" "$REQLIST" )
estrlist union $REQLIST | estrlist list -
}
......
......@@ -125,7 +125,7 @@ do
done
LISTBUILT=$(strip_spaces "$LISTBUILT")
LISTBUILT=$(estrlist strip_spaces "$LISTBUILT")
test -z "$LISTBUILT" && fatal "Error: List for build is empty. Check if the file is exists."
}
......@@ -414,8 +414,8 @@ do
set_target_type ${i/-/} || LISTARGS="$LISTARGS $i"
fi
done
LISTNAMES=$(strip_spaces "$LISTNAMES")
LISTARGS=$(strip_spaces "$LISTARGS")
LISTNAMES=$(estrlist strip_spaces "$LISTNAMES")
LISTARGS=$(estrlist strip_spaces "$LISTARGS")
[ -n "$VERBOSE" ] && echo "LISTNAMES=$LISTNAMES LISTARGS=$LISTARGS" || :
}
......
......@@ -160,7 +160,7 @@ clean_pkgreq()
echo "$i" | grep "[()<=>]" >/dev/null && continue
echo "$i" | grep "^ *[0-9]\.[0-9]" >/dev/null && continue
echo -n "$i " | sed -e "s|[,}]||g"
done | filter_strip_spaces
done | estrlist filter_strip_spaces
}
# Print list of all build requires in ALT notation
......@@ -178,7 +178,7 @@ print_pkgreq()
# Print list of all groups
print_grpreq()
{
eval_spec ${1} | grep "^Group" | sed -e "s|^.*:||g" | sort -u | filter_strip_spaces
eval_spec ${1} | grep "^Group" | sed -e "s|^.*:||g" | sort -u | estrlist filter_strip_spaces
}
# FIXME: need improvement
......
......@@ -4,58 +4,13 @@
# Public domain
filter_strip_spaces()
{
# possible use just
#xargs echo
sed -e "s| \+| |g" | \
sed -e "s|^ ||" | sed -e "s| \$||"
}
# TODO: see etersoft-build-utils/tests/test_isnumber.sh
isnumber()
{
echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
}
strip_spaces()
{
echo "$*" | filter_strip_spaces
}
# remove_from_list "1." "11 12 21 22" -> "21 22"
remove_from_list()
{
local i
local RES=
for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i"
done
strip_spaces "$RES"
}
# Args: LIST1 LIST2
# do_exclude_list print LIST2 exclude fields contains also in LIST1
# Example: do_exclude_list "1 3" "1 2 3 4" -> "2 4"
do_exclude_list()
{
estrlist exclude "$@"
}
# regexp_exclude_list "22 1." "11 12 21 22" -> "21"
regexp_exclude_list()
{
estrlist reg_wordexclude "$@"
}
estrlist()
{
# can't use fatal here due $(estrlist) using
[ -x "$ETERBUILDBIN/estrlist" ] || return
$ETERBUILDBIN/estrlist "$@"
echo "$*" | estrlist filter_strip_spaces | grep -q "^[0-9]\+$"
}
# CHECKME: the same like estrlist has ?
# the same like estrlist match (reg_has)
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
rhas()
{
......@@ -71,7 +26,7 @@ drop_args()
local ARGS="$1"
shift
local LISTIGNORE="$@"
echo "$ARGS" | sed -e "s|-[${LISTIGNORE/ /}]||g" | filter_strip_spaces
echo "$ARGS" | sed -e "s|-[${LISTIGNORE/ /}]||g" | estrlist filter_strip_spaces
#echo "$ARGS" | \
# ( for i in $LISTIGNORE ; do sed -e "s|-$i||g" ; done ) #| sed -e "s| +| |g"
}
......
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