Commit 9c945af0 authored by Vitaly Lipatov's avatar Vitaly Lipatov

move to DISTRNAME, DISTRVERSION, BUILDARCH, PKGFORMAT, PKGVENDOR, RPMVENDOR

parent 2140456b
......@@ -101,7 +101,7 @@ if [ -n "$BUILDOPT" ] ; then
fi
# Set nodeps if run in non rpm system
[ "$TARGET" = "rpm" ] && NODEPS="" || NODEPS="--nodeps"
[ "$PKGFORMAT" = "rpm" ] && NODEPS="" || NODEPS="--nodeps"
for i in $LISTNAMES
do
......
......@@ -32,7 +32,7 @@ FIXPATCHFUZZ="%define _default_patch_fuzz 3"
echo "Converting spec $(basename $SPECNAME) to $MDISTR..."
# Set buildreq
if [ "$VENDOR" = "alt" ] ; then
if [ "$PKGVENDOR" = "alt" ] ; then
# FIXME: needed for some backport level...
#BUILDREQ="BuildRequires: rpm-build-compat >= 0.95"
BUILDREQ=
......@@ -54,10 +54,10 @@ else
BUILDREQ="BuildRequires: rpm-build-altlinux-compat >= 0.95 make gcc\n$FIXPATCHFUZZ"
[ -z "$BUILDCOMMAND" ] && BUILDCOMMAND=$ETERBUILDBIN/rpmbb
TXTRELEASE=$(get_txtrelease $SPECNAME)
# Override release with KORINFTARGETRELEASE if set
# HACK: Override release with KORINFTARGETRELEASE if set
[ -z "$KORINFTARGETRELEASE" ] || TXTRELEASE=$KORINFTARGETRELEASE
showcmd set_release $SPECNAME $TXTRELEASE$BASERELEASE$VENDOR
set_release $SPECNAME $TXTRELEASE$BASERELEASE$VENDOR
showcmd set_release $SPECNAME $TXTRELEASE$BASERELEASE$PKGVENDOR
set_release $SPECNAME $TXTRELEASE$BASERELEASE$PKGVENDOR
test -z "$VERBOSE" || echo "Build package with release $TXTRELEASE"
ADDDEF="%defattr(-, root, root)"
CLEANTEXT=""
......@@ -65,7 +65,7 @@ fi
# FIXME 05.05.2012: it is needed now?
if [ "$VENDOR" = "mdv" ] || [ "$VENDOR" = "pclinux" ] ; then
if [ "$PKGVENDOR" = "mdv" ] || [ "$PKGVENDOR" = "pclinux" ] ; then
# due new libtool, affected on Mandriva 2009.0
test -z "$VERBOSE" || echo "Disable libtoolize"
# FIXME
......@@ -85,21 +85,21 @@ if [ "$DISTRNAME/$DISTRVERSION" = "ASPLinux/11.2" ] ; then
fi
# fix readlink -mv, introduced by new libtool and missed in Generic (FreeBSD) (replace with realpath)
if [ "$VENDOR" = "generic" ] ; then
if [ "$PKGVENDOR" = "generic" ] ; then
test -z "$VERBOSE" || echo "Add subst readlink -mv"
ADDFIXCOMMAND="$ADDFIXCOMMAND
%__subst 's|readlink -mv|realpath|g' libtool configure ltmain.sh"
fi
# HACK need only for wine on x86_64
if [ "$BUILDARCH" = x86_64" ] && echo $SPECNAME | grep -q wine ; then
if [ "$BUILDARCH" = "x86_64" ] && echo $SPECNAME | grep -q wine ; then
test -z "$VERBOSE" || echo "Add remove_optflags -m64"
ADDFIXCOMMAND="$ADDFIXCOMMAND
%remove_optflags -m64"
fi
# fix mktemp using for MCBC
if [ "$VENDOR" = "mcbc" ] ; then
if [ "$PKGVENDOR" = "mcbc" ] ; then
test -z "$VERBOSE" || echo "Add subst mktemp -dt"
ADDFIXCOMMAND="$ADDFIXCOMMAND
%__subst 's|mktemp -dt|mktemp -d|g' configure ; %__subst 's|readlink -mv|ls -1|g' configure ltmain.sh"
......@@ -214,14 +214,14 @@ mv $SPECNAME $SPECNAME.old &&
subst "s|^Patch0:|Patch:|g" $SPECNAME
subst "s|^%patch0 |%patch |g" $SPECNAME
if [ "$VENDOR" != "alt" ] ; then
if [ "$PKGVENDOR" != "alt" ] ; then
# Due possible using %release in Source: and Patch: names
subst "s|^\(Source.*\)%release|\1$RELEASE|g" $SPECNAME
subst "s|^\(Patch.*\)%release|\1$RELEASE|g" $SPECNAME
fi
# Auto*=yes,nomingw32 works only since ALT 4.1
if [ "$VENDOR" = "alt" ] ; then
if [ "$PKGVENDOR" = "alt" ] ; then
if echo "$MDISTR" | egrep -q "M24|M30|M40" ; then
subst "s|^\(AutoReq.*\),nomingw32|\1|g" $SPECNAME
subst "s|^\(AutoProv.*\),nomingw32|\1|g" $SPECNAME
......@@ -249,7 +249,7 @@ fi
rm -f $SPECNAME.old
if [ "$VENDOR" = "alt" ] ; then
if [ "$PKGVENDOR" = "alt" ] ; then
subst "1i#" $SPECNAME
# use old compress method for the src.rpm on ALT 4.0 and 4.1
if [ "$DISTRVERSION" = "4.0" ] || [ "$DISTRVERSION" = "4.1" ] ; then
......@@ -331,7 +331,7 @@ mygetopts $LISTARGS
test -z "$LISTNAMES" && fatal "file not found in '$@'"
if [ "$VENDOR" = "alt" ] ; then
if [ "$PKGVENDOR" = "alt" ] ; then
MDISTR=$MENV
[ -n "$BINARYREPONAME" ] && MDISTR=$(get_altdistr_mod $BINARYREPONAME)
[ "$MDISTR" = "SS" ] && fatal "It is senseless to backport to Sisyphus (You can try with -b $EXAMPLEALTDISTRVERSION)."
......@@ -350,7 +350,7 @@ fi
[ -n "$SPECDIR" ] || set_specdir $LISTNAMES
# if run for ALT inside gear repo, just create backported spec
if [ "$VENDOR" = "alt" ] && is_gear $SPECDIR ; then
if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
[ -f "$LISTNAMES" ] || fatal "Run with one spec inside gear repo"
USEBRANCH=$MDISTR
SPEC=$LISTNAMES
......
......@@ -53,7 +53,7 @@ real_file()
real_file "$1"
case $TARGET in
case $PKGFORMAT in
"rpm")
rpmquery -f $ARG "$FULLFILEPATH"
;;
......
......@@ -73,7 +73,7 @@ if ! set_eterbuilddir ; then
exit 1
fi
DISTRVENDOR=$(realpath $ATOPDIR/../rpm-build-altlinux-compat/bin/distr_vendor 2>/dev/null)
DISTRVENDOR=$(realpath $ETERBUILDBIN/../../rpm-build-altlinux-compat/bin/distr_vendor 2>/dev/null)
[ -x "$DISTRVENDOR" ] || DISTRVENDOR=distr_vendor
print_list()
......@@ -147,18 +147,38 @@ if [ -n "$NEEDETERBUILD" ] ; then
fi
fi
# Used DISTRNAME
set_target_pkg_env()
{
[ "$($DISTRVENDOR -V)" -ge "20120519" ] || fatal "update rpm-build-altlinux-compat package to get new $DISTRVENDOR command"
[ -n "$DISTRNAME" ] || fatal "Run set_target_pkg_env without DISTRNAME"
PKGFORMAT=$($DISTRVENDOR -p "$DISTRNAME")
PKGVENDOR=$($DISTRVENDOR -s "$DISTRNAME")
RPMVENDOR=$($DISTRVENDOR -n "$DISTRNAME")
}
# We believe that follow vars correctly in any way:
# DISTRNAME - f.i. ALTLinux
# DISTRVERSION - f.i. p6
# BUILDARCH - f.i. x86_64 (set in config)
# Filled with set_target_pkg_env:
# PKGFORMAT (was TARGET) - f.i. rpm
# use DISTRNAME if possible instead follow
# PKGVENDOR (was VENDOR) - like in package name release, f.i. alt
# RPMVENDOR - like %_vendor in spec, f.i. alt
# Internal
# Detect distro name / vendor according to ROOTDIR system or current system
# You can set DISTRNAME, DISTRVERSION, BUILDARCH externally
detect_target_env()
{
MENVARG=""
DISTRNAME=$($DISTRVENDOR -d)
DISTRVERSION=$($DISTRVENDOR -v)
TARGET=$($DISTRVENDOR -p)
VENDOR=$($DISTRVENDOR -s)
RPMVENDOR=$($DISTRVENDOR -n)
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d)
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env
if [ "$VENDOR" = "alt" ] && [ -n "$MENV" ] ; then
if [ "$PKGVENDOR" = "alt" ] && [ -n "$MENV" ] ; then
#[ -n "$APTCONF" ] && fatal "Internal error: APTCONF already defined as $APTCONF for $MENV"
APTCONF=${APTCONFBASE/.SS}.$MENV
......@@ -166,7 +186,7 @@ if [ "$VENDOR" = "alt" ] && [ -n "$MENV" ] ; then
MENVARG="-$MENV"
else
# FIXME: echog breaks vars
echog "Distribution: \$DISTRNAME/\$DISTRVERSION (\$VENDOR) (target package: \$TARGET)"
echog "Distribution: \$DISTRNAME/\$DISTRVERSION (\$PKGVENDOR) (target package: \$PKGFORMAT)"
fi
}
......
......@@ -3,7 +3,7 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
ETERBUILDVERSION=2011
ETERBUILDVERSION=2012
SUDO="sudo"
......
......@@ -6,9 +6,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?
# sets ALTPKGNAME, TARGETPKGNAME variable
# used for hack: PKGFORMAT, DISTRNAME, BUILDARCH
tolocal_anyrepl()
{
local i REPLRULE WARULES
......@@ -31,7 +30,7 @@ tolocal_anyrepl()
done
# Hack for default replace -devel to -dev on Deb target
if [ "$TARGET" = "deb" ] ; then
if [ "$PKGFORMAT" = "deb" ] ; then
local NEWRESULT=`echo $GREP | sed -e "s|^ *\(.*\)-devel *\$|\1-dev|g"`
[ "$NEWRESULT" = "$GREP" ] && return 1
ALTPKGNAME=$GREP
......@@ -40,7 +39,7 @@ tolocal_anyrepl()
fi
# Add hack for replace lib with lib64 on Mandriva
if [ "$VENDOR" = "mdv" ] && [ $BUILDARCH = "x86_64" ] ; then
if [ "$DISTRNAME" = "Mandriva" ] && [ $BUILDARCH = "x86_64" ] ; then
local NEWRESULT=`echo $GREP | sed -e "s|^lib\([^6]\)|lib64\1|g"`
[ "$NEWRESULT" = "$GREP" ] && return 1
ALTPKGNAME=$GREP
......@@ -81,20 +80,20 @@ 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
# PKGVENDOR, PKGFORMAT, DISTRVERSION is already defined in detect_target_env() func
internal_repl_list()
{
local REPLBASE="$1"
local ARCHEXT="$2"
local FINDPKG=$REPLBASE.$VENDOR.$DISTRVERSION$ARCHEXT
local FINDPKG=$REPLBASE.$PKGVENDOR.$DISTRVERSION$ARCHEXT
# sure we use our version firstly
echo $FINDPKG
# Hack for sort by last numbers: sort -n -t . -k 3
( ls -1 $PKGREPLBASE/pkgrepl.$VENDOR*$ARCHEXT 2>/dev/null | \
( test -n "$ARCHEXT" && grep -v "$VENDOR$ARCHEXT\$" || grep -v "x86_64" ) ; echo $FINDPKG ) | \
( ls -1 $PKGREPLBASE/pkgrepl.$PKGVENDOR*$ARCHEXT 2>/dev/null | \
( test -n "$ARCHEXT" && grep -v "$PKGVENDOR$ARCHEXT\$" || grep -v "x86_64" ) ; echo $FINDPKG ) | \
sort -u | sort -n -t . -k 3 | grep "^$FINDPKG\$" -B1000 | sort -r
echo $REPLBASE.$VENDOR$ARCHEXT
[ "$VENDOR" = "alt" ] || echo "$REPLBASE.$TARGET$ARCHEXT "
echo $REPLBASE.$PKGVENDOR$ARCHEXT
[ "$PKGVENDOR" = "alt" ] || echo "$REPLBASE.$PKGFORMAT$ARCHEXT "
}
# internal
......
......@@ -25,14 +25,14 @@ drop_pkg_extensions()
# TODO: add get_update_repo_command
# TODO: migrate to file using (as repos)
# args: VENDORNAME [interactive]
# args: DISTRNAME [interactive]
get_install_package_command()
{
local VENDORNAME=$1
local DISTRNAME=$1
local INAC=$2
local CMD
local RET=0
case $VENDORNAME in
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
[ -n "$INAC" ] && CMD="apt-get install" || CMD="apt-get -y --force-yes install"
;;
......@@ -47,7 +47,7 @@ get_install_package_command()
;;
*)
RET=1
CMD="echo \"Do not known install command for VENDORNAME $VENDORNAME\""
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
echo $CMD
......
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