From 5956b7fdb9361dd7ab9aeb1bb761a23d30d5b712 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Mon, 15 Apr 2013 20:58:28 +0000 Subject: [PATCH 01/13] update build for multipkg --- c/configure.ac | 2 +- c/index.yaml | 4 ++++ c/scripts/build | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 c/index.yaml create mode 100755 c/scripts/build diff --git a/c/configure.ac b/c/configure.ac index 87b0be1..32aab80 100644 --- a/c/configure.ac +++ b/c/configure.ac @@ -60,7 +60,7 @@ case $host_os in esac AM_CONDITIONAL([MINGW32], test "x$host_os_mingw32" = "xyes") -X_C_COMPILE_FLAGS($ZS_CFLAGS -g -Wall -Wwrite-strings -Winline -Wextra -Winline -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wundef -Wbad-function-cast -Wcast-align -Wvolatile-register-var -ffast-math) +#X_C_COMPILE_FLAGS($ZS_CFLAGS -g -Wall -Wwrite-strings -Winline -Wextra -Winline -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wundef -Wbad-function-cast -Wcast-align -Wvolatile-register-var -ffast-math) dnl --- output AC_SUBST(ac_aux_dir) diff --git a/c/index.yaml b/c/index.yaml new file mode 100644 index 0000000..127e571 --- /dev/null +++ b/c/index.yaml @@ -0,0 +1,4 @@ +default: + name: zsync + version: 0.6.2 + summary: 'http based rsync style file fetching with precomputed checksums' diff --git a/c/scripts/build b/c/scripts/build new file mode 100755 index 0000000..bec615e --- /dev/null +++ b/c/scripts/build @@ -0,0 +1,9 @@ +#!/bin/sh + +aclocal +autoheader +automake --add-missing +autoconf +./configure +make install LDFLAGS='-lcurl' DESTDIR="$DESTDIR" + From 44ca93873d9534e7e82a172e82ad3a0230a54061 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Mon, 15 Apr 2013 21:08:51 +0000 Subject: [PATCH 02/13] add source symlink for multipkg --- c/source | 1 + 1 file changed, 1 insertion(+) create mode 120000 c/source diff --git a/c/source b/c/source new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/c/source @@ -0,0 +1 @@ +. \ No newline at end of file From c0a6f7ee775933c11ce25ba8f1bbdef147cf9b17 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Mon, 15 Apr 2013 21:11:04 +0000 Subject: [PATCH 03/13] replace symlink hack with index.yaml conf --- c/index.yaml | 1 + c/source | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 120000 c/source diff --git a/c/index.yaml b/c/index.yaml index 127e571..f1a66c7 100644 --- a/c/index.yaml +++ b/c/index.yaml @@ -2,3 +2,4 @@ default: name: zsync version: 0.6.2 summary: 'http based rsync style file fetching with precomputed checksums' + sourcedir: . diff --git a/c/source b/c/source deleted file mode 120000 index 945c9b4..0000000 --- a/c/source +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file From 7655c9d1bc9921ac475138a30c888fb17255eadd Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Mon, 15 Apr 2013 22:54:59 +0000 Subject: [PATCH 04/13] put this in /usr --- c/scripts/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/scripts/build b/c/scripts/build index bec615e..2882910 100755 --- a/c/scripts/build +++ b/c/scripts/build @@ -4,6 +4,6 @@ aclocal autoheader automake --add-missing autoconf -./configure +./configure --prefix=/usr make install LDFLAGS='-lcurl' DESTDIR="$DESTDIR" From 29c9f414fd5e92a9bae628dc795b9668bdab8309 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Fri, 19 Apr 2013 10:24:16 -0700 Subject: [PATCH 05/13] fix getopt handling, always use -s for input file --- c/make.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/c/make.c b/c/make.c index 191b527..54099bd 100644 --- a/c/make.c +++ b/c/make.c @@ -585,7 +585,7 @@ int main(int argc, char **argv) { { /* Options parsing */ int opt; - while ((opt = getopt(argc, argv, "b:Ceo:f:u:U:vVzZ")) != -1) { + while ((opt = getopt(argc, argv, "b:Ceo:f:s:u:U:vVzZ")) != -1) { switch (opt) { case 'e': do_exact = 1; @@ -637,31 +637,29 @@ int main(int argc, char **argv) { case 'Z': no_look_inside = 1; break; - } - } - - /* Open data to create .zsync for - either it's a supplied filename, or stdin */ - if (optind == argc - 1) { - infname = strdup(argv[optind]); - instream = fopen(infname, "rb"); - if (!instream) { - perror("open"); - exit(2); - } - - { /* Get mtime if available */ - struct stat st; - if (fstat(fileno(instream), &st) == 0) { - mtime = st.st_mtime; + case 's': + /* Open data to create .zsync its supplied filename */ + infname = strdup(optarg); + instream = fopen(infname, "rb"); + if (!instream) { + perror("open"); + exit(2); } + { + struct stat st; + if (fstat(fileno(instream), &st) == 0) { + mtime = st.st_mtime; + } + } + if (!fname) + fname = basename(optarg); + break; } - - /* Use supplied filename as the target filename */ - if (!fname) - fname = basename(argv[optind]); } - else { - instream = stdin; + + if (!instream) { + printf("ERR: -s infile required\n"); + exit(2); } } From a7f7eaff5652a937adb45cea3cdffeb98a90754a Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Wed, 10 Jul 2013 19:31:03 -0700 Subject: [PATCH 06/13] travis --- .travis.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bb0c7b3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: c +compiler: + - gcc +# - clang +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq libcurl4 libcurl4-dev +script: cd c && ./configure && make + + +notifications: + irc: "irc.freenode.net#eam" + From 0e5d24da32ddcf29a22fa4cd4326e45f14a4455d Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Wed, 10 Jul 2013 19:34:12 -0700 Subject: [PATCH 07/13] test --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bb0c7b3..bd4acae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ before_install: - sudo apt-get install -qq libcurl4 libcurl4-dev script: cd c && ./configure && make - notifications: irc: "irc.freenode.net#eam" From cbf1a72d2bb00123352467835f8fee7dc0c28498 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Wed, 10 Jul 2013 19:40:03 -0700 Subject: [PATCH 08/13] libcurl4 dev --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bd4acae..050186c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ compiler: # - clang before_install: - sudo apt-get update -qq - - sudo apt-get install -qq libcurl4 libcurl4-dev + - sudo apt-get install -qq libcurl4-openssl-dev script: cd c && ./configure && make notifications: From 410d3629e8f17aad62dce2b00050aa5102c976c1 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Wed, 10 Jul 2013 19:48:37 -0700 Subject: [PATCH 09/13] doit --- .travis.yml | 2 +- c/doit.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 c/doit.sh diff --git a/.travis.yml b/.travis.yml index 050186c..8aafe3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ compiler: before_install: - sudo apt-get update -qq - sudo apt-get install -qq libcurl4-openssl-dev -script: cd c && ./configure && make +script: cd c && ./doit.sh notifications: irc: "irc.freenode.net#eam" diff --git a/c/doit.sh b/c/doit.sh new file mode 100755 index 0000000..d0b3fc1 --- /dev/null +++ b/c/doit.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e +set -x +export DESTDIR=$HOME/prefix + +rm -rf $DESTDIR || exit 1 +make clean || true # ignore failures + +aclocal || exit 1 +#libtoolize --force || exit 1 +autoheader || exit 1 +automake -a || exit 1 +autoconf || exit 1 +./configure --prefix=/usr || exit 1 +make || exit 1 +make install || exit 1 + From d6a30e24ade3920ff4308417da53239827df83ce Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Wed, 10 Jul 2013 19:52:20 -0700 Subject: [PATCH 10/13] no email --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8aafe3c..6c46f92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ script: cd c && ./doit.sh notifications: irc: "irc.freenode.net#eam" - + email: false From d539864e6bbcd0698c16f0481bd9bdfad9767132 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Wed, 10 Jul 2013 20:04:21 -0700 Subject: [PATCH 11/13] link libcurl --- c/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/Makefile.am b/c/Makefile.am index a4b103a..4bde310 100644 --- a/c/Makefile.am +++ b/c/Makefile.am @@ -10,7 +10,7 @@ zsyncmake_SOURCES = make.c makegz.c makegz.h format_string.h zsyncmake_LDADD = libzsync/libzsync.a librcksum/librcksum.a zlib/libinflate.a zlib/libdeflate.a -lm zsync_SOURCES = client.c http.c http.h url.c url.h progress.c progress.h base64.c format_string.h zsglobal.h -zsync_LDADD = libzsync/libzsync.a librcksum/librcksum.a zlib/libinflate.a $(LIBOBJS) +zsync_LDADD = libzsync/libzsync.a librcksum/librcksum.a zlib/libinflate.a -lcurl $(LIBOBJS) EXTRA_zsync_SOURCES = getaddrinfo.h From 00c650819eb2d3bf2d3de8076a1393621c97cf90 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Thu, 11 Jul 2013 12:23:16 -0700 Subject: [PATCH 12/13] initial stab at some tests --- .travis.yml | 2 +- c/t/zsyncmake.t | 39 +++++++++++++++++++++++++++++++++++++++ c/testit.sh | 4 ++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 c/t/zsyncmake.t create mode 100755 c/testit.sh diff --git a/.travis.yml b/.travis.yml index 6c46f92..b97227b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ compiler: before_install: - sudo apt-get update -qq - sudo apt-get install -qq libcurl4-openssl-dev -script: cd c && ./doit.sh +script: cd c && ./doit.sh && ./testit.sh notifications: irc: "irc.freenode.net#eam" diff --git a/c/t/zsyncmake.t b/c/t/zsyncmake.t new file mode 100755 index 0000000..0877f56 --- /dev/null +++ b/c/t/zsyncmake.t @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; + +use Test::More qw(no_plan); +use FindBin; +use File::Temp; + +my $build_root = $ENV{DESTDIR} || "$ENV{HOME}/prefix"; +my $zsm = "$build_root/usr/bin/zsyncmake"; + +my ($small_data_file_fh, $small_data_file) = File::Temp::tempfile(); +my ($medium_data_file_fh, $medium_data_file) = File::Temp::tempfile(); + +print $small_data_file_fh "hello world\n" x 8; +close $small_data_file_fh; + +for (1..1024) { + print $medium_data_file_fh "hello world\n" x 8; +} +close $medium_data_file_fh; + +is(`cat $small_data_file|md5sum`, + "c206bfeb596f75167b404119249403e1 -\n", + "test that our small setup file was generated properly",); + +like( `$zsm -s $small_data_file -o /dev/stdout -u relative/url/path`, + qr! + Filename:\s\w+\s+ + MTime:\s\w+, \s \d+ \s \w+ \s \d+ \s [0-9:]+ \s \+\d+ \s+ + Blocksize: \s 2048 \s+ + Length: \s 96 \s+ + Hash-Lengths: \s 1,2,4 \s+ + URL: \s relative/url/path \s+ + SHA-1: \s \w{40} + !mx, + "zsyncmake small_data_file"); + diff --git a/c/testit.sh b/c/testit.sh new file mode 100755 index 0000000..dc2074f --- /dev/null +++ b/c/testit.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cd t +for i in *.t; do ./$i || exit 1; done From 72c44290a48d3ab9681d1bfab20ab8c992b534d9 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Fri, 12 Jul 2013 06:34:32 -0700 Subject: [PATCH 13/13] notifications at #range --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b97227b..23864ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,5 @@ before_install: script: cd c && ./doit.sh && ./testit.sh notifications: - irc: "irc.freenode.net#eam" + irc: "irc.freenode.net#range" email: false