packit / dist-git-to-source-git

Converting dist-git to source-git
MIT License
4 stars 9 forks source link

re-add support for %setup+%patch #39

Closed TomasTomecek closed 4 years ago

TomasTomecek commented 4 years ago

We need to explicitly support the %setup + %patch combo because these two macros can't be replaced via the traditional macro system in /usr/lib/rpm/ since rpm parses them via C code in:

https://github.com/rpm-software-management/rpm/pull/1350

This patch tries to detect the usage of %setup - if any of the %auto{setup,patch} are used, we're good since those use the %_scm{setup/apply} which we override to make sure git repos are created. Otherwise d2s replaces %setup with '%autosetup -N' (-N to let %patch do the job). With that change we'll be sure that git repo is created during %prep. We then replace %__patch with packitpatch to apply the patches.

The last missing piece was patch metadata - rpm does not pass the patch name to %patch. Luckily, Michal Domonkos is so fabulous - we can readlink -f /dev/stdin which points to the actual patch (rpm does `cat $patch | %patch`).

🍻 🥂 🎉 🥳

Fixes #37

softwarefactory-project-zuul[bot] commented 4 years ago

Build succeeded.

TomasTomecek commented 4 years ago

w0000000000t, passed?!

softwarefactory-project-zuul[bot] commented 4 years ago

Build succeeded.

softwarefactory-project-zuul[bot] commented 4 years ago

Build succeeded (gate pipeline).