Skip to content

Commit

Permalink
ENH: RPM spec file for Fedora (#4)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
kernc and offlinehacker authored Feb 6, 2025
1 parent 6ca24ff commit 8a2a0fd
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .copr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
VERSION := $(shell \
curl 'https://api.github.com/repos/efck-chat-keyboard/efck/releases/latest' | \
grep -oP '(?<=tag_name": "v)[^"]+' )
.PHONY: prepare srpm rpm


prepare:
dnf -y install rpmdevtools rpm-build
sed -Ei "s/^(%global version ).*/\1$(VERSION)/" $(spec)
spectool -g -R $(spec)

srpm: prepare
rpmbuild -bs --define "_srcrpmdir $(outdir)" $(spec)

rpm: prepare
rpmbuild -bb --define "_rpmdir $(outdir)" $(spec)
83 changes: 83 additions & 0 deletions packaging/copr-rpm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
%global app_name efck-chat-keyboard
%global module_name efck

%global version 1.0git

Name: %{module_name}
Version: %{version}
Release: 1%{?dist}
Summary: Emoji filter / Unicode chat keyboard
License: AGPLv3
URL: https://efck-chat-keyboard.github.io
BugURL: https://github.com/efck-chat-keyboard/efck

Source0: %{pypi_source efck}
Source1: https://github.com/efck-chat-keyboard/efck/archive/v%{version}/%{module_name}-v%{version}.tar.gz

%description %{expand:
A Qt GUI utility that pops up a dialog with tabs for:
emoji filtering / selection, text to Unicode transformation,
GIF meme selection etc. (extensible).
Upon activation, it 'pastes' your selection into the previously active
(focused) window, such as a web browser or a desktop chat app or similar.}

# https://docs.fedoraproject.org/en-US/packaging-guidelines/Debuginfo/#_useless_or_incomplete_debuginfo_packages_due_to_other_reasons
%global debug_package %{nil}
# https://serverfault.com/questions/681691/when-debuginfo-rpm-is-generated
%global __debug_package 0

BuildArch: noarch
BuildRequires: python3-devel
# Dependency on Fedora, required in other distros
BuildRequires: pyproject-rpm-macros
# For %check section
BuildRequires: xorg-x11-server-Xvfb
BuildRequires: python3-pyqt6
BuildRequires: python3-unicodedata2

Requires: (python3-pyqt6 or python3-qt5)
Requires: google-noto-emoji-color-fonts
Recommends: xdotool if xorg-x11-server-Xorg
Recommends: ydotool
Recommends: python3dist(unicodedata2)
Provides: %{module_name}

%py_provides python3-%{module_name}

%generate_buildrequires
%pyproject_buildrequires -r requirements.txt


%prep
%autosetup -n %{module_name}-%{version}


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files efck +auto
install -Dm644 -t %{buildroot}%{_datadir}/applications/ packaging/debian/%{app_name}.desktop
install -Dm644 -t %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/ packaging/debian/%{app_name}.svg


%files -n %{module_name} -f %{pyproject_files}
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/scalable/apps/*
%doc README.md
%license LICENSE.txt


# For now disable check stage as it goes:
# Check import: efck
# /var/tmp/rpm-tmp.ixJzGa: line 57: 655 Aborted (core dumped)
#%check
#%%pyproject_check_import
#xvfb-run -a -- %%{_bindir}/%%{module_name} --help


%changelog
* Fri Sep 30 2022 Maintainer <[email protected]> - 1.0
- initial package

0 comments on commit 8a2a0fd

Please sign in to comment.