[arch-commits] Commit in varnish/trunk (2 files)

2017-11-24 Thread Dave Reisner
Date: Friday, November 24, 2017 @ 23:31:34
  Author: dreisner
Revision: 310834

upgpkg: varnish 5.2.1-1

- switch to github source
- backport fix for building with python3

Added:
  varnish/trunk/hack-up-vcstools-to-work-with-python-2-and-3.patch
Modified:
  varnish/trunk/PKGBUILD

+
 PKGBUILD   |   28 +---
 hack-up-vcstools-to-work-with-python-2-and-3.patch |   66 +++
 2 files changed, 84 insertions(+), 10 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2017-11-24 22:34:20 UTC (rev 310833)
+++ PKGBUILD2017-11-24 23:31:34 UTC (rev 310834)
@@ -5,7 +5,7 @@
 # Contributor: Roberto Alsina 
 
 pkgname=varnish
-pkgver=5.1.3
+pkgver=5.2.1
 pkgrel=1
 pkgdesc="High-performance HTTP accelerator"
 arch=('x86_64')
@@ -12,25 +12,33 @@
 url="https://www.varnish-cache.org/;
 license=('BSD')
 depends=('gcc' 'libedit' 'pcre')
-makedepends=('python-docutils')
+makedepends=('python-docutils' 'python')
 optdepends=('python: needed for vmod development')
 backup=('etc/varnish/default.vcl')
+options=('!buildflags')
 install=$pkgname.install
