forked from pihhan/rpm-gitprep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.rpm-gitprep
54 lines (49 loc) · 2.01 KB
/
macros.rpm-gitprep
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# gitprep specific
# Here comes the hack
%_gitprep_rpmpatch %{_libexecdir}/rpm-gitprep/rpmpatch.git
# original_value from lib
# is there way to use old %%_fixperms value without creating recursion?
%_gitprep_orig_fixperms %{__chmod} -Rf a+rX,u+w,g-w,o-w
%_gitprep_fixperms \
%{?__scm:if [ "%__scm" = patch ]; then %{_gitprep_fixperms_git_setup}; fi} \
%{_gitprep_orig_fixperms}
%_gitprep__patch %{_gitprep_rpmpatch} --git=%{__git}
# Because variables of macro will be destroyed if _fixperms calls macro,
# workaround it by using a non-macro copy of __scm_setup_git
%_gitprep_fixperms_git_setup \
%{__git} init %{-q}\
%{__git} config user.name "%{__scm_username}"\
%{__git} config user.email "%{__scm_usermail}"\
%{__git} config gc.auto 0\
%{__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
# workaround to message support
# this macros allow usage of .autosetup -S gitprep
%__scm_setup_gitprep(q) %{__scm_setup_git %{-q}}
%__scm_apply_gitprep(qp:m:)\
%{_gitprep__patch} %{-p:-p%{-p*}} %{-m:-m %{-m*}} %{-q:-s} --fuzz=%{_default_patch_fuzz} %{_default_patch_flags} %{?1} %{?2}
# Define special handler commiting changes after sections
%___gitprep_post() \
if test "%__scm" = gitprep && \
test "$(%{__git} status --porcelain --untracked-files=no | wc -l)" != 0; then \
%{__git} commit -am %{1}-post \
else : \
fi \
%{nil}
%__spec_prep_post %{___gitprep_post prep} %{___build_post}
%__spec_conf_post %{___gitprep_post conf} %{___build_post}
%__spec_build_post %{___gitprep_post build} %{___build_post}
%__spec_check_post %{___gitprep_post check} %{___build_post}
%__spec_install_post\
%{?__debug_package:%{__debug_install_post}}\
%{__arch_install_post}\
%{__os_install_post}\
%{___gitprep_post install}\
%{nil}
# Add to your ~/.rpmmacros:
# %_fixperms %{_gitprep_rpmfixperms}
# %__patch %{_gitprep_rpmpatch}
# %__scm_apply_patch %{__scm_apply_gitprep}