#118 RFE: rpmautospec should use libgit2 (or another library)
Closed: Fixed a year ago by scoady. Opened a year ago by zbyszek.

Currently rpmautospec is written to shell out to git binary. Based on my experience with writing those kinds of things (e.g. integration of git calls in versions checks in a build system and scripts to gather repo statistics), this is always going to be slow and brittle [1]. In particular, git invoked directly has complicated rules how to figure out what the right worktree is, is affected by environment variables and nested repos. Since git does text output, postprocessing of this text is always going to be more complicated than getting structured data. Thus, I think it is paramount to rewrite rpmautospec to integrate directly with a library like libgit2, for efficiency and reliability. There are some other ones, but I think libgit2 is the most widely used.

If there would be agreement on this, I am volunteering to write patches and in general help with this. I think @ignatenkobrain might be too.

[1] https://github.com/systemd/systemd/commit/a412ec5714


The code used to rely on pygit2 and was actually migrated away from it to reduce the dependency list which also means reducing the number of packages installed in the buildroot.

Well, that's unfortunate :(

I don't understand the tradeoff here: koji and fedpkg and dnf are already python-based. So using python3-pygit2.x86_64 pulls in only a small amount of packages, so the effect should not be too bad. OTOH, by calling out to git, the git stack is pulled in, which otherwise might not be.

But I don't think the list of deps should be the primary factor. Correctness and reliability are more important.

I don't understand the tradeoff here: koji and fedpkg and dnf are already python-based. So using python3-pygit2.x86_64 pulls in only a small amount of packages, so the effect should not be too bad. OTOH, by calling out to git, the git stack is pulled in, which otherwise might not be.

The git stack is always pulled, that's how koji gets the content stored in
dist-git.

Aside from this, I'd prefer to use a library rather than calling out to commands, myself. But in my experience and our case here, calling out to git is easier, makes for less complex code than using pygit2.

FWIW, my initial experience was that rpmautospec was very easy to break. Unless things and args are exactly right, it just does the wrong thing. Also, git is really designed for interactive use... In my initial message I listed various ways in which trying to call git directly is not as easy as it might seem.

Metadata Update from @nphilipp:
- Issue assigned to nphilipp

a year ago

The latest changes to the algorithm allowed us to forgo doing things in the build root which relaxes our stance on 3rd party dependencies a great deal, allowing us to implement the functionality on top of pygit2 rather than calling git directly. Stay tuned.

Here's the corresponding PR: #158

Hah, thank the change in deps requirements. :grinning:

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #158 Merged a year ago