forked from uyuni-project/uyuni-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
52 lines (38 loc) · 1.28 KB
/
Copy pathpush.sh
File metadata and controls
52 lines (38 loc) · 1.28 KB
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
50
51
52
#!/usr/bin/bash
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
# This script is called by push-packages-to-obs
PRODUCT=$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
# convert legacy value
test "${PRODUCT}" == "https://api.suse.de" && PRODUCT="MLM"
if [ "${PRODUCT}" == "MLM" ]; 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.2.0/' -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 provider_prefix.*$/a%global version_details ${VERSION} $COMMIT_ID" -i ${SRPM_PKG_DIR}/uyuni-tools.spec