Commit 42e20f38 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

Conflicts: bin/rpmbs
parents 420b1abc 8cf8a579
etersoft-build-utils-1.6.7: 19 Sep 2009
- add ccache support and use it in rpmbb
- rpmbph: set vendor name part in release inherited from prev. release
- rpmbph: remove SOURCE and SPEC files after build src.rpm
- add new command jmake for run parallel make with ccache
- rpmgs: add tbz support
etersoft-build-utils-1.6.6: 23 Jul 2009
- require make and gcc in any way (as part of build env)
- fix mcbc build
......
korinf
:
# etersoft-build-utils repack DIR - DIR NAME-VERSION
# etersoft-build-utils remove DIR/FILE [DIR/FILE] -
......
#!/bin/sh
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
if [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
echo "jmake - make with ccache using and parallel build enabled"
exit 0
fi
if [ -z "$CCACHE_DISABLE" ] ; then
enable_ccache
fi
# get number of available processors
[ -n "$NPROCS" ] || NPROCS=`/usr/bin/getconf _NPROCESSORS_ONLN`
# get rounded load average
LOADAVG=`cat /proc/loadavg | cut -f1 -d" " | sed -e "s/\..*//g"`
MAKEARG=
[ "$(( $NPROCS - $LOADAVG ))" -gt 1 ] && MAKEARG="-j$NPROCS"
#make $MAKEARG "CC=$CC" "CXX=$CXX" "CPP=$CPP" "CXXCPP=$CXXCPP" $@
time -p make $MAKEARG $@
......@@ -73,6 +73,11 @@ mkdir -p "$RPMTOPDIR/RPMS"
test -z "$LISTNAMES" && fatal "Please run with spec(s) name"
test -n "$LISTRPMARGS" && echog "Run $RPMBUILD with options: '$LISTRPMARGS'"
# enable ccache using
if [ -n "$CCACHE_ENABLE" ] ; then
enable_ccache
fi
# instead cbuild req
if [ -n "$BUILDREQ" ] ; then
uni_buildreq $LISTNAMES
......
......@@ -31,7 +31,7 @@ if [ "$VENDOR" = "alt" ] ; then
[ -z "$BUILDCOMMAND" ] && BUILDCOMMAND=$ETERBUILDBIN/rpmbsh
# Change release according to alt policy with extensions
# General rule: alwars alt(N-1).MM.(N)
set_release $SPECNAME alt$(decrement_release $BASERELEASE).$MDISTR.$BASERELEASE
set_release $SPECNAME $(get_txtrelease $SPECNAME)$(decrement_release $BASERELEASE).$MDISTR.$BASERELEASE
ADDDEF=""
CLEANTEXT=""
# due new libtool, affected on ALT Linux
......@@ -40,7 +40,7 @@ else
# Need our compat package and disable strong patch checking
BUILDREQ="BuildRequires: rpm-build-altlinux-compat >= 0.95 make gcc\n$FIXPATCHFUZZ"
[ -z "$BUILDCOMMAND" ] && BUILDCOMMAND=$ETERBUILDBIN/rpmbb
set_release $SPECNAME eter$BASERELEASE$VENDOR
set_release $SPECNAME $(get_txtrelease $SPECNAME)$BASERELEASE$VENDOR
ADDDEF="%defattr(-, root, root)"
CLEANTEXT=""
fi
......@@ -266,7 +266,7 @@ phelp()
while getopts :hniv opt; do
case $opt in
h) phelp; exit 0;;
n) BUILDCOMMAND="$ETERBUILDBIN/rpmbs";;
n) BUILDCOMMAND="$ETERBUILDBIN/rpmbs --rmsource --rmspec";;
v) VERBOSE=1;;
+?) 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;;
......
......@@ -18,7 +18,7 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod rpm
load_mod rpm tarball
SIGN=
UPLOADNOW=
......@@ -118,13 +118,19 @@ check_gear_and_tag()
fi
}
# SRC.RPM DIR
extract_tarball_to_dest()
{
local TDIR=$(mktemp -d || fatal "can't create tmp dir")
cd $TDIR
cat "$1" | rpm2cpio | cpio -i "*.tar*"
cp -fv *.tar* $2
#cp -fv *.tar* $2
local TARNAME=$(rpm -q -p --queryformat "%{NAME}-%{VERSION}" $1)
# FIXME: hack to replace alt release to eter
local TARGETTARNAME=$(rpm -q -p --queryformat "%{NAME}-%{VERSION}-%{RELEASE}" $1 | sed -e "s/-alt/-eter/g")
copy_tarball_to_tar_bz2 $TARNAME*.tar* $2/$TARGETTARNAME.tar.bz2
cd -
make_md5sum $2 $TARGETTARNAME.tar.bz2
rm -f $TDIR/*
rmdir $TDIR
}
......@@ -141,6 +147,7 @@ rpmbs_copying_built()
# Publish tarball if target dir is exist
if [ -d "$ETERDESTSRPM/tarball" ] ; then
echog "There is tarball dir exists. Extract tarball for other build system compatibility."
for i in $LISTBUILT ; do
extract_tarball_to_dest $i $ETERDESTSRPM/tarball
done
......@@ -227,64 +234,89 @@ if [ -n "${DELETENOW}" ]; then
exit 0
fi
test -z "$ETERDESTSRPM" && ETERDESTSRPM=$UPLOADDIR${MENVARG/-/.}
if [ -n "$SIGN" ]; then
release_check $LISTBUILT
# if just packing
if [ -z "$SIGN" ]; then
rpmbs_copying_built
exit $?
fi
# Sign src.rpm and upload it
release_check $LISTBUILT
if [ -r "$LISTBUILT" ] ; then
if [ -r "$LISTBUILT" ] ; then
check_gear_and_tag
fi
fi
echog "Will try to sign follow packages with GPG: \$LISTBUILT"
# 1. only rpm command has --addsign 2. do 3 retries
rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT
RET=$?
if [ ! "$RET" = "0" ] ; then
echog "Impossible to sign package. Check your password and try again."
echog "Wait for ten seconds."
sleep 10
exit 1
fi
echog "Will try to sign follow packages with GPG: \$LISTBUILT"
# 1. only rpm command has --addsign 2. do 3 retries
rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT
RET=$?
############################################
echog "Changing permissions..."
chmod 644 -- $LISTBUILT || fatal "can't chmod"
echog -n "Checking with sisyphus_check..."
test -n "$NOCHECK" || sisyphus_check --files $LISTBUILT || fatal "sisyphus check failed"
echog "OK"
# rpm's find-req do not find rpmlint :)
RPMLINT=rpmlint
if which $RPMLINT >/dev/null ; then
############################################
echog "Changing permissions..."
chmod 644 -- $LISTBUILT || fatal "can't chmod"
echog -n "Checking with sisyphus_check..."
# TODO: check for ALT specific
# skip some checking for src.rpm if it is local upload
CHECK_OPTIONS=""
[ -n "${UPLOADNOW}" ] || CHECK_OPTIONS="--no-check=$HASHER_NOCHECK"
test -n "$NOCHECK" || sisyphus_check $CHECK_OPTIONS --files $LISTBUILT || fatal "sisyphus check failed"
echog "OK"
# rpm's find-req do not find rpmlint :)
RPMLINT=rpmlint
if which $RPMLINT >/dev/null ; then
echog -n "Checking with rpmlint..."
echo
echo
$RPMLINT $LISTBUILT
else
else
echog "It is recommended to install rpmlint package for additional checking"
fi
test -n "$CHECKONLY" && exit 0
############################################
fi
if [ "$RET" = "0" ]
then
if [ -n "${UPLOADNOW}" ] ; then
echog "Uploading to $GIRARHOST"
check_key
# TODO: rsync foo.src.rpm git.alt: && ssh git.alt build srpm foo.src.rpm
# git.alt build -b 4.0 srpm foo.src.rpm
rsync -vay --partial --progress $CHECKSUM \
test -n "$CHECKONLY" && exit 0
############################################
# If upload signed package is not needed
if [ -z "${UPLOADNOW}" ] ; then
rpmbs_copying_built
exit $?
fi
echog "Uploading to $GIRARHOST"
check_key
# TODO: rsync foo.src.rpm git.alt: && ssh git.alt build srpm foo.src.rpm
# git.alt build -b 4.0 srpm foo.src.rpm
rsync -vay --partial --progress $CHECKSUM \
-e ssh $LISTBUILT $GIRARHOST: && \
echo "---------------------" && \
echog "All files synced" || fatal "Error during rsync"
echo "---------------------" && \
echog "All files synced" || fatal "Error during rsync"
TASKLIST=""
for i in $LISTBUILT ; do
TASKLIST=""
for i in $LISTBUILT ; do
TASKLIST="$TASKLIST srpm $(basename $i)"
done
if [ -n "$TASKNUMBER" ] ; then
done
if [ -n "$TASKNUMBER" ] ; then
echo "Add $TASKLIST to task $TASKNUMBER"
[ -n "$VERBOSE" ] && echo "...with command ssh $GIRARHOST task add $TASKNUMBER $TASKLIST"
ssh $GIRARHOST task add $TASKNUMBER $TASKLIST
else
else
echo "Create task for $TASKLIST"
[ -n "$VERBOSE" ] && echo "...with command ssh $GIRARHOST build -b $BINARYREPO $TASKLIST"
ssh $GIRARHOST build -b $BINARYREPO $TASKLIST
fi
fi
for i in $LISTBUILT ; do
for i in $LISTBUILT ; do
# FIXME: more general way
LOGFILE="$LOGDIR/`basename $i .src.rpm`$MENVARG.log"
echo >>$LOGFILE
......@@ -293,15 +325,10 @@ if [ -n "$SIGN" ]; then
TEXTADD="run build src.rpm"
[ -z "$TASKNUMBER" ] || TEXTADD="add src.rpm to task $TASKNUMBER"
echo "$(basename $i) $TEXTADD at $GIRARHOST ($MENV) at `date "+%c"`" >>$RPMDIR/uploaded.log
done
else
test -z "$ETERDESTSRPM" && ETERDESTSRPM=$UPLOADDIR${MENVARG/-/.}
rpmbs_copying_built
fi
done
echog "Removing buildroot after upload..."
for i in $LISTNAMES ; do
echog "Removing buildroot after upload..."
for i in $LISTNAMES ; do
if [ -z ${i/*.src.rpm/} ] ; then
echo " skipping for $i"
continue
......@@ -316,15 +343,5 @@ if [ -n "$SIGN" ]; then
else
echog "missed"
fi
done
done
else
echog "Impossible to sign package. Check your password and try again."
echog "Wait for ten seconds."
sleep 10
exit 1
fi
else
rpmbs_copying_built
fi
......@@ -14,7 +14,7 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod rpm
load_mod rpm tarball
WEXT=""
GETSOURCE=""
......@@ -82,21 +82,7 @@ get_archive1()
echog -n "Converting to $WEXT.bz2..."
}
bzipit()
{
locale PBZIPIT
PBZIPIT=`which pbzip2 2>/dev/null`
if [ -n "$PBZIPIT" ] ; then
echog -n " with pzip2..."
$PBZIPIT -9 -f $1
return $?
else
echog -n " with bzip2..."
bzip -f --best $1
return $?
fi
}
#TODO: use functions from tarball
get_tarbz2()
{
get_archive tar.bz2
......
......@@ -64,3 +64,9 @@
# Path to Sisyphus repo (where i586/RPMS.classic) for rpmunmets build
#SISYPHUSPATH=/var/ftp/pub/ALTLinux/Sisyphus/
# enable ccache using
# CCACHE_ENABLE=yes
# set dir for ccache cache
# export CCACHE_DIR=$OURTMPDIR/ccache
Name: etersoft-build-utils
Version: 1.6.7
Release: alt0.1
Release: alt2
Summary: A set of build rpm utilities
......@@ -61,7 +61,16 @@ RECOMMENDED packages: gcc-c++ perl-libwww ccache elinks mutt hasher curl
%config(noreplace) %_sysconfdir/eterbuild/repos
%changelog
* Thu Aug 27 2009 Vitaly Lipatov <lav@altlinux.ru> 1.6.7-alt0.1
* Tue Sep 22 2009 Vitaly Lipatov <lav@altlinux.ru> 1.6.7-alt2
- rpmbs: imprpove publish tarball function, add md5sum for tarball
- rpmbs: skip some sisyphus_check for local src.rpm build
* Sat Sep 19 2009 Vitaly Lipatov <lav@altlinux.ru> 1.6.7-alt1
- add ccache support and use it in rpmbb
- rpmbph: set vendor name part in release inherited from prev. release
- rpmbph: remove SOURCE and SPEC files after build src.rpm
- add new command jmake for run parallel make with ccache
- rpmgs: add tbz support
- rpmbs: add support for tarball target subdir
* Thu Aug 06 2009 Vitaly Lipatov <lav@altlinux.ru> 1.6.6-alt2
......
......@@ -16,6 +16,7 @@ uni_rpmbuild()
local ONEPARAM="--quiet"
local TWOPARAM="--quiet"
local THRPARAM="--quiet"
local FOURPARAM="--quiet"
local COMMIT=""
if [ "$1" = "--commit" ] ; then
......@@ -40,6 +41,10 @@ uni_rpmbuild()
TWOPARAM="--define=_topdir $RPMTOPDIR"
fi
if [ -n "$CCACHE_ENABLE" ] && [ -n "$CCACHE_DIR" ] ; then
FOURPARAM="--define=__ccache_dir $CCACHE_DIR"
fi
if is_gear $SPECDIR ; then
[ -f "$SPECNAME" ] || fatal "run uni_rpmbuild with spec as 2nd parameter"
shift # skip spec name
......@@ -53,7 +58,7 @@ uni_rpmbuild()
fi
# build package without MENV checking
if true || [ "$MENV" = "SS" ] ; then
$NICE $GEAR $COMMIT $GEARRULES --rpmbuild -- $RPMBUILD "$ONEPARAM" "$TWOPARAM" "$THRPARAM" $@ || RET=$?
$NICE $GEAR $COMMIT $GEARRULES --rpmbuild -- $RPMBUILD "$ONEPARAM" "$TWOPARAM" "$THRPARAM" "$FOURPARAM" $@ || RET=$?
else
fatal "Build backported src.rpm from git is unsupported now"
# build src.rpm via hasher (on ALT)
......@@ -62,9 +67,9 @@ uni_rpmbuild()
fi
else
mkdir -p $RPMTOPDIR/BUILD $RPMTOPDIR/SRPMS
$NICE $RPMBUILD "$ONEPARAM" "$TWOPARAM" "$THRPARAM" $@ || RET=$?
$NICE $RPMBUILD "$ONEPARAM" "$TWOPARAM" "$THRPARAM" "$FOURPARAM" $@ || RET=$?
fi
[ -n "$VERBOSE" ] && echo "Run $RPMBUILD $ONEPARAM $TWOPARAM $THRPARAM $@" || :
[ -n "$VERBOSE" ] && echo "Run $RPMBUILD $ONEPARAM $TWOPARAM $THRPARAM $FOURPARAM $@" || :
return $RET
}
......
......@@ -181,3 +181,20 @@ is_ssh_target()
{
echo "$1" | grep -q ":"
}
enable_ccache()
{
which ccache >/dev/null || fatal "Install ccache package before using"
# handled in gcc-common
export GCC_USE_CCACHE=1
# step to gcc-common
export CC=gcc CXX=g++
#export CC="ccache gcc"
#export CPP="ccache gcc -E"
#export CXX="ccache g++"
#export CXXCPP="ccache g++ -E"
}
......@@ -53,6 +53,12 @@ BUILDSERVER=
PKGREPLBASE=$ETERBUILDDIR/pkgrepl
# TODO: use common ccache dir
export CCACHE_DIR=$OURTMPDIR/ccache
# enable ccache using
# CCACHE_ENABLE=yes
test -f /etc/eterbuild/config && . /etc/eterbuild/config
if [ -f ~/.config/eterbuild ] ; then
......
#!/bin/bash
# 2009 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# FILE
# bzip FILE with pzip2 (if exists) or bzip2
bzipit()
{
locale PBZIPIT
PBZIPIT=`which pbzip2 2>/dev/null`
if [ -n "$PBZIPIT" ] ; then
echog -n " with pzip2..."
$PBZIPIT -9 -f $1
return $?
else
echog -n " with bzip2..."
bzip -f --best $1
return $?
fi
}
# TODO: use bzipit
copy_tarball_to_tar_bz2()
{
local SNAME=$1
local TNAME=$2
#echo SNAME: $SNAME
test -r "$SNAME" || return 1
# copying from tar.bz2
if [ ! ${SNAME/.tar.bz2/} = "$SNAME" ] ; then
#echo O tar.bz2
cp -fv "$SNAME" "$TNAME"
return
fi
if [ ! ${SNAME/.tar.gz/} = "$SNAME" ] ; then
gunzip -c "$SNAME" | bzip -c > "$TNAME"
return
fi
# FIXME: matchs with .tarNNN
if [ ! ${SNAME/.tar/} = "$SNAME" ] ; then
bzip -c "$SNAME" > "$TNAME"
return
fi
return 1
}
# DIR FILE
make_md5sum()
{
cd "$1"
md5sum -b $2 > $2.md5
cd -
}
......@@ -11,6 +11,7 @@ glibc-devel|libc6-dev
glibc-devel-static|libc6-dev
libfreetype-devel|libfreetype6-dev
libfreetype|libfreetype6
fontconfig-devel|libfontconfig1-dev
libxslt-devel|libxslt1-dev
libncurses-devel|libncurses5-dev
libncursesw-devel|libncursesw5-dev
......@@ -21,6 +22,7 @@ libasound-devel|libasound2-dev
libreadline-devel|libreadline5-dev
libreadline|libreadline5
libXaw-devel|libxaw7-dev
libXext-devel|libxext-dev
libXrender-devel|libxrender-dev
libXrender|libxrender1
......@@ -88,3 +90,5 @@ libgladeui|libgladeui-1-9
librsvg-devel|librsvg2-dev
librsvg|librsvg2
# hack due our wine package with -devel
libwine-devel|libwine-devel
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod tarball
# see rpmbs for using it
copy_tarball_to_tar_bz2 dd.tar tdd.tar.bz2
copy_tarball_to_tar_bz2 dd.tar.bz2 tdd.tar.bz2
copy_tarball_to_tar_bz2 dd.tar.gz tdd.tar.bz2
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