Skip to content

Commit 0466f1f

Browse files
authored
feat(build-debian): Run licenserecon (#97)
UDENG-8802
2 parents 3489d42 + 7c0fa59 commit 0466f1f

2 files changed

Lines changed: 37 additions & 8 deletions

File tree

.github/workflows/test-build-deb.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ jobs:
4242
set -eu
4343
4444
echo "::group::Get source"
45-
pull-lp-source --download-only hello
46-
dpkg-source -x hello*.dsc hello-src
47-
rm -rf hello_*
48-
mv -v hello-src/* .
45+
PKG=debianutils
46+
pull-lp-source --download-only "$PKG"
47+
dpkg-source -x "$PKG"*.dsc pkg-src
48+
rm -rf "${PKG}_"*
49+
cd pkg-src
4950
echo "::endgroup::"
5051
5152
echo "::group::Mark package as a native package"
@@ -63,6 +64,7 @@ jobs:
6364
uses: ./.source/gh-actions/common/build-debian
6465
with:
6566
docker-image: ${{ env.UBUNTU_IMAGE }}
67+
source-dir: pkg-src
6668
eatmydata: false
6769

6870

@@ -118,9 +120,10 @@ jobs:
118120
# Get package source
119121
set -eu
120122
121-
pull-lp-source --download-only hello
122-
dpkg-source -x hello*.dsc hello-src
123-
rm -rfv hello_*.{dsc,debian.}*
123+
PKG=debianutils
124+
pull-lp-source --download-only "$PKG"
125+
dpkg-source -x "$PKG"*.dsc pkg-src
126+
rm -rfv "${PKG}_"*.{dsc,debian.}*
124127
125128
- name: Checkout code
126129
uses: actions/checkout@v4
@@ -132,7 +135,7 @@ jobs:
132135
with:
133136
docker-image: ${{ env.UBUNTU_IMAGE }}
134137
sources-only: true
135-
source-dir: ./hello-src
138+
source-dir: pkg-src
136139
lintian: skip
137140

138141

gh-actions/common/build-debian/action.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ inputs:
5959
description: Arguments to pass to lintian, if any. Set to `skip` to skip the lintian check.
6060
default: ''
6161

62+
lrc:
63+
required: false
64+
description: Arguments to pass to licenserecon, if any. Set to `skip` to skip the licenserecon check.
65+
default: ''
66+
6267

6368
# The process:
6469
# 1. We build the source package in a docker container. If ca-certificates are
@@ -150,6 +155,27 @@ runs:
150155
echo "SOURCE_DIR=${srcdir}" >> "${GITHUB_ENV}"
151156
echo "::endgroup::"
152157
158+
- name: Check licenses
159+
if: ${{ inputs.lrc != 'skip' }}
160+
uses: kohlerdominik/docker-run-action@v2.0.0
161+
with:
162+
# Use ubuntu:devel to have a recent version of licenserecon, because we
163+
# found older versions to report false positives (e.g. GPL-2 vs GPL-2+).
164+
image: ubuntu:devel
165+
volumes: |
166+
${{ github.workspace }}:${{ github.workspace }}
167+
workdir: ${{ env.SOURCE_DIR }}
168+
shell: bash
169+
run: |
170+
echo "::group::Install licenserecon"
171+
apt-get update
172+
apt-get install -y --no-install-recommends licenserecon
173+
echo "::endgroup::"
174+
175+
echo "::group::Run licenserecon"
176+
lrc ${{ inputs.lrc }}
177+
echo "::endgroup::"
178+
153179
- name: Prepare source package
154180
uses: kohlerdominik/docker-run-action@v2.0.0
155181
with:

0 commit comments

Comments
 (0)