Skip to content

Commit 283490c

Browse files
authored
Package for Fedora COPR (#188)
* Added non -git RPM spec file * Added GitHub Actions for test building and uploading to COPR
1 parent cbe06c2 commit 283490c

File tree

5 files changed

+197
-4
lines changed

5 files changed

+197
-4
lines changed

.github/workflows/fedora-build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check build for Fedora.
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
jobs:
13+
fedora-build:
14+
container: registry.fedoraproject.org/fedora-minimal:latest
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Install tooling for source RPM build
19+
run: |
20+
microdnf -y install --nodocs --setopt=install_weak_deps=0 \
21+
@development-tools @rpm-development-tools rpkg git \
22+
'dnf5-command(builddep)' 'dnf5-command(copr)'
23+
# Enable the official COPR repo
24+
# (in case there are dependencies missing in the upstream repos, like updated gtk4-layer-shell)
25+
microdnf copr enable erikreider/swayosd -y
26+
27+
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
28+
- name: Check out sources
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
path: swayosd
33+
34+
- name: Copy spec into root dir
35+
run: |
36+
cd swayosd
37+
cp ./build-scripts/swayosd.rpkg.spec ./
38+
39+
- name: Generate spec
40+
run: |
41+
cd swayosd
42+
mkdir specs
43+
rpkg spec --source --outdir specs
44+
45+
- name: Install build dependencies
46+
run: |
47+
cd swayosd
48+
microdnf -y builddep ./specs/swayosd.rpkg.spec
49+
50+
- name: Local build
51+
run: |
52+
cd swayosd
53+
mkdir -p out
54+
rpkg local --out `pwd`/out

.github/workflows/fedora-copr.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Package for Fedora Copr repo
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
jobs:
11+
fedora-copr:
12+
container: registry.fedoraproject.org/fedora-minimal:latest
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Install API token for copr-cli
17+
env:
18+
API_LOGIN: ${{ secrets.COPR_API_LOGIN }}
19+
API_USERNAME: ${{ secrets.COPR_API_USERNAME }}
20+
API_TOKEN_CONTENT: ${{ secrets.COPR_API_TOKEN }}
21+
run: |
22+
mkdir -p "$HOME/.config"
23+
# To generate a new token: https://copr.fedorainfracloud.org/api/.
24+
echo "[copr-cli]" >> "$HOME/.config/copr"
25+
echo "login = $API_LOGIN" >> "$HOME/.config/copr"
26+
echo "username = $API_USERNAME" >> "$HOME/.config/copr"
27+
echo "token = $API_TOKEN_CONTENT" >> "$HOME/.config/copr"
28+
echo "copr_url = https://copr.fedorainfracloud.org" >> "$HOME/.config/copr"
29+
30+
- name: Install tooling for source RPM build
31+
run: |
32+
microdnf -y install --nodocs --setopt=install_weak_deps=0 \
33+
copr-cli rpkg git
34+
35+
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
36+
- name: Check out sources
37+
uses: actions/checkout@v3
38+
with:
39+
fetch-depth: 0
40+
path: swayosd
41+
42+
- name: Copy spec into root dir
43+
run: |
44+
cd swayosd
45+
cp ./build-scripts/swayosd.rpkg.spec ./
46+
47+
- name: Submit the build to copr
48+
run: |
49+
cd swayosd
50+
rpkg -v copr-build -w ${{ secrets.COPR_REPO_NAME }}

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ ninja -C build
3939
meson install -C build
4040
```
4141

42+
### Fedora
43+
44+
The package is available on COPR:
45+
46+
```zsh
47+
dnf copr enable erikreider/swayosd
48+
dnf install swayosd
49+
```
50+
51+
### Fedora Silverblue (and other rpm-ostree variants)
52+
53+
The package can be layered over the base image after adding the Copr repo as an ostree repo:
54+
55+
```zsh
56+
sudo curl -sL -o /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:erikreider:swayosd.repo https://copr.fedorainfracloud.org/coprs/erikreider/swayosd/repo/fedora-$(rpm -E %fedora)/erikreider-swayosd-fedora-$(rpm -E %fedora).repo
57+
rpm-ostree install swayosd
58+
```
59+
4260
### Arch Linux
4361

4462
- extra: [swayosd](https://archlinux.org/packages/extra/x86_64/swayosd/)

build-scripts/swayosd.rpkg.spec

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# vim: syntax=spec
2+
%global alt_pkg_name swayosd
3+
4+
Name: %{alt_pkg_name}
5+
Version: 0.2.1
6+
Release: 1%{?dist}
7+
Summary: A GTK based on screen display for keyboard shortcuts like caps-lock and volume
8+
Provides: %{alt_pkg_name} = %{version}-%{release}
9+
License: GPLv3
10+
URL: https://github.com/ErikReider/swayosd
11+
VCS: {{{ git_repo_vcs }}}
12+
Source: {{{ git_repo_pack }}}
13+
14+
# TODO: Use fedora RPM rust packages
15+
BuildRequires: meson >= 1.5.1
16+
BuildRequires: rust
17+
BuildRequires: cargo
18+
BuildRequires: pkgconfig(gtk4)
19+
BuildRequires: pkgconfig(gtk4-layer-shell-0)
20+
BuildRequires: pkgconfig(glib-2.0) >= 2.50
21+
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.68
22+
BuildRequires: pkgconfig(gee-0.8) >= 0.20
23+
BuildRequires: pkgconfig(libpulse)
24+
BuildRequires: pkgconfig(libudev)
25+
BuildRequires: pkgconfig(libevdev)
26+
BuildRequires: pkgconfig(libinput)
27+
BuildRequires: pkgconfig(dbus-1)
28+
BuildRequires: systemd-devel
29+
BuildRequires: systemd
30+
BuildRequires: sassc
31+
32+
Requires: dbus
33+
%{?systemd_requires}
34+
35+
%description
36+
A OSD window for common actions like volume and capslock.
37+
38+
%prep
39+
{{{ git_repo_setup_macro }}}
40+
41+
%build
42+
%meson
43+
%meson_build
44+
45+
%install
46+
%meson_install
47+
48+
%files
49+
%doc README.md
50+
%{_bindir}/swayosd-client
51+
%{_bindir}/swayosd-server
52+
%{_bindir}/swayosd-libinput-backend
53+
%license LICENSE
54+
%config(noreplace) %{_sysconfdir}/xdg/swayosd/backend.toml
55+
%config(noreplace) %{_sysconfdir}/xdg/swayosd/config.toml
56+
%config(noreplace) %{_sysconfdir}/xdg/swayosd/style.css
57+
%{_unitdir}/swayosd-libinput-backend.service
58+
%{_libdir}/udev/rules.d/99-swayosd.rules
59+
%{_datadir}/dbus-1/system-services/org.erikreider.swayosd.service
60+
%{_datadir}/dbus-1/system.d/org.erikreider.swayosd.conf
61+
%{_datadir}/polkit-1/actions/org.erikreider.swayosd.policy
62+
%{_datadir}/polkit-1/rules.d/org.erikreider.swayosd.rules
63+
64+
# Changelog will be empty until you make first annotated Git tag.
65+
%changelog
66+
{{{ git_repo_changelog }}}

meson.build

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
project('swayosd', 'rust',
2-
version: '0.2.0',
3-
meson_version: '>= 0.62.0',
4-
default_options: [ 'warning_level=2', 'werror=false', ],
1+
project(
2+
'swayosd',
3+
'rust',
4+
version: '0.2.1',
5+
meson_version: '>= 0.62.0',
6+
default_options: [
7+
'warning_level=2',
8+
'werror=false',
9+
],
510
)
611

712
config_path = join_paths(get_option('sysconfdir'), 'xdg', 'swayosd')

0 commit comments

Comments
 (0)