Hello community,

here is the log from the commit of package librepo for openSUSE:Factory checked 
in at 2019-05-12 11:46:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/librepo (Old)
 and      /work/SRC/openSUSE:Factory/.librepo.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "librepo"

Sun May 12 11:46:15 2019 rev:7 rq:702408 version:1.10.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/librepo/librepo.changes  2019-04-01 
12:40:01.521962976 +0200
+++ /work/SRC/openSUSE:Factory/.librepo.new.5148/librepo.changes        
2019-05-12 11:46:25.228161549 +0200
@@ -1,0 +2,18 @@
+Sun May 12 02:58:52 UTC 2019 - Neal Gompa <ngomp...@gmail.com>
+
+- Upgrade to 1.10.2
+  + Fix librepo isn't able to load zchunk files from next server on failure 
(rh#1706321)
+
+-------------------------------------------------------------------
+Fri May 10 14:21:16 UTC 2019 - Neal Gompa <ngomp...@gmail.com>
+
+- Upgrade to 1.10.1
+  + Clean up target->curl_handle rather than target->handle (rh#1694411)
+  + Add an option to preserve timestamps of the downloaded files (rh#1688537)
+  + Fix fetching repositories supplied by SUSE Customer Center
+  + [tests] Wait for server to start instead of doing arbitrary sleep
+- Drop patch included in this release
+  * Patch: librepo-PR148-clean-up-curl-target_handle.patch
+- Disable executing test suite on ARM and RISC-V due to performance issues 
with builders
+
+-------------------------------------------------------------------

Old:
----
  librepo-1.9.6.tar.gz
  librepo-PR148-clean-up-curl-target_handle.patch

New:
----
  librepo-1.10.2.tar.gz

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

Other differences:
------------------
++++++ librepo.spec ++++++
--- /var/tmp/diff_new_pack.ZB0ZlY/_old  2019-05-12 11:46:26.696165707 +0200
+++ /var/tmp/diff_new_pack.ZB0ZlY/_new  2019-05-12 11:46:26.736165805 +0200
@@ -17,7 +17,13 @@
 #
 
 
+%ifarch %{arm} aarch64 riscv64
+# Don't run tests on ARM and RISC-V for now. There are problems
+# with performance on the builders and often these time out.
+%bcond_with tests
+%else
 %bcond_without tests
+%endif
 
 # zchunk is only available in Leap 15.1 and newer
 %if 0%{?sle_version} >= 150100 || 0%{?suse_version} >= 1550
@@ -29,7 +35,7 @@
 %define devname %{name}-devel
 
 Name:           librepo
-Version:        1.9.6
+Version:        1.10.2
 Release:        0
 Summary:        Repodata downloading library
 License:        LGPL-2.0-or-later
@@ -38,10 +44,6 @@
 URL:            https://github.com/rpm-software-management/librepo
 Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
 
-# Patches proposed upstream
-## Clean up target->curl_handle rather than target->handle (rh#1694411)
-Patch0101:      librepo-PR148-clean-up-curl-target_handle.patch
-
 BuildRequires:  cmake
 BuildRequires:  doxygen
 BuildRequires:  gpgme-devel
@@ -87,6 +89,7 @@
 BuildRequires:  python3-gpg
 BuildRequires:  python3-Flask
 BuildRequires:  python3-nose
+BuildRequires:  python3-requests
 %endif
 BuildRequires:  python3-Sphinx
 BuildRequires:  python3-xattr

++++++ librepo-1.9.6.tar.gz -> librepo-1.10.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/VERSION.cmake 
new/librepo-1.10.2/VERSION.cmake
--- old/librepo-1.9.6/VERSION.cmake     2019-03-27 12:26:10.000000000 +0100
+++ new/librepo-1.10.2/VERSION.cmake    2019-05-12 04:57:19.000000000 +0200
@@ -1,3 +1,3 @@
 SET(LIBREPO_MAJOR "1")
-SET(LIBREPO_MINOR "9")
-SET(LIBREPO_PATCH "6")
+SET(LIBREPO_MINOR "10")
+SET(LIBREPO_PATCH "2")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/downloader.c 
new/librepo-1.10.2/librepo/downloader.c
--- old/librepo-1.9.6/librepo/downloader.c      2019-03-27 12:26:10.000000000 
+0100
+++ new/librepo-1.10.2/librepo/downloader.c     2019-05-12 04:57:19.000000000 
+0200
@@ -19,6 +19,8 @@
  */
 
 #define _XOPEN_SOURCE   500 // Because of fdopen() and ftruncate()
+#define _DEFAULT_SOURCE     // Because of futimes()
+#define _BSD_SOURCE         // Because of futimes()
 
 #include <glib.h>
 #include <assert.h>
@@ -28,6 +30,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 #include <sys/xattr.h>
 #include <fcntl.h>
 #include <curl/curl.h>
@@ -1451,8 +1454,8 @@
         if(target->zck_state == LR_ZCK_DL_FINISHED) {
             g_debug("%s: Target already fully downloaded: %s", __func__, 
target->target->path);
             target->state = LR_DS_FINISHED;
-            curl_easy_cleanup(target->handle);
-            target->handle = NULL;
+            curl_easy_cleanup(target->curl_handle);
+            target->curl_handle = NULL;
             g_free(target->headercb_interrupt_reason);
             target->headercb_interrupt_reason = NULL;
             fclose(target->f);
@@ -2213,6 +2216,21 @@
         // Any other checks should go here
         //
 
+        // Preserve timestamp of downloaded file if requested
+        if (target->target->handle && target->target->handle->preservetime) {
+            long remote_filetime = -1;
+            curl_easy_getinfo(target->curl_handle, CURLINFO_FILETIME, 
&remote_filetime);
+            if (remote_filetime >= 0) {
+                const struct timeval tv[] = {{remote_filetime, 0}, 
{remote_filetime, 0}};
+                if (futimes(fileno(target->f), tv) == -1)
+                    g_debug("%s: Failed to change timestamps of downloaded 
file.", __func__);
+            } else {
+                g_debug("%s: Unable to get remote time of retrieved document 
\"%s\"",
+                        __func__, target->target->path);
+            }
+        }
+
+
 transfer_error:
 
         //
@@ -2308,8 +2326,14 @@
                   g_error_free(transfer_err);  // Ignore the error
 
                   // Truncate file - remove downloaded garbage (error html 
page etc.)
-                  if (!truncate_transfer_file(target, err))
-                      return FALSE;
+                  #ifdef WITH_ZCHUNK
+                  if (!target->target->is_zchunk || target->zck_state == 
LR_ZCK_DL_HEADER) {
+                  #endif
+                    if (!truncate_transfer_file(target, err))
+                        return FALSE;
+                  #ifdef WITH_ZCHUNK
+                  }
+                  #endif
                 }
             }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/handle.c 
new/librepo-1.10.2/librepo/handle.c
--- old/librepo-1.9.6/librepo/handle.c  2019-03-27 12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo/handle.c 2019-05-12 04:57:19.000000000 +0200
@@ -64,6 +64,7 @@
     curl_easy_setopt(h, CURLOPT_SSL_VERIFYHOST, 2);
     curl_easy_setopt(h, CURLOPT_SSL_VERIFYPEER, 1);
     curl_easy_setopt(h, CURLOPT_FTP_USE_EPSV, LRO_FTPUSEEPSV_DEFAULT);
+    curl_easy_setopt(h, CURLOPT_FILETIME, 0);
 
     return h;
 }
@@ -110,6 +111,7 @@
     handle->proxyauthmethods = LRO_PROXYAUTHMETHODS_DEFAULT;
     handle->ftpuseepsv = LRO_FTPUSEEPSV_DEFAULT;
     handle->cachedir = NULL;
+    handle->preservetime = 0;
 
     return handle;
 }
