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:
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`).
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