Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Official Gentoo repository #720

Open
Eiji7 opened this issue Dec 2, 2023 · 13 comments
Open

Official Gentoo repository #720

Eiji7 opened this issue Dec 2, 2023 · 13 comments

Comments

@Eiji7
Copy link

Eiji7 commented Dec 2, 2023

Hi,

I found that trackma's latest version available for Gentoo is 0.8.5-r1 and it's a part of kzd overlay. Since creating a Gentoo repository is very simple (I did it locally in "5 min") could you please consider maintaining such repository?

Here is how simple it looks like:

  1. Creating a repository using command sudo eselect repository create z411
  2. Create a directory /var/db/repos/z411/net-misc/trackma
  3. Add 2 simple files called metadata.xml and trackma-0.8.6.ebuild in newly created directory
  4. Generate manifest using command sudo pkgdev manifest

Here is a metadata.xml contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
	<maintainer type="person">
		<email>z411@omaera.org</email>
		<name>z411</name>
	</maintainer>
	<upstream>
		<maintainer status="active">
			<email>z411@omaera.org</email>
			<name>z411</name>
		</maintainer>
		<bugs-to>https://github.com/z411/trackma/labels/bug</bugs-to>
		<changelog>https://github.com/z411/trackma/releases</changelog>
		<remote-id type="github">z411/trackma</remote-id>
	</upstream>
	<use>
		<flag name="cli">
			Command Line Interface for Trackma.
		</flag>
	</use>
</pkgmetadata>

and here is a trackma-0.8.6.ebuild contents:

EAPI=8
KEYWORDS="amd64"
PYTHON_COMPAT=( python3_{7..12} )
DISTUTILS_USE_PEP517=poetry

inherit distutils-r1 desktop

DESCRIPTION="Open multi-site list manager for media tracking sites"
HOMEPAGE="https://github.com/z411/trackma"
SRC_URI="https://github.com/z411/trackma/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3"
SLOT="0"
IUSE="+ncurses cli gtk inotify qt5"
REQUIRED_USE="|| ( cli gtk ncurses qt5 )"

DEPEND="ncurses? ( dev-python/urwid[${PYTHON_USEDEP}] )
	gtk? (
		dev-python/pygobject:3[${PYTHON_USEDEP}]
		dev-python/pycairo[${PYTHON_USEDEP}]
		dev-python/pillow[${PYTHON_USEDEP}]
	)
	qt5? (
		dev-python/PyQt5[${PYTHON_USEDEP},gui,widgets]
		dev-python/pillow[${PYTHON_USEDEP}]
	)"

RDEPEND="sys-process/lsof
	inotify? ( || ( dev-python/pyinotify ) )
	${DEPEND}"

distutils_enable_tests pytest

python_configure_all() {
	if ! use cli; then
		rm "${S}/${PN}/ui/cli.py" || die
	fi

	if ! use ncurses; then
		rm "${S}/${PN}/ui/curses.py" || die
	fi

	if ! use gtk; then
		rm -R "${S}/${PN}/ui/gtk" || die
	fi

	if ! use qt5; then
		rm -R "${S}/${PN}/ui/qt" || die
	fi
}

python_install_all() {
	distutils-r1_python_install_all
	newicon "${S}/${PN}/data/icon.png" "${PN}.png"
	use cli && make_desktop_entry "${PN}" "${PN^} (cli)" "${PN}" "Network" "Terminal=true"
	use ncurses && make_desktop_entry "${PN}-curses" "${PN^} (ncurses)" "${PN}" "Network" "Terminal=true"
	use gtk && make_desktop_entry "${PN}-gtk" "${PN^} (gtk3)" "${PN}" "Network" "StartupWMClass=${PN}-gtk3"
	use qt5 && make_desktop_entry "${PN}-qt" "${PN^} (qt5)" "${PN}" "Network" "StartupWMClass=${PN}-qt5"
}

python_test() {
	FORCE_COLOR=1 epytest
}

Here are some notes:

  1. As you may noticed I have used \t instead of 2 spaces. This is a "proper" format for Gentoo.
  2. You may use pkgcheck scan to verify your repository
  3. Please pay attention that there is no version mentioned in those files. Instead there is a variable called PV (project version i.e. a version in *.ebuild file name). This means that when you release a new trackma version all you have to do is to call a simple copy and regenerate manifest command as described above.

Most of the code here you need to "maintain" are static data in metadata.xml or a dependencies related. The rest of code is based on desktop and distutils-r1 inherited features with poetry in a variable called DISTUTILS_USE_PEP517. As long as you would not add more dependencies to project you don't have to even touch those already prepared files!

Adding a custom remote repository is also simple. All what Gentoo users have to do is to add it as root using:

eselect repository add z411 git https://github.com/z411/trackma-gentoo.git
# optional: set USE flag
echo "net-misc/trackma ncurses qt5" >> /etc/portage/package.use/z411
# optional: add trackma to the package set
echo "net-misc/trackma" >> /etc/portage/sets/anime-tools

