Skip to content

Commit abe4952

Browse files
authored
Merge pull request #146 from ssahani/fix/ci-packaging
Fix/ci packaging
2 parents f8ffd22 + d084064 commit abe4952

3 files changed

Lines changed: 68 additions & 45 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ jobs:
6060
strategy:
6161
fail-fast: false
6262
matrix:
63-
os: [fedora:latest, fedora:41]
63+
include:
64+
- os: fedora:latest
65+
artifact: fedora-latest
66+
- os: fedora:41
67+
artifact: fedora-41
6468

6569
container:
6670
image: ${{ matrix.os }}
@@ -86,36 +90,33 @@ jobs:
8690
python3-lxml
8791
8892
- name: Set up RPM build tree
89-
run: rpmdev-setuptree
93+
run: rpmdev-setuptree || mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
9094

9195
- name: Create source tarball
9296
run: |
93-
VERSION=$(grep "version:" meson.build | head -1 | sed "s/.*'\(.*\)'.*/\1/")
97+
VERSION=$(grep -oP "version\s*:\s*'\K[^']+" meson.build | head -1)
9498
echo "Building version $VERSION"
95-
tar czf ~/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz \
96-
--transform "s,^\.,systemd-netlogd-$VERSION," \
97-
--exclude='.git' --exclude='builddir' \
98-
.
99+
mkdir -p /tmp/systemd-netlogd-$VERSION
100+
cp -a $(ls -A | grep -v '^\.\(git\)$' | grep -v '^builddir$') /tmp/systemd-netlogd-$VERSION/
101+
tar czf $HOME/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz -C /tmp systemd-netlogd-$VERSION
102+
ls -lh $HOME/rpmbuild/SOURCES/
99103
100104
- name: Copy spec file
101-
run: cp systemd-netlogd.spec ~/rpmbuild/SPECS/
105+
run: cp systemd-netlogd.spec $HOME/rpmbuild/SPECS/
102106

103107
- name: Build RPMs
104-
run: rpmbuild -ba ~/rpmbuild/SPECS/systemd-netlogd.spec
108+
run: rpmbuild -ba $HOME/rpmbuild/SPECS/systemd-netlogd.spec
105109

106110
- name: Test install RPM
107111
run: |
108-
dnf install -y ~/rpmbuild/RPMS/*/systemd-netlogd-*.rpm
112+
rpm -ivh --nodeps $HOME/rpmbuild/RPMS/*/systemd-netlogd-*.rpm
109113
rpm -qi systemd-netlogd
110-
systemctl status systemd-netlogd || true
111114
112115
- name: Upload RPM artifacts
113116
uses: actions/upload-artifact@v4
114117
with:
115-
name: rpms-${{ matrix.os }}
116-
path: |
117-
~/rpmbuild/RPMS/*/*.rpm
118-
~/rpmbuild/SRPMS/*.rpm
118+
name: rpms-${{ matrix.artifact }}
119+
path: /github/home/rpmbuild/RPMS/
119120
retention-days: 30
120121

121122
build-rpm-rocky:
@@ -148,39 +149,36 @@ jobs:
148149
python3-sphinx \
149150
python3-devel \
150151
python3-lxml
151-
pip3 install meson ninja
152+
pip3 install --prefix=/usr meson ninja
152153
153154
- name: Set up RPM build tree
154-
run: rpmdev-setuptree
155+
run: rpmdev-setuptree || mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
155156

156157
- name: Create source tarball
157158
run: |
158-
VERSION=$(grep "version:" meson.build | head -1 | sed "s/.*'\(.*\)'.*/\1/")
159+
VERSION=$(grep -oP "version\s*:\s*'\K[^']+" meson.build | head -1)
159160
echo "Building version $VERSION"
160-
tar czf ~/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz \
161-
--transform "s,^\.,systemd-netlogd-$VERSION," \
162-
--exclude='.git' --exclude='builddir' \
163-
.
161+
mkdir -p /tmp/systemd-netlogd-$VERSION
162+
cp -a $(ls -A | grep -v '^\.\(git\)$' | grep -v '^builddir$') /tmp/systemd-netlogd-$VERSION/
163+
tar czf $HOME/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz -C /tmp systemd-netlogd-$VERSION
164+
ls -lh $HOME/rpmbuild/SOURCES/
164165
165166
- name: Copy spec file
166-
run: cp systemd-netlogd.spec ~/rpmbuild/SPECS/
167+
run: cp systemd-netlogd.spec $HOME/rpmbuild/SPECS/
167168

168169
- name: Build RPMs
169-
run: rpmbuild -ba ~/rpmbuild/SPECS/systemd-netlogd.spec
170+
run: rpmbuild -ba --nodeps $HOME/rpmbuild/SPECS/systemd-netlogd.spec
170171

