Skip to content

Commit

Permalink
Split git setup to several steps
Browse files Browse the repository at this point in the history
Configuration requirements for `git` and `git_am` can be different
enough so that that these two should not share the setup routine
in it's entirety [1]. On the other hand, some parts of the setup
can (and should) be kept same in both approaches.

[1]: #3472

This splits the `%__scm_setup_git` macro into several named steps,
that are later combined. This will allow for future differentiation
of `git` and `git_am` by customizing (only) the relevant step(s).
  • Loading branch information
khardix committed Dec 13, 2024
1 parent fe9a914 commit 92e4315
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -1239,17 +1239,26 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\
%__scm_source_timestamp @${SOURCE_DATE_EPOCH:-${RPM_BUILD_TIME:?}}

# Git
%__scm_setup_git(q)\
%__scm_init_git(q)\
%{__git} init %{-q}\
%{__git} config gc.auto 0

%__scm_configure_git\
%{__git} config user.name "%{__scm_username}"\
%{__git} config user.email "%{__scm_usermail}"\
%{__git} config gc.auto 0\
%{__git} config user.email "%{__scm_usermail}"

%__scm_import_git(q)\
%{__git} add --force .\
GIT_COMMITTER_DATE=%{__scm_source_timestamp} GIT_AUTHOR_DATE=%{__scm_source_timestamp}\\\
%{__git} commit %{-q} --allow-empty -a\\\
--author "%{__scm_author}" -m "%{NAME}-%{VERSION} base"\
%{__git} checkout --track -b rpm-build

%__scm_setup_git(q)\
%{expand:%__scm_init_git %{-q}}\
%{expand:%__scm_configure_git}\
%{expand:%__scm_import_git %{-q}}

%__scm_apply_git(qp:m:)\
%{__git} apply --index --reject %{-p:-p%{-p*}} -\
GIT_COMMITTER_DATE=%{__scm_source_timestamp} GIT_AUTHOR_DATE=%{__scm_source_timestamp}\\\
Expand Down

0 comments on commit 92e4315

Please sign in to comment.