Allow to build packages standalone [#METR-21515].

This commit is contained in:
Alexey Milovidov 2016-05-28 03:52:18 +03:00
parent 39d87694be
commit 48b33acc55
2 changed files with 47 additions and 31 deletions

15
release
View File

@ -9,6 +9,14 @@ CHDATE=$(LC_ALL=C date -R | sed -e 's/,/\\,/g') # Заменим запятую
# Собирать пакет с конфигурационными файлами для Яндекс.Метрики.
BUILD_PACKAGE_FOR_METRIKA=$([ -f 'private/Server/metrika/config.xml' ] && echo 'yes')
# Don't sign packages, don't upload, don't create tags.
if [[ $1 == '--standalone' ]]
then
STANDALONE='yes'
DEBUILD_NOSIGN_OPTIONS="-us -uc"
shift
fi
# Список демонов для сборки может быть указан в аргументах командной строки.
if [ $# -gt 0 ]
then
@ -25,6 +33,9 @@ make_control "$CONTROL" "$DAEMONS"
gen_changelog "$REVISION" "$CHDATE" "$AUTHOR" "$CHLOG" "$DAEMONS"
# Сборка (только бинарных пакетов).
debuild -e DAEMONS="${DAEMONS}" -e DISABLE_MONGODB -e CC -e CXX -b
debuild -e DAEMONS="${DAEMONS}" -e DISABLE_MONGODB -e CC -e CXX -b ${DEBUILD_NOSIGN_OPTIONS}
upload_debs "$REVISION" "$DAEMONS"
if [[ $STANDALONE != 'yes' ]]
then
upload_debs "$REVISION" "$DAEMONS"
fi

View File

@ -61,43 +61,48 @@ function gen_revision_author {
IS_IT_GITHUB=$( git config --get remote.origin.url | grep 'github')
REVISION=$( git tag | tag_filter | tail -1 )
MAX_REVISION=$(($REVISION + 10)) # Максимальное количество попыток отправить тег в Git.
REVISION_FULL_NAME=$REVISION
# Создадим номер ревизии и попытаемся залить на сервер.
succeeded=0
attempts=0
max_attempts=5
while [ $succeeded -eq 0 ] && [ $attempts -le $max_attempts ]
do
REVISION=$(($REVISION + 1))
attempts=$(($attempts + 1))
if [[ $STANDALONE != 'yes' ]]
then
MAX_REVISION=$(($REVISION + 10)) # Максимальное количество попыток отправить тег в Git.
[ "$REVISION" -ge "$MAX_REVISION" ] && exit 1
# Создадим номер ревизии и попытаемся залить на сервер.
succeeded=0
attempts=0
max_attempts=5
while [ $succeeded -eq 0 ] && [ $attempts -le $max_attempts ]
do
REVISION=$(($REVISION + 1))
attempts=$(($attempts + 1))
REVISION_FULL_NAME=$REVISION
[ "$REVISION" -ge "$MAX_REVISION" ] && exit 1
if [[ "$IS_IT_GITHUB" = "" ]]
then
REVISION_FULL_NAME=$REVISION_FULL_NAME-mobmet
fi
REVISION_FULL_NAME=$REVISION
echo -e "\nTrying to create revision:" $REVISION_FULL_NAME
if git tag $REVISION_FULL_NAME
then
echo -e "\nTrying to push revision to origin:" $REVISION_FULL_NAME
git push origin $REVISION_FULL_NAME
if [ $? -ne 0 ];
if [[ "$IS_IT_GITHUB" = "" ]]
then
git tag -d $REVISION_FULL_NAME
else
succeeded=1
REVISION_FULL_NAME=$REVISION_FULL_NAME-mobmet
fi
fi
done
if [ $succeeded -eq 0 ]; then
echo "Fail to create tag"
exit 1
echo -e "\nTrying to create revision:" $REVISION_FULL_NAME
if git tag $REVISION_FULL_NAME
then
echo -e "\nTrying to push revision to origin:" $REVISION_FULL_NAME
git push origin $REVISION_FULL_NAME
if [ $? -ne 0 ];
then
git tag -d $REVISION_FULL_NAME
else
succeeded=1
fi
fi
done
if [ $succeeded -eq 0 ]; then
echo "Fail to create tag"
exit 1
fi
fi
AUTHOR=$(git config --get user.name)