Installation on Gentoo is simple and easily customizable:

# finally install it using
emerge net-misc/trackma
# optional: install package with temporary USE flags
# Note: 
USE="gtk" emerge net-misc/trackma
# optional: install from package set
emerge @anime-tools

All mentioned commands comes from app-eselect/eselect-repository, dev-util/pkgcheck and dev-util/pkgdev packages. You can find more information in the official documentation Creating an ebuild repository.

I guess in 99% cases you can simply do it from CI. Let me know if I have missed something or if you have any questions.

@FichteFoll
Copy link
Collaborator

Doesn't Gentoo have a community repository to maintain such things like all the other notable Linux distros (OpenSUSE, Arch, nix, etc.)? I don't have any Gentoo experience and don't intend to acquire any, nor do I want to be responsible for maintaining something I have no experience with and do not plan on using.

@Eiji7
Copy link
Author

Eiji7 commented May 1, 2024

@FichteFoll As linked above there is some kzd overlay. As in it's description:

kzd's personal overlay

it's not a community repository, but personal one, so if the author would drop it then somebody would need to recreate his own "personal" overlay or build a community around it to have a reasonable support. Having official repository is always better as basically it's dropped not sooner than the core project. A typical trackma user as well as user of any other app do not think what would happen if core project would be dropped which is way different than a "personal" overlay.

I don't remember a case when I was in need to add some dependency, because of update in trackma project, so as said maintaining it would be as simple as writing an automated CI script. Everything I wrote above could be on CI side, so pushing a new trackma version would trigger trackma-gentoo CI action (via some hooks or something like that - never used that feature before) to generate new or rename existing .ebuild file. I believe this is one-time CI + hooks setup.

I'm using both trackma and Gentoo everyday, so I can be responsible for maintaining an official repository as well as do all the testing you need. For example if you would create a trackma-gentoo repository which automatically create a PR on new trackma release, add me as a member then I could test changes in said PR, fix bugs (if any) and finally simply click merge button. If for some reason I would not maintain it then still you as an owner holds it, so you can ask somebody to take my place or archive repository.

Contents of both metadata and ebuild files I posted above are valid and working in my local ebuild repository, so they are ready to use in production. I don't require any knowledge from you. As long as you can do everything on CI side I would give you all information you need including what commands needs to be called to generate md5-cache and so on …

@FichteFoll
Copy link
Collaborator

FichteFoll commented May 2, 2024

it's not a community repository, but personal one

Yes, I was asking whether no such thing exists like the AUR, but from asking around it doesn't seem like it does.

I find this decentralized way of operation odd, but I personally wouldn't mind creating a new repository in a trackma-adjacent place and adding you as a contributor to it while not really interacting with it myself. However, I am just a collaborator on this project myself and @z411 would need to create either a new personal repo under his account or create a "trackma" organization to group the main and the gentoo-trackma repo, so I can't help further.

I don't remember a case when I was in need to add some dependency, because of update in trackma project,

Incidentally, there was such a change just yesterday when I merged #683 and there will another one once #628 is done, so dependency changes do occur, but are limited to only a few per year at most.

@Eiji7
Copy link
Author

Eiji7 commented May 2, 2024

Yes, I was asking whether no such thing exists like the AUR, but from asking around it doesn't seem like it does.

There is no one big repository like non-free or something like that. We have above 400 repositories which could be found in eselect repository list. Some of them are dedicated to a project or group like kde and there are also a personal repositories. You can search between them easily with:

https://gpo.zugaina.org

As you can see there trackma the only trackma there is in one personal repository and it's outdated.

Incidentally, there was such a change just yesterday when I merged #683 and there will another one once #628 is done, so dependency changes do occur, but are limited to only a few per year at most.

Oh, that's weird as trackma works for me without pydbus installed, but I'm using it only to update the anime status manually, so that's the reason. Also since it's compiled from source I guess that things like ./configure (or equivalent) handles all the required stuff and disabled some features if some optional dependencies are not installed. 😅

Anyway, both pydbus and jeepney are in official repository and are seen as stable. I don't see any problem of adding them to ebuild file under their own USE flag.

Qt 6 support? Great! That's not a problem for me at all. That's said I'm really waiting for it and it would be pleasure to test it! Also it does not look that migration to Qt 6 would cause any problem dev-python/PyQt6 is seen as stable and have same use flags (i.e. gui and widgets), so it's just about replacing all 5's with 6 in said .ebuild. I'm using KDE Plasma 6 at everyday, so I can join the fun immediately!

@FichteFoll
Copy link
Collaborator

Oh, that's weird as trackma works for me without pydbus installed

Most of trackma's dependencies are optional and only imported when you use them, most notably the UI libraries.

Anyway, that was just FYI.

@Eiji7
Copy link
Author

Eiji7 commented May 5, 2024

Brilliant! Gentoo users are always happy hearing that! 😃

If you decide to do so please ping me on initial PR with a complete list of all dependencies. I would make sure that all related distribution packages are listed together with their USE flag for optional support.

