-
Notifications
You must be signed in to change notification settings - Fork 19
/
push.sh
49 lines (36 loc) · 1.22 KB
/
push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/bash
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
# This script is called by push-packages-to-obs
OSCAPI=$1
GIT_DIR=$2
PKG_NAME=$3
SRPM_PKG_DIR=$(dirname "$0")
pushd ${GIT_DIR}
REMOTE_BRANCH=$(git for-each-ref --format='%(upstream:lstrip=-1)' $(git rev-parse --symbolic-full-name HEAD))
COMMIT_ID=$(git rev-parse --short HEAD)
popd
if [ "${OSCAPI}" == "https://api.suse.de" ]; then
VERSION="HEAD"
case ${REMOTE_BRANCH} in Manager-*)
VERSION="${REMOTE_BRANCH#Manager-}"
esac
# Define the default tag to use
sed 's/^tag=%{!?_default_tag:latest}/tag=5.1.0-alpha1/' -i ${SRPM_PKG_DIR}/uyuni-tools.spec
sed "s/namespace='%{_default_namespace}'/namespace='%{_default_namespace}\/%{_arch}'/" -i ${SRPM_PKG_DIR}/uyuni-tools.spec
else
pushd ${GIT_DIR}
VERSION=$(git tag --points-at HEAD Uyuni-*)
popd
if test -z "${VERSION}"; then
case ${REMOTE_BRANCH} in Uyuni-*)
VERSION="${REMOTE_BRANCH#Uyuni-}"
esac
if test -z "${VERSION}"; then
VERSION="Master"
fi
fi
fi
# Add the version_details value for use in the version tag
sed "/^%global productname.*$/a%global version_details ${VERSION} $COMMIT_ID" -i ${SRPM_PKG_DIR}/uyuni-tools.spec