171172
- name: Test install RPM
172173
run: |
173-
dnf install -y ~/rpmbuild/RPMS/*/systemd-netlogd-*.rpm
174+
rpm -ivh --nodeps $HOME/rpmbuild/RPMS/*/systemd-netlogd-*.rpm
174175
rpm -qi systemd-netlogd
175-
systemctl status systemd-netlogd || true
176176
177177
- name: Upload RPM artifacts
178178
uses: actions/upload-artifact@v4
179179
with:
180180
name: rpms-rockylinux-9
181-
path: |
182-
~/rpmbuild/RPMS/*/*.rpm
183-
~/rpmbuild/SRPMS/*.rpm
181+
path: /github/home/rpmbuild/RPMS/
184182
retention-days: 30
185183

186184
build-deb:
@@ -189,7 +187,13 @@ jobs:
189187
strategy:
190188
fail-fast: false
191189
matrix:
192-
os: [ubuntu:24.04, ubuntu:22.04, debian:12]
190+
include:
191+
- os: ubuntu:24.04
192+
artifact: ubuntu-24.04
193+
- os: ubuntu:22.04
194+
artifact: ubuntu-22.04
195+
- os: debian:12
196+
artifact: debian-12
193197

194198
container:
195199
image: ${{ matrix.os }}
@@ -220,17 +224,24 @@ jobs:
220224
- name: Build DEB package
221225
run: dpkg-buildpackage -us -uc -b
222226

227+
- name: Collect DEB packages
228+
run: |
229+
mkdir -p debs
230+
cp ../*.deb debs/ || true
231+
ls -lh debs/
232+
223233
- name: Test install DEB
224234
run: |
225-
dpkg -i ../systemd-netlogd_*.deb || apt-get install -f -y
235+
dpkg -i debs/systemd-netlogd_*.deb || apt-get install -f -y
226236
dpkg -s systemd-netlogd
227237
systemctl status systemd-netlogd || true
228238
229239
- name: Upload DEB artifacts
230240
uses: actions/upload-artifact@v4
241+
if: always()
231242
with:
232-
name: debs-${{ matrix.os }}
233-
path: ../*.deb
243+
name: debs-${{ matrix.artifact }}
244+
path: debs/
234245
retention-days: 30
235246

236247
build-archlinux:

Makefile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,30 @@ all: build
44

55
build:
66
meson setup build
7+
.PHONY: build
78

89
clean:
910
rm -rf build/
1011
.PHONY: clean
1112

12-
install: build
13+
install: all
1314
ninja -C build install
1415
.PHONY: install
1516

16-
format:
17-
@for f in lib/*.[ch] tool/*.[ch]; do \
18-
echo $$f; \
19-
astyle --quiet --options=.astylerc $$f; \
20-
done
21-
.PHONY: format
17+
uninstall:
18+
ninja -C build uninstall
19+
.PHONY: uninstall
2220

23-
install-tree: build
21+
test: all
22+
meson test -C build -v
23+
.PHONY: test
24+
25+
install-tree: all
2426
rm -rf build/install-tree
2527
DESTDIR=install-tree ninja -C build install
2628
tree build/install-tree
2729
.PHONY: install-tree
30+
31+
rpm: all
32+
rpmbuild -ba systemd-netlogd.spec
33+
.PHONY: rpm

systemd-netlogd.spec

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ License: LGPL-2.1-or-later AND GPL-2.0-only
77
URL: https://github.com/systemd/systemd-netlogd
88
Source0: %{URL}/archive/v%{version}/systemd-netlogd-%{version}.tar.gz
99

10+
%global debug_package %{nil}
11+
1012
BuildRequires: gcc
1113
BuildRequires: meson >= 0.51
1214
BuildRequires: ninja-build
@@ -41,14 +43,18 @@ Supported transports: UDP, TCP, TLS (RFC 5425), DTLS (RFC 6012)
4143
%autosetup
4244

4345
%build
44-
%meson
45-
%meson_build
46+
meson setup redhat-linux-build \
47+
--prefix=/usr/lib/systemd \
48+
--sysconfdir=/etc/systemd \
49+
--buildtype=plain
50+
ninja -C redhat-linux-build %{?_smp_mflags}
4651

4752
%check
48-
%meson_test
53+
ninja -C redhat-linux-build test
4954

5055
%install
51-
%meson_install
56+
DESTDIR=%{buildroot} ninja -C redhat-linux-build install
57+
mkdir -p %{buildroot}/var/lib/systemd-netlogd
5258

5359
%pre
5460
getent group systemd-journal >/dev/null 2>&1 || groupadd -r systemd-journal 2>/dev/null || :

0 commit comments

Comments
 (0)