Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pygit2 for openSUSE:Factory 
checked in at 2024-05-02 23:48:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pygit2 (Old)
 and      /work/SRC/openSUSE:Factory/.python-pygit2.new.1880 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pygit2"

Thu May  2 23:48:44 2024 rev:37 rq:1171422 version:1.14.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pygit2/python-pygit2.changes      
2024-04-03 17:22:10.721396964 +0200
+++ /work/SRC/openSUSE:Factory/.python-pygit2.new.1880/python-pygit2.changes    
2024-05-03 10:43:36.075196277 +0200
@@ -1,0 +2,7 @@
+Thu May  2 10:26:23 UTC 2024 - Michal Suchanek <msucha...@suse.com>
+
+- Fix build with gcc 14
+  * Fix-CI.patch
+  * Fix-leaks-in-fetch_refspecs-and-push_refspecs.patch
+
+-------------------------------------------------------------------

New:
----
  Fix-CI.patch
  Fix-leaks-in-fetch_refspecs-and-push_refspecs.patch

BETA DEBUG BEGIN:
  New:- Fix build with gcc 14
  * Fix-CI.patch
  * Fix-leaks-in-fetch_refspecs-and-push_refspecs.patch
  New:  * Fix-CI.patch
  * Fix-leaks-in-fetch_refspecs-and-push_refspecs.patch
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pygit2.spec ++++++
--- /var/tmp/diff_new_pack.1mrDsZ/_old  2024-05-03 10:43:37.083232915 +0200
+++ /var/tmp/diff_new_pack.1mrDsZ/_new  2024-05-03 10:43:37.083232915 +0200
@@ -27,6 +27,10 @@
 Source:         
https://files.pythonhosted.org/packages/source/p/pygit2/pygit2-%{version}.tar.gz
 # PATCH-FIX-UPSTREAM pygit2-Upgrade_to_libgit2_v1_8_0.patch 
gh#libgit2/pygit2@6d539d76b53b
 Patch0:         pygit2-Upgrade_to_libgit2_v1_8_0.patch
+# PATCH-FIX-UPSTREAM - fixup for the libgit 1.8 support
+Patch1:         Fix-CI.patch
+# PATCH-FIX-UPSTREAM - happens to eliminate bogus pointer casts
+Patch2:         Fix-leaks-in-fetch_refspecs-and-push_refspecs.patch
 BuildRequires:  %{python_module cached-property}
 BuildRequires:  %{python_module cffi >= 1.4.0}
 BuildRequires:  %{python_module devel}
@@ -48,9 +52,10 @@
 Bindings for libgit2, a linkable C library for the Git version-control system.
 
 %prep
-%setup -q -n pygit2-%{version}
-%if %{?pkg_vcmp:%pkg_vcmp libgit2-devel >= 1.8}%{!?pkg_vcmp:0}
-%patch -P 0 -p1
+%autosetup -p1 -n pygit2-%{version}
+%if %{?pkg_vcmp:%pkg_vcmp libgit2-devel < 1.8}%{!?pkg_vcmp:1}
+%patch -P 1 -p1 -R
+%patch -P 0 -p1 -R
 %endif
 
 # do not add options to pytest

++++++ Fix-CI.patch ++++++
>From 51d35d010b9dcee199be5eb3785246ca9ef418e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= <jdavid....@gmail.com>
Date: Thu, 21 Mar 2024 10:53:59 +0100
Subject: [PATCH] Fix CI

(cherry picked from commit 3eba911fb5fcc4d431d31848a66f117df8275af2)
---
 src/blob.c               |  1 +
 src/filter.c             |  1 +
 test/test_credentials.py | 10 ++++++----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/blob.c b/src/blob.c
index e69a8f7..a1f40df 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -28,6 +28,7 @@
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <git2.h>
+#include <git2/sys/errors.h>
 #include "diff.h"
 #include "error.h"
 #include "object.h"
diff --git a/src/filter.c b/src/filter.c
index a1b220e..5e51a20 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -28,6 +28,7 @@
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <git2.h>
+#include <git2/sys/errors.h>
 #include <git2/sys/filter.h>
 #include "diff.h"
 #include "error.h"
diff --git a/test/test_credentials.py b/test/test_credentials.py
index 2d1166c..04e2185 100644
--- a/test/test_credentials.py
+++ b/test/test_credentials.py
@@ -26,6 +26,7 @@
 """Tests for credentials"""
 
 from pathlib import Path
+import platform
 
 import pytest
 
@@ -161,10 +162,11 @@ def test_fetch_certificate_check(testrepo):
         remote.fetch(callbacks=MyCallbacks())
 
     # libgit2 uses different error message for Linux and Windows
-    # TODO test one or the other depending on the platform
-    assert str(exc.value) in (
-        'user rejected certificate for github.com', # httpclient
-        'user cancelled certificate check') # winhttp
+    value = str(exc.value)
+    if platform.system() == 'Windows':
+        assert value == 'user cancelled certificate check'  # winhttp
+    else:
+        assert value == 'user rejected certificate for github.com'  # 
httpclient
 
     # TODO Add GitError.error_code
     #assert exc.value.error_code == pygit2.GIT_ERROR_HTTP
-- 
2.44.0


++++++ Fix-leaks-in-fetch_refspecs-and-push_refspecs.patch ++++++
>From 0f8a1a91db0825daa0d25549f15791bcee0f9a94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= <jdavid....@gmail.com>
Date: Sun, 24 Mar 2024 09:09:36 +0100
Subject: [PATCH] Fix leaks in fetch_refspecs and push_refspecs

