Skip to content
Snippets Groups Projects

Improve customizability for downstream projects

Merged Emanuele Aina requested to merge wip/em/customize-packaging-branch into master
+ 15
10
# vi:et:sts=2
variables:
OSNAME: apertis
# we cannot just stick the regex in a variable due to
# https://gitlab.com/gitlab-org/gitlab/-/issues/35438
OSNAME_BRANCH_RULE: &osname_branch_rule $CI_COMMIT_BRANCH =~ /^apertis\//
OBS_REPOSITORIES: default
NAME: ${GITLAB_USER_NAME}
FULLNAME: ${GITLAB_USER_NAME}
EMAIL: ${GITLAB_USER_EMAIL}
@@ -11,7 +17,6 @@ variables:
# Disable shallow clone as history is needed for describing tags
GIT_DEPTH: 0
LICENSE_BLACKLIST_target: "GPL-3 GPL-3+ AGPL-3 AGPL-3+ AGPL-1 AGPL-1+ LGPL-3 LGPL-3+ BSD-4-Clause MPL-1.1"
OBS_REPOSITORIES: default
# Set OBS_PREFIX in the project package variables to force uploads to a
# branch. For instance, by setting it to home:yourusername:branches uploads
# for apertis:v2020:target will end up in home:yourusername:branches:apertis:v2020:target
@@ -127,7 +132,7 @@ build-source:
tags:
- lightweight
script:
- TAG=$(git describe --tags --match "apertis/*" --exact || true)
- TAG=$(git describe --tags --match "$OSNAME/*" --exact || true)
- if [ -n "$TAG" ]; then echo "Skip building the package, already tagged as '$TAG'"; exit 0; fi
- ci-buildpackage -S --git-prebuild='debian/rules debian/control || true'
- mv _build/ _build-snapshot/
@@ -204,16 +209,16 @@ tag-release:
exit 1
fi
- |
if git describe --tags --match 'apertis/*' --exact-match > /dev/null 2>&1
if git describe --tags --match "$OSNAME/*" --exact-match > /dev/null 2>&1
then
echo "Fetching the already tagged source package version for this commit"
pristine-lfs -v checkout --full --branch ${PRISTINE_SOURCE} --auto -o _build-release/
exit 0
fi
- VERSIONTAG=apertis/$(dpkg-parsechangelog -SVersion | sed -e 'y/:~/%_/' -e 's/\.\(\.\|$\|lock$\)/.\1#/g')
- VERSIONTAG=$OSNAME/$(dpkg-parsechangelog -SVersion | sed -e 'y/:~/%_/' -e 's/\.\(\.\|$\|lock$\)/.\1#/g')
- echo "debian/changelog points to ${VERSIONTAG}, looking for it"
- |
if git describe --tags --match 'apertis/*' --exact-match ${VERSIONTAG} > /dev/null 2>&1
if git describe --tags --match "$OSNAME/*" --exact-match ${VERSIONTAG} > /dev/null 2>&1
then
echo "debian/changelog points to ${VERSIONTAG} which already exists, skip"
exit 0
@@ -223,8 +228,8 @@ tag-release:
--git-tag-only
--git-ignore-branch
--git-ignore-new
--git-debian-tag='apertis/%(version)s'
--git-debian-tag-msg='%(pkg)s Apertis release %(version)s'
--git-debian-tag="$OSNAME/%(version)s"
--git-debian-tag-msg="%(pkg)s $OSNAME release %(version)s"
- ci-buildpackage -S --git-prebuild='debian/rules debian/control || true'
- mv _build/ _build-release/
- pristine-lfs -v import-dsc --full --branch "${PRISTINE_SOURCE}" _build-release/*.dsc
@@ -236,7 +241,7 @@ tag-release:
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- if: $CI_COMMIT_BRANCH =~ /^apertis\//
- if: *osname_branch_rule
changes:
- debian/changelog
when: on_success
@@ -310,7 +315,7 @@ upload:
- build.log
when: always
script:
- git describe --tags --match 'apertis/*' --exact && export RELEASE=1
- git describe --tags --match "$OSNAME/*" --exact && export RELEASE=1
- |
if [ "$RELEASE" == 1 ]
then
@@ -369,7 +374,7 @@ upload:
rules: &upload_rules
- if: $CI_MERGE_REQUEST_ID
when: never
- if: $CI_COMMIT_BRANCH =~ /^apertis\//
- if: *osname_branch_rule
when: on_success
- when: never
dependencies:
Loading