Commit dc79733c authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents abe71857 064ed423
rpmbsh -u rpmbs -s ( )
rpmgp -r git -
%name -
, gear-update
apt-cache list-extras
BuildArch: noarch
......
......@@ -8,7 +8,7 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/hasher
load_mod hasher
#############################
Usage="Usage: $name [-m -s -u -i -c] src.rpm..."
......@@ -22,7 +22,6 @@ phelp()
echog "$Descr"
echog "$Usage"
echog "Options:"
# echog " -m - mail result log"
echog " -s - sign package(s)"
echog " -u - sign and upload package(s) to Incoming"
echog " -i - install built packages in test hasher"
......@@ -32,7 +31,6 @@ phelp()
while getopts :hmic opt; do
case $opt in
h) phelp; exit 0;;
# m) fatal "Mail is disabled for this version" ; TOMAIL=1 ;;
i) TESTINSTALL=1;;
c) HASHERARG="--without-stuff $HASHERARG";;
+?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;;
......@@ -53,22 +51,6 @@ LISTRPMARGS=$@
parse_cmd_pre "$@"
mygetopts $LISTARGS
# Start as mail helper
function mail_build()
{
MUTT=mutt
which $MUTT &>/dev/null || return
$0 "$@" 2>&1 | $MUTT "$OWNERMAIL" -s "Result of rebuild at $HOSTNAME at `date`"
}
if [ -n "$TOMAIL" ]; then
echog "Build via email"
( mail_build $LISTNAMES $LISTARGS ) >/dev/null 2>&1 &
echog "Build request is accepted for: $LISTNAMES"
echog "Report will be sending to: $OWNERMAIL"
exit 0
fi
RESULT=0
HASHERDIR=$HASHERDIR$MENVARG
......
......@@ -9,8 +9,9 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm
. $ETERBUILDDIR/functions/repl
. load_mod rpm
. load_mod repl
. load_mod spec
dummy_spec()
{
......@@ -98,7 +99,7 @@ do
echog "cleanup_spec for $i..."
cleanup_spec $i
# convert from PLD's cases
# convert from PLD's cases
subst "s|%if %{with \(.*\)}|%if_with \1|g" $i
subst "s|%if %{without \(.*\)}|%if_without \1|g" $i
# replaces with and without too
......@@ -111,6 +112,10 @@ do
# For case if name was macros
test -n "$BASENAME" && set_var $i Name $BASENAME
# For case if version was macros
# set_version is major define safe
test -n "$VERSION" && set_version $i $VERSION
echog -n "fix obsoleted constructions..."
subst "s|Source0:|Source:|" $i
subst "s|Patch0:|Patch:|" $i
......
......@@ -38,6 +38,8 @@ list_systems()
for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do
printf "[%-17s] %s\n" ${SYSNAME[$i]} ${SYSURL[$i]}
done
echo
echo "You can add system to /etc/eterbuild/repos"
}
html_filter()
......@@ -74,6 +76,9 @@ get_list()
get_system_idx()
{
if [ -z "$1" ] ; then
return 1
fi
for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do
if [ ${SYSNAME[$i]} = "$1" ] ; then
echo $i
......@@ -106,77 +111,117 @@ check_name()
check_system()
{
local i
local IDX=$1
local URL=${SYSURL[$IDX]}
#echo "Check for $SYSTEM"
get_list $IDX $FORCEUPDATE
get_list $IDX
#ls -l $LIST
check_name $NAME && wget -c $URL/$NLIST
check_name $NAME
if [ "$DOWNLOADALL" ] ; then
for i in $NLIST ; do
wget -c $URL/$i
done
fi
}
update_cache_list()
{
load_systems_list
# if followed by system name
IDX=`get_system_idx "$1"`
if [ -n "$IDX" ] ; then
get_list $IDX force
shift
exit 0
fi
# update all systems
for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do
get_list $i force
done
}
if [ "$1" = "-h" ]; then
echog "Using:"
Usage="Usage: $name [options] [system] pkgname"
function mygetopts()
{
name=${0##*/}
Descr="$name - various package download operations"
phelp()
{
# TODO: improve description
echog "$Descr"
echog "$Usage"
echog "Options:"
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 " -b install packages needed for build (installs with sudo apt-get)"
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 " -r refresh package list (download it again)"
echog " -s lists all known systems"
exit 0
fi
}
TRYINST="1"
if [ "$1" = "-n" ] ; then
shift
TRYINST=""
fi
while getopts :habcdlnrs opt; do
case $opt in
h) phelp; exit 0;;
a) ALLSYSTEM=1 ;;
b) INSTALLBYNARY=1 ;;
c) CHECKONLINE=1 ;;
d) DOWNLOADALL=1 ;;
l) LISTREQS=1 ;;
n) TRYINST="" ;;
r) UPDATECACHE=1 ;;
s) load_systems_list
list_systems
exit 0
;;
+?) 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;
esac
done
# list systems
if [ "$1" = "-s" ] ; then
load_systems_list
list_systems
exit 0
# FIXME: (, -i, -b)
# remove args that were options
if [ $# -gt 0 ]; then
shift $((OPTIND - 1))
fi
# update cache list
if [ "$1" = "-r" ] ; then
load_systems_list
FORCEUPDATE=force
shift
# if followed by system name
IDX=`get_system_idx "$2"`
if [ -n "$IDX" ] ; then
get_list $IDX $FORCEUPDATE
shift
exit 0
fi
# pass other options to RPM:
LISTARGS=$@
}
mygetopts "$@"
# remove args that were options
if [ $# -gt 0 ]; then
shift $((OPTIND - 1))
fi
# check for all repos
if [ "$1" = "-a" ] ; then
ALLSYSTEM=1
shift
# optional arg
if [ -n "$UPDATECACHE" ] ; then
update_cache_list $1
exit 0
fi
test -z "$1" && fatal "Please run with spec/package name"
test -z "$LISTARGS" && fatal "Please run with spec/package name"
#
# , ( ?),
# -
#
#
# - []
# install binary packages
if [ "$1" = "-b" ] ; then
shift
if [ -n "$INSTALLBYNARY" ] ; then
parse_cmd_pre "$@"
pack_src_rpm $LISTRPMARGS
echog "Running apt-get for install needed packages for $LISTBUILT"
......@@ -188,16 +233,13 @@ if [ "$1" = "-b" ] ; then
fi
# lists packages for build
if [ "$1" = "-l" ] ; then
shift
if [ -n "$LISTREQS" ] ; then
print_target_buildreq $1
exit 0
fi
# Check online
if [ "$1" = "-c" ] ; then
shift
CHECKONLINE=1
if [ -n "$CHECKONLINE" ] ; then
if [ -f $1 ] ; then
build_rpms_name "$1"
SRCRPM=$NAMESRPMIN
......
......@@ -14,7 +14,12 @@ set_eterbuilddir()
# if run from no system installation
ETERBUILDDIR=$(realpath `dirname $0`/../share/eterbuild)
ETERBUILDETC=$(realpath `dirname $0`/../etc)
echo "Note: run from source tree, datadir=$ETERBUILDDIR, sysconfdir=$ETERBUILDETC"
if [ -r "$ETERBUILDETC/../AUTHORS" ] ; then
echo "Note: run from source tree, datadir=$ETERBUILDDIR, sysconfdir=$ETERBUILDETC"
else
ETERBUILDETC=/etc/eterbuild
ETERBUILDDIR=/usr/share/eterbuild
fi
fi
test -n "$ETERBUILDDIR"
# returns test result
......@@ -169,7 +174,9 @@ set_incoming()
add_changelog_helper()
{
# don't work sometime?
if ! tty -s && [ -z "$@" ] ; then
# TODO: fix with $@, single arg?
local DESC SPEC
if ! tty -s && [ -z "$DESC" ] ; then
echo "skip changelog fixing without tty"
return 1
fi
......
......@@ -97,7 +97,7 @@ build_rpms_name()
local BNS NSS
BNS="$BASENAME".spec
NSS=`basename $NAMESPEC`
test "$NSS" != "$BNS" && warning "BASENAME is not the same as NAMESPEC: $BNS against $SS"
test "$NSS" != "$BNS" && warning "Spec name ($NSS) is not equal to Name of package ($BNS)"
build_buildroot
}
......
......@@ -14,11 +14,11 @@ eval_spec()
{
# Hack: just print spec if -bE failed
# TODO: use rpm -showrc instead -bE for get main variables?
if is_alt ; then
$RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ || fatal "Check spec's fields"
else
#if is_alt ; then
# $RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ || fatal "Check spec's fields"
#else
$RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ 2>/dev/null || cat $1
fi
#fi
}
get_release()
......
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