From 260819d83fbc9482d3ce0716c7f9a04a658c2c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dylan=20A=C3=AFssi?= <dylan.aissi@collabora.com> Date: Thu, 17 Oct 2024 15:07:51 +0200 Subject: [PATCH] scan-licenses: create a merge request updating the copyright file on default branch only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is especially useful during a rebase where the copyright tooling is updated and the copyrght file needs to be refreshed. Some packages don't have any update in the next Debian release, but the pipeline fails only because we have to manually refresh the copyright file, so let's it create a MR to save us time. Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com> --- ci-package-builder.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ci-package-builder.yml b/ci-package-builder.yml index 27d1cfe2..bbbe510f 100644 --- a/ci-package-builder.yml +++ b/ci-package-builder.yml @@ -571,6 +571,31 @@ scan-licenses: - dpkg-source --after-build . - | case $BRANCH in + $CI_DEFAULT_BRANCH) + if ! diff debian/apertis/copyright.new debian/apertis/copyright + then + echo "Copyright report needs to be updated, creating a MR" + NEW_BRANCH=proposed-copyright-updates/$CI_COMMIT_SHORT_SHA + git checkout -b $NEW_BRANCH + mv debian/apertis/copyright.new debian/apertis/copyright + git add -f debian/apertis/copyright + git commit -s -m 'Refresh the automatically detected licensing information' debian/apertis/copyright + dch -i -m 'Refresh the automatically detected licensing information' -D apertis --force-distribution + git add -f debian/changelog + NEW_VERSION=$(dpkg-parsechangelog -SVersion) + git commit -s -m "Release $PACKAGE version $NEW_VERSION" + git push -o merge_request.create \ + -o merge_request.remove_source_branch \ + -o merge_request.target=$CI_DEFAULT_BRANCH \ + -o merge_request.target_project=$CI_PROJECT_PATH \ + -o merge_request.title='Refresh the automatically detected licensing information' \ + ${CI_AUTH_PROJECT_URL} HEAD:${NEW_BRANCH} + exit 1 + else + echo "Copyright report is up to date" + fi + rm debian/apertis/copyright.new + ;; $OSNAME/*) if ! diff debian/apertis/copyright.new debian/apertis/copyright then -- GitLab