[libvirt] [PATCH] rpm: simplify applying of patches

Daniel P. Berrangé posted 1 patch 5 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180803093532.16922-1-berrange@redhat.com
Test syntax-check failed
libvirt.spec.in | 38 +-------------------------------------
1 file changed, 1 insertion(+), 37 deletions(-)
[libvirt] [PATCH] rpm: simplify applying of patches
Posted by Daniel P. Berrangé 5 years, 8 months ago
The distros we support for RPM builds all have %autosetup support so we
can ditch the convoluted code for running git manually and use the RPM
defaults.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 libvirt.spec.in | 38 +-------------------------------------
 1 file changed, 1 insertion(+), 37 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 19ae55cdaf..a2f3112a0b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -993,43 +993,7 @@ Libvirt plugin for NSS for translating domain names into IP addresses.
 
 %prep
 
-%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
-rm -rf .git
+%autosetup -S git_am
 
 %build
 %if ! %{supported_platform}
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] rpm: simplify applying of patches
Posted by Martin Kletzander 5 years, 8 months ago
On Fri, Aug 03, 2018 at 10:35:32AM +0100, Daniel P. Berrangé wrote:
>The distros we support for RPM builds all have %autosetup support so we
>can ditch the convoluted code for running git manually and use the RPM
>defaults.
>

I'm no specfile expert, but I tried making an RPM with some Patches in it and it
looks like it works.  It's very verbose, though and I can't find proper docs for
`autosetup`, it just shouts that it doesn't support `-q`.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] rpm: simplify applying of patches
Posted by Daniel P. Berrangé 5 years, 8 months ago
On Wed, Aug 08, 2018 at 02:20:02PM +0200, Martin Kletzander wrote:
> On Fri, Aug 03, 2018 at 10:35:32AM +0100, Daniel P. Berrangé wrote:
> > The distros we support for RPM builds all have %autosetup support so we
> > can ditch the convoluted code for running git manually and use the RPM
> > defaults.
> > 
> 
> I'm no specfile expert, but I tried making an RPM with some Patches in it and it
> looks like it works.  It's very verbose, though and I can't find proper docs for
> `autosetup`, it just shouts that it doesn't support `-q`.
> 
> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

FYI docs are here:

  http://rpm.org/user_doc/autosetup.html

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] rpm: simplify applying of patches
Posted by no-reply@patchew.org 5 years, 8 months ago
Hi,

This series was run against 'syntax-check' test by patchew.org, which failed, please find the details below:

Type: series
Message-id: 20180803093532.16922-1-berrange@redhat.com
Subject: [libvirt] [PATCH] rpm: simplify applying of patches

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
time bash -c './autogen.sh && make syntax-check'
=== TEST SCRIPT END ===

Updating bcb55ab053bc79561b55d0394490f4b64e0f2d01
Switched to a new branch 'test'
fatal: Not a valid branch point: '9eae8398edde9446ecc99f4f393bea94652fb6a2'.
Traceback (most recent call last):
  File "patchew-tester/src/patchew-cli", line 523, in test_one
    cwd=clone, stdout=logf, stderr=logf)
  File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'branch', 'base', '9eae8398edde9446ecc99f4f393bea94652fb6a2']' returned non-zero exit status 128.


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list