Commit a65443cc authored by Vitaly Lipatov's avatar Vitaly Lipatov

loginhsh: drop automode (-a)

myhsh: add -b for get binary packages, -r for remove packages rpmbsh: release -i (install in hasher) here
parent 9d2396c2
...@@ -46,13 +46,12 @@ phelp() ...@@ -46,13 +46,12 @@ phelp()
echog " -x allow run X program (obsoleted)" echog " -x allow run X program (obsoleted)"
} }
while getopts :chitoadvqr:b:p:xXY opt; do while getopts :chitodvqr:b:p:xXY opt; do
case $opt in case $opt in
h) phelp; exit 0;; h) phelp; exit 0;;
t) TESTMODE=1 ;; t) TESTMODE=1 ;;
i) INITIALIZE=1 ;; i) INITIALIZE=1 ;;
c) CLEANUP=1 ;; c) CLEANUP=1 ;;
a) AUTOMODE=1 ;;
d) PRINTHASHERDIR=1 ;; d) PRINTHASHERDIR=1 ;;
q) QUIETMODE=1 ;; q) QUIETMODE=1 ;;
b) BINARYREPONAME=$OPTARG ;; b) BINARYREPONAME=$OPTARG ;;
...@@ -93,7 +92,7 @@ HASHERARG="$HASHERARG --apt-config=$OURAPTCONF --target $BUILDARCH --with-stuff" ...@@ -93,7 +92,7 @@ HASHERARG="$HASHERARG --apt-config=$OURAPTCONF --target $BUILDARCH --with-stuff"
set_hasherdir set_hasherdir
if [ -n "$HASHERPOSTFIX" ] ; then if [ -n "$HASHERPOSTFIX" ] ; then
HASHERDIR=$HASHERDIR-$HASHERPOSTFIX HASHERDIR=$HASHERDIR-$HASHERPOSTFIX
elif [ -n "$TESTMODE" ] || [ -n "$AUTOMODE" ] ; then elif [ -n "$TESTMODE" ] ; then
HASHERDIR=$HASHERDIR-test HASHERDIR=$HASHERDIR-test
fi fi
...@@ -111,7 +110,7 @@ if [ "$CLEANUP" = "1" ] ; then ...@@ -111,7 +110,7 @@ if [ "$CLEANUP" = "1" ] ; then
exit exit
fi fi
if [ ! -d $HASHERDIR ] || [ "$INITIALIZE" = "1" ] || [ -n "$AUTOMODE" ]; then if [ ! -d $HASHERDIR ] || [ "$INITIALIZE" = "1" ] ; then
echog "Initialize $HASHERDIR ..." echog "Initialize $HASHERDIR ..."
mkdir -p $HASHERDIR || fatal "mkdir" mkdir -p $HASHERDIR || fatal "mkdir"
docmd $HSH $VERBOSE $HASHERARG --initroot-only $HASHERDIR || fatal "Cannot initialize hasher" docmd $HSH $VERBOSE $HASHERARG --initroot-only $HASHERDIR || fatal "Cannot initialize hasher"
...@@ -142,7 +141,7 @@ if epm requires $LISTNAMES 2>/dev/null | grep -q dbus ; then ...@@ -142,7 +141,7 @@ if epm requires $LISTNAMES 2>/dev/null | grep -q dbus ; then
UTILPKG="$UTILPKG dbus-tools-gui" UTILPKG="$UTILPKG dbus-tools-gui"
fi fi
if [ -n "$AUTOMODE" ] || [ -n "$ALLOWX" ] ; then if [ -n "$ALLOWX" ] ; then
UTILPKG="$UTILPKG xauth fonts-ttf-liberation" UTILPKG="$UTILPKG xauth fonts-ttf-liberation"
SHELLHASHERARG="$SHELLHASHERARG $ALLOWX" SHELLHASHERARG="$SHELLHASHERARG $ALLOWX"
else else
...@@ -158,13 +157,3 @@ fi ...@@ -158,13 +157,3 @@ fi
echog "You are in hasher shell" echog "You are in hasher shell"
docmd $HSH-shell $HASHERDIR $SHELLHASHERARG $ROOTER --wait-lock --shell docmd $HSH-shell $HASHERDIR $SHELLHASHERARG $ROOTER --wait-lock --shell
if [ -n "$AUTOMODE" ] ; then
# FIXME: do not remove on x86_64
echo "Removing package for test preun scripts..."
# use when eepm >= 1.3.0 will everywhere
#docmd $HSH-run --rooter $HASHERDIR -- epm remove $LISTNAMES
docmd $HSH-run --rooter $HASHERDIR -- rpm -e $(drop_pkg_extensions $LISTNAMES)
echo "Cleanup hasher in $HASHERDIR..."
docmd $HSH --cleanup-only $HASHERDIR
fi
#!/bin/bash #!/bin/bash
# 2003-2006, 2008-2010, 2013 (c) Etersoft www.etersoft.ru # 2003-2006, 2008-2010, 2013, 2016 (c) Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
# #
# Пересборка указанных SRPM-пакетов в hasher # Пересборка указанных SRPM-пакетов в hasher
# -i устанавливает в тестовый hasher после пересборки
# load common functions, compatible with local and installed script # load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common . `dirname $0`/../share/eterbuild/functions/common
load_mod hasher check load_mod hasher check
TESTINSTALL=
WITHSTUFF="--with-stuff" WITHSTUFF="--with-stuff"
############################# #############################
...@@ -18,7 +16,7 @@ Usage="Usage: $name [-i -c -l] src.rpm..." ...@@ -18,7 +16,7 @@ Usage="Usage: $name [-i -c -l] src.rpm..."
function mygetopts() function mygetopts()
{ {
name=${0##*/} name=${0##*/}
Descr="$name - build package via hasher" Descr="$name - internal helper for build package via hasher"
phelp() phelp()
{ {
...@@ -26,16 +24,18 @@ phelp() ...@@ -26,16 +24,18 @@ phelp()
echog "$Usage" echog "$Usage"
echo echo
echog "Options:" echog "Options:"
echog " -i install built packages in test hasher"
echog " -c build without stuff (without previous built packages)" echog " -c build without stuff (without previous built packages)"
echog " -r remove packages from test hasher"
echog " -b print binary packages by built list"
echog " -l lazy cleanup (before build, not after)" echog " -l lazy cleanup (before build, not after)"
} }
while getopts :hicl opt; do while getopts :hbclr opt; do
case $opt in case $opt in
h) phelp; exit 0;; h) phelp; exit 0;;
i) TESTINSTALL=1;; b) PRINTBINPKG=1;;
r) REMOVEPKG=1;;
l) HASHERARG="$HASHERARG --lazy-cleanup";; l) HASHERARG="$HASHERARG --lazy-cleanup";;
c) WITHSTUFF="--without-stuff";; c) WITHSTUFF="--without-stuff";;
+?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;; +?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;;
...@@ -62,6 +62,36 @@ RESULT=0 ...@@ -62,6 +62,36 @@ RESULT=0
HASHERARG="$HASHERARG $WITHSTUFF" HASHERARG="$HASHERARG $WITHSTUFF"
set_hasherdir set_hasherdir
if [ -n "$PRINTBINPKG" ] ; then
BINPACKAGES=
# allow absolute path and just src.rpm name
LISTNAMES="$LISTNAMES $LISTRPMARGS"
RPMHASHERDIR=$HASHERDIR/repo/$BUILDARCH/RPMS.hasher
for i in $LISTNAMES ; do
#echog "Find binary packages for '$(basename $i)' in $RPMHASHERDIR ..."
BINPACKAGES="$BINPACKAGES $(epm print binpkgfilelist $RPMHASHERDIR $i)"
done
test -n "$BINPACKAGES" || fatal "Can't find any binary packages for $LISTNAMES in $(ls -l $RPMHASHERDIR)"
echo "$BINPACKAGES"
exit
fi
if [ -n "$REMOVEPKG" ] ; then
check_locking
HASHERDIR=$HASHERDIR-test
# FIXME: do not remove on x86_64
echo "Removing package(s)..."
# use when eepm >= 1.3.0 will everywhere
#docmd $HSH-run --rooter $HASHERDIR -- epm remove $LISTNAMES
docmd $HSH-run --rooter $HASHERDIR -- rpm -e $(epm print pkgname from filename $LISTNAMES)
#echo "Cleanup hasher in $HASHERDIR ..."
#docmd $HSH --cleanup-only $HASHERDIR
exit
fi
mkdir -p $LOGDIR $HASHERDIR || fatal "cannot mkdir" mkdir -p $LOGDIR $HASHERDIR || fatal "cannot mkdir"
check_locking check_locking
...@@ -121,27 +151,15 @@ do ...@@ -121,27 +151,15 @@ do
done done
echo echo
if [ "$RESULT" = "1" ] ; then if [ "$RESULT" = "0" ] ; then
echog "Full list of the hashered packages:"
else
echo echo
echog "!!!!!!! Hasher: FAILED FAILED FAILED !!!!!!!!!" echog "!!!!!!! Hasher: FAILED FAILED FAILED !!!!!!!!!"
echog "Build failed with $i, built only" echog "Build failed with $i, built only"
else
echog "Full list of the hashered packages:"
fi fi
print_list $LISTBUILTSH
print_list $LISTBUILTSH
echo echo
if [ "$RESULT" = "0" ] && [ -n "$TESTINSTALL" ] ; then
# test install (only for last package in list)
# some key for build hasher from scratch
echog "Find binary packages for '$(basename $LASTPACKAGE)' in $HASHERDIR/repo/$BUILDARCH/RPMS.hasher..."
BINPACKAGES=`get_binpkg_list $HASHERDIR/repo/$BUILDARCH/RPMS.hasher $LASTPACKAGE | estrlist reg_exclude debuginfo -`
test -n "$BINPACKAGES" || fatal "Can't find binary packages for $LASTPACKAGE in `ls -l $HASHERDIR/repo/$BUILDARCH/RPMS.hasher`"
echo "List: $BINPACKAGES"
echo
showcmd $ETERBUILDBIN/loginhsh -a $MENVARG $BINPACKAGES
$ETERBUILDBIN/loginhsh -a $MENVARG $BINPACKAGES
exit
fi
exit $RESULT exit $RESULT
...@@ -40,10 +40,11 @@ phelp() ...@@ -40,10 +40,11 @@ phelp()
echog " -b REPONAME binary repository name (4.1, p5, t6 and so on)" echog " -b REPONAME binary repository name (4.1, p5, t6 and so on)"
} }
while getopts :htb: opt; do while getopts :ihtb: opt; do
case $opt in case $opt in
h) phelp; exit 0;; h) phelp; exit 0;;
t) COMMIT="--commit" ;; t) COMMIT="--commit" ;;
i) INSTALLPKG=1 ;;
b) BINARYREPONAME=$OPTARG ;; b) BINARYREPONAME=$OPTARG ;;
+?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;; +?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;;
# ?) echog "$name: $OPTARG: bad option. Use -h for help." 1>&2 ; exit 2;; # ?) echog "$name: $OPTARG: bad option. Use -h for help." 1>&2 ; exit 2;;
...@@ -78,7 +79,7 @@ fi ...@@ -78,7 +79,7 @@ fi
# We do not not pass args for myhsh here... # We do not not pass args for myhsh here...
# FIXME: не обрабатывает два пропускаемых вместе параметра # FIXME: не обрабатывает два пропускаемых вместе параметра
pack_src_rpm $COMMIT $(drop_args "$LISTRPMARGS" s u i c l f a A) pack_src_rpm $COMMIT $(drop_args "$LISTRPMARGS" s u c l f a A)
# TODO: use gear --hasher directly, drop myhsh # TODO: use gear --hasher directly, drop myhsh
...@@ -86,8 +87,27 @@ if rhas "$LISTNAMES" spec ; then ...@@ -86,8 +87,27 @@ if rhas "$LISTNAMES" spec ; then
set_specdir $LISTNAMES set_specdir $LISTNAMES
fi fi
# build in hasher
docmd time $ETERBUILDBIN/myhsh $MENVARG $(drop_args "$LISTRPMARGS" f u a A) $LISTBUILT docmd time $ETERBUILDBIN/myhsh $MENVARG $(drop_args "$LISTRPMARGS" f u a A) $LISTBUILT
RESULT=$? RESULT=$?
# if ok and requested test install, do it
if [ "$RESULT" = "0" ] && [ -n "$INSTALLPKG" ] ; then
BINPACKAGES=$($ETERBUILDBIN/myhsh -b $LISTBUILT) || fatal "Can't get binary packages for $LISTBUILT"
echo
echog "List of binary packages:"
print_list $BINPACKAGES
echo
# showcmd separately due console input
showcmd $ETERBUILDBIN/loginhsh -Y -t -i $MENVARG $BINPACKAGES
$ETERBUILDBIN/loginhsh -Y -t -i $MENVARG $BINPACKAGES
# test remove packages from test hasher dir
docmd $ETERBUILDBIN/myhsh -r $MENVARG $BINPACKAGES
fi
# remove generated src.rpm # remove generated src.rpm
for i in $LISTBUILT ; do for i in $LISTBUILT ; do
estrlist has $i $LISTNAMES || rm -f $i estrlist has $i $LISTNAMES || rm -f $i
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
# FIXME: use build directly in build scripts # FIXME: use build directly in build scripts
load_mod build load_mod build
# REMOVE: for compatibility
load_mod rpmpkg
# get correct BUILDROOT, run build_rpms_name before! # get correct BUILDROOT, run build_rpms_name before!
build_buildroot() build_buildroot()
{ {
......
#!/bin/bash
# 2008 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# build binary package list (1st - repo dir, 2st - pkgname)
# algorithm: list all files in PKGDIR, print packages with our source pkg name
get_binpkg_list()
{
local PKGDIR=$1
local PKGNAME=$(basename $2)
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
rpmquery -p --qf='%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n' "{}" \; \
| grep "^$PKGNAME[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo -n "$PKGDIR/{} "
}
drop_pkg_extensions()
{
for i in $@ ; do
echo -n "$(basename $i) " | sed -e "s|\.[a-z_0-9]*\.rpm||g"
done | filter_strip_spaces
}
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod rpm hasher
MENVARG=$1
test -n "$MENVARG" || MENVARG=-SS
set_hasherdir
for i in `ls -1 $HASHERDIR/repo/SRPMS.hasher` ; do
echo "get for $i:"
LISTNAMES=`get_binpkg_list $HASHERDIR/repo/$BUILDARCH/RPMS.hasher $(basename $i)`
echo $LISTNAMES
echo "without ext: $(drop_pkg_extensions $LISTNAMES)"
done
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