@@ -725,6 +727,11 @@
         handle->cachedir = g_strdup(va_arg(arg, char *));
         break;
 
+    case LRO_PRESERVETIME:
+        handle->preservetime = va_arg(arg, long) ? 1 : 0;
+        c_rc = curl_easy_setopt(c_h, CURLOPT_FILETIME, handle->preservetime);
+        break;
+
     default:
         g_set_error(err, LR_HANDLE_ERROR, LRE_BADOPTARG,
                     "Unknown option");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/handle.h 
new/librepo-1.10.2/librepo/handle.h
--- old/librepo-1.9.6/librepo/handle.h  2019-03-27 12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo/handle.h 2019-05-12 04:57:19.000000000 +0200
@@ -368,6 +368,10 @@
         Path to base cache directory for repositories, used by zchunk to find
         old files to copy data from.  If this is NULL, zchunk will be disabled 
*/
 
+    LRO_PRESERVETIME, /*!< (long 1 or 0)
+        If enabled, librepo will try to keep timestamps of the downloaded files
+        in sync with that on the remote side. */
+
     LRO_SENTINEL,    /*!< Sentinel */
 
 } LrHandleOption; /*!< Handle config options */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/handle_internal.h 
new/librepo-1.10.2/librepo/handle_internal.h
--- old/librepo-1.9.6/librepo/handle_internal.h 2019-03-27 12:26:10.000000000 
+0100
+++ new/librepo-1.10.2/librepo/handle_internal.h        2019-05-12 
04:57:19.000000000 +0200
@@ -219,6 +219,9 @@
     gchar *cachedir; /*!<
         Base cache dir for repositories */
 
