rpm-software-management / tito

A tool for managing rpm based git projects.
GNU General Public License v2.0
378 stars 129 forks source link

Turn deprecated %patchN syntax into %patch -PN #499

Open xsuchy opened 4 months ago

xsuchy commented 4 months ago

RPM has deprecated the %patchN syntax in favor of %patch -PN where N is the patch number for a year now. See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/IYU7AG53C6YWZWHUJJYQBVVU2O7EQ2F6/

And Tito will be affected:

$ git grep Patch
src/tito/builder/main.py:        patch_pattern = re.compile(r'^Patch(\d+):')
src/tito/builder/main.py:        # Find the largest PatchX: line, or failing that SourceX:
src/tito/builder/main.py:        patch_number = 0  # What number should we use for our PatchX line
src/tito/builder/main.py:        patch_insert_index = 0  # Where to insert our PatchX line in the list
src/tito/builder/main.py:            error_out("Unable to insert PatchX or %patchX lines in spec file")
src/tito/builder/main.py:        debug("Patch: %s" % patch_file)
src/tito/builder/main.py:        lines.insert(patch_insert_index, "Patch%s: %s\n" % (patch_number,
src/tito/distributionbuilder.py:      Patch0: foo-1.2.13-1-to-foo-1.2.13-3-sat.patch
src/tito/distributionbuilder.py:      Patch0: foo-1.2.13-1-to-foo-1.2.13-2-sat.patch
src/tito/distributionbuilder.py:      Patch1: foo-1.2.13-2-to-foo-1.2.13-3-sat.patch
src/tito/distributionbuilder.py:            lines.insert(patch_insert_index, "Patch%s: %s\n" % (patch_number, patch))
tito.props.5.asciidoc:put in spec file as Patch0.
tito.props.5.asciidoc: Patch0: foo-1.2-1-to-foo-1.2-2.patch
tito.props.5.asciidoc: Patch1: foo-1.2-1-to-foo-1.2-3.patch
praiskup commented 4 months ago

I thought %patch N is the preferred variant 8-)

decathorpe commented 4 months ago

AFAIK %patch N is the modern syntax, but that's not supported by all RPM versions that are still relevant.

praiskup commented 4 months ago

Could we use %autosetup instead?