-source=("https://repo.varnish-cache.org/source/$pkgname-$pkgver.tar.gz;
+source=("https://github.com/varnishcache/varnish-cache/archive/varnish-$pkgver.tar.gz;
+hack-up-vcstools-to-work-with-python-2-and-3.patch
 varnish-vcl-reload
 varnish.service
 varnish.sysusers)
-sha256sums=('7439c93ca581340f3722b8c790160f46dc6c5328188e4c0bc233c42f3f04a54e'
+sha256sums=('f44decf0f382a2ac762478167a6b41909a3f6179eeefce402d19e694aba0'
+'97a00962474a5bf97fd71e4c0e792861157aa8ac872fc9c5636b763f11445e8c'
 '0369e3e735e4c6150f08677df8b7cdae1a36ea75fd0e03734abe814a94312f80'
 '069904391237641eb770e8bc3989d18a3b3a9cb2374b9cd525235bfbb49b6b1d'
 'b58dd6b00eb81c75e4bb30421b85b2be88c049d5b72a8ee553ba690a5414972b')
 
+prepare() {
+  cd "varnish-cache-varnish-$pkgver"
+
+  patch -Np1 <"$srcdir/hack-up-vcstools-to-work-with-python-2-and-3.patch"
+
+  ./autogen.sh
+}
+
 build() {
-  cd "$pkgname-$pkgver"
+  cd "varnish-cache-varnish-$pkgver"
 
-  # https://github.com/varnishcache/varnish-cache/issues/1875
-  [[ $CARCH == i686 ]] && CFLAGS+=' -fexcess-precision=standard'
-
   ./configure \
 --prefix=/usr \
 --sysconfdir=/etc \
@@ -41,7 +49,7 @@
 }
 
 check() {
-  cd "$pkgname-$pkgver"
+  cd "varnish-cache-varnish-$pkgver"
 
   # Sometimes fails on i686 in address remapping test. Not sure if flaky
   # test or otherwise...
@@ -49,7 +57,7 @@
 }
 
 package() {
-  cd "$pkgname-$pkgver"
+  cd "varnish-cache-varnish-$pkgver"
 
   make DESTDIR="$pkgdir" install
 

Added: hack-up-vcstools-to-work-with-python-2-and-3.patch
===
--- hack-up-vcstools-to-work-with-python-2-and-3.patch  
(rev 0)
+++ hack-up-vcstools-to-work-with-python-2-and-3.patch  2017-11-24 23:31:34 UTC 
(rev 310834)
@@ -0,0 +1,66 @@
+From 17c92e43fda114bf5341e51d752e882238b8fe8c Mon Sep 17 00:00:00 2001
+From: Nils Goroll 
+Date: Thu, 5 Oct 2017 13:39:23 +0200
+Subject: [PATCH] hack up vsctool to work with python 2 and 3
+
+StringIO does not exist any more in python3, yet requiring 2.7 would
+not pave the path forward, so try to be compatible with both.
+
+Works for me on Python 2.7.9 and Python 3.4
+
+I would appreciate if someone more fluent in serpentinous programming
+language reviewed and/or rewrote this.
+---
+ lib/libvcc/vsctool.py | 24 
+ 1 file changed, 20 insertions(+), 4 deletions(-)
+
+diff --git a/lib/libvcc/vsctool.py b/lib/libvcc/vsctool.py
+index 854968e3b..829c6e518 100644
+--- a/lib/libvcc/vsctool.py
 b/lib/libvcc/vsctool.py
+@@ -37,7 +37,10 @@
+ import json
+ import sys
+ import gzip
+-import StringIO
++try:
++import StringIO
++except ImportError:
++import io
+ import collections
+ import struct
+ 
+@@ -54,9 +57,22 @@
+   "format":   [ "integer", FORMATS],
+ }
+ 
++# http://python3porting.com/problems.html#bytes-strings-and-unicode
++if sys.version_info < (3,):
++def b(x):
++return x
++else:
++import codecs
++def b(x):
++return codecs.latin_1_encode(x)[0]
++
+ def gzip_str(s):
+-  out = StringIO.StringIO()
+-  gzip.GzipFile(fileobj=out, mode="w").write(s)
++  try:
++  out = StringIO.StringIO()
++  except NameError:
++  out = io.BytesIO()
++
++  gzip.GzipFile(fileobj=out, mode="w").write(b(s))
+   out.seek(4)
+   out.write(struct.pack("

[arch-commits] Commit in varnish/trunk (2 files)

2013-12-03 Thread Dave Reisner
Date: Tuesday, December 3, 2013 @ 15:58:37
  Author: dreisner
Revision: 200723

upgpkg: varnish 3.0.5-1

Modified:
  varnish/trunk/PKGBUILD
Deleted:
  varnish/trunk/0001-Make-up-our-mind-Any-req.-we-receive-from-the-client.patch

-+
 0001-Make-up-our-mind-Any-req.-we-receive-from-the-client.patch |  133 
--
 PKGBUILD|   15 -
 2 files changed, 3 insertions(+), 145 deletions(-)

Deleted: 0001-Make-up-our-mind-Any-req.-we-receive-from-the-client.patch
===
--- 0001-Make-up-our-mind-Any-req.-we-receive-from-the-client.patch 
2013-12-03 12:56:51 UTC (rev 200722)
+++ 0001-Make-up-our-mind-Any-req.-we-receive-from-the-client.patch 
2013-12-03 14:58:37 UTC (rev 200723)
@@ -1,133 +0,0 @@
-From 4bd5b7991bf602a6c46dd0d65fc04d4b8d9667a6 Mon Sep 17 00:00:00 2001
-From: Martin Blix Grydeland mar...@varnish-software.com
-Date: Wed, 30 Oct 2013 13:48:20 +0100
-Subject: [PATCH] Make up our mind:  Any req.* we receive from the client with
- fundamental trouble gets failed back without VCL involvement.
-
-Fixes  #1367

- bin/varnishd/cache_center.c  | 28 +++-
- bin/varnishd/cache_http.c|  2 +-
- bin/varnishtest/tests/r01367.vtc | 30 ++
- 3 files changed, 46 insertions(+), 14 deletions(-)
- create mode 100644 bin/varnishtest/tests/r01367.vtc
-
-diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
-index 19eb2ce..fdf7cee 100644
 a/bin/varnishd/cache_center.c
-+++ b/bin/varnishd/cache_center.c
-@@ -1474,9 +1474,12 @@ DOT start - recv [style=bold,color=green]
- static int
- cnt_start(struct sess *sp)
- {
--  uint16_t done;
-+  uint16_t err_code;
-   char *p;
--  const char *r = HTTP/1.1 100 Continue\r\n\r\n;
-+  const char *r_100 = HTTP/1.1 100 Continue\r\n\r\n;
-+  const char *r_400 = HTTP/1.1 400 Bad Request\r\n\r\n;
-+  const char *r_413 = HTTP/1.1 413 Request Entity Too Large\r\n\r\n;
-+  const char *r_417 = HTTP/1.1 417 Expectation Failed\r\n\r\n;
- 
-   CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-   AZ(sp-restarts);
-@@ -1499,10 +1502,14 @@ cnt_start(struct sess *sp)
-   sp-wrk-vcl = NULL;
- 
-   http_Setup(sp-http, sp-ws);
--  done = http_DissectRequest(sp);
-+  err_code = http_DissectRequest(sp);
- 
-   /* If we could not even parse the request, just close */
--  if (done == 400) {
-+  if (err_code == 400)
-+  (void)write(sp-fd, r_400, strlen(r_400));
-+  else if (err_code == 413)
-+  (void)write(sp-fd, r_413, strlen(r_413));
-+  if (err_code != 0) {
-   sp-step = STP_DONE;
-   vca_close_session(sp, junk);
-   return (0);
-@@ -1514,12 +1521,6 @@ cnt_start(struct sess *sp)
-   /* Catch original request, before modification */
-   HTTP_Copy(sp-http0, sp-http);
- 
--  if (done != 0) {
--  sp-err_code = done;
--  sp-step = STP_ERROR;
--  return (0);
--  }
--
-   sp-doclose = http_DoConnection(sp-http);
- 
-   /* XXX: Handle TRACE  OPTIONS of Max-Forwards = 0 */
-@@ -1529,13 +1530,14 @@ cnt_start(struct sess *sp)
-*/
-   if (http_GetHdr(sp-http, H_Expect, p)) {
-   if (strcasecmp(p, 100-continue)) {
--  sp-err_code = 417;
--  sp-step = STP_ERROR;
-+  (void)write(sp-fd, r_417, strlen(r_417));
-+  sp-step = STP_DONE;
-+  vca_close_session(sp, junk);
-   return (0);
-   }
- 
-   /* XXX: Don't bother with write failures for now */
--  (void)write(sp-fd, r, strlen(r));
-+  (void)write(sp-fd, r_100, strlen(r_100));
-   /* XXX: When we do ESI includes, this is not removed
-* XXX: because we use http0 as our basis.  Believed
-* XXX: safe, but potentially confusing.
-diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
-index 8753acc..605975b 100644
 a/bin/varnishd/cache_http.c
-+++ b/bin/varnishd/cache_http.c
-@@ -601,7 +601,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
-   hp-hd[h2].e = p;
- 
-   if (!Tlen(hp-hd[h2]))
--  return (413);
-+  return (400);
- 
-   /* Skip SP */
-   for (; vct_issp(*p); p++) {
-diff --git a/bin/varnishtest/tests/r01367.vtc 
b/bin/varnishtest/tests/r01367.vtc
-new file mode 100644
-index 000..e1de20a
 /dev/null
-+++ b/bin/varnishtest/tests/r01367.vtc
-@@ -0,0 +1,30 @@
-+varnishtest blank GET
-+
-+server s1 {
-+  rxreq
-+  txresp
-+} -start
-+
-+varnish v1 -vcl+backend { 
-+  sub vcl_error {
-+  return (restart);
-+  }
-+} -start
-+
-+client c1 {
-+  send GET\nHost: example.com\n\n
-+