+    long preservetime; /*!<
+        Preserve timestapms of downloaded files */
+
     LrUrlVars *yumslist;
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/python/__init__.py 
new/librepo-1.10.2/librepo/python/__init__.py
--- old/librepo-1.9.6/librepo/python/__init__.py        2019-03-27 
12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo/python/__init__.py       2019-05-12 
04:57:19.000000000 +0200
@@ -378,6 +378,10 @@
 
     *Boolean* Enable/Disable EPSV (Extended Passive mode) for FTP.
 
+.. data:: LRO_PRESERVETIME
+
+    *Boolean* If enabled, librepo will try to keep timestamps of the 
downloaded files
+    in sync with that on the remote side.
 
 .. _handle-info-options-label:
 
@@ -1410,6 +1414,10 @@
 
         See :data:`.LRO_FTPUSEEPSV`
 
+    .. attribute:: preservetime
+
+        See :data:`.LRO_PRESERVETIME`
+
     """
 
     def setopt(self, option, val):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/python/handle-py.c 
new/librepo-1.10.2/librepo/python/handle-py.c
--- old/librepo-1.9.6/librepo/python/handle-py.c        2019-03-27 
12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo/python/handle-py.c       2019-05-12 
04:57:19.000000000 +0200
@@ -374,6 +374,7 @@
     case LRO_SSLVERIFYHOST:
     case LRO_ADAPTIVEMIRRORSORTING:
     case LRO_FTPUSEEPSV:
+    case LRO_PRESERVETIME:
     case LRO_OFFLINE:
     {
         long d;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/python/librepomodule.c 
new/librepo-1.10.2/librepo/python/librepomodule.c
--- old/librepo-1.9.6/librepo/python/librepomodule.c    2019-03-27 
12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo/python/librepomodule.c   2019-05-12 
04:57:19.000000000 +0200
@@ -306,6 +306,7 @@
     PYMODULE_ADDINTCONSTANT(LRO_PROXYAUTHMETHODS);
     PYMODULE_ADDINTCONSTANT(LRO_FTPUSEEPSV);
     PYMODULE_ADDINTCONSTANT(LRO_CACHEDIR);
+    PYMODULE_ADDINTCONSTANT(LRO_PRESERVETIME);
     PYMODULE_ADDINTCONSTANT(LRO_SENTINEL);
 
     // Handle info options
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo/util.c 
new/librepo-1.10.2/librepo/util.c
--- old/librepo-1.9.6/librepo/util.c    2019-03-27 12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo/util.c   2019-05-12 04:57:19.000000000 +0200
@@ -187,6 +187,7 @@
     size_t total_len;  // Maximal len of result
     size_t offset = 0;
     int is_first = 1;
+    char *qmark_section;
     int previous_was_empty = 0; // If last chunk was "" then separator will be
                                 // appended to the result
 
@@ -203,6 +204,8 @@
     if (total_len == 0)
         return g_strdup("");
 
+    qmark_section = strchr(first, '?');
+
     res = lr_malloc(total_len + separator_len + 1);
 
     next = first;
@@ -227,6 +230,8 @@
 
         start = current;
         end = start + current_len;
+         if (is_first && qmark_section)
+             end -= strlen(qmark_section);
 
         /* Skip leading separators - except first element */
         if (separator_len && is_first == 0) {
@@ -260,6 +265,11 @@
     }
     va_end(args);
 
+    if (qmark_section) {
+        strcpy(res + offset, qmark_section);
+        offset += strlen(qmark_section);
+    }
+
     assert(offset <= total_len);
 
     if (offset == 0) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/librepo.spec 
new/librepo-1.10.2/librepo.spec
--- old/librepo-1.9.6/librepo.spec      2019-03-27 12:26:10.000000000 +0100
+++ new/librepo-1.10.2/librepo.spec     2019-05-12 04:57:19.000000000 +0200
@@ -26,7 +26,7 @@
 %global dnf_conflict 2.8.8
 
 Name:           librepo
-Version:        1.9.6
+Version:        1.10.2
 Release:        1%{?dist}
 Summary:        Repodata downloading library
 
@@ -74,6 +74,7 @@
 %if %{with pythontests}
 BuildRequires:  python2-flask
 BuildRequires:  python2-nose
+BuildRequires:  python2-requests
 %if (0%{?rhel} && 0%{?rhel} <= 7)
 BuildRequires:  pyxattr
 BuildRequires:  pygpgme
@@ -99,6 +100,7 @@
 BuildRequires:  python3-flask
 BuildRequires:  python3-nose
 BuildRequires:  python3-pyxattr
+BuildRequires:  python3-requests
 %endif
 BuildRequires:  python3-sphinx
 Requires:       %{name}%{?_isa} = %{version}-%{release}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librepo-1.9.6/tests/python/tests/base.py 
new/librepo-1.10.2/tests/python/tests/base.py
--- old/librepo-1.9.6/tests/python/tests/base.py        2019-03-27 
12:26:10.000000000 +0100
+++ new/librepo-1.10.2/tests/python/tests/base.py       2019-05-12 
04:57:19.000000000 +0200
@@ -3,6 +3,7 @@
 import socket
 import ctypes
 import os.path
+import requests
 from multiprocessing import Process, Value
 from tests.servermock.server import app
 try:
@@ -93,9 +94,20 @@
     def setUpClass(cls):
         cls.server = Process(target=application, args=(cls._TS_PORT,))
         cls.server.start()
-        time.sleep(0.5)
         cls.MOCKURL = MOCKURL_TEMPLATE % cls._TS_PORT.value
         cls.PORT = cls._TS_PORT.value
+        # Wait for the server to start (max 5 seconds)
+        for i in range(50):
+            try:
+                requests.get(cls.MOCKURL, timeout=0.1)
+                break
+            except (requests.exceptions.ConnectionError):
+                time.sleep(0.1)
+            except (requests.exceptions.Timeout):
+                pass
+        else:
+            cls.tearDownClass()
+            raise Exception("Server didn't start even after 5 seconds.")
 
     @classmethod
     def tearDownClass(cls):


Reply via email to