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