Commit d5b62a51 authored by Vitaly Lipatov's avatar Vitaly Lipatov

introduce get_type_by_current_branch, use it for branch detecting

add test for get current type from branch
parent 1ca09e66
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
load_mod git
is_alt() is_alt()
{ {
test -f /etc/altlinux-release test -f /etc/altlinux-release
...@@ -12,6 +14,7 @@ is_alt() ...@@ -12,6 +14,7 @@ is_alt()
# Internal # Internal
set_target_type() set_target_type()
{ {
# check for M51 and so on
if echo $1 | grep "^M[0-9][0-9]$" >/dev/null ; then if echo $1 | grep "^M[0-9][0-9]$" >/dev/null ; then
MENV=$1 MENV=$1
return 0 return 0
...@@ -25,25 +28,30 @@ set_target_type() ...@@ -25,25 +28,30 @@ set_target_type()
return 1; return 1;
} }
set_incoming() get_type_by_git_branch_name()
{ {
INCOMING="Sisyphus" if [ "$1" = "p5" ] ; then
test -z "$1" && return echo "M50"
case "$1" in return
("DD") fi
INCOMING="Daedalus"
;; # like 5.1
("SS") if echo $1 | grep -q "^[0-9].[0-9]$" ; then
INCOMING="Sisyphus" get_altdistr_mod $1
;; return
*) fi
if [ -n "$UPDATES" ] ; then
INCOMING="updates/`get_altdistr_version $1`" # like M50
else if echo $1 | grep -q "^M[0-9][0-9]$" ; then
INCOMING="backports/`get_altdistr_version $1`" get_altdistr_mod ${1/^M/}
fi return
;; fi
esac }
get_type_by_current_branch()
{
local BRANCH=$(get_current_branch)
get_type_by_git_branch_name $BRANCH
} }
set_binaryrepo() set_binaryrepo()
......
...@@ -167,9 +167,12 @@ fi ...@@ -167,9 +167,12 @@ fi
[ "$1" = "--help" ] && mygetopts -h [ "$1" = "--help" ] && mygetopts -h
# Sisyphus by default # Build for Sisyphus by default
MENV=SS MENV=SS
set_target_type $(basename `pwd`) if is_gear ; then
# Set target according to current branch
set_target_type $(get_type_by_current_branch)
fi
LISTNAMES= LISTNAMES=
LISTARGS= LISTARGS=
......
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod git alt
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'"
}
echo "Current git branch: $(get_current_branch)"
check 1 M40 $(get_type_by_git_branch_name 4.0)
check 1 M40 $(get_type_by_git_branch_name M40)
check 1 M50 $(get_type_by_git_branch_name p5)
check 1 M50 $(get_type_by_git_branch_name M50)
check 1 M50 $(get_type_by_git_branch_name 5.0)
check 1 M51 $(get_type_by_git_branch_name M51)
check 1 M51 $(get_type_by_git_branch_name 5.1)
check 1 "" $(get_type_by_git_branch_name master)
check 1 "" $(get_type_by_git_branch_name sisyphus)
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