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 apt-cache list-extras
BuildArch: noarch BuildArch: noarch
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# load common functions, compatible with local and installed script # load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common . `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/hasher load_mod hasher
############################# #############################
Usage="Usage: $name [-m -s -u -i -c] src.rpm..." Usage="Usage: $name [-m -s -u -i -c] src.rpm..."
...@@ -22,7 +22,6 @@ phelp() ...@@ -22,7 +22,6 @@ phelp()
echog "$Descr" echog "$Descr"
echog "$Usage" echog "$Usage"
echog "Options:" echog "Options:"
# echog " -m - mail result log"
echog " -s - sign package(s)" echog " -s - sign package(s)"
echog " -u - sign and upload package(s) to Incoming" echog " -u - sign and upload package(s) to Incoming"
echog " -i - install built packages in test hasher" echog " -i - install built packages in test hasher"
...@@ -32,7 +31,6 @@ phelp() ...@@ -32,7 +31,6 @@ phelp()
while getopts :hmic opt; do while getopts :hmic opt; do
case $opt in case $opt in
h) phelp; exit 0;; h) phelp; exit 0;;
# m) fatal "Mail is disabled for this version" ; TOMAIL=1 ;;
i) TESTINSTALL=1;; i) TESTINSTALL=1;;
c) HASHERARG="--without-stuff $HASHERARG";; c) HASHERARG="--without-stuff $HASHERARG";;
+?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;; +?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;;
...@@ -53,22 +51,6 @@ LISTRPMARGS=$@ ...@@ -53,22 +51,6 @@ LISTRPMARGS=$@
parse_cmd_pre "$@" parse_cmd_pre "$@"
mygetopts $LISTARGS 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 RESULT=0
HASHERDIR=$HASHERDIR$MENVARG HASHERDIR=$HASHERDIR$MENVARG
......
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
# load common functions, compatible with local and installed script # load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common . `dirname $0`/../share/eterbuild/functions/common
. $ETERBUILDDIR/functions/rpm . load_mod rpm
. $ETERBUILDDIR/functions/repl . load_mod repl
. load_mod spec
dummy_spec() dummy_spec()
{ {
...@@ -98,7 +99,7 @@ do ...@@ -98,7 +99,7 @@ do
echog "cleanup_spec for $i..." echog "cleanup_spec for $i..."
cleanup_spec $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 %{with \(.*\)}|%if_with \1|g" $i
subst "s|%if %{without \(.*\)}|%if_without \1|g" $i subst "s|%if %{without \(.*\)}|%if_without \1|g" $i
# replaces with and without too # replaces with and without too
...@@ -111,6 +112,10 @@ do ...@@ -111,6 +112,10 @@ do
# For case if name was macros # For case if name was macros
test -n "$BASENAME" && set_var $i Name $BASENAME 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..." echog -n "fix obsoleted constructions..."
subst "s|Source0:|Source:|" $i subst "s|Source0:|Source:|" $i
subst "s|Patch0:|Patch:|" $i subst "s|Patch0:|Patch:|" $i
......
...@@ -38,6 +38,8 @@ list_systems() ...@@ -38,6 +38,8 @@ list_systems()
for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do
printf "[%-17s] %s\n" ${SYSNAME[$i]} ${SYSURL[$i]} printf "[%-17s] %s\n" ${SYSNAME[$i]} ${SYSURL[$i]}
done done
echo
echo "You can add system to /etc/eterbuild/repos"
} }
html_filter() html_filter()
...@@ -74,6 +76,9 @@ get_list() ...@@ -74,6 +76,9 @@ get_list()
get_system_idx() get_system_idx()
{ {
if [ -z "$1" ] ; then
return 1
fi
for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do for ((i=0; i < ${#SYSNAME[*]}; i++)) ; do
if [ ${SYSNAME[$i]} = "$1" ] ; then if [ ${SYSNAME[$i]} = "$1" ] ; then
echo $i echo $i
...@@ -106,77 +111,117 @@ check_name() ...@@ -106,77 +111,117 @@ check_name()
check_system() check_system()
{ {
local i
local IDX=$1 local IDX=$1
local URL=${SYSURL[$IDX]} local URL=${SYSURL[$IDX]}
#echo "Check for $SYSTEM" #echo "Check for $SYSTEM"
get_list $IDX $FORCEUPDATE get_list $IDX
#ls -l $LIST #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 Usage="Usage: $name [options] [system] pkgname"
echog "Using:" 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 "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 " name - installed package name or src.rpm"
echog " system - name of system (ALT Linux by default if -a missed too)" echog " system - name of system (ALT Linux by default if -a missed too)"
echog " -a check for pkgname in all known repositories" 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 " -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 " -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 " -n do not install in RPM after download, download in current dir"
echog " -r refresh package list (download it again)" echog " -r refresh package list (download it again)"
echog " -s lists all known systems" echog " -s lists all known systems"
exit 0 exit 0
fi }
TRYINST="1" TRYINST="1"
if [ "$1" = "-n" ] ; then while getopts :habcdlnrs opt; do
shift case $opt in
TRYINST="" h) phelp; exit 0;;
fi 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 # FIXME: (, -i, -b)
if [ "$1" = "-s" ] ; then # remove args that were options
load_systems_list if [ $# -gt 0 ]; then
list_systems shift $((OPTIND - 1))
exit 0
fi fi
# update cache list # pass other options to RPM:
if [ "$1" = "-r" ] ; then LISTARGS=$@
load_systems_list }
FORCEUPDATE=force
shift mygetopts "$@"
# if followed by system name
IDX=`get_system_idx "$2"` # remove args that were options
if [ -n "$IDX" ] ; then if [ $# -gt 0 ]; then
get_list $IDX $FORCEUPDATE shift $((OPTIND - 1))
shift
exit 0
fi
fi fi
# check for all repos # optional arg
if [ "$1" = "-a" ] ; then if [ -n "$UPDATECACHE" ] ; then
ALLSYSTEM=1 update_cache_list $1
shift exit 0
fi fi
test -z "$1" && fatal "Please run with spec/package name" test -z "$LISTARGS" && fatal "Please run with spec/package name"
#
# , ( ?), # , ( ?),
# - # -
# #
# #
# - [] # - []
# install binary packages # install binary packages
if [ "$1" = "-b" ] ; then if [ -n "$INSTALLBYNARY" ] ; then
shift
parse_cmd_pre "$@" parse_cmd_pre "$@"
pack_src_rpm $LISTRPMARGS pack_src_rpm $LISTRPMARGS
echog "Running apt-get for install needed packages for $LISTBUILT" echog "Running apt-get for install needed packages for $LISTBUILT"
...@@ -188,16 +233,13 @@ if [ "$1" = "-b" ] ; then ...@@ -188,16 +233,13 @@ if [ "$1" = "-b" ] ; then
fi fi
# lists packages for build # lists packages for build
if [ "$1" = "-l" ] ; then if [ -n "$LISTREQS" ] ; then
shift
print_target_buildreq $1 print_target_buildreq $1
exit 0 exit 0
fi fi
# Check online # Check online
if [ "$1" = "-c" ] ; then if [ -n "$CHECKONLINE" ] ; then
shift
CHECKONLINE=1
if [ -f $1 ] ; then if [ -f $1 ] ; then
build_rpms_name "$1" build_rpms_name "$1"
SRCRPM=$NAMESRPMIN SRCRPM=$NAMESRPMIN
......
...@@ -14,7 +14,12 @@ set_eterbuilddir() ...@@ -14,7 +14,12 @@ set_eterbuilddir()
# if run from no system installation # if run from no system installation
ETERBUILDDIR=$(realpath `dirname $0`/../share/eterbuild) ETERBUILDDIR=$(realpath `dirname $0`/../share/eterbuild)
ETERBUILDETC=$(realpath `dirname $0`/../etc) 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 fi
test -n "$ETERBUILDDIR" test -n "$ETERBUILDDIR"
# returns test result # returns test result
...@@ -169,7 +174,9 @@ set_incoming() ...@@ -169,7 +174,9 @@ set_incoming()
add_changelog_helper() add_changelog_helper()
{ {
# don't work sometime? # 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" echo "skip changelog fixing without tty"
return 1 return 1
fi fi
......
...@@ -97,7 +97,7 @@ build_rpms_name() ...@@ -97,7 +97,7 @@ build_rpms_name()
local BNS NSS local BNS NSS
BNS="$BASENAME".spec BNS="$BASENAME".spec
NSS=`basename $NAMESPEC` 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 build_buildroot
} }
......
...@@ -14,11 +14,11 @@ eval_spec() ...@@ -14,11 +14,11 @@ eval_spec()
{ {
# Hack: just print spec if -bE failed # Hack: just print spec if -bE failed
# TODO: use rpm -showrc instead -bE for get main variables? # TODO: use rpm -showrc instead -bE for get main variables?
if is_alt ; then #if is_alt ; then
$RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ || fatal "Check spec's fields" # $RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ || fatal "Check spec's fields"
else #else
$RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ 2>/dev/null || cat $1 $RPMBUILD -bE --target $DEFAULTARCH $RPMBUILDARG $@ 2>/dev/null || cat $1
fi #fi
} }
get_release() 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