From a7313995fb2da14a89be6317b0b6233366a42d91 Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Sun, 6 Apr 2025 13:33:25 +0200 Subject: [PATCH] Initial import (fedora#2356982). --- .gitignore | 1 + fix-build-with-gcc-14.patch | 89 +++++++++++++++++++++++++++++++++++++ sources | 1 + zsync.spec | 61 +++++++++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 .gitignore create mode 100644 fix-build-with-gcc-14.patch create mode 100644 sources create mode 100644 zsync.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a590d08 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/zsync-0.6.2.tar.bz2 diff --git a/fix-build-with-gcc-14.patch b/fix-build-with-gcc-14.patch new file mode 100644 index 0000000..43bce49 --- /dev/null +++ b/fix-build-with-gcc-14.patch @@ -0,0 +1,89 @@ +Description: Fix build with GCC-14 +Author: Marcos Talau +Bug-Debian: https://bugs.debian.org/1075710 +Forwarded: https://github.com/cph6/zsync/issues/20 +Last-Update: 2024-08-16 + +Index: zsync-0.6.2/client.c +=================================================================== +--- zsync-0.6.2.orig/client.c ++++ zsync-0.6.2/client.c +@@ -392,7 +392,7 @@ int fetch_remaining_blocks_http(struct z + */ + int fetch_remaining_blocks(struct zsync_state *zs) { + int n, utype; +- const char *const *url = zsync_get_urls(zs, &n, &utype); ++ char **url = zsync_get_urls(zs, &n, &utype); + int *status; /* keep status for each URL - 0 means no error */ + int ok_urls = n; + +@@ -452,7 +452,7 @@ extern long global_offset; + int main(int argc, char **argv) { + struct zsync_state *zs; + char *temp_file = NULL; +- char **seedfiles = NULL; ++ void **seedfiles = NULL; + int nseedfiles = 0; + char *filename = NULL; + long long local_used; +Index: zsync-0.6.2/libzsync/zmap.c +=================================================================== +--- zsync-0.6.2.orig/libzsync/zmap.c ++++ zsync-0.6.2/libzsync/zmap.c +@@ -333,7 +333,7 @@ int zmap_search(const struct zmap* zm, l + * and in the order that it returned them, this condition is satisfied. + */ + void configure_zstream_for_zdata(const struct zmap *zm, z_stream * zs, +- long zoffset, long long *poutoffset) { ++ long zoffset, off_t *poutoffset) { + /* Find the zmap entry corresponding to this offset */ + int i = zmap_search(zm, zoffset); + +Index: zsync-0.6.2/libzsync/zmap.h +=================================================================== +--- zsync-0.6.2.orig/libzsync/zmap.h ++++ zsync-0.6.2/libzsync/zmap.h +@@ -29,7 +29,7 @@ struct zmap* zmap_make(const struct gzbl + void zmap_free(struct zmap*); + + off_t* zmap_to_compressed_ranges(const struct zmap* zm, off_t* byterange, int nrange, int* num); +-void configure_zstream_for_zdata(const struct zmap* zm, struct z_stream_s* zs, long zoffset, long long* poutoffset); ++void configure_zstream_for_zdata(const struct zmap* zm, struct z_stream_s* zs, long zoffset, off_t* poutoffset); + + /* gzip flag byte */ + #define GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +Index: zsync-0.6.2/libzsync/zsync.c +=================================================================== +--- zsync-0.6.2.orig/libzsync/zsync.c ++++ zsync-0.6.2/libzsync/zsync.c +@@ -436,7 +436,7 @@ void zsync_progress(const struct zsync_s + * Note that these URLs could be for encoded versions of the target; a 'type' + * is returned in *type which tells libzsync in later calls what version of the + * target is being retrieved. */ +-const char *const *zsync_get_urls(struct zsync_state *zs, int *n, int *t) { ++char **zsync_get_urls(struct zsync_state *zs, int *n, int *t) { + if (zs->zmap && zs->nzurl) { + *n = zs->nzurl; + *t = 1; +@@ -768,7 +768,7 @@ char *zsync_end(struct zsync_state *zs) + */ + void zsync_configure_zstream_for_zdata(const struct zsync_state *zs, + struct z_stream_s *zstrm, +- long zoffset, long long *poutoffset) { ++ long zoffset, off_t *poutoffset) { + configure_zstream_for_zdata(zs->zmap, zstrm, zoffset, poutoffset); + { /* Load in prev 32k sliding window for backreferences */ + long long pos = *poutoffset; +Index: zsync-0.6.2/libzsync/zsync.h +=================================================================== +--- zsync-0.6.2.orig/libzsync/zsync.h ++++ zsync-0.6.2/libzsync/zsync.h +@@ -58,7 +58,7 @@ int zsync_submit_source_file(struct zsyn + * (the URL pointers are still referenced by the library, and are valid only until zsync_end). + */ + +-const char * const * zsync_get_urls(struct zsync_state* zs, int* n, int* t); ++char ** zsync_get_urls(struct zsync_state* zs, int* n, int* t); + + /* zsync_needed_byte_ranges - get the byte ranges needed from a URL. + * Returns the number of ranges in *num, and a malloc'd array (to be freed diff --git a/sources b/sources new file mode 100644 index 0000000..d62cd44 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (zsync-0.6.2.tar.bz2) = 56437594831f2320c532759805b5c51116c53c8848f14b54cfd9b76676d1d061abe7fc914264f496ed1c7922fbbd5b884166c855a2fb9eb1285f216e478c5f0d diff --git a/zsync.spec b/zsync.spec new file mode 100644 index 0000000..91a3e4c --- /dev/null +++ b/zsync.spec @@ -0,0 +1,61 @@ +Name: zsync +Summary: a file transfer program using the same algorithm as rsync over HTTP +URL: http://zsync.moria.org.uk/ +License: Artistic-2.0 and Zlib and NTP and LicenseRef-Fedora-Public-Domain + # Zlib: zlib/* + # NTP: base64.c + # PD: librcksum/* +Version: 0.6.2 +Release: %autorelease + +Source0: http://zsync.moria.org.uk/download/%{name}-%{version}.tar.bz2 + +# https://sources.debian.org/data/main/z/zsync/0.6.2-7/debian/patches/fix-build-with-gcc-14.patch +Patch1: fix-build-with-gcc-14.patch + +BuildRequires: gcc +BuildRequires: make +BuildRequires: autoconf +BuildRequires: automake + +# "zsync uses a large part of zlib [...]. This code contains local changes by +# me that are not compatible with and not available in standard zlib [...]." +Provides: bundled(zlib) + +%description +zsync is a file transfer program. It allows you to download a file from a +remote server, where you have a copy of an older version of the file on your +computer already. zsync downloads only the new parts of the file. It uses the +same algorithm as rsync. However, where rsync is designed for synchronising +data from one computer to another within an organisation, zsync is designed for +file distribution, with one file on a server to be distributed to thousands of +downloaders. zsync requires no special server software - just a web server to +host the files - and imposes no extra load on the server, making it ideal for +large scale file distribution. + +%prep +%autosetup -p1 +sed -i '/^doc_DATA/s/COPYING//' Makefile.am # avoid duplicating license file + +%build +autoreconf -if +%configure +%make_build CFLAGS+="-Wno-old-style-definition -D_DEFAULT_SOURCE" +# bundled zlib uses old-style function definition, ignore. +# zsync uses deprecated _BSD_SOURCE in places, also define replacement. + +%install +%make_install + +%check +./check-zsyncmake + +%files +%license COPYING +%{_datadir}/doc/%{name} +%{_bindir}/%{name} +%{_bindir}/%{name}make +%{_mandir}/man1/%{name}* + +%changelog +%autochangelog