srpm-spec-inject-patches(1)

SRPM-SPEC-INJECT-PATCHES(1) User Contributed Perl Documentation SRPM-SPEC-INJECT-PATCHES(1)

NAME

srpm-spec-inject-patches - inject patches into a spec from set of dirs.

SYNOPSIS

srpm-spec-inject-patches [-h|--help] [-n|--dry-run] [--spec spec file to insert] [--from directory] [--inject-spec path to spec file] [--no-inject-spec,--debian] [--shift number] [--prefix number]

DESCRIPTION

srpm-spec-inject-patches can and usually should be run without command line arguments in a gear repository. Its arguments should be placed in the spec file. However, there are also command line arguments for testing and debug purposes.

To manage external patches with the help of this utility create a directory for each source of patches. For example:
mkdir fedora debian suse Create subdirs `applied' and `not-applied' in each directory. Unpack the contents of the corresponding source package to its directory (for example, src.rpm from Fedora to fedora dir) removing upstream sources. Move the spec file and the patches you want to apply to the 'applied' subdir. Move the rest to the 'not-applied' subdir. Add the dir to the git. Add the gear rule to copy patches form applied subdir. Add the placeholders to the main and prep sections of the spec file with the format below:

# BeginPatches(<dirname>)<[optional variables]>: <optional comments> # EndPatches(<dirname>): <optional comments>

for example,

 # ------ inserted with srpm-spec-inject-patches(1) -------
 # BeginPatches(fedora)[shift=300]: ----------------------------------
 # EndPatches(fedora): ------------------------------------

note that the variables (in the `[' `]' brackets) are read and set in the main section only. You can place variables in prep section placeholder, but they will be ignored.

Now run the script and the placeholders will be filled with the patches found in `applied' subdir.

For the list and meaning of suppored variables, see OPTIONS

OPTIONS

-h, --help
Display this help and exit.
-n, --dry-run
Do not overwrite the spec; just print the result to stdout.
--spec spec file to insert
Spec file to insert patches to. By default, if a gear repository detected, the default gear repository spec file is used.
[--from directory]
Directory for the source of patches. It should contain `applied' and `not-applied' subdirs. The argument corresponds to <dirname> in the placeholders
# BeginPatches(<dirname>)<[optional variables]>: <optional comments>
# EndPatches(<dirname>): <optional comments>
[--shift number]
Shift the patch numbers of inserted patches by a given number. The corresponding variable is called shift.
[--inject-spec path to spec file]
The spec file that has patches to be inserted. The utility will pick the PatchXX: line for each patch to be inserted (from the `applied' subdir) together with the preceding comments and will pick the patch prefixes (%patchXX -p<prefix>) and other options from the %prep section. Also the utility will check that all patches mentioned in the spec are found either in `applied' or `not-applied' subdir. The corresponding variable is called spec (also inject_spec).

By default, a spec file found in `applied' subdir is used. If a spec file is not found or not provided a warning is issued unless `debian' mode is enabled.

[--no-inject-spec,--debian]
Enables `debian' mode. In `debian' mode no spec file is expected for the given set of patches. Instead, patches are added in the lexicographical order. If the directory for the source of patches has name `debian' or `ubuntu', then `debian' mode is enabled by default.

The corresponding variable assignment looks like no_inject_spec=1 or debian=1.

[--prefix number]
Set prefix in %patch -p<prefix>. Assume `debian' mode. The corresponding variable is called prefix.

AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

COPYING

Copyright (c) 2017 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

2023-10-12 perl v5.34.0