mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
spec: Automatically apply all patches with git
With this change, any patch declared in libvirt.spec with Patch[0-9]* is automatically applied in %prep. Unlike with the standard %patch[0-9]*, patches are applied with "git am" to avoid some unexpected results. However, as a result of this, all patches must be in the right format for "git am" to be able to apply them; they should ideally be generated from git using "git format-patch". Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
21c676c2aa
commit
1fd8360751
2
cfg.mk
2
cfg.mk
@ -1084,7 +1084,7 @@ exclude_file_name_regexp--sc_prohibit_strdup = \
|
|||||||
^(docs/|examples/|src/util/virstring\.c|tests/virnetserverclientmock.c$$)
|
^(docs/|examples/|src/util/virstring\.c|tests/virnetserverclientmock.c$$)
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_close = \
|
exclude_file_name_regexp--sc_prohibit_close = \
|
||||||
(\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt-stream\.c|tests/vir(cgroup|pci)mock\.c)$$)
|
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/virfile\.c|src/libvirt-stream\.c|tests/vir(cgroup|pci)mock\.c)$$)
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||||
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff$$)
|
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff$$)
|
||||||
|
@ -425,6 +425,7 @@ BuildRequires: gettext-devel
|
|||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
BuildRequires: /usr/bin/pod2man
|
BuildRequires: /usr/bin/pod2man
|
||||||
%endif
|
%endif
|
||||||
|
BuildRequires: git
|
||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
BuildRequires: python
|
BuildRequires: python
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
@ -1198,6 +1199,41 @@ driver
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
|
# Patches have to be stored in a temporary file because RPM has
|
||||||
|
# a limit on the length of the result of any macro expansion;
|
||||||
|
# if the string is longer, it's silently cropped
|
||||||
|
%{lua:
|
||||||
|
tmp = os.tmpname();
|
||||||
|
f = io.open(tmp, "w+");
|
||||||
|
count = 0;
|
||||||
|
for i, p in ipairs(patches) do
|
||||||
|
f:write(p.."\n");
|
||||||
|
count = count + 1;
|
||||||
|
end;
|
||||||
|
f:close();
|
||||||
|
print("PATCHCOUNT="..count.."\n")
|
||||||
|
print("PATCHLIST="..tmp.."\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
git init -q
|
||||||
|
git config user.name rpm-build
|
||||||
|
git config user.email rpm-build
|
||||||
|
git config gc.auto 0
|
||||||
|
git add .
|
||||||
|
git commit -q -a --author 'rpm-build <rpm-build>' \
|
||||||
|
-m '%{name}-%{version} base'
|
||||||
|
|
||||||
|
COUNT=$(grep '\.patch$' $PATCHLIST | wc -l)
|
||||||
|
if [ $COUNT -ne $PATCHCOUNT ]; then
|
||||||
|
echo "Found $COUNT patches in $PATCHLIST, expected $PATCHCOUNT"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $COUNT -gt 0 ]; then
|
||||||
|
xargs git am <$PATCHLIST || exit 1
|
||||||
|
fi
|
||||||
|
echo "Applied $COUNT patches"
|
||||||
|
rm -f $PATCHLIST
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if ! %{with_xen}
|
%if ! %{with_xen}
|
||||||
%define _without_xen --without-xen
|
%define _without_xen --without-xen
|
||||||
|
Loading…
Reference in New Issue
Block a user