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

define DISTRNAME and DISTRVERSION globally and use it

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