Commit 0bc9a52b authored by Yuri Fil's avatar Yuri Fil

Merge branch 'master' of git.eter:/people/lav/packages/etersoft-build-utils

parents 563b3559 5cfa9ea7
etersoft-build-utils-1.7.5: 22 Jan 2010
- rpmbs/rpmbsh: add -l option for lazy-cleanup after build
- rpmgs: check dir with the same as package name firstly
- version up to 175
- repl: make required packages list unique
- rpmgp: add -m option for migrate spec to gear support
- rpmgp: fix -b option (install buildreqs packages) to work in distro independent manner
- rpmgp: fix get remote branches and main branch selecting
etersoft-build-utils-1.7.4: 14 Jan 2010
- rpmbph: support for branches like 5.1 if exists, instead M51
- rpmgp: clone all branches locally
......
---------------------------
ginit [GEAR] - initialize repo in git.eter for current project
ginit [GEAR] - initialize repo in git.alt for current project
Use: ginit without parameters
ginit git.eter - for init in git.eter gear repo
---------------------------
gpull [args] - do git pull --rebase
Use: ginit without parameters
Use: gpull without parameters
---------------------------
gpush - publish current project repo to git.eter
gpush - publish current project repo remote git repo
Use: gpush [-f|--force] [-a|--all] [project name] [target branch]
---------------------------
jmake - make with ccache using and parallel build enabled
---------------------------
loginhsh - install package in hasher / take shell
Usage: [-t -i -h -r] bin.rpm...
Usage: [-t -i -h -r -c] [-M51] bin.rpm...
:
-i - hasher ( )
-c - cleanup hasher
-o - log in as root user
-t - hasher,
-r - hasher ̣
-M?? - branch name
---------------------------
......@@ -39,22 +45,23 @@ Usage: [-m -s -u -i -c] src.rpm...
---------------------------
rpmbb - build binary rpm from spec
Usage: [-c -p -i -r] spec...
Usage: [-c -p -i -r -R] spec...
:
-c - start from compile stage
-i -
-p - packaging installed files into package
-r - (buildreq)
-R - find build requires with -bi
---------------------------
rpmbph - backports spec and rebuild it
Usage: [-r -u -U -n -i -m -v] [-M??] spec...
Use rpmbph -M40 for backport to ALT 4.0 and so on
Usage: [-r -u -U -n -i -m -v] [-M51] spec...
Use rpmbph -M51 for backport to ALT M51 and so on
:
-r - ̣
-u/-U - sign and upload after build
-n - hasher
-n - do not build in hasher (use first in the list)
-i - install built packages in test hasher
-v - more verbose
......@@ -96,13 +103,14 @@ rpmcs spec - cleanup spec (like cleanup_spec command), adapted to ALT
rpmgp - various package download operations
Usage: [options] [system] pkgname
:
rpmgp [-a -c -n] [system] pkgname - download src.rpm from 'system' repository to RPM/SRPMS and install it
rpmgp [options] [system] pkgname - download src.rpm from 'system' repository to RPM/SRPMS and install it
name - src.rpm
system - name of system (ALT Linux by default if -a missed too)
-a search pkgname in all known repositories
-b install packages needed for build (use sudo apt-get) (need spec not package name)
-c check if this package exists in the ALT Linux repository
-d download all matched packages
-g remote clone repo to USER/packages and clone it locally
-l list packages needed for build (in local pkg system notation) (experimental)
-n do not install after download, just download in current dir
-r refresh package list (download it again)
......
---------------------------
ginit [GEAR] - initialize repo in git.eter for current project
ginit [GEAR] - initialize repo in git.alt for current project
Use: ginit without parameters
ginit git.eter - for init in git.eter gear repo
---------------------------
gpull [args] - do git pull --rebase
Use: ginit without parameters
Use: gpull without parameters
---------------------------
gpush - publish current project repo to git.eter
gpush - publish current project repo remote git repo
Use: gpush [-f|--force] [-a|--all] [project name] [target branch]
---------------------------
jmake - make with ccache using and parallel build enabled
---------------------------
loginhsh - install package in hasher / take shell
Usage: [-t -i -h -r] bin.rpm...
Usage: [-t -i -h -r -c] [-M51] bin.rpm...
Options:
-i - initialize hasher
-c - cleanup hasher
-o - log in as root user
-t - use test hasher dir
-r - remote login to hasher
-M?? - branch name
---------------------------
......@@ -39,22 +45,23 @@ Options:
---------------------------
rpmbb - build binary rpm from spec
Usage: [-c -p -i -r] spec...
Usage: [-c -p -i -r -R] spec...
Options:
-c - start from compile stage
-i - install and package
-p - packaging installed files into package
-r - find build requires
-R - find build requires with -bi
---------------------------
rpmbph - backports spec and rebuild it
Usage: [-r -u -U -n -i -m -v] [-M??] spec...
Use rpmbph -M40 for backport to ALT 4.0 and so on
Usage: [-r -u -U -n -i -m -v] [-M51] spec...
Use rpmbph -M51 for backport to ALT M51 and so on
Options:
-r - remote build
-u/-U - sign and upload after build
-n - do not build in hasher
-n - do not build in hasher (use first in the list)
-i - install built packages in test hasher
-v - more verbose
......@@ -96,13 +103,14 @@ rpmcs spec - cleanup spec (like cleanup_spec command), adapted to ALT
rpmgp - various package download operations
Usage: [options] [system] pkgname
Options:
rpmgp [-a -c -n] [system] pkgname - download src.rpm from 'system' repository to RPM/SRPMS and install it
rpmgp [options] [system] pkgname - download src.rpm from 'system' repository to RPM/SRPMS and install it
name - installed package name or src.rpm
system - name of system (ALT Linux by default if -a missed too)
-a search pkgname in all known repositories
-b install packages needed for build (use sudo apt-get) (need spec not package name)
-c check if this package exists in the ALT Linux repository
-d download all matched packages
-g remote clone repo to USER/packages and clone it locally
-l list packages needed for build (in local pkg system notation) (experimental)
-n do not install after download, just download in current dir
-r refresh package list (download it again)
......
rpmgp -b - apt-get build-dep,
lib, %files:
%post -p %post_ldconfig
%postun -p %postun_ldconfig
backports
- upload.SS rpmbs -u
- upload.SS rpmbs -u ??
http://git.altlinux.org/people/kharpost/packages/gitalt-tasker.git?p=gitalt-tasker.git;a=blob;f=gitalt-tasker/git-task;h=81e0261813a9fe2be230fb0c47b4ff4efd9a2675;hb=bfcc80b9af49b8ea0629db80d4c2f29a024d574e
korinf
:
gear
# etersoft-build-utils repack DIR - DIR NAME-VERSION
# etersoft-build-utils remove DIR/FILE [DIR/FILE] -
......@@ -45,11 +48,7 @@ exec time rpmbuild --target="\$target" $nodeps -bs "\$@"
( ). , ,
.
rpmbb git
Req ( )
, hasher
src.rpm SRPMS
:
ALT -
......@@ -58,7 +57,6 @@ pkgrepl.pclinux -
pkgrepl.pclinux.2007 -
, ( ALT)
-x ̣ x86_64?
%homedir tmp ?
rpm -bE rpm --showrc ?
......@@ -81,7 +79,7 @@ pkgrepl.pclinux.2007 -
- / ?
=== 1.8 ===
- how to use --build-args= for hsh? - myhsh rpm
+ how to use --build-args= for hsh? - myhsh rpm
- ?
- , ޣ (diff )
- .pot
......@@ -96,11 +94,6 @@ pkgrepl.pclinux.2007 -
- ( )?
( )
alias
alias hsh="hsh --build='--define \"_unpackaged_files_terminate_build 1\"'"
~/.rpmmacros
Unpackaged:
awk '
on { if (/^ +\//) print $0; else on=0 }
......
......@@ -11,7 +11,7 @@
load_mod hasher
#############################
Usage="Usage: $name [-m -s -u -i -c] src.rpm..."
Usage="Usage: $name [-m -s -u -i -c -l] src.rpm..."
function mygetopts()
{
name=${0##*/}
......@@ -24,13 +24,16 @@ phelp()
echog "Options:"
echog " -i - install built packages in test hasher"
echog " -c - build without stuff (previous built packages)"
echog " -l - lazy cleanup (before build, not after)"
}
while getopts :hmic opt; do
while getopts :hmicl opt; do
case $opt in
h) phelp; exit 0;;
i) TESTINSTALL=1;;
c) HASHERARG="--without-stuff $HASHERARG";;
l) HASHERARG="$HASHERARG --lazy-cleanup";;
c) HASHERARG="$HASHERARG --without-stuff";;
+?) 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;;
?) OPTIND=$((OPTIND-1)); break;
......
......@@ -87,7 +87,7 @@ if [ -n "$BUILDREQ" ] ; then
fi
if [ -n "$BUILDOPT" ] ; then
is_alt || fatal "Sorry, only ALT Linux systems support --short-circuit correctly"
is_alt || fatal "Sorry, only ALT Linux rpm supports --short-circuit correctly"
for it in $BUILDOPT
do
uni_rpmbuild --commit $LISTNAMES -b$it $LISTRPMARGS --target $DEFAULTARCH --short-circuit
......
......@@ -363,11 +363,9 @@ if [ "$VENDOR" = "alt" ] ; then
fatal "User cancelled. You are still in $USEBRANCH branch with modified spec"
fi
git add $SPEC
if ! git commit -a -m "backported to $USEBRANCH by rpmbph script as $(get_version $SPEC)-$(get_release $SPEC)" ; then
if ! git_commit_ignore_nothing -a -m "backported to $USEBRANCH as $(get_version $SPEC)-$(get_release $SPEC) (with rpmbph script)" ; then
#git checkout $CURBRANCH
#fatal "Commit error. You are still in $MDISTR branch with modified and uncommitted spec"
# FIXME: git commit returns error if no commit needed
echo
fatal "Commit error. You are still in $MDISTR branch with modified and uncommitted spec"
fi
[ -n "$NOBUILD" ] && BUILDCOMMAND="$ETERBUILDBIN/rpmbs"
$BUILDCOMMAND $LISTRPMARGS $REMOTEBUILD $DISTRARG $SPEC || { git checkout $CURBRANCH ; fatal "Can't build" ; }
......
......@@ -41,12 +41,13 @@ phelp()
echog "$Descr"
echog "$Usage"
echog "Options:"
echog " -s - sign package(s) and move it to upload dir"
echog " -s - sign package(s) and move it to upload dir (ETERDESTSRPM)"
echog " -c - only sign package(s) with checking"
echog " -u - sign package(s), upload it and run build"
echog " -a TASK - sign package(s), update it and add to task TASK"
# echog " -U - sign package(s) and upload it to Incoming (updates)"
# echog " -d - remove package(s) from SRPMS and Incoming"
echog " -l - lazy cleanup (before build, not after)"
echog " -n - do not check with sisyphus_check before upload"
echog " -o - create nosrc.rpm package"
echog " -z - create src.rpm with compatible gzip compression"
......@@ -179,6 +180,8 @@ if [ -n "$UPLOADNOW" ] && is_gear $SPECDIR ; then
check_gear_and_tag
$ETERBUILDBIN/gpush $GIRARHOST $BASENAME || fatal "Git push via gpush failed. Possibly you need to run ginit for create remote repo."
TAG=$VERSION-$RELEASE
echo
echo "Run build $BASENAME at $GIRARHOST"
if [ -n "$TASKNUMBER" ] ; then
ssh $GIRARHOST task add $TASKNUMBER repo $BASENAME $TAG
else
......
......@@ -33,19 +33,18 @@ phelp()
echog "Options:"
echog " -r - remote build"
echog " -t - make temporary commit before build (rpmbb like behavior)"
echog " -u/-U - sign and upload after build"
echog " -s - sign and and copy to upload after build"
echog " -u - sign and upload after build"
echog " -s - sign and and copy to upload dir (ETERDESTSRPM) after build"
echog " -i - install built packages in test hasher"
echog " -l - lazy cleanup (before build, not after)"
echog " -c - build without stuff (previous built packages)"
}
while getopts :hrusimt opt; do
while getopts :hrulsimt opt; do
case $opt in
h) phelp; exit 0;;
r) REMOTEBUILD=1 ;;
t) COMMIT=--commit ;;
# u) UPLOADNOW="-u" ;;
# s) UPLOADNOW="-s" ;;
t) COMMIT="--commit" ;;
+?) 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;;
?) OPTIND=$((OPTIND-1)); break;
......@@ -70,14 +69,15 @@ fi
parse_cmd_pre "$@"
mygetopts $LISTARGS
[ -n "$LISTNAMES" ] || fatal "Run with exists specs as arg"
# TODO: skip for prev. packed src.rpm
# If fail, we already has correct changelog
add_changelog_helper "- new version" $LISTNAMES
#echo ${LISTRPMARGS/\-m/} @ ${LISTRPMARGS} @${LISTNAMES}
# We do not not pass args for myhsh here...
# FIXME:
pack_src_rpm $COMMIT $(echo $LISTRPMARGS | sed -e "s|-[suUic]||g")
pack_src_rpm $COMMIT $(echo $LISTRPMARGS | sed -e "s|-[suUicl]||g")
# TODO: skip for prev. packed src.rpm
set_specdir $LISTNAMES
......@@ -100,9 +100,8 @@ 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 $RPMTOPDIR/SRPMS && time $ETERBUILDBIN/myhsh $MENVARG $LISTRPMARGS $LISTBUILT
time $ETERBUILDBIN/myhsh $MENVARG $LISTRPMARGS $LISTBUILT
RESULT=$?
cd -
date
echo "-------------------------------"
......@@ -110,12 +109,11 @@ fi
# make src.rpm if build OK and we have options for rpmbs
if [ "$RESULT" = "0" ] && [ -n "$LISTRPMARGS" ]; then
if is_gear $SPECDIR ; then
$ETERBUILDBIN/rpmbs $GIRARHOST $MENVARG $LISTRPMARGS $LISTNAMES
else
$ETERBUILDBIN/rpmbs $GIRARHOST $MENVARG $LISTRPMARGS $LISTBUILT
fi
if [ ! "$RESULT" = "0" ] || [ -z "$LISTRPMARGS" ]; then
exit $RESULT
fi
exit $RESULT
is_gear $SPECDIR && TSKLIST=$LISTNAMES || TSKLIST=$LISTBUILT
$ETERBUILDBIN/rpmbs $GIRARHOST $MENVARG $LISTRPMARGS $TSKLIST
......@@ -11,7 +11,7 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod rpm repl git
load_mod rpm repl git rpm
# path to ALT Linux's repositories
REPOSITORY="files/SRPMS obsolete orphaned"
......@@ -160,6 +160,7 @@ phelp()
echog " -c check if this package exists in the ALT Linux repository"
echog " -d download all matched packages"
echog " -g remote clone repo to USER/packages and clone it locally"
echog " -m migrate to gear from spec"
echog " -l list packages needed for build (in local pkg system notation) (experimental)"
echog " -n do not install after download, just download in current dir"
echog " -r refresh package list (download it again)"
......@@ -168,7 +169,7 @@ phelp()
}
TRYINST="1"
while getopts :habcdglnrs opt; do
while getopts :habcdglmnrs opt; do
case $opt in
h) phelp; exit 0;;
a) ALLSYSTEM=1 ;;
......@@ -177,6 +178,7 @@ while getopts :habcdglnrs opt; do
d) DOWNLOADALL=1 ;;
g) CLONEGIT=1 ;;
l) LISTREQS=1 ;;
m) MIGRATEGEAR=1 ;;
n) TRYINST="" ;;
r) UPDATECACHE=1 ;;
s) load_systems_list
......@@ -221,30 +223,48 @@ test -z "$LISTARGS" && fatal "Please run with spec/package name"
#
# - []
# install binary packages
# install required for build binary packages
if [ -n "$INSTALLBINARY" ] ; then
parse_cmd_pre "$@"
pack_src_rpm $LISTRPMARGS
echog "Running apt-get build-dep for install needed packages for $LISTBUILT"
# FIXME: ALT Specific
$SUDO apt-get build-dep $LISTBUILT
LISTPKG=$(rpmquery --requires -p $LISTBUILT | clean_pkgreq | sed -e "s|rpm-build-altlinux-compat||g")
DISTRVENDOR=$(distr_vendor -d)
CMD=$(get_install_package_command $DISTRVENDOR interactive)
echog "Running $SUDO $CMD $LISTPKG..."
$SUDO $CMD $LISTPKG
fi
if [ -n "$MIGRATEGEAR" ] ; then
parse_cmd_pre "$@"
pack_src_rpm $LISTRPMARGS
for PKGNAME in $LISTBUILT ; do
echo "Create gear repo"
GITALT=~/Projects/git-alt
GEARDIR=$GITALT/$BASENAME
test -d "$GEARDIR" && fatal "repo $GEARDIR already exits"
mkdir -p "$GEARDIR" || fatal "can't create dir $GEARDIR"
cd $GEARDIR || fatal "can't cd to $GEARDIR"
git init-db || fatal "can't init db"
gear-srpmimport $PKGNAME || fatal "can't import srpm $PKGNAME"
rm -vf $PKGNAME
done
exit 0
fi
# clone remote git
if [ -n "$CLONEGIT" ] ; then
PKGNAME=$1
INITLETTER=$(echo $PKGNAME | sed "s/^\(.\).*/\1/g")
INITLETTER=$(echo $PKGNAME | cut -c1)
# http://git.altlinux.org/srpms/N/NAME.git
echo "Remote clone from /srpms/$INITLETTER/$PKGNAME.git ..."
ssh $GIRARHOST clone /srpms/$INITLETTER/$PKGNAME.git packages/$PKGNAME.git || warning "Can't remote clone."
git clone git.alt:packages/$PKGNAME.git
if cd $PKGNAME ; then
CURRENTBRANCH=$(get_current_branch)
for i in $(git branch -a | grep "remotes/origin/.*[0-9]\$") ; do
for i in $(git branch -a | grep -v "/HEAD" | grep "remotes/origin/") ; do
git checkout -b $(echo $i | sed -e "s|remotes.*/||g") $i
done
git checkout $CURRENTBRANCH
git checkout sisyphus || git checkout master || git checkout $CURRENTBRANCH
cd - >/dev/null
fi
echo "See other repos at $GIRARHOST:"
......
......@@ -290,10 +290,11 @@ do
add_changelog_helper "- new version ($CURVER) $EGEARME" $i || echog "Changelog entry for $CURVER-$CURREL already exists"
fi
if [ -n "$GSSETVERSION" ] && is_gear ; then
CURNAME=$(get_tarballname $i)
CURNAME=$BASENAME
test -d "$CURNAME" || CURNAME=$(get_tarballname $i)
echo "Commit tarball $RPMSOURCEDIR/$FTB to git subdir '$CURNAME'..."
gear-update "$RPMSOURCEDIR/$FTB" "$CURNAME"
git commit -m "just import $(basename $RPMSOURCEDIR/$FTB)"
gear-update "$RPMSOURCEDIR/$FTB" "$CURNAME" && rm -f "$RPMSOURCEDIR/$FTB"
git commit -m "just import $(basename $RPMSOURCEDIR/$FTB) with rpmgs script"
else
is_gear && echo "Run without version. Skip tarball commiting."
fi
......
......@@ -40,10 +40,9 @@ test -e "$SPEC" || fatal "use with spec"
$ETERBUILDBIN/rpmgs $SPEC $VER || fatal "Error with get source"
add_changelog_helper "- new version $(get_version $SPEC) (with rpmrb script)" $SPEC || echog "Changelog entry already exists"
# TODO
if is_gear `pwd` ; then
#git diff $SPEC
git commit $SPEC -m "update spec to new build" || exit 1
git_commit_ignore_nothing $SPEC -m "update spec to new build $(get_version $SPEC) (with rpmrb script)" || exit 1
fi
$ETERBUILDBIN/rpmbsh $REMOTE -i $SPEC || fatal "Error with build in hasher"
......
Name: etersoft-build-utils
Version: 1.7.4
Version: 1.7.5
Release: alt1
Summary: A set of build rpm utilities
......@@ -64,6 +64,12 @@ RECOMMENDED packages: gcc-c++ perl-libwww ccache elinks mutt hasher curl
%config(noreplace) %_sysconfdir/eterbuild/repos
%changelog
* Fri Jan 22 2010 Vitaly Lipatov <lav@altlinux.ru> 1.7.5-alt1
- rpmbs/rpmbsh: add -l option for lazy-cleanup after build
- rpmgp: add -m option for migrate spec to gear support
- rpmgp: fix -b option (install buildreqs packages) to work in distro independent manner
- rpmgp: fix get remote branches and main branch selecting
* Thu Jan 14 2010 Vitaly Lipatov <lav@altlinux.ru> 1.7.4-alt1
- rpmbph: support for branches like 5.1 if exists, instead M51
- rpmgp: clone all branches locally
......
......@@ -3,7 +3,7 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
ETERBUILDVERSION=167
ETERBUILDVERSION=175
# SUDO
SUDO="sudo"
......
......@@ -62,3 +62,10 @@ list_git_package()
{
_list_git_package $(ssh $GIRARHOST find-package $1)
}
git_commit_ignore_nothing()
{
git commit "$@" && return
git commit "$@" 2>&1 | grep "nothing to commit" && return 0
return 1
}
......@@ -41,7 +41,7 @@ tolocal_anyrepl()
clean_pkgreq()
{
local i VAR
VAR=`cat`
VAR=`cat | sort -u`
for i in $VAR ; do
echo "$i" | egrep "gcc|cpp|gcc-c++" >/dev/null && continue
echo "$i" | grep "[()<=>]" >/dev/null && continue
......
......@@ -88,3 +88,31 @@ drop_pkg_extensions()
done
}
# distr_vendor [interactive]
get_install_package_command()
{
local DISTRVENDOR=$1
local INAC=$2
local CMD
local RET=0
case $DISTRVENDOR in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
[ -n "$INAC" ] && CMD="apt-get install" || CMD="apt-get -y --force-yes install"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
[ -n "$INAC" ] && CMD="yum install" || CMD="yum -y install"
;;
"Mandriva")
[ -n "$INAC" ] && CMD="urpmi --no-verify-rpm" || CMD="urpmi --auto --no-verify-rpm"
;;
"SUSE")
[ -n "$INAC" ] && CMD="zypper --non-interactive install" || CMD="yes | zypper --non-interactive install"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRVENDOR $DISTRVENDOR\""
;;
esac
echo $CMD
return $RET
}
#!/bin/sh
# see libshell
. shell-quote
test1()
{
echo "run with \'$@\'"
echo 1 - $1
echo 2 - $2
echo 3 - $3
test "$2" = "test string" || echo ERROR with $2
}
func()
{
#test1 "$(quote_shell "$@")"
cmd="$(quote_shell "$@")"
test1 "$cmd"
test1 "$@"
test1 $@
}
func -m "test string"
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