-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmacros.packit
35 lines (29 loc) · 1.42 KB
/
macros.packit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
# we want both: here and in packitpatch
# if there are no patches, packitpatch never gets invoked and this will b/c of autosetup
%__scm_setup_patch(q)\
%{__git} init\
%{__git} add -f .\
%{__git} commit -q --allow-empty -a -m "%{NAME}-%{VERSION} base"
# %{1} = absolute path to the patch
# %{2} = patch ID
%__scm_apply_patch(qp:m:)\
/usr/bin/packitpatch %{1} %{2} %{-p:-p%{-p*}} %{-q:-s} --fuzz=%{_default_patch_fuzz} %{_default_patch_flags}
%__patch /usr/bin/packitpatch %{1} %{2} %{-p:-p%{-p*}} %{-q:-s} --fuzz=%{_default_patch_fuzz} %{_default_patch_flags}
%__scm_setup_git(q)\
%{__git} init %{-q}\
%{__git} add -f .\
%{__git} commit -q --allow-empty -a -m "%{NAME}-%{VERSION} base"
# commit_msg contains commit message of the last commit
%__scm_apply_git_am(qp:m:)\
%{__git} am %{-q} %{-p:-p%{-p*}}\
patch_name=`basename %{1}`\
commit_msg=`%{__git} log --format=%B -n1`\
metadata_commit_msg=`printf "patch_name: $patch_name\\npresent_in_specfile: true\\nlocation_in_specfile: %{2}\\nsquash_commits: true"`\
%{__git} commit --amend -m "$commit_msg" -m "$metadata_commit_msg"
%__scm_apply_git(qp:m:)\
%{__git} apply --index %{-p:-p%{-p*}} -\
patch_name=`basename %{1}`\
metadata_commit_msg=`printf "patch_name: $patch_name\\npresent_in_specfile: true\\nlocation_in_specfile: %{2}"`\
%{__git} commit %{-q} -m %{-m*} -m "$metadata_commit_msg" --author "%{__scm_author}"