#58 RFE: prepare gitrepo for source code
Opened 13 years ago by npajkovs. Modified 7 years ago

full comment is in patch. Also I'm working on fedpkg to be able commit(git am -3 < patch) patches from root dir. Patches could be without From, Subject. From can be easily taken from git config. Subject will be automatically taken from file name a it's up to maintainer fix/regenerate/rebase patches if he wants to use this feature.

Posting the patch summary here as it is difficult to get via clicking on the attachment:

[PATCH] prepare gitrepo for souce code

fedpkg prep is not enought for good using git, because
you don't use it for developing. So I propuse simple patch
which extract source tarball([tar.]xz,lzma,[tar.]bz2,[tar.]gz),
rename it to %{NAME}-%{VERSION}.git, init git repo and
commit full upstream source code into git.

usage: fedpkg prep --git

[firefox/fedorahosted have conspired to eat my former well-formulated comment. This is a cheap replacement.]

I see these issues:

  1. fedpkg prep runs the spec file's %prep section. fedpkg prep --git as proposed has nothing to do whatsoever with the %prep section.

  2. As proposed, the patch does not appear to add anything over an almost-trivial tarball extraction and running git init && git add . && git commit on it.

I like the basic idea of this patch, but I would like it to do a few more things.

One idea would be to apply all patches listed in the spec file in sequence (and do a git commit after each patch). Then one could add more commits, rebase some, and arrive with a new patch set.

However, this still has nothing to do with the %prep section which commonly does other things besides extract-one-tarball-and-apply-patches, like extracting more tarballs, running sed -i to "patch" some files, do charset or EOL conversions, etc. And you would As %prep is just a shell script, one would need to hook into it in some way and do a git commit after every shell command it runs... if that is possible at all.

Also, I would expect this to come with an easy way to actually hook the revised set of commits from the new git repo into the spec file in the form of a series of patches. Of course, this would need to filter out any changes done by command line tools in %prep which were not originally patches, and fix the order between those tools and the patches. This is not easy.

So, it appears that as it is, this patch is more or less trivial, but to fix its issues it still has some hard stuff to solve.

Maybe I am wrong, but I wanted something similar as description. I hacked some attempt to init git repo in fedpkg prep and apply all patches and manual commands to the repository. It requires no change of spec file at this time. My solution might be able to 3 way merge to incorporate non-clean patches.

See https://github.com/pihhan/rpm-gitprep for details.

Login to comment on this ticket.