Skip to content

Commit 8a2a0fd

Browse files
kerncofflinehacker
andauthored
ENH: RPM spec file for Fedora (#4)
* MNT: Add RPM spec Co-authored-by: Jaka Hudoklin <[email protected]> * fixup! MNT: Add RPM spec * Use `git describe --abrev=0` * Try `make srpm` build with .copr/Makefile * Extract version string from GitHub API. Nothing else works! 🫣 * Write app_version into specfile before building * Remove %generate_buildrequires line that errors Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.ZG7Ec0 + umask 022 + cd /builddir/build/BUILD/efck-chat-keyboard-1.0-build + cd efck-chat-keyboard-1.0 /var/tmp/rpm-tmp.ZG7Ec0: line 34: cd: efck-chat-keyboard-1.0: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.ZG7Ec0 (%generate_buildrequires) * Revision after having rtfm * Fix some names * Unify names 😵‍💫 * %pyproject_wheel needs %generate_buildrequires * For %check, BuildRequire pyqt6 which is not in setup_requires= * pyproject_buildrequires -r requirements.txt * Disable %check (crashes) * Reshuffle files * Avoid warnings "File listed twice" * Avoid `find-debuginfo -S debugsourcefiles.list` error --------- Co-authored-by: Jaka Hudoklin <[email protected]>
1 parent 6ca24ff commit 8a2a0fd

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

.copr/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
VERSION := $(shell \
2+
curl 'https://api.github.com/repos/efck-chat-keyboard/efck/releases/latest' | \
3+
grep -oP '(?<=tag_name": "v)[^"]+' )
4+
.PHONY: prepare srpm rpm
5+
6+
7+
prepare:
8+
dnf -y install rpmdevtools rpm-build
9+
sed -Ei "s/^(%global version ).*/\1$(VERSION)/" $(spec)
10+
spectool -g -R $(spec)
11+
12+
srpm: prepare
13+
rpmbuild -bs --define "_srcrpmdir $(outdir)" $(spec)
14+
15+
rpm: prepare
16+
rpmbuild -bb --define "_rpmdir $(outdir)" $(spec)

packaging/copr-rpm.spec

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
%global app_name efck-chat-keyboard
2+
%global module_name efck
3+
4+
%global version 1.0git
5+
6+
Name: %{module_name}
7+
Version: %{version}
8+
Release: 1%{?dist}
9+
Summary: Emoji filter / Unicode chat keyboard
10+
License: AGPLv3
11+
URL: https://efck-chat-keyboard.github.io
12+
BugURL: https://github.com/efck-chat-keyboard/efck
13+
14+
Source0: %{pypi_source efck}
15+
Source1: https://github.com/efck-chat-keyboard/efck/archive/v%{version}/%{module_name}-v%{version}.tar.gz
16+
17+
%description %{expand:
18+
A Qt GUI utility that pops up a dialog with tabs for:
19+
emoji filtering / selection, text to Unicode transformation,
20+
GIF meme selection etc. (extensible).
21+
Upon activation, it 'pastes' your selection into the previously active
22+
(focused) window, such as a web browser or a desktop chat app or similar.}
23+
24+
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Debuginfo/#_useless_or_incomplete_debuginfo_packages_due_to_other_reasons
25+
%global debug_package %{nil}
26+
# https://serverfault.com/questions/681691/when-debuginfo-rpm-is-generated
27+
%global __debug_package 0
28+
29+
BuildArch: noarch
30+
BuildRequires: python3-devel
31+
# Dependency on Fedora, required in other distros
32+
BuildRequires: pyproject-rpm-macros
33+
# For %check section
34+
BuildRequires: xorg-x11-server-Xvfb
35+
BuildRequires: python3-pyqt6
36+
BuildRequires: python3-unicodedata2
37+
38+
Requires: (python3-pyqt6 or python3-qt5)
39+
Requires: google-noto-emoji-color-fonts
40+
Recommends: xdotool if xorg-x11-server-Xorg
41+
Recommends: ydotool
42+
Recommends: python3dist(unicodedata2)
43+
Provides: %{module_name}
44+
45+
%py_provides python3-%{module_name}
46+
47+
%generate_buildrequires
48+
%pyproject_buildrequires -r requirements.txt
49+
50+
51+
%prep
52+
%autosetup -n %{module_name}-%{version}
53+
54+
55+
%build
56+
%pyproject_wheel
57+
58+
59+
%install
60+
%pyproject_install
61+
%pyproject_save_files efck +auto
62+
install -Dm644 -t %{buildroot}%{_datadir}/applications/ packaging/debian/%{app_name}.desktop
63+
install -Dm644 -t %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/ packaging/debian/%{app_name}.svg
64+
65+
66+
%files -n %{module_name} -f %{pyproject_files}
67+
%{_datadir}/applications/*
68+
%{_datadir}/icons/hicolor/scalable/apps/*
69+
%doc README.md
70+
%license LICENSE.txt
71+
72+
73+
# For now disable check stage as it goes:
74+
# Check import: efck
75+
# /var/tmp/rpm-tmp.ixJzGa: line 57: 655 Aborted (core dumped)
76+
#%check
77+
#%%pyproject_check_import
78+
#xvfb-run -a -- %%{_bindir}/%%{module_name} --help
79+
80+
81+
%changelog
82+
* Fri Sep 30 2022 Maintainer <[email protected]> - 1.0
83+
- initial package

0 commit comments

Comments
 (0)