Commit a7414eab authored by Vitaly Lipatov's avatar Vitaly Lipatov

move share to share/eterbuild for compat with installed hierarhy

add support for run from the source tree move helper files to eterbuild/functions break functions/common in small thematic files
parent ede16960
......@@ -17,6 +17,6 @@ install:
install -m 644 etc/config $(sysconfdir)/eterbuild/
install -m 644 etc/repos $(sysconfdir)/eterbuild/
#install -m 644 apt/apt.conf.* apt/sources.list.* %buildroot/%_sysconfdir/apt/
install -m 644 share/pkgrepl/pkgrepl.* $(datadir)/eterbuild/pkgrepl/
install -m 644 share/grprepl/grprepl.* $(datadir)/eterbuild/grprepl/
install -m 644 share/* $(datadir)/eterbuild/ || :
install -m 644 share/eterbuild/pkgrepl/pkgrepl.* $(datadir)/eterbuild/pkgrepl/
install -m 644 share/eterbuild/grprepl/grprepl.* $(datadir)/eterbuild/grprepl/
install -m 644 share/eterbuild/* $(datadir)/eterbuild/ || :
......@@ -10,7 +10,9 @@
# Public domain
# TODO: -r
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/hasher
SAVEOPT=$@
......
......@@ -5,8 +5,8 @@
# Make patch for file in $1 against CVS/SVN repository or .orig file
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
if [ -f Makefile.in ] ; then
DD1=`grep ^TOPOBJDIR Makefile.in | sed -e "s| ||g"`
......
......@@ -6,8 +6,9 @@
# SRPM- hasher
# -i hasher
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/hasher
#############################
Usage="Usage: $name [-m -s -u -i -c] spec..."
......
......@@ -3,7 +3,8 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
if [ "$1" = "-h" ]; then
echo "rpmU - the same as [sudo] rpm -Uvh - update package"
......
......@@ -11,7 +11,9 @@
# TODO -M?
# TODO: -c
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm
# Start as helper
if [ "$1" = "--helper" ]; then
......@@ -20,6 +22,21 @@ if [ "$1" = "--helper" ]; then
exit $?
fi
# get correct BUILDROOT, run build_rpms_name before!
build_buildroot()
{
test -z "$BASENAME" && fatal "Use build_buildroot with BASENAME defined"
# ALT Only?
BUILDROOT=`rpm --eval %buildroot | subst_namever`
test -z "$BUILDROOT" && fatal "Fix rpm's buildroot"
if [ "$BUILDROOT" = "%buildroot" ] ; then
BUILDROOT="$HOME/tmp/$BASENAME-buildroot"
warning "Can't get buildroot from RPM, set to $BUILDROOT"
return 1
fi
return 0
}
#############################
Usage="Usage: $name [-c -p -i -r] spec..."
......@@ -117,31 +134,3 @@ do
done
echog "Built is done correctly"
date
exit 0
######################################################
# rpmbbr =========
RESULT=0
check_key
echog "Packing without check of build dependencies for packages"
NODEPS="--nodeps"
LISTBUILT=""
pack_src_rpm $LISTRPMARGS
echog "==== Copying to build server ====="
echog "It is recommended to rename old version at server for save traffic during rsync"
rsync -vay --partial --progress --stats --checksum \
-e ssh $LISTBUILT $BUILDSERVER:/$RPMDIR/SRPMS/
echo
echog "############ Build at build server ############"
echo
ssh $BUILDSERVER rpm -ivh $LISTBUILT
ssh -t $BUILDSERVER rpmbb --helper "$@"
echo "-------------------------------"
echog "Remote build is done"
date
......@@ -10,7 +10,9 @@
# alt0.M24.4
# TODO: use RPMBUILDARG
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/repl
#VENDORVERSION=`distr_vendor -e`
DISTRVERSION=`distr_vendor -v`
......
......@@ -16,7 +16,9 @@
# -n,
# TODO: -r
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm
SIGN=
UPLOADNOW=
......@@ -209,7 +211,6 @@ if [ -n "$SIGN" ]; then
# Hack about paths
test -f "$i" && NAME=$i || NAME=$CURDIR/$i
build_rpms_name $NAME
#build_buildroot
echo -n " $BUILDROOT "
if [ -d "$BUILDROOT" ] ; then
rm -rf "$BUILDROOT" && echog "DONE" || echog "failed"
......
......@@ -11,7 +11,9 @@
# TODO:
# TODO: ??
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm
RESULT=0
REMCOM=
......
......@@ -9,7 +9,8 @@
# TODO: ( ?)
# TODO:
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
[ -n "$BROWSER" ] || BROWSER=url_handler.sh
......
......@@ -7,7 +7,8 @@
# :
# - -
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
dummy_spec()
{
......
......@@ -9,7 +9,9 @@
# -c - checkonline
# -n - do not install
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm
# path to ALT Linux's repositories
REPOSITORY="files/SRPMS obsolete orphaned"
......
......@@ -12,7 +12,8 @@
# -a - get all source
# check for the same file with other compression
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
WEXT=""
GETSOURCE=""
......
......@@ -8,8 +8,6 @@
# -
# TODO not -i only, we need any key
#. /etc/rpm/etersoft-build-functions
if [ "$1" = "-h" ]; then
echo "rpmqf - the same as rpm -qf"
exit 0
......
......@@ -8,6 +8,9 @@
# rpmrb []
# 2.6.1 (), 2.6 (major) .1 (minor)
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
REMOTE=
if [ "$1" = "-r" ] ; then
REMOTE=$1
......@@ -23,8 +26,6 @@ if [ "$1" = "-h" ]; then
exit 0
fi
. /usr/share/eterbuild/common
test -e "$SPEC" || fatal "use with spec"
if [ -n "$VER" ] ; then
......
......@@ -8,7 +8,8 @@
#
# Tests unmets in built int hasher packages
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
make_ordinalbox()
{
......
......@@ -8,7 +8,8 @@
# - -
#
. /usr/share/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
[ -n "$BROWSER" ] || BROWSER=url_handler.sh
# (command from perl-libwww)
......
......@@ -5,13 +5,16 @@ MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter
SCRIPTLIST = ../share/eterbuild/functions/common \
../share/eterbuild/functions/rpm ../share/eterbuild/functions/hasher ../share/eterbuild/functions/spec
all: etersoft-build-utils.mo
etersoft-build-utils.mo: etersoft-build-utils.po
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
etersoft-build-utils.pot: ../share/common ../tools/upload-to-alt Makefile
etersoft-build-utils.pot: $(SCRIPTLIST) ../tools/upload-to-alt Makefile
ls -1 -d ../bin/* | xargs xgettext -a -o $@ -L Shell --from-code=koi8-r $^ || :
etersoft-build-utils.po: etersoft-build-utils.pot
......@@ -21,4 +24,4 @@ install: etersoft-build-utils.mo
install -D $< $(DESTDIR)$(datadir)/locale/ru/LC_MESSAGES/$<
clean:
rm -f etersoft-build-utils.mo
\ No newline at end of file
rm -f etersoft-build-utils.mo
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
#!/bin/bash
# 2003-2008 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
ETERBUILDETC=/etc/eterbuild
ETERBUILDDIR=/usr/share/eterbuild
# if run from local installation
if ! dirname $0 | grep /usr/share >/dev/null ; then
ETERBUILDDIR=$(realpath `dirname $0`/../share/eterbuild)
ETERBUILDETC=$(realpath `dirname $0`/../etc)
echo "Note: run from source tree, datadir=$ETERBUILDDIR, sysconfdir=$ETERBUILDETC"
fi
#
fatal()
{
echog "Error: $@"
exit 1
}
#
warning()
{
echog "Warning: $@"
}
print_list()
{
local i
for i in $@ ; do
echo " $i"
done
}
is_alt()
{
test -f /etc/altlinux-release
return $?
}
if [ "$UID" = "0" ] ; then
fatal "It is strict recommended do not use these scripts as root"
fi
. $ETERBUILDDIR/functions/config
. $ETERBUILDDIR/functions/gettext
. $ETERBUILDDIR/functions/spec
# Internal
set_target_type()
{
if echo $1 | grep "^M[0-9][0-9]$" >/dev/null ; then
MENV=$1
return 0
fi
case "$1" in
("DD" | "SS" | "EE")
MENV="$1"
return 0;
;;
esac
return 1;
}
# Internal
# , : -M23 -M24 ,
detect_target_env()
{
local DISTRNAME=`distr_vendor -e`
MENVARG=""
TARGET=`distr_vendor -p`
VENDOR=`distr_vendor -s`
if [ "$VENDOR" = "alt" ] && [ -n "$MENV" ] ; then
APTCONF=$APTCONF.$MENV
echog "Target ALT Linux system: \$MENV, use \$APTCONF"
MENVARG="-$MENV"
else
echog "Distribution: \$DISTRNAME (\$VENDOR) (target package: \$TARGET)"
fi
}
# LISTNAMES
# MENV
# LISTARGS
# :
# - (MENV)
# -
# -
parse_cmd_pre()
{
local i
if [ $# -lt 1 ]; then
[ -n "$Usage" ] && echog "$Usage"
fatal "Use -h for help."
fi
# Sisyphus by default
MENV=SS
set_target_type $(basename `pwd`)
LISTNAMES=""
LISTARGS=""
OPTINDEX=1
for i in "$@"
do
# , , .
if [ -f "$i" ]; then
LISTNAMES="$LISTNAMES $i"
else
set_target_type ${i/-/} || LISTARGS="$LISTARGS $i"
fi
done
# parse MENV
detect_target_env
[ -n "$VERBOSE" ] && echo "LISTNAMES=$LISTNAMES LISTARGS=$LISTARGS" || :
}
check_key()
{
echog "Check access to SSH private key..."
ssh-add -l || ssh-add $SSH_KEYFILE || return 1
return 0
}
get_distr_version()
{
echo $1 | sed -e "s|M\([0-9]\)\([0-9]\)|\1\.\2|g" | sed -e "s|SS|Sisyphus|g" | sed -e "s|DD|Daedalus|g"
}
set_incoming()
{
INCOMING="Sisyphus"
test -z "$1" && return
case "$1" in
("DD")
INCOMING="Daedalus"
;;
("SS")
INCOMING="Sisyphus"
;;
*)
if [ -n "$UPDATES" ] ; then
INCOMING="updates/`get_distr_version $1`"
else
INCOMING="backports/`get_distr_version $1`"
fi
;;
esac
}
add_changelog_helper()
{
# don't work sometime?
if ! tty -s && [ -z "$@" ] ; then
echo "skip changelog fixing without tty"
return 1
fi
add_changelog -e "$@"
R=$?
[ -z "$EDITOR" ] && { echo "skip changelog editing without EDITOR var"; return 1 ; }
# If changelog sucessfully added
if [ "$R" = "0" ]; then
shift
for SPEC in "$@" ; do
N=`grep -n '^%changelog' $SPEC | head -n 1 | sed s!:.*!!g`
# +1 -- comment with date and packager name
# +2 -- place for edit comments
# +N works for mcedit and vi
${EDITOR} +$(($N + 2)) $SPEC
done
fi
return $R
}
......@@ -4,9 +4,6 @@
# Author: Denis Smirnov <mithraen@altlinux.ru>
# Public domain
# 20.07.08
get_branch_list()
{
git branch | grep '^ ' | sed 's/^..\(.*\)/\1/'
......
#!/bin/bash
# 2008 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
. $ETERBUILDDIR/functions/rpm
check_locking()
{
if [ -f $HASHERDIR/lockdir/lockfile ]
then
echo
echog "Hasher $HASHERDIR in use at `date`"
echo -n "Wait for unlocking"
while test -f $HASHERDIR/lockdir/lockfile
do
echo -n "."
sleep $(($RANDOM%5+3))
done
echo
fi
}
......@@ -114,3 +114,14 @@ publish_tarball()
ssh $PUBLICSERVER ln -sf $TARNAME $PUBLICPATH/$BASENAME-current.tar.bz2
fi
}
# Publish srpm (need ETERDESTSRPM)
publish_srpm()
{
echo "Copying $NAMESRPMIN to $ETERDESTSRPM"
export ETERDESTSRPM
rpmbs -s $* $SPECNAME || fatal "Can't build SRPMS"
}
......@@ -3,8 +3,6 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# 20.07.08
# Get replacement rule for ALT package to local in $1 (scan for files in $@)
# set ALTPKGNAME, TARGETPKGNAME variable
tolocal_anyrepl()
......
#!/bin/bash
# 2008 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# Universal rpmbuild function
# 1st: rpmbuild, hsh, buildreq
# 2nd: spec name(s) (only one if git, we will skip it)
# other parameters
uni_rpmbuild()
{
local COMMAND=$1
# just for fill by something
local ONEPARAM="-v"
shift
local SPECNAME=$1
local SPECDIR=`dirname $SPECNAME`
if [ -n "$USE_LEGACY_COMPRESSION" ] ; then
# FIXME: do not override -v
ONEPARAM="--define=_source_payload w9.gzdio"
fi
if is_git $SPECDIR ; then
[ -f "$SPECNAME" ] || fatal "run uni_rpmbuild with spec as 2nd parameter"
shift # skip spec name
[ -n "$SPECDIR" ] && [ "$SPECDIR" != "." ] && warning "Spec is not in git dir"
$NICE gear --commit --rpmbuild -- $COMMAND "$ONEPARAM" $@
else
$COMMAND "$ONEPARAM" $@
fi
[ -n "$VERBOSE" ] && echo "Run $COMMAND $ONEPARAM $@" || :
}
# .
# !
# Name:
# TODO: NAMESPEC, SPECNAME
build_rpms_name()
{
local tmprpm CATSPEC NAMESPEC
#TODO change : to = and execute?
NAMESPEC=$1
shift
test -f "$NAMESPEC" || fatal "Spec $NAMESPEC does not exist"
# Check for broken mktemp
if mktemp -V &>/dev/null ; then
tmprpm=`mktemp || exit 1`
else
tmprpm=`mktemp /tmp/$NAME.XXXXXX || exit 1`
fi
eval_spec $NAMESPEC $@ | grep ":" >$tmprpm
CATSPEC="cat $tmprpm"
BASENAME=$($CATSPEC | get_var "Name")
RELEASE=$($CATSPEC | get_var "Release")
VERSION=$($CATSPEC | get_var "Version")
TARBALLNAME=$($CATSPEC | get_var "Source.*")
[ -n "$TARBALLNAME" ] && TARBALLNAME=$(basename $TARBALLNAME)
rm -f $tmprpm
NAMERPMIN=$BASENAME-$VERSION-$RELEASE.$DEFAULTARCH.rpm
NAMESRPMIN=$BASENAME-$VERSION-$RELEASE.src.rpm
#RPMSOURCEDIR=$RPMDIR/SOURCES
RPMSOURCEDIR=`rpm --eval %_sourcedir | subst_namever`
local BNS NSS
BNS="$BASENAME".spec
NSS=`basename $NAMESPEC`
test "$NSS" != "$BNS" && warning "BASENAME is not the same as NAMESPEC: $BNS against $SS"
build_buildroot
}
# LISTNAMES, options in arg
pack_src_rpm()
{
local i
ARGS=$@
# NOTE: always nodeps
# enable --nodeps for other ENV
#test -n "$MENV" &&
[ -n "$VERBOSE" ] && echo "LISTNAMES=$LISTNAMES ARGS=$ARGS" || :
ARGS="$ARGS --nodeps"
for i in $LISTNAMES
do
if [ -z ${i/*rpm/} ] ; then
# if rpm not spec, guess it is src.rpm
NAMESRPMIN=$i
else
#
# BASENAME, RELEASE, VERSION, NAMESRPMIN, NAMERPMIN
build_rpms_name "$i" $ARGS
if [ -n "${SIGN}" ]; then
echog "Try to packing \$NAMESRPMIN package for sign"
add_changelog $i
if [ $? = "0" ]; then
echog "Spec file \$i had not ChangeLog entry. It have added now, check it and enter your command again."
echog "Wait for ten seconds."
sleep 10
exit 1
fi
uni_rpmbuild $RPMBUILD $i -bs $ARGS $NODEPS --target $DEFAULTARCH
else
echog "Just packing \$NAMESRPMIN"
uni_rpmbuild $RPMBUILD $i -bs $ARGS $NODEPS --target $DEFAULTARCH || fatal "Error with rpmbuild"
fi
fi
if [ -f $RPMDIR/SRPMS/$NAMESRPMIN ] ; then
LISTBUILT="$LISTBUILT$NAMESRPMIN "
else
fatal "Can't find '$NAMESRPMIN' in '$RPMDIR/SRPMS'"
fi
done
test -z "$LISTBUILT" && fatal "Error: List for build is empty. Check if file is exist."
#LISTRPMARGS=`echo ${LISTRPMARGS} | sed -e "s/--nodeps//g"`
}
# build binary package list (1st - repo dir, 2st - pkgname
function get_binpkg_list()
{
local PKGDIR=$1
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
rpmquery -p --qf='%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n' "{}" \; \
| grep "^$2[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo "$PKGDIR/{} "
}
check_log()
{
local LOGFILE i RES
echo
echo "-------------------------------------------------------"
echog "Check log for..."
LOGFILE=$1
grep 'ld: warning: libstdc++\.so\.5, needed by [^ ]\+, may conflict with libstdc++\.so\.6' $LOGFILE
RES=$?
if [ $RES = 0 ] ; then
echog "Error: libstdc++.so.5/6 conflicts"
return 1
fi
grep 'python-strict' $LOGFILE && warning "python-strict used!!!"
NC1="command not found"
NC2="-march=athlon -mtune=athlon-xp"
#for i in ${NC1} ; do
grep -- '$NC1' $LOGFILE && warning "'$NC1' in build output (some errors in a scripts)"
grep -- '$NC2' $LOGFILE && warning "'$NC2' in build output (forbidden) "
#done
return 0
}
......@@ -3,8 +3,6 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# 20.07.08
get_var()
{
grep -i "^$1:" | head -n 1 | sed -e "s/^[^:]*[ \t]*:[ \t]*//"
......
#!/bin/sh
# copy specs to separate tree, make rpmcs and printout diff
. /etc/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
cd $RPMDIR
......
......@@ -2,7 +2,8 @@
# Lists incoming dir
# Use -M23 and so on
. /etc/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
parse_cmd_pre -- "$@"
......
......@@ -5,7 +5,8 @@
# 25.01.2005 upload.old.xxx
# 04.11.2005 use arg for set destination (-M23 and so on)
. /etc/eterbuild/common
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
build_list_and_args -- "$@"
......
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