Commit 1ece2c1f authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

Conflicts: NEWS bin/rpmbs bin/rpmcs etersoft-build-utils.spec share/eterbuild/functions/common share/eterbuild/functions/config share/eterbuild/functions/rpm
parents 166b3be3 d4110035
......@@ -4,18 +4,23 @@ etersoft-build-utils-1.5.3: 04 Jan 2009
- cleanup code, remove obsoleted mailing code
- rpmgp: use getopt, add -d options for download package (list only by default)
etersoft-build-utils-1.5.2: 11 Dec 2008
etersoft-build-utils-1.5.2: 13 Dec 2008
- fix using from other projects
- add get_version, fix inc_release, inc_subrelease
- disable annoyed Target distro (use VERBOSE=1)
- clean up code (thanks Slava Semushin for comments)
- myhsh: disable -x (trace info)
- fix rpmbb -r (buildreq) with git
- cleanup code
- fix comment about different specs
- rewrite rpmgp: use getopt, add -d options for download package
- use gear via vars, do not require it
- fix set tag in rpmbs
etersoft-build-utils-1.5.1: 06 Dec 2008
- APTCONF sets used apt.conf if defined
- add support for x86_64 build with generic i586 sources.list
- set git tag during rpmbs -s
- set git tag during rpmbs -s / -u
- fix release checking in universal manner
- skip sisyphus_check if build from git
- update QuickHelp, remove unneeded comments
......
......@@ -21,7 +21,6 @@ Usage: [-t -i -h -r] bin.rpm...
---------------------------
Warning: Can't get topdir from Makefile.in
---------------------------
......@@ -90,13 +89,16 @@ rpmcs spec - cleanup spec (like cleanup_spec command), adapted to ALT
---------------------------
Using:
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
name - src.rpm
system - name of system (ALT Linux by default if -a missed too)
-a check for pkgname in all known repositories
-b install packages needed for build (installs with sudo apt-get) (need spec not package name)
-c check for exist the package in ALT Linux repository
-b install packages needed for build (installs with sudo apt-get)
-d download all matches packages from all repositories
-l lists packages needed for build (in local pkg system notation) (experimental)
-n do not install in RPM after download, download in current dir
-r refresh package list (download it again)
......
......@@ -21,7 +21,6 @@ Options:
---------------------------
Warning: Can't get topdir from Makefile.in
---------------------------
......@@ -90,13 +89,16 @@ rpmcs spec - cleanup spec (like cleanup_spec command), adapted to ALT
---------------------------
Using:
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
name - installed package name or src.rpm
system - name of system (ALT Linux by default if -a missed too)
-a check for pkgname in all known repositories
-b install packages needed for build (installs with sudo apt-get) (need spec not package name)
-c check for exist the package in ALT Linux repository
-b install packages needed for build (installs with sudo apt-get)
-d download all matches packages from all repositories
-l lists packages needed for build (in local pkg system notation) (experimental)
-n do not install in RPM after download, download in current dir
-r refresh package list (download it again)
......
......@@ -103,6 +103,8 @@ $HSH-install $HASHERDIR $UTILPKG $LISTRPMARGS $LISTNAMES || fatal "Error with in
echog "You are in hasher shell"
$HSH-shell $HASHERDIR -Y --shell
if [ -n "$TESTMODE" ] ; then
echo "Remove package for test preun scripts"
$HSH-run --rooter $HASHERDIR -- rpm -e $(drop_pkg_extensions $LISTNAMES)
echo "Cleanup hasher..."
$HSH --cleanup-only $HASHERDIR
fi
......
......@@ -194,7 +194,7 @@ $BUILDCOMMAND $LISTRPMARGS $REMOTEBUILD $DISTRARG $SPECNAME || fatal "Can't buil
#############################
Usage="Usage: $name [-r -u -U -n -i -m -v] spec..."
Usage="Usage: $name [-r -u -U -n -i -m -v] [-M??] spec..."
function mygetopts()
{
name=${0##*/}
......@@ -204,6 +204,7 @@ phelp()
{
echog "$Descr"
echog "$Usage"
echo "Use rpmbph -M40 for backport to ALT 4.0 and so on"
echog "Options:"
echog " -r - remote build"
# echog " -m - send result via e-mail"
......
......@@ -151,15 +151,34 @@ if [ -n "${DELETENOW}" ]; then
exit 0
fi
if [ -n "$SIGN" ]; then
release_check $LISTBUILT
check_gear()
{
local GEARCTAG=gear-create-tag
# create tag according to package release
if is_git $SPECDIR ; then
local GEARCTAG=gear-create-tag
# needed correct user.name/user.email for get GPG id
# workaround about spaces in LISTNAMES
if [ -r "$(echo $LISTNAMES)" ] ; then
#echo wait SPECDIR from rpmbsh
#echo 1 $SPECDIR
[ -n "$SPECDIR" ] || SPECDIR=`dirname $LISTNAMES`
#echo 2 $SPECDIR
#pwd
fi
if is_gear $SPECDIR ; then
# needed corrent user.name/user.email for get GPG id
pushd $SPECDIR
$GEARCTAG --force
popd
# git push ?
fi
}
if [ -n "$SIGN" ]; then
release_check $LISTBUILT
# workaround about spaces in LISTBUILT
if [ -r "$(echo $LISTBUILT)" ] ; then
echo if one spec, check gear
check_gear
fi
echog "Will try to sign follow packages with GPG: \$LISTBUILT"
cd $RPMDIR/SRPMS
# 1. only rpm command has --addsign 2. do 3 retries
......
......@@ -72,6 +72,15 @@ add_changelog_helper "- new version" $LISTNAMES
# FIXME:
pack_src_rpm $(echo $LISTRPMARGS | sed -e "s|-[suUic]||g")
# Hack to pass SPECDIR to rpmbs
# workaround about spaces in LISTNAMES
if [ -r "$(echo $LISTNAMES)" ] ; then
export SPECDIR=`dirname $LISTNAMES`
#echo 0 $SPECDIR
if [ "$SPECDIR" = "." ] ; then
SPECDIR=$(pwd)
fi
fi
if [ -n "$REMOTEBUILD" ] ; then
check_key
......
......@@ -94,11 +94,11 @@ check_name()
exit 1
fi
NLIST=`cat $LIST | grep -i $1`
if [ `cat $LIST | list_filter | grep -i $1 | wc -l` -gt 1 ] ; then
# if [ `cat $LIST | list_filter | grep -i $1 | wc -l` -gt 1 ] ; then
#echo "Please type a full name of the package"
print_list $NLIST
return 1
fi
# print_list $NLIST
# return 1
# fi
if [ -z "$NLIST" ] ; then
echo "$1: Not found"
......@@ -155,14 +155,14 @@ phelp()
echog "rpmgp [-a -c -n] [system] pkgname - download src.rpm from 'system' repository to RPM/SRPMS and install it"
echog " name - installed package name or src.rpm"
echog " system - name of system (ALT Linux by default if -a missed too)"
echog " -a check for pkgname in all known repositories"
echog " -b install packages needed for build (installs with sudo apt-get) (need spec not package name)"
echog " -c check for exist the package in ALT Linux repository"
echog " -d download all matches packages from all repositories"
echog " -l lists packages needed for build (in local pkg system notation) (experimental)"
echog " -n do not install in RPM after download, download in current dir"
echog " -a search pkgname in all known repositories"
echog " -b install packages needed for build (use sudo apt-get) (need spec not package name)"
echog " -c check if this package exists in the ALT Linux repository"
echog " -d download all matched packages"
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)"
echog " -s lists all known systems"
echog " -s list all known remote repositories"
exit 0
}
......@@ -171,7 +171,7 @@ while getopts :habcdlnrs opt; do
case $opt in
h) phelp; exit 0;;
a) ALLSYSTEM=1 ;;
b) INSTALLBYNARY=1 ;;
b) INSTALLBINARY=1 ;;
c) CHECKONLINE=1 ;;
d) DOWNLOADALL=1 ;;
l) LISTREQS=1 ;;
......@@ -220,7 +220,7 @@ test -z "$LISTARGS" && fatal "Please run with spec/package name"
# - []
# install binary packages
if [ -n "$INSTALLBYNARY" ] ; then
if [ -n "$INSTALLBINARY" ] ; then
parse_cmd_pre "$@"
pack_src_rpm $LISTRPMARGS
echog "Running apt-get for install needed packages for $LISTBUILT"
......@@ -256,6 +256,11 @@ if [ -n "$CHECKONLINE" ] ; then
exit 0
fi
if [ -n "$2" ] && [ "$1" = "all" ] ; then
shift
ALLSYSTEM=1
fi
# Check concrete system
# two params: system, package
if [ -n "$2" ] ; then
......@@ -264,6 +269,7 @@ if [ -n "$2" ] ; then
IDX=`get_system_idx "$1"`
if [ -n "$IDX" ] ; then
check_system $IDX
print_list $NLIST
else
#fatal "Unknown system '$1', use rpmgp -s for get list"
NAME=
......@@ -280,6 +286,7 @@ if [ -n "$ALLSYSTEM" ] ; then
for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do
echo
check_system $i
print_list $NLIST
done
exit 0
fi
......
Name: etersoft-build-utils
Version: 1.5.2
Version: 1.5.3
Release: alt1
Summary: A set of build rpm utilities
......@@ -60,11 +60,16 @@ RECOMMENDED packages: gcc-c++ perl-libwww ccache elinks mutt hasher curl
%config(noreplace) %_sysconfdir/eterbuild/repos
%changelog
* Sun Jan 04 2009 Vitaly Lipatov <lav@altlinux.ru> 1.5.2-alt1
* Sun Jan 04 2009 Vitaly Lipatov <lav@altlinux.ru> 1.5.3-alt1
- add IGNOREGEAR env var support
- detect package arch from spec
- rpmgp: use getopt, add -d options for download package (list only by default)
* Sat Dec 13 2008 Vitaly Lipatov <lav@altlinux.ru> 1.5.2-alt1
- really 1.5.2, cleanup code
- rewrite rpmgp: use getopt, add -d options for download package
- use gear via vars, do not require it
* Thu Dec 11 2008 Vitaly Lipatov <lav@altlinux.ru> 1.5.1-alt2
- add get_version, fix inc_release, inc_subrelease
- clean up code (thanks Slava Semushin for comments)
......
......@@ -59,6 +59,34 @@ is_alt()
return $?
}
# Obsoleted:
# TODO: check for .gear, not .git?
is_git()
{
local DIR=$1
[ -n "$DIR" ] && [ -d "$DIR/.git" ] && return 0
[ -d ".git" ] && return 0
# hack for support spec in some subdir
[ -d "../.gear" ] && return 0
return 1
}
is_gear()
{
local DIR=$1
[ -n "$DIR" ] && [ -d "$DIR/.gear" ] && return 0
[ -d ".gear" ] && return 0
# compat
[ -n "$DIR" ] && [ -r "$DIR/.gear-rules" ] && return 0
[ -r ".gear-rules" ] && return 0
# hack for support spec in some subdir
[ -d "../.gear" ] && return 0
return 1
}
if [ "$UID" = "0" ] ; then
fatal "It is strict recommended do not use these scripts as root"
fi
......@@ -204,3 +232,17 @@ add_changelog_helper()
return $R
}
make_temp_file()
{
# Workaround about broken mktemp
if mktemp -V >/dev/null 2>/dev/null ; then
mktemp || exit 1
else
mktemp /tmp/$1.XXXXXX || exit 1
fi
}
load_mod()
{
. $ETERBUILDDIR/functions/$1
}
......@@ -21,20 +21,6 @@ OURTMPDIR=$TMPDIR
NICE="nice"
RPMBUILD=rpmbuild
# TODO: check for .gear, not .git?
is_git()
{
local DIR=$1
[ -n "$IGNOREGEAR" ] && return 1
[ -n "$DIR" ] && [ -d "$DIR/.git" ] && return 0
[ -n "$DIR" ] && [ -d "$DIR/.gear" ] && return 0
[ -d ".git" ] && return 0
[ -d ".gear" ] && return 0
# hack for support spec in some subdir
[ -d "../.gear" ] && return 0
return 1
}
RPMDIR="$HOME/RPM"
[ -n "$APTCONFBASE" ] || APTCONFBASE=$ETERBUILDETC/apt/apt.conf
......
......@@ -3,10 +3,9 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# 20.07.08
# Obsoleted code (use for publish from CVS repositories only)
############# Project build & publish section ##############################
# Use only it this order:
# Note: Use only it this order
# Update from CVS
update_from_cvs()
......
......@@ -55,31 +55,38 @@ print_pkgreq()
eval_spec ${1} | grep "Requires" | sed -e "s|^.*:||g" | clean_pkgreq
}
print_pkgrepl_list()
# internal
print_replbased_list()
{
local REPLBASE=$PKGREPLBASE/pkgrepl.
# VENDOR, TARGET is defined in detect_target_env() func
local REPLBASE="$1"
# VENDOR, TARGET is already defined in detect_target_env() func
[ -z "$DISTRVERSION" ] && DISTRVERSION=`distr_vendor -v`
# Get list of replacement rules files
#[ -r "$REPLBASE$VENDOR.$DISTRVERSION" ] &&
echo -n "$REPLBASE$VENDOR.$DISTRVERSION $REPLBASE$VENDOR "
#[ -r "$REPLBASE$VENDOR" ] &&
echo -n "$REPLBASE$VENDOR "
[ "$VENDOR" != "alt" ] && echo -n "$REPLBASE$TARGET"
}
print_grprepl_list()
# TODO: list in alph. order and use if <= then our version
print_pkgrepl_list()
{
local REPLBASE=$PKGREPLBASE/../grprepl/grprepl.
print_replbased_list $PKGREPLBASE/pkgrepl.
}
# VENDOR, TARGET is defined in detect_target_env() func
[ -z "$DISTRVERSION" ] && DISTRVERSION=`distr_vendor -v`
# Get list of replacement rules files
echo -n "$REPLBASE$VENDOR.$DISTRVERSION $REPLBASE$VENDOR "
[ "$VENDOR" != "alt" ] && echo -n "$REPLBASE$TARGET"
print_grprepl_list()
{
print_replbased_list $PKGREPLBASE/../grprepl/grprepl.
}
# Prints out buildreqs in target notation for SPEC
# Prints out buildreqs in target notation for SPEC (1st arg)
print_target_buildreq()
{
local i
# Build list in target ($VENDOR) notation for package's buildreqs
for i in `print_buildreq ${1}` ; do
# get target name or just print out original one
......
......@@ -75,20 +75,17 @@ build_rpms_name()
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
tmprpm=`make_temp_file $NAME`
# Optimization
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.*")
BASENAME=$(cat $tmprpm | get_var "Name")
RELEASE=$(cat $tmprpm | get_var "Release")
VERSION=$(cat $tmprpm | get_var "Version")
TARBALLNAME=$(cat $tmprpm | get_var "Source.*")
[ -n "$TARBALLNAME" ] && TARBALLNAME=$(basename $TARBALLNAME)
PKGARCH=$($CATSPEC | get_var "BuildArch")
PKGARCH=$(cat $tmprpm | get_var "BuildArch")
if [ "$PKGARCH" != "noarch" ] ; then
PKGARCH=$DEFAULTARCH
fi
......@@ -97,6 +94,8 @@ build_rpms_name()
#RPMSOURCEDIR=$RPMDIR/SOURCES
RPMSOURCEDIR=`rpm --eval %_sourcedir | subst_namever`
[ -n "$RPMSOURCEDIR" ] || fatal "Can't detect RPM/SOURCES dir"
local BNS NSS
BNS="$BASENAME".spec
NSS=`basename $NAMESPEC`
......@@ -152,7 +151,7 @@ test -z "$LISTBUILT" && fatal "Error: List for build is empty. Check if file is
}
# build binary package list (1st - repo dir, 2st - pkgname
function get_binpkg_list()
get_binpkg_list()
{
local PKGDIR=$1
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
......@@ -160,6 +159,12 @@ function get_binpkg_list()
| grep "^$2[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo "$PKGDIR/{} "
}
drop_pkg_extensions()
{
for i in $@ ; do
echo -n "$(basename $i) " | sed -e "s|\.[a-z0-9]*\.rpm||g"
done
}
check_log()
{
......
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod repl
# : - .*
#
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$2' do not match with '$3'" || echo "OK for '$1' with '$2'"
}
get_pkglist()
{
VENDOR=Fedora
TARGET=rpm
DISTRVERSION=10
for i in `print_pkgrepl_list` ; do
echo $(basename $i)
done
}
get_grplist()
{
VENDOR=Fedora
TARGET=rpm
DISTRVERSION=10
for i in `print_grprepl_list` ; do
echo $(basename $i)
done
}
echo "PkgRepl:"
get_pkglist
echo
check pkgrepl "fedora" `get_pkglist`
echo "GrpRepl:"
get_grplist
echo
#!/bin/sh
# copy specs to separate tree, make rpmcs and printout diff
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
SPECLIST=`find $RPMDIR/SPECS -type f -name "*.spec"`
for i in $SPECLIST ; do
if echo $i | grep -q HELP ; then
continue
fi
LANG=C rpmgp -c $i 2>&1 | grep -v "^Note" | grep -v "^Checking" | grep -v "^Repository"
done
# | xargs -n 1 rpmcs 2>&1 | tee $0.r.out
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