Also use git_strarray_dispose instead of deprecated git_strarray_free.
And fix a couple of build warnings in git_commit_create.

(cherry picked from commit c7c65cf12547eeadb46cfb30531285e1afcbd708)
---
 pygit2/decl/strarray.h |  2 +-
 pygit2/remotes.py      | 16 +++-------------
 pygit2/utils.py        | 15 ++++++++++-----
 src/repository.c       | 10 ++++------
 4 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/pygit2/decl/strarray.h b/pygit2/decl/strarray.h
index a9b249f..fdbf2aa 100644
--- a/pygit2/decl/strarray.h
+++ b/pygit2/decl/strarray.h
@@ -3,4 +3,4 @@ typedef struct git_strarray {
        size_t count;
 } git_strarray;
 
-void git_strarray_free(git_strarray *array);
+void git_strarray_dispose(git_strarray *array);
diff --git a/pygit2/remotes.py b/pygit2/remotes.py
index 3c4748c..37a6ca3 100644
--- a/pygit2/remotes.py
+++ b/pygit2/remotes.py
@@ -222,7 +222,6 @@ class Remote:
         specs = ffi.new('git_strarray *')
         err = C.git_remote_get_fetch_refspecs(specs, self._remote)
         check_error(err)
-
         return strarray_to_strings(specs)
 
     @property
@@ -232,7 +231,6 @@ class Remote:
         specs = ffi.new('git_strarray *')
         err = C.git_remote_get_push_refspecs(specs, self._remote)
         check_error(err)
-
         return strarray_to_strings(specs)
 
     def push(self, specs, callbacks=None, proxy=None):
@@ -294,14 +292,12 @@ class RemoteCollection:
 
     def __len__(self):
         names = ffi.new('git_strarray *')
-
         try:
             err = C.git_remote_list(names, self._repo._repo)
             check_error(err)
-
             return names.count
         finally:
-            C.git_strarray_free(names)
+            C.git_strarray_dispose(names)
 
     def __iter__(self):
         cremote = ffi.new('git_remote **')
@@ -323,15 +319,13 @@ class RemoteCollection:
 
     def _ffi_names(self):
         names = ffi.new('git_strarray *')
-
         try:
             err = C.git_remote_list(names, self._repo._repo)
             check_error(err)
-
             for i in range(names.count):
                 yield names.strings[i]
         finally:
-            C.git_strarray_free(names)
+            C.git_strarray_dispose(names)
 
     def names(self):
         """An iterator over the names of the available remotes."""
@@ -386,11 +380,7 @@ class RemoteCollection:
         problems = ffi.new('git_strarray *')
         err = C.git_remote_rename(problems, self._repo._repo, to_bytes(name), 
to_bytes(new_name))
         check_error(err)
-
-        ret = strarray_to_strings(problems)
-        C.git_strarray_free(problems)
-
-        return ret
+        return strarray_to_strings(problems)
 
     def delete(self, name):
         """Remove a remote from the configuration
diff --git a/pygit2/utils.py b/pygit2/utils.py
index 638c199..f4e3fc8 100644
--- a/pygit2/utils.py
+++ b/pygit2/utils.py
@@ -26,7 +26,7 @@
 import os
 
 # Import from pygit2
-from .ffi import ffi
+from .ffi import ffi, C
 
 
 def maybe_string(ptr):
@@ -73,11 +73,16 @@ def ptr_to_bytes(ptr_cdata):
 
 
 def strarray_to_strings(arr):
-    l = [None] * arr.count
-    for i in range(arr.count):
-        l[i] = ffi.string(arr.strings[i]).decode('utf-8')
+    """
+    Return a list of strings from a git_strarray pointer.
 
-    return l
+    Free the strings contained in the git_strarry, this means it won't be 
usable after
+    calling this function.
+    """
+    try:
+        return [ffi.string(arr.strings[i]).decode('utf-8') for i in 
range(arr.count)]
+    finally:
+        C.git_strarray_dispose(arr)
 
 
 class StrArray:
diff --git a/src/repository.c b/src/repository.c
index cf7597c..1f6db24 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1069,8 +1069,7 @@ Repository_create_commit(Repository *self, PyObject *args)
 
     err = git_commit_create(&oid, self->repo, update_ref,
                             py_author->signature, py_committer->signature,
-                            encoding, message, tree, parent_count,
-                            (const git_commit**)parents);
+                            encoding, message, tree, parent_count, parents);
     if (err < 0) {
         Error_set(err);
         goto out;
@@ -1152,8 +1151,7 @@ Repository_create_commit_string(Repository *self, 
PyObject *args)
 
     err = git_commit_create_buffer(&buf, self->repo,
                                    py_author->signature, 
py_committer->signature,
-                                   encoding, message, tree, parent_count,
-                                   (const git_commit**)parents);
+                                   encoding, message, tree, parent_count, 
parents);
     if (err < 0) {
         Error_set(err);
         goto out;
@@ -1313,7 +1311,7 @@ Repository_raw_listall_references(Repository *self, 
PyObject *args)
     }
 
 out:
-    git_strarray_free(&c_result);
+    git_strarray_dispose(&c_result);
     return py_result;
 }
 
@@ -2182,7 +2180,7 @@ Repository_list_worktrees(Repository *self, PyObject 
*args)
     }
 
 out:
-    git_strarray_free(&c_result);
+    git_strarray_dispose(&c_result);
     return py_result;
 }
 
-- 
2.44.0

Reply via email to