Helpful resource: Gentoo's USE flag index - it's a list of existing USE flags with global flags (i.e. used in many packages providing support for exactly same thing) on top and per-package flags. It would be definitely a worth reference when adding optional dependencies.

@FichteFoll
Copy link
Collaborator

FichteFoll commented May 5, 2024

Dependencies are documented in the README and otherwise listed & grouped in our pyproject.toml file, which will "always" be up-to-date.

@CodingOtaku
Copy link
Contributor

I'm just chiming in here as an interested party who maintains a personal Gentoo overlay that includes trackma.

On 2024-06-01, Python 3.12 will become the default on Gentoo. Which is not supported yet by trackma — for example, load_module used in engine.py was deprecated and does not work in Python 3.12. exec_module should be used instead.

So it would be better to wait till that happens before adding this project to the Gentoo repository.

@Eiji7
Copy link
Author

Eiji7 commented May 11, 2024

@CodingOtaku Interesting … I have compiled trackma using PYTHON_TARGETS: python3_12 without any problem. Is it runtime-only bug? Because of no Qt 6 support yet, I'm using the GTK+ GUI and never had any problems with trackma. It it something unrelated to list management (like scanning for media) as I'm using this app just for updating my list. 😅

@CodingOtaku
Copy link
Contributor

CodingOtaku commented May 11, 2024

There are no compile time errors, I use only the CLI version (with cli inotify ncurses USE flags). The error shows when launching trackma in cli-mode.

python/cpython#104212 could help to figure out how to migrate.

Edit: This particular code is run only if you have hooks.

@Eiji7
Copy link
Author

Eiji7 commented May 11, 2024

@CodingOtaku Ok, so if we are going to crate a repository we would need to use one of the above option:

  1. Create 2 ebuilds - one for older python versions (current trackma release) and one with python 3.12 support (future trackma release)
  2. Add a python version check or use any other way to call right API, so the trackma would be backwards compatible with previous Python versions and therefore there would be no need for extra ebuild files for future releases

It's up to @z411 how he plans to support various Python versions.

$ equery l python
 * Searching for python ...
[IP-] [  ] dev-lang/python-3.11.9:3.11
[IP-] [  ] dev-lang/python-3.12.3:3.12
$ eix dev-lang/python
[I] dev-lang/python
     Available versions:  
     (2.7)  2.7.18_p16-r2^t
     (3.8)  3.8.19_p1^t
     (3.9)  3.9.19_p2^t
     (3.10) 3.10.14_p1^t
     (3.11) 3.11.9^t
     (3.12) 3.12.3^t
     (3.13) **3.13.0_alpha6^t ~3.13.0_beta1^t
       {berkdb bluetooth build debug +ensurepip examples gdbm jit libedit +ncurses pgo +readline +sqlite +ssl test tk valgrind verify-sig wininst +xml LLVM_SLOT="+16 +18"}
     Installed versions:  3.11.9(3.11)^t(08:03:46 27.04.2024)(ensurepip gdbm ncurses readline sqlite ssl -bluetooth -build -debug -examples -libedit -pgo -test -tk -valgrind -verify-sig) 3.12.3(3.12)^t(23:27:25 11.04.2024)(ensurepip gdbm ncurses readline sqlite ssl -bluetooth -build -debug -examples -libedit -pgo -test -tk -valgrind -verify-sig)
     Homepage:            https://www.python.org/ https://github.com/python/cpython/
     Description:         An interpreted, interactive, object-oriented programming language

The news about making 3.12 a default version of Python on Gentoo does not mention that any previous version would be dropped from portage tree. On Gentoo we not only can require previous Python version to be installed, but also install multiple Python versions at the same time using slots. I'm using 3.12 as default Python version much before this announcement as it was marked as stable for a long time already.

Another thing we can use is USE flag restriction. For example if we add hooks USE flag and users would enable it on their installations then they would be forced (by portage) to also enable PYTHON_TARGETS: python3_11 until we do one of solutions mentioned above. So from here if there would be any bug report on Gentoo about hooks then firstly we would ask if they have hooks USE flag enabled.

So it would be better to wait till that happens before adding this project to the Gentoo repository.

I do not see why we should wait for that … I could understand any other distribution, but Gentoo is extremely configurable as described above. If you ask me it's not about "what if" something could go wrong - it's about how can I make it work. As said I'm using Gentoo for over 10 years and I can work on ebuild files to make it work as you wish. Just name what you need and I would update the files that I have used in first post. I can create some Gentoo-specific patches (if any needed) as well. If needed I can even test ebuild for all stable Python slots (as long as trackma support all of those versions) that I showed above in the output of eix command.

@FichteFoll
Copy link
Collaborator

Trackma not supporting Python 3.12 (when hooks are involved) is an entirely separate issue and something that I can fix myself when I find the time. It's tracked in #736. (I use trackma CLI on Python 3.12 without issues, but I also don't use hooks.)

@ahmubashshir
Copy link
Contributor

I'm using 6937663 to fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants