- Fix %autosetup not to cause errors during run of rpmspec tool

- Resolves: #1293687
This commit is contained in:
Lubos Kardos 2016-01-19 16:20:24 +01:00
parent cc1db15b09
commit a0329136e3
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 231a7213b90a8dfba426737732e2dc6e62acfbad Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Tue, 19 Jan 2016 14:37:07 +0100
Subject: [PATCH] Fix %autosetup to not cause errors during run of rpmspec tool
Firstly %autosetup showed an error during its expansion if some patch
wasn't available, that is an error was showed during parsing of a spec
file. This caused showing an error during execution of rpmspec
tool (rhbz:1293687).
Now %autosetup doesn't cause an error during parsing of a spec file but
it causes an error during building of specfile if some patch is not
available. Also old macro %patch behaves similarly.
---
macros.in | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/macros.in b/macros.in
index 319a1a3..f11affe 100644
--- a/macros.in
+++ b/macros.in
@@ -1122,8 +1122,15 @@ done \
# Single patch application
%apply_patch(qp:m:)\
-test -f %{1} || exit 1 ; \
-%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
+%{lua:\
+local file = rpm.expand("%{1}")\
+if posix.access(file, "r") then\
+ local options = rpm.expand("%{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}")\
+ local scm_apply = rpm.expand("%__scm_apply_%{__scm}")\
+ print(rpm.expand("%{uncompress:"..file.."} | "..scm_apply.." "..options.."\\n"))\
+else\
+ print("echo 'Cannot read "..file.."'; exit 1;".."\\n")\
+end}
# Automatically apply all patches
%autopatch(vp:)\
--
1.9.3

View File

@ -29,7 +29,7 @@
Summary: The RPM package management system Summary: The RPM package management system
Name: rpm Name: rpm
Version: %{rpmver} Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}16%{?dist} Release: %{?snapver:0.%{snapver}.}17%{?dist}
Group: System Environment/Base Group: System Environment/Base
Url: http://www.rpm.org/ Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2 Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@ -66,6 +66,7 @@ Patch110: rpm-4.13.0-disabling-filetriggers.patch
Patch111: rpm-4.13.0-chroot-file-triggers.patch Patch111: rpm-4.13.0-chroot-file-triggers.patch
Patch112: rpm-4.13.0-missingok.patch Patch112: rpm-4.13.0-missingok.patch
Patch113: rpm-4.13.0-recursing-rpmdeps.patch Patch113: rpm-4.13.0-recursing-rpmdeps.patch
Patch114: rpm-4.13.0-autosetup-errors.patch
# These are not yet upstream # These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch Patch302: rpm-4.7.1-geode-i686.patch
@ -570,6 +571,9 @@ exit 0
%doc doc/librpm/html/* %doc doc/librpm/html/*
%changelog %changelog
* Tue Jan 19 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.17
- Fix %autosetup not to cause errors during run of rpmspec tool (#1293687)
* Fri Jan 15 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.16 * Fri Jan 15 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.16
- Fix recursive calling of rpmdeps tool (#1297557) - Fix recursive calling of rpmdeps tool (#1297557)