Commit 78db5e89 authored by Vitaly Lipatov's avatar Vitaly Lipatov

define DISTRNAME and DISTRVERSION globally and use it

parent dcc8603f
#!/bin/bash #!/bin/bash
# 2003-2010 (c) Etersoft www.etersoft.ru # 2003-2010, 2012 (c) Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
# #
# BPH - backport; use hasher # BPH - backport; use hasher
# Used ROOTDIR if defined
# Makes backport package to any target platfrom (RPM, DEB, TGZ) # Makes backport package to any target platfrom (RPM, DEB, TGZ)
# Релиз строится на основе релиза из Сизифа. Если там был alt4 # Релиз строится на основе релиза из Сизифа. Если там был alt4, то здесь будет alt0.M24.4
# то здесь будет alt0.M24.4
# TODO: use RPMBUILDARG # TODO: use RPMBUILDARG
# 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
load_mod repl rpm git buildsrpm load_mod repl rpm git buildsrpm
DISTRVERSION=`$DISTRVENDOR -v`
altspec_to_local() altspec_to_local()
{ {
local i local i
...@@ -50,8 +48,8 @@ if [ "$VENDOR" = "alt" ] ; then ...@@ -50,8 +48,8 @@ if [ "$VENDOR" = "alt" ] ; then
%undefine __libtoolize" %undefine __libtoolize"
fi fi
else else
# Hack for repack on x86_64 packages with ExclusiveArch: %{ix586} # Hack for allow repack on x86_64 packages with ExclusiveArch: %{ix586}
subst "s|^ExclusiveArch:.*||g" $SPECNAME [ "$SYSARCH" = "x86_64" ] && subst "s|^ExclusiveArch:.*||g" $SPECNAME
# Need our compat package and disable strong patch checking # Need our compat package and disable strong patch checking
BUILDREQ="BuildRequires: rpm-build-altlinux-compat >= 0.95 make gcc\n$FIXPATCHFUZZ" BUILDREQ="BuildRequires: rpm-build-altlinux-compat >= 0.95 make gcc\n$FIXPATCHFUZZ"
[ -z "$BUILDCOMMAND" ] && BUILDCOMMAND=$ETERBUILDBIN/rpmbb [ -z "$BUILDCOMMAND" ] && BUILDCOMMAND=$ETERBUILDBIN/rpmbb
...@@ -79,10 +77,8 @@ fi ...@@ -79,10 +77,8 @@ fi
# Do not add BuildReq if already exist # Do not add BuildReq if already exist
cat $SPECNAME | grep rpm-build-compat &>/dev/null && BUILDREQ="" cat $SPECNAME | grep rpm-build-compat &>/dev/null && BUILDREQ=""
DISTRSYS="$($DISTRVENDOR -d)"
# fix readlink -m, introduced by new libtool and missed in RHEL4 (replace with readlink -f) # fix readlink -m, introduced by new libtool and missed in RHEL4 (replace with readlink -f)
if [ "$DISTRSYS/$DISTRVERSION" = "ASPLinux/11.2" ] ; then if [ "$DISTRNAME/$DISTRVERSION" = "ASPLinux/11.2" ] ; then
test -z "$VERBOSE" || echo "Add subst readlink -m" test -z "$VERBOSE" || echo "Add subst readlink -m"
ADDFIXCOMMAND="$ADDFIXCOMMAND ADDFIXCOMMAND="$ADDFIXCOMMAND
%__subst 's|readlink -m|readlink -f|g' libtool ltmain.sh" %__subst 's|readlink -m|readlink -f|g' libtool ltmain.sh"
...@@ -97,6 +93,7 @@ fi ...@@ -97,6 +93,7 @@ fi
# FIXME HACK need only for wine on x86_64 # FIXME HACK need only for wine on x86_64
#if [ "$DISTRSYS" = "Ubuntu" ] || [ "$DISTRSYS" = "Debian" ]; then #if [ "$DISTRSYS" = "Ubuntu" ] || [ "$DISTRSYS" = "Debian" ]; then
# FIXME: add BUILDARCH using
if echo $SPECNAME | grep -q wine ; then if echo $SPECNAME | grep -q wine ; then
test -z "$VERBOSE" || echo "Add remove_optflags -m64" test -z "$VERBOSE" || echo "Add remove_optflags -m64"
ADDFIXCOMMAND="$ADDFIXCOMMAND ADDFIXCOMMAND="$ADDFIXCOMMAND
...@@ -130,8 +127,6 @@ LISTGROUP=`eval_spec $SPECNAME | grep Group | sed -e "s|^.*:||g" | xargs -n1 ec ...@@ -130,8 +127,6 @@ LISTGROUP=`eval_spec $SPECNAME | grep Group | sed -e "s|^.*:||g" | xargs -n1 ec
ALLREPLRULES="" ALLREPLRULES=""
[ -n "$VERBOSE" ] && echo "Checking req names for $LISTDEP" [ -n "$VERBOSE" ] && echo "Checking req names for $LISTDEP"
export DISTRVERSION
if [ -n "$VERBOSE" ] ; then if [ -n "$VERBOSE" ] ; then
echo -n "Use replacement file: " echo -n "Use replacement file: "
print_pkgrepl_list print_pkgrepl_list
...@@ -239,7 +234,7 @@ else ...@@ -239,7 +234,7 @@ else
subst "s|^popd|cd - >/dev/null|g" $SPECNAME subst "s|^popd|cd - >/dev/null|g" $SPECNAME
fi fi
if [ "$DISTRSYS/$DISTRVERSION" = "CentOS/5" ] ; then if [ "$DISTRNAME/$DISTRVERSION" = "CentOS/5" ] ; then
test -z "$VERBOSE" || echo "Remove egg-info from file list" test -z "$VERBOSE" || echo "Remove egg-info from file list"
subst "s|.*\.egg-info.*||g" $SPECNAME subst "s|.*\.egg-info.*||g" $SPECNAME
fi fi
...@@ -263,12 +258,12 @@ if [ "$VENDOR" = "alt" ] ; then ...@@ -263,12 +258,12 @@ if [ "$VENDOR" = "alt" ] ; then
export USE_LEGACY_COMPRESSION=1 export USE_LEGACY_COMPRESSION=1
fi fi
subst "1i# This spec is backported to $DISTRSYS $DISTRVERSION automatically by rpmbph script. Do not edit it." $SPECNAME subst "1i# This spec is backported to $DISTRNAME $DISTRVERSION automatically by rpmbph script. Do not edit it." $SPECNAME
ENTRY="- backport to $DISTRSYS $DISTRVERSION (by rpmbph script)" ENTRY="- backport to $DISTRNAME $DISTRVERSION (by rpmbph script)"
DISTRARG="-$MDISTR" DISTRARG="-$MDISTR"
else else
subst "1i# This spec is autoported from ALT Linux Sisyphus to $DISTRSYS $DISTRVERSION automatically by rpmbph script. Do not edit it." $SPECNAME subst "1i# This spec is autoported from ALT Linux Sisyphus to $DISTRNAME $DISTRVERSION automatically by rpmbph script. Do not edit it." $SPECNAME
ENTRY="- autoport to $DISTRSYS $DISTRVERSION (by rpmbph script)" ENTRY="- autoport to $DISTRNAME $DISTRVERSION (by rpmbph script)"
export USE_VENDOR=$RPMVENDOR export USE_VENDOR=$RPMVENDOR
export USE_LEGACY_COMPRESSION=1 export USE_LEGACY_COMPRESSION=1
DISTRARG="" DISTRARG=""
...@@ -304,6 +299,7 @@ phelp() ...@@ -304,6 +299,7 @@ phelp()
echog " -r remote build" # will pass to rpmbs/rpmbsh echog " -r remote build" # will pass to rpmbs/rpmbsh
echog " -v more verbose" echog " -v more verbose"
echog " -q quiet" echog " -q quiet"
echog "Set ROOTDIR variable for backport to the other system"
# echog " -m - send result via e-mail" # echog " -m - send result via e-mail"
} }
......
...@@ -238,7 +238,7 @@ if [ -n "$INSTALLBINARY" ] ; then ...@@ -238,7 +238,7 @@ if [ -n "$INSTALLBINARY" ] ; then
# pack by LISTNAMES list # pack by LISTNAMES list
pack_src_rpm --commit $LISTRPMARGS pack_src_rpm --commit $LISTRPMARGS
LISTPKG=$(rpmquery --requires -p $LISTBUILT | clean_pkgreq | sed -e "s|rpm-build-altlinux-compat||g" | sed -e "s|gcc-c++||g") LISTPKG=$(rpmquery --requires -p $LISTBUILT | clean_pkgreq | sed -e "s|rpm-build-altlinux-compat||g" | sed -e "s|gcc-c++||g")
CMD=$(get_install_package_command `$DISTRVENDOR -d` interactive) CMD=$(get_install_package_command $DISTRNAME interactive)
docmd $SUDO $CMD $LISTPKG docmd $SUDO $CMD $LISTPKG
exit exit
fi fi
......
...@@ -53,7 +53,7 @@ real_file() ...@@ -53,7 +53,7 @@ real_file()
real_file "$1" real_file "$1"
case "$($DISTRVENDOR -p)" in case $TARGET in
"rpm") "rpm")
rpmquery -f $ARG "$FULLFILEPATH" rpmquery -f $ARG "$FULLFILEPATH"
;; ;;
......
...@@ -148,10 +148,12 @@ if [ -n "$NEEDETERBUILD" ] ; then ...@@ -148,10 +148,12 @@ if [ -n "$NEEDETERBUILD" ] ; then
fi fi
# Internal # Internal
# Detect distro name / vendor according to ROOTDIR system or current system
detect_target_env() detect_target_env()
{ {
local DISTRNAME=$($DISTRVENDOR -e)
MENVARG="" MENVARG=""
DISTRNAME=$($DISTRVENDOR -d)
DISTRVERSION=$($DISTRVENDOR -v)
TARGET=$($DISTRVENDOR -p) TARGET=$($DISTRVENDOR -p)
VENDOR=$($DISTRVENDOR -s) VENDOR=$($DISTRVENDOR -s)
RPMVENDOR=$($DISTRVENDOR -n) RPMVENDOR=$($DISTRVENDOR -n)
...@@ -164,7 +166,7 @@ if [ "$VENDOR" = "alt" ] && [ -n "$MENV" ] ; then ...@@ -164,7 +166,7 @@ if [ "$VENDOR" = "alt" ] && [ -n "$MENV" ] ; then
MENVARG="-$MENV" MENVARG="-$MENV"
else else
# FIXME: echog breaks vars # FIXME: echog breaks vars
echog "Distribution: \$DISTRNAME (\$VENDOR) (target package: \$TARGET)" echog "Distribution: \$DISTRNAME/\$DISTRVERSION (\$VENDOR) (target package: \$TARGET)"
fi fi
} }
......
...@@ -7,6 +7,8 @@ PKGREPLBASE=$ETERBUILDDIR/pkgrepl ...@@ -7,6 +7,8 @@ PKGREPLBASE=$ETERBUILDDIR/pkgrepl
# Get replacement rule for ALT package to local in $1 (scan for files in $@) # Get replacement rule for ALT package to local in $1 (scan for files in $@)
# set ALTPKGNAME, TARGETPKGNAME variable # set ALTPKGNAME, TARGETPKGNAME variable
# used: TARGET, VENDOR, DEFAULTARCH
# FIXME: BUILDARCH?
tolocal_anyrepl() tolocal_anyrepl()
{ {
local i REPLRULE WARULES local i REPLRULE WARULES
...@@ -79,6 +81,7 @@ print_grpreq() ...@@ -79,6 +81,7 @@ print_grpreq()
eval_spec ${1} | grep "^Group" | sed -e "s|^.*:||g" | sort -u | filter_strip_spaces eval_spec ${1} | grep "^Group" | sed -e "s|^.*:||g" | sort -u | filter_strip_spaces
} }
# VENDOR, TARGET, DISTRVERSION is already defined in detect_target_env() func
internal_repl_list() internal_repl_list()
{ {
local REPLBASE="$1" local REPLBASE="$1"
...@@ -98,9 +101,6 @@ internal_repl_list() ...@@ -98,9 +101,6 @@ internal_repl_list()
print_replbased_list() print_replbased_list()
{ {
local REPLBASE="$1" local REPLBASE="$1"
# VENDOR, TARGET is already defined in detect_target_env() func
[ -z "$DISTRVERSION" ] && DISTRVERSION=$($DISTRVENDOR -v)
if [ "$DEFAULTARCH" = "x86_64" ] ; then if [ "$DEFAULTARCH" = "x86_64" ] ; then
internal_repl_list $REPLBASE .x86_64 internal_repl_list $REPLBASE .x86_64
fi fi
......
...@@ -25,7 +25,7 @@ drop_pkg_extensions() ...@@ -25,7 +25,7 @@ drop_pkg_extensions()
# TODO: add get_update_repo_command # TODO: add get_update_repo_command
# TODO: migrate to file using (as repos) # TODO: migrate to file using (as repos)
# args: distr_vendor [interactive] # args: VENDORNAME [interactive]
get_install_package_command() get_install_package_command()
{ {
local VENDORNAME=$1 local VENDORNAME=$1
......
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