Commit 8302b969 authored by Vitaly Lipatov's avatar Vitaly Lipatov

Merge branch 'master' of git.alt:packages/etersoft-build-utils

parents d0959bd7 8e4e0e6d
rpmbph: --define _specdir --define _sourcedir
rpmgp -r git -
%name -
, gear-update
......
......@@ -8,9 +8,14 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
if [ -f Makefile.in ] ; then
if [ -f Makefile ] ; then
DD1=`grep ^TOPOBJDIR Makefile | sed -e "s| ||g"`
DD2=`grep ^top_builddir Makefile | sed -e "s| ||g"`
DD3=`grep ^top_srcdir Makefile | sed -e "s| ||g"`
elif [ -f Makefile.in ] ; then
DD1=`grep ^TOPOBJDIR Makefile.in | sed -e "s| ||g"`
DD2=`grep ^top_builddir Makefile.in | sed -e "s| ||g"`
DD3=`grep ^top_srcdir Makefile.in | sed -e "s| ||g"`
else
warning "Can't get topdir from Makefile.in"
fi
......@@ -25,6 +30,11 @@ if [ -n "$DD2" ] ; then
TOPDIR=$top_builddir
fi
if [ -n "$DD3" ] ; then
export $DD3
TOPDIR=$top_srcdir
fi
#test -z "$TOPDIR" && exit 1
#echo "TOPDIR: $TOPDIR"
export TOPDIR
......
......@@ -129,7 +129,7 @@ echo
if [ "$RESULT" = "0" -a -n "$TESTINSTALL" ] ; then
# test install (only for last package in list)
# some key for build hasher from scratch
echog "Find binary packages for $LASTPACKAGE ..."
echog "Find binary packages for '$(basename $LASTPACKAGE)' in $HASHERDIR/repo/$DEFAULTARCH/RPMS.hasher..."
BINPACKAGES=`get_binpkg_list $HASHERDIR/repo/$DEFAULTARCH/RPMS.hasher $LASTPACKAGE`
test -n "$BINPACKAGES" || fatal "Can't find binary packages for $LASTPACKAGE in `ls -l $HASHERDIR/repo/$DEFAULTARCH/RPMS.hasher`"
echo "List: $BINPACKAGES"
......
......@@ -18,7 +18,7 @@ load_mod rpm
# Start as helper
if [ "$1" = "--helper" ]; then
shift
cd $RPMDIR/SPECS && rpmbb "$@"
cd $RPMTOPDIR/SPECS && rpmbb "$@"
exit $?
fi
......@@ -69,13 +69,13 @@ mygetopts $LISTARGS
mkdir -p "$LOGDIR"
mkdir -p "$RPMDIR/RPMS"
mkdir -p "$RPMTOPDIR/RPMS"
test -z "$LISTNAMES" && fatal "Please run with spec(s) name"
test -n "$LISTRPMARGS" && echog "Run $RPMBUILD with options: '$LISTRPMARGS'"
# instead cbuild req
if [ -n "$BUILDREQ" ] ; then
uni_rpmbuild buildreq $LISTNAMES
uni_buildreq $LISTNAMES
RET=$?
echog "You can run buildreq with -bi param for search a dependences for install section of the package"
exit $RET
......@@ -85,7 +85,7 @@ if [ -n "$BUILDOPT" ] ; then
is_alt || fatal "Sorry, only ALT Linux systems support --short-circuit correctly"
for it in $BUILDOPT
do
uni_rpmbuild $RPMBUILD $LISTNAMES -b$it $LISTRPMARGS --target $DEFAULTARCH --short-circuit
uni_rpmbuild $LISTNAMES -b$it $LISTRPMARGS --target $DEFAULTARCH --short-circuit
done
exit 0
fi
......@@ -109,7 +109,7 @@ do
LOGFILE="$LOGDIR/`basename $NAMESRPMIN .src.rpm`$MENVARG.log"
echo "Build in native system" >$LOGFILE
rm -f $LOGFILE.failed
(uni_rpmbuild $RPMBUILD $i -bb $LISTRPMARGS $NODEPS --target $DEFAULTARCH 2>&1 || touch $LOGFILE.failed) | tee -a $LOGFILE
(uni_rpmbuild $i -bb $LISTRPMARGS $NODEPS --target $DEFAULTARCH 2>&1 || touch $LOGFILE.failed) | tee -a $LOGFILE
[ -r "$LOGFILE.failed" ] && RET=1 || RET=0
if [ "$RET" = "0" ] ; then
......
......@@ -12,7 +12,7 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod repl
load_mod repl rpm
#VENDORVERSION=`distr_vendor -e`
DISTRVERSION=`distr_vendor -v`
......@@ -255,13 +255,17 @@ fi
unset MENV MENVARG
mkdir -p $RPMDIR/SPECS/$MDISTR
# handle src.rpm too, LISTBUILT - result src.rpms in SRPMS dir
pack_src_rpm $LISTNAMES
for i in $LISTNAMES ; do
DEST=`basename $i`
cp $i $RPMDIR/SPECS/$MDISTR/$DEST || fatal "Can't copy spec"
cd $RPMDIR/SPECS/$MDISTR || fatal "Error"
alt_tolocal $DEST
cd -
export RPMTOPDIR=$RPMDIR/BP
for i in $LISTBUILT ; do
SPKG=$RPMDIR/SRPMS/$i
uni_rpminstall $SPKG
SPECNAME=$RPMTOPDIR/SPECS/$(spec_by_srpm $SPKG)
test -r "$SPECNAME" || fatal "Spec $SPECNAME is not found"
rm -f $SPKG
alt_tolocal $SPECNAME
done
......@@ -110,7 +110,7 @@ if [ -n "$REMOTEBUILD" ] ; then
echog "==== Copying to build server ====="
#echog "It is recommended to rename old version at server for save traffic during rsync"
rsync -vay --partial --progress --checksum \
-e ssh $LISTBUILT $BUILDSERVER:/$RPMDIR/SRPMS/ || exit 1
-e ssh $LISTBUILT $BUILDSERVER:/$RPMTOPDIR/SRPMS/ || exit 1
$REMCOM rpmbs --helper $MENVARG $LISTRPMARGS $LISTBUILT
exit 0
fi
......@@ -141,7 +141,7 @@ set_incoming $MENV
if [ -n "${DELETENOW}" ]; then
echog "Removing from '$RSYNCINCOMING/$INCOMING/'"
check_key
cd $RPMDIR/SRPMS
cd $RPMTOPDIR/SRPMS
for i in $LISTBUILT ; do
> $i
done
......@@ -174,7 +174,7 @@ check_gear_and_tag()
if [ -n "$SIGN" ]; then
release_check $LISTBUILT
cd $RPMDIR/SRPMS
cd $RPMTOPDIR/SRPMS
if [ -r "$LISTBUILT" ] ; then
echo if one spec, check gear
check_gear_and_tag $SPECDIR
......
......@@ -86,7 +86,7 @@ if [ -n "$REMOTEBUILD" ] ; then
echo
echog "==== Copying to build server ====="
#echog "It is recommended to rename old version at server for save traffic during rsync"
cd $RPMDIR/SRPMS && rsync -vay --partial --progress --checksum \
cd $RPMTOPDIR/SRPMS && rsync -vay --partial --progress --checksum \
-e ssh $LISTBUILT $BUILDSERVER:$REMOTERPMDIR/SRPMS/ || fatal "Error with rsync"
ssh -t $BUILDSERVER "cd $REMOTERPMDIR/SRPMS && time myhsh $MENVARG $LISTRPMARGS $LISTBUILT"
RESULT=$?
......@@ -94,7 +94,7 @@ if [ -n "$REMOTEBUILD" ] ; then
echo "-------------------------------"
test "$RESULT" = "0" && echog "It was remote build at $BUILDSERVER" || echog "There is error during remote build at $BUILDSERVER"
else
cd $RPMDIR/SRPMS && time myhsh $MENVARG $LISTRPMARGS $LISTBUILT
cd $RPMTOPDIR/SRPMS && time myhsh $MENVARG $LISTRPMARGS $LISTBUILT
RESULT=$?
date
echo "-------------------------------"
......
......@@ -224,7 +224,7 @@ if [ -n "$INSTALLBINARY" ] ; then
parse_cmd_pre "$@"
pack_src_rpm $LISTRPMARGS
echog "Running apt-get for install needed packages for $LISTBUILT"
cd $RPMDIR/SRPMS
cd $RPMTOPDIR/SRPMS
# FIXME: ALT Specific
$SUDO apt-get build-dep $LISTBUILT
cd -
......@@ -309,7 +309,7 @@ fi
test -z "$SRCRPM" && fatal "Cannon find package for $1"
echog "Try to download $SRCRPM"
test -z ${TRYINST} || { mkdir -p $RPMDIR/SRPMS && cd $RPMDIR/SRPMS ; }
test -z ${TRYINST} || { mkdir -p $RPMTOPDIR/SRPMS && cd $RPMTOPDIR/SRPMS ; }
echog "Downloading in $(pwd)"
for i in $REPOSITORY
......
......@@ -22,6 +22,8 @@ NICE="nice"
RPMBUILD=rpmbuild
RPMDIR="$HOME/RPM"
# Can be overrided in the scripts
[ -n "$RPMTOPDIR" ] || RPMTOPDIR="$RPMDIR"
[ -n "$APTCONFBASE" ] || APTCONFBASE=$ETERBUILDETC/apt/apt.conf
......
......@@ -11,10 +11,11 @@
uni_rpmbuild()
{
local RET=0
local COMMAND=$1
# hack due quotes
# just for fill by something
local ONEPARAM="-v"
shift
local TWOPARAM="-v"
local SPECNAME=$1
local SPECDIR=`dirname $SPECNAME`
local GEAR=gear
......@@ -24,14 +25,9 @@ uni_rpmbuild()
# FIXME: do not override -v
ONEPARAM="--define=_source_payload w9.gzdio"
fi
if [ "$COMMAND" = "buildreq" ] ; then
if is_gear $SPECDIR ; then
$NICE $GEARBUILDREQ --commit -- $@ || RET=$?
else
$NICE $COMMAND $@ || RET=$?
fi
return $RET
if [ -n "$RPMTOPDIR" ] ; then
TWOPARAM="--define=_topdir $RPMTOPDIR"
fi
if is_gear $SPECDIR ; then
......@@ -39,16 +35,51 @@ uni_rpmbuild()
shift # skip spec name
[ -n "$SPECDIR" ] && [ "$SPECDIR" != "." ] && warning "Spec is not in git dir"
if [ "$MENV" = "SS" ] ; then
$NICE $GEAR --commit --rpmbuild -- $COMMAND "$ONEPARAM" $@ || RET=$?
$NICE $GEAR --commit --rpmbuild -- $RPMBUILD "$ONEPARAM" "$TWOPARAM" $@ || RET=$?
else
fatal "Unsupported now"
# build src.rpm via hasher (on ALT)
# $NICE gear-hsh --build-args="-bs" --rpmbuild -- $COMMAND "$ONEPARAM" $@
$NICE $GEAR --hasher -- myhsh --build-prog=$ETERBUILDDIR/functions/rebuild $@ || RET=$?
fi
else
$NICE $COMMAND "$ONEPARAM" $@ || RET=$?
$NICE $RPMBUILD "$ONEPARAM" "$TWOPARAM" $@ || RET=$?
fi
[ -n "$VERBOSE" ] && echo "Run $RPMBUILD $ONEPARAM $TWOPARAM $@" || :
return $RET
}
uni_buildreq()
{
local RET=0
local SPECNAME=$1
local SPECDIR=`dirname $SPECNAME`
local GEARBUILDREQ=gear-buildreq
if is_gear $SPECDIR ; then
$NICE $GEARBUILDREQ --commit -- $@ || RET=$?
else
$NICE buildreq $@ || RET=$?
fi
return $RET
}
uni_rpminstall()
{
local RET=0
local TWOPARAM="-v"
if [ -n "$RPMTOPDIR" ] ; then
TWOPARAM="--define=_topdir $RPMTOPDIR"
fi
[ -n "$VERBOSE" ] && echo "Run $COMMAND $ONEPARAM $@" || :
#if is_gear $SPECDIR ; then
# $NICE $GEARBUILDREQ --commit -- $@ || RET=$?
#else
echo -n "Install package "
rpm -iv "$TWOPARAM" $@ || RET=$?
#fi
return $RET
}
......@@ -96,7 +127,6 @@ build_rpms_name()
NAMERPMIN=$BASENAME-$VERSION-$RELEASE.$PKGARCH.rpm
NAMESRPMIN=$BASENAME-$VERSION-$RELEASE.src.rpm
#RPMSOURCEDIR=$RPMDIR/SOURCES
RPMSOURCEDIR=`rpm --eval %_sourcedir | subst_namever`
[ -n "$RPMSOURCEDIR" ] || fatal "Can't detect RPM/SOURCES dir"
......@@ -124,7 +154,7 @@ do
if [ -z ${i/*rpm/} ] ; then
# if rpm not spec, guess it is src.rpm
NAMESRPMIN=$i
NAMESRPMIN=$(basename $i)
else
#
# BASENAME, RELEASE, VERSION, NAMESRPMIN, NAMERPMIN
......@@ -138,16 +168,18 @@ do
sleep 10
exit 1
fi
uni_rpmbuild $RPMBUILD $i -bs $ARGS $NODEPS --target $DEFAULTARCH
uni_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"
uni_rpmbuild $i -bs $ARGS $NODEPS --target $DEFAULTARCH || fatal "Error with rpmbuild"
fi
fi
if [ -f $RPMDIR/SRPMS/$NAMESRPMIN ] ; then
# Check the package really built
if [ -f $RPMTOPDIR/SRPMS/$NAMESRPMIN ] ; then
LISTBUILT="$LISTBUILT $NAMESRPMIN"
else
fatal "Can't find '$NAMESRPMIN' in '$RPMDIR/SRPMS'"
fatal "Can't find '$NAMESRPMIN' in '$RPMTOPDIR/SRPMS'"
fi
done
# remove extra space before list
......@@ -157,12 +189,14 @@ test -z "$LISTBUILT" && fatal "Error: List for build is empty. Check if file is
}
# 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 "^$2[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo "$PKGDIR/{} "
| grep "^$PKGNAME[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo "$PKGDIR/{} "
}
drop_pkg_extensions()
......
......@@ -163,3 +163,10 @@ add_changelog_helper()
return $R
}
spec_by_srpm()
{
local PKG=$1
local PKGNAME
PKGNAME=$(rpm -qp --queryformat "%{NAME}" $PKG)
[ -n "$PKGNAME" ] && echo $PKGNAME.spec
}
......@@ -85,4 +85,7 @@ libexpat-devel|expat-devel
libltdl-devel|libtool-ltdl-devel
libhal-devel|hal-devel
\ No newline at end of file
libhal-devel|hal-devel
liblua5-devel|lua-devel
libctemplate-devel|ctemplate-devel
libuuid-devel|uuid-devel
......@@ -4,4 +4,8 @@
. $ETERBUILDDIR/functions/rpm
HASHERDIR=$HASHERDIR-SS
get_binpkg_list $HASHERDIR/repo/$DEFAULTARCH/RPMS.hasher asymptote-1.43-alt1.src.rpm
for i in `ls -1 $HASHERDIR/repo/SRPMS.hasher` ; do
echo "get for $i:"
get_binpkg_list $HASHERDIR/repo/$DEFAULTARCH/RPMS.hasher $(basename $i)
done
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm
install_srpm_package()
{
uni_rpminstall $1
}
pack_srpm_package()
{
LISTNAMES=$1 pack_src_rpm
}
export IGNOREGEAR=1
RPMTOPDIR=$RPMDIR/BP
for i in `ls -1 $RPMDIR/SRPMS` ; do
PKGNAME=$RPMDIR/SRPMS/$i
echo "get for $i:"
install_srpm_package $PKGNAME
SPECNAME=$RPMTOPDIR/SPECS/$(spec_by_srpm $PKGNAME)
echo "spec: $SPECNAME"
pack_srpm_package $SPECNAME
echo Compare $PKGNAME $LISTBUILT
rpmdiff $PKGNAME $RPMTOPDIR/SRPMS/$LISTBUILT
exit 1
done
......@@ -21,11 +21,15 @@ print_usedby()
echo "Required by:"
print_list $USEDBY
echo "Second required by:"
print_list `list_wd $USEDBY`
for i in `list_wd $USEDBY | sort -u` ; do
# skip repeated
echo $USEDBY | grep -q $i && continue
echo " $i"
done
}
SPECLIST=`find $RPMDIR/SPECS -type f -name "*.spec"`
[ -n "$SPECLIST" ] || SPECLIST=`find $RPMDIR/SPECS -type f -name "*.spec"`
for i in $SPECLIST ; do
if echo $i | grep -q HELP ; then
continue
......
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