Subject: sx: new upstream: SX-2.0
From: Török Edwin <[email-masked]>
To: [email-masked]
Date: Tue, 15 Dec 2015 20:16:10 +0200

Source: sx
Severity: wishlist

Dear László,

SX-2.0 is available: http://www.skylable.com/community/mailing-list/lurker/message/20151215.180918.67077476.en.html

Changes from a packaging point of view:
 - libsxclient.so.2 -> libsxclient.so.3 (not API/ABI compatible)
 - sxsetup --upgrade has to be run to upgrade the DB schema
 - new optional build dependency: libfuse-dev (>= 2.7.0) that builds a FUSE
   client called /usr/bin/sxfs if present (manpage is always built)

You can see my (not necesarily correct) attempt to update the package to SX-2.0 in the attachment:
 - Breaks/Replaces because some plugins have same filename
 - add /usr/bin/sxfs explicitly to make sure its built
 - drop patches from debian/patches, all applied upstream
 - ca-certificates as dependency for sxinit
 - libsx/->libsxclient/ in debian/copyright
 - update sx.logrotate with latest version from SX-2.0 package
 - run sxsetup --upgrade automatically from sx.postinst configure step

There is also a set of tests using python-cram in the experimental repository that show examples of various client tools (except sxfs);
the tests assume you are running an SX server called 'sxtest' and you've already sxinit-ed sx://admin@sxtest:
http://gitweb.skylable.com/gitweb/?p=experimental.git;a=tree;f=cram-test;hb=refs/heads/apitest

-- System Information:
Debian Release: 8.2
  APT prefers stable
  APT policy: (600, 'stable'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-0.bpo.1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- 
Edwin Török | Co-founder and Lead Developer

Skylable open-source object storage: reliable, fast, secure
http://www.skylable.com
diff --git a/debian/control b/debian/control
index b5d6780..909e30d 100644
--- a/debian/control
+++ b/debian/control
@@ -6,13 +6,14 @@ Build-Depends: debhelper (>= 9), libssl-dev, libyajl-dev, libfcgi-dev,
     libcurl4-openssl-dev (>= 7.34.0), libltdl-dev,
     libsqlite3-dev (>= 3.8.4.3), pkg-config (>= 0.9.0), nginx,
     libwww-perl, libjson-xs-perl, libdigest-hmac-perl, liburi-perl,
-    python, dh-python
+    python, dh-python,
+    libfuse-dev (>= 2.7.0)
 Standards-Version: 3.9.6
 Homepage: http://www.skylable.com/products/sx
 
 Package: sx
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, nginx, openssl, logrotate, ${python:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, openssl, logrotate, ca-certificates, ${python:Depends}
 Description: Scalable public and private cloud storage
  Skylable Sx is a reliable, fully distributed cluster solution for your data
  storage needs.
@@ -25,7 +26,9 @@ Description: Scalable public and private cloud storage
  Additionally Sx has built-in support for deduplication, client-side
  encryption, on-the-fly compression and much more.
 
-Package: libsxclient2
+Package: libsxclient3
+Replaces: libsxclient2
+Breaks: libsxclient2
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Scalable public and private cloud storage
@@ -43,7 +46,7 @@ Description: Scalable public and private cloud storage
 Package: libsxclient-dev
 Section: libdevel
 Architecture: any
-Depends: libsxclient2 (= ${binary:Version}), ${misc:Depends}
+Depends: libsxclient3 (= ${binary:Version}), ${misc:Depends}
 Description: Scalable public and private cloud storage
  Skylable Sx is a reliable, fully distributed cluster solution for your data 
  storage needs.
diff --git a/debian/copyright b/debian/copyright
index d8efe4b..ce63497 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -6,7 +6,7 @@ Files: *
 Copyright: 2012- Skylable Ltd. <[email-masked]>
 License: GPL-2 with OpenSSL exception
 
-Files: libsx/*
+Files: libsxclient/*
 Copyright: 2012- Skylable Ltd. <[email-masked]>
 License: LGPL-2.1+
 
diff --git a/debian/libsxclient2.install b/debian/libsxclient2.install
deleted file mode 100644
index 5556315..0000000
--- a/debian/libsxclient2.install
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/*/*.so.*
-usr/lib/*/sxclient/*-*.so
diff --git a/debian/patches/0001-fix-make-check-when-disable-sxhttpd-is-used.patch b/debian/patches/0001-fix-make-check-when-disable-sxhttpd-is-used.patch
deleted file mode 100644
index 5dc70a4..0000000
--- a/debian/patches/0001-fix-make-check-when-disable-sxhttpd-is-used.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From: =?utf-8?q?T=C3=B6r=C3=B6k_Edwin?= <[email-masked]>
-Date: Mon, 29 Dec 2014 16:45:12 +0200
-Subject: fix make check when --disable-sxhttpd is used
-
----
- server/configure              | 5 ++++-
- server/configure.ac           | 6 ++++--
- server/test/run-nginx-test.sh | 2 +-
- 3 files changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/server/configure b/server/configure
-index a5b03bf..4c37a12 100755
---- a/server/configure
-+++ b/server/configure
-@@ -14341,7 +14341,7 @@ $as_echo "no" >&6; }
- fi
- 
-   if test "x$ac_pt_SXHTTPD" = x; then
--    SXHTTPD="as_fn_error $? "nginx is required when --disable-sxhttpd is used" "$LINENO" 5"
-+    SXHTTPD="false"
-   else
-     case $cross_compiling:$ac_tool_warned in
- yes:)
-@@ -14355,6 +14355,9 @@ else
-   SXHTTPD="$ac_cv_path_SXHTTPD"
- fi
- 
-+    if test "$SXHTTPD" = "false"; then
-+        as_fn_error $? "nginx is required when --disable-sxhttpd is used" "$LINENO" 5
-+    fi
- else
-     SXHTTPD="$sbindir/sxhttpd"
- fi
-diff --git a/server/configure.ac b/server/configure.ac
-index 68614d9..e5d04eb 100644
---- a/server/configure.ac
-+++ b/server/configure.ac
-@@ -187,9 +187,11 @@ build_sxhttpd=$enableval, build_sxhttpd="yes")
- 
- 
- if test "x$build_sxhttpd" = "xno"; then
--    AC_PATH_TOOL(SXHTTPD,nginx,
--                 [AC_MSG_ERROR([nginx is required when --disable-sxhttpd is used])],
-+    AC_PATH_TOOL(SXHTTPD,nginx, [false],
-                  [/usr/sbin:/usr/local/sbin:$PATH])
-+    if test "$SXHTTPD" = "false"; then
-+        AC_MSG_ERROR([nginx is required when --disable-sxhttpd is used])
-+    fi
- else
-     SXHTTPD="$sbindir/sxhttpd"
- fi
-diff --git a/server/test/run-nginx-test.sh b/server/test/run-nginx-test.sh
-index 6fd5545..a86b32d 100755
---- a/server/test/run-nginx-test.sh
-+++ b/server/test/run-nginx-test.sh
-@@ -32,7 +32,7 @@ if [ `uname` = 'SunOS' ]; then
- else
-   FLAG=
- fi
--(cd sxscripts && make -s clean && make -s $FLAG prefix="$prefix" SXHTTPD="$prefix/sbin/sxhttpd" sbindir="$prefix/sbin" bindir="$prefix/bin" sysconfdir="$prefix/etc" localstatedir="$prefix/var" install)
-+(cd sxscripts && make -s clean && make -s $FLAG prefix="$prefix" sbindir="$prefix/sbin" bindir="$prefix/bin" sysconfdir="$prefix/etc" localstatedir="$prefix/var" install)
- (cd sxscripts && make -s clean && make -s)
- 
- ln -s `pwd`/../client/src/tools/init/sxinit "$prefix/bin/sxinit"
diff --git a/debian/patches/0002-set-other-paths-needed-to-run-as-non-root.patch b/debian/patches/0002-set-other-paths-needed-to-run-as-non-root.patch
deleted file mode 100644
index beb62a2..0000000
--- a/debian/patches/0002-set-other-paths-needed-to-run-as-non-root.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: =?utf-8?q?T=C3=B6r=C3=B6k_Edwin?= <[email-masked]>
-Date: Mon, 29 Dec 2014 16:58:25 +0200
-Subject: set other paths needed to run as non-root
-
-TODO: only when --disable-sxhttpd is given
----
- server/sxscripts/sxserver/sxhttpd.conf.default.in | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/server/sxscripts/sxserver/sxhttpd.conf.default.in b/server/sxscripts/sxserver/sxhttpd.conf.default.in
-index 30882cc..16cc6f6 100644
---- a/server/sxscripts/sxserver/sxhttpd.conf.default.in
-+++ b/server/sxscripts/sxserver/sxhttpd.conf.default.in
-@@ -23,6 +23,9 @@ http {
-        client_max_body_size 150M;
-        client_body_temp_path @localstatedir@/lib/sxserver/sxhttpd;
-        fastcgi_temp_path @localstatedir@/lib/sxserver/sxhttpd;
-+       proxy_temp_path @localstatedir@/lib/sxserver/sxhttpd;
-+       uwsgi_temp_path @localstatedir@/lib/sxserver/sxhttpd;
-+       scgi_temp_path @localstatedir@/lib/sxserver/sxhttpd;
-        server {
- #            ssl on;
- #            ssl_certificate @sysconfdir@/ssl/certs/sxcert.pem;
diff --git a/debian/patches/0003-fix-manpage-has-bad-whatis-entry.patch b/debian/patches/0003-fix-manpage-has-bad-whatis-entry.patch
deleted file mode 100644
index aa065b0..0000000
--- a/debian/patches/0003-fix-manpage-has-bad-whatis-entry.patch
+++ /dev/null
@@ -1,99 +0,0 @@
-From: =?utf-8?q?T=C3=B6r=C3=B6k_Edwin?= <[email-masked]>
-Date: Wed, 31 Dec 2014 11:40:24 +0200
-Subject: fix manpage-has-bad-whatis-entry
-
-https://lintian.debian.org/tags/manpage-has-bad-whatis-entry.html
----
- client/man/sxrev-copy.1.in   | 2 +-
- client/man/sxrev-delete.1.in | 2 +-
- client/man/sxrev-list.1.in   | 2 +-
- client/man/sxvol-create.1.in | 2 +-
- client/man/sxvol-filter.1.in | 2 +-
- client/man/sxvol-modify.1.in | 2 +-
- client/man/sxvol-remove.1.in | 2 +-
- 7 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/client/man/sxrev-copy.1.in b/client/man/sxrev-copy.1.in
-index 1a21608..cad7c5e 100644
---- a/client/man/sxrev-copy.1.in
-+++ b/client/man/sxrev-copy.1.in
-@@ -1,6 +1,6 @@
- .TH SXREV-COPY "1" "September 2014" "sxrev @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxrev copy \- copy a specific revision of a file
-+sxrev-copy \- copy a specific revision of a file
- .SH SYNOPSIS
- .B sxrev copy
- [\fI\,OPTIONS\/\fR] \fI\,sx://\/\fR[\fI\,profile@\/\fR]\fI\,cluster/volume/path DEST\/\fR
-diff --git a/client/man/sxrev-delete.1.in b/client/man/sxrev-delete.1.in
-index 062a7f2..a195868 100644
---- a/client/man/sxrev-delete.1.in
-+++ b/client/man/sxrev-delete.1.in
-@@ -1,6 +1,6 @@
- .TH SXREV-DELETE "1" "September 2014" "sxrev @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxrev delete \- delete a revision
-+sxrev-delete \- delete a revision
- .SH SYNOPSIS
- .B sxrev delete
- [\fI\,OPTIONS\/\fR] \fI sx://\/\fR[\fI\,profile@\/\fR]\fI\,cluster/volume/path\/\fR
-diff --git a/client/man/sxrev-list.1.in b/client/man/sxrev-list.1.in
-index 9bd7506..5d1b8cc 100644
---- a/client/man/sxrev-list.1.in
-+++ b/client/man/sxrev-list.1.in
-@@ -1,6 +1,6 @@
- .TH SXREV-LIST "1" "September 2014" "sxrev @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxrev list \- list revisions
-+sxrev-list \- list revisions
- .SH SYNOPSIS
- .B sxrev list
- \fIsx://\/\fR[\fI\,profile@\/\fR]\fI\,cluster/volume/path\/\fR
-diff --git a/client/man/sxvol-create.1.in b/client/man/sxvol-create.1.in
-index b35b7e1..c1812d4 100644
---- a/client/man/sxvol-create.1.in
-+++ b/client/man/sxvol-create.1.in
-@@ -1,6 +1,6 @@
- .TH SXVOL-CREATE "1" "September 2014" "sxvol @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxvol create \- create volumes on SX clusters
-+sxvol-create \- create volumes on SX clusters
- .SH SYNOPSIS
- .B sxvol create
- \fR[\fI\,OPTIONS\/\fR] \fI\,-r N -s SIZE -o username sx://\/\fR[\fI\,profile@\/\fR]\fI\,cluster/volume\/\fR
-diff --git a/client/man/sxvol-filter.1.in b/client/man/sxvol-filter.1.in
-index 176bb39..f5e0b26 100644
---- a/client/man/sxvol-filter.1.in
-+++ b/client/man/sxvol-filter.1.in
-@@ -1,6 +1,6 @@
- .TH SXVOL-FILTER "1" "September 2014" "sxvol @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxvol filter \- display information about filters
-+sxvol-filter \- display information about filters
- .SH SYNOPSIS
- .B sxvol
- \fI\,filter <OPTIONS>\/\fR...
-diff --git a/client/man/sxvol-modify.1.in b/client/man/sxvol-modify.1.in
-index 1972bc0..bc758c0 100644
---- a/client/man/sxvol-modify.1.in
-+++ b/client/man/sxvol-modify.1.in
-@@ -1,6 +1,6 @@
- .TH SXVOL-MODIFY "1" "November 2014" "sxvol @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxvol modify \- modify existing volumes
-+sxvol-modify \- modify existing volumes
- .SH SYNOPSIS
- .B sxvol modify
- \fR<\fI\,OPTIONS\/\fR> \fI\,sx://\/\fR[\fI\,profile@\/\fR]\fI\,cluster/volume\/\fR
-diff --git a/client/man/sxvol-remove.1.in b/client/man/sxvol-remove.1.in
-index e19823c..775aa71 100644
---- a/client/man/sxvol-remove.1.in
-+++ b/client/man/sxvol-remove.1.in
-@@ -1,6 +1,6 @@
- .TH SXVOL-REMOVE "1" "September 2014" "sxvol @VERSION@" "Skylable SX Manual"
- .SH NAME
--sxvol remove \- remove volumes from SX clusters
-+sxvol-remove \- remove volumes from SX clusters
- .SH SYNOPSIS
- .B sxvol remove
- [\fI\,OPTIONS\/\fR] \fI\,sx://\/\fR[\fI\,profile@\/\fR]\fI\,cluster/volume\/\fR
diff --git a/debian/patches/0004-backport-fix-1134.patch b/debian/patches/0004-backport-fix-1134.patch
deleted file mode 100644
index fac2455..0000000
--- a/debian/patches/0004-backport-fix-1134.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-Backport fix for bb #1134 (cannot locate socket: path too long)
-
-Use relative paths for socket
-
-Index: sx-debian/server/test/run-nginx-test.sh
-===================================================================
---- sx-debian.orig/server/test/run-nginx-test.sh
-+++ sx-debian/server/test/run-nginx-test.sh
-@@ -12,7 +12,8 @@ unset http_proxy
- unset HTTPS_PROXY
- unset https_proxy
- 
--prefix=`mktemp -d $PWD/sx-test-XXXXXXXX`
-+prefix_rel=`mktemp -d sx-test-XXXXXXXX`
-+prefix="$PWD/$prefix_rel"
- cleanup () {
-     (cd sxscripts && make clean)
-     rm -rf $prefix
-@@ -45,7 +46,7 @@ test -x "$built_nginx" && ln -s "$built_
- 
- cp "$prefix/etc/sxserver/sxhttpd.conf.default" "$prefix/etc/sxserver/sxhttpd.conf"
- 
--SXRUNDIR="$prefix/var/run/sxserver"
-+SXRUNDIR="$prefix_rel/var/run/sxserver"
- SXSTOREDIR="$prefix/var/lib/sxserver"
- SXLOGFILE="$prefix/var/log/sxserver/sxfcgi.log"
- cat >"$prefix/etc/sxserver/sxfcgi.conf" <<EOF
-@@ -63,9 +64,14 @@ fi
- cat >"$prefix/etc/sxserver/sxsetup.conf" <<EOF
- SX_NO_ROOT=1
- SX_RUN_DIR="$SXRUNDIR"
-+SX_LOG_FILE="$SXLOGFILE"
-+SX_LIB_DIR="$prefix/var/lib/sxserver"
- EOF
- 
--sed -e "s|^user.*|user `whoami`;|" -e "s|listen .*443|listen 127.0.0.1:8443|g" -e "s|listen .*80|listen 127.0.0.1:8013|g" $prefix/etc/sxserver/sxhttpd.conf >$prefix/etc/sxserver/sxhttpd.conf.1
-+sed -e "s|^user.*|user `whoami`;|" -e "s|listen .*443|listen 127.0.0.1:8443|g" \
-+    -e "s|listen .*80|listen 127.0.0.1:8013|g" \
-+    -e "s|unix:.*|unix:$SXRUNDIR/sxfcgi.socket;|" \
-+    $prefix/etc/sxserver/sxhttpd.conf >$prefix/etc/sxserver/sxhttpd.conf.1
- mv "$prefix/etc/sxserver/sxhttpd.conf.1" "$prefix/etc/sxserver/sxhttpd.conf"
- 
- "$prefix/sbin/sxadm" node --new --batch-mode "$SXSTOREDIR/data"
-@@ -77,6 +83,7 @@ mv "$prefix/etc/sxserver/sxhttpd.conf.1"
- cleanup () {
-     echo "cleaning up"
-     "$prefix/sbin/sxserver" stop
-+    cat "$SXLOGFILE"
-     rm -rf $prefix
- }
- export SX_FCGI_OPTS="--config-file=$prefix/etc/sxserver/sxfcgi.conf"
-@@ -86,14 +93,12 @@ trap cleanup EXIT INT
- 
- "$prefix/bin/sxinit" --batch-mode --port=8013 --no-ssl --auth-file="$SXSTOREDIR/data/admin.key" --config-dir="$prefix/.sx" sx://localhost
- `dirname $0`/client-test --config-dir="$prefix/.sx" --filter-dir="`pwd`/../client/src/filters" sx://localhost || {
--    cat "$SXLOGFILE";
-     cat $prefix/var/log/sxserver/sxhttpd-error.log;
-     exit 1
- }
- 
- perl `dirname $0`/fcgi-test.pl 127.0.0.1:8013 $SXSTOREDIR/data || {
-     rc=$?
--    cat "$SXLOGFILE";
-     cat $prefix/var/log/sxserver/sxhttpd-error.log;
-     if [ "$rc" -eq 2 ]; then
-         exit 77 # perl dep missing
diff --git a/debian/patches/0005-compatibility_with_curl_7.45.0.patch b/debian/patches/0005-compatibility_with_curl_7.45.0.patch
deleted file mode 100644
index 0d698a9..0000000
--- a/debian/patches/0005-compatibility_with_curl_7.45.0.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From ca51bc44809331e15d053ba7d6cfcd5ca12cad81 Mon Sep 17 00:00:00 2001
-From: =?utf8?q?T=C3=B6r=C3=B6k=20Edwin?= <[email-masked]>
-Date: Tue, 13 Oct 2015 16:18:13 +0300
-Subject: [PATCH] compatibility with curl 7.45.0 (bb#1541)
-
----
- libsxclient/src/openssl.c |    2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/libsxclient/src/openssl.c b/libsxclient/src/openssl.c
-index 62bfc01..666430a 100644
---- a/libsxclient/src/openssl.c
-+++ b/libsxclient/src/openssl.c
-@@ -98,6 +98,8 @@ int sxi_sslctxfun(sxc_client_t *sx, curlev_t *ev, const struct curl_tlssessionin
-         return -1;
-     }
-     SSL_CTX *ctx = (SSL_CTX*)info->internals;
-+    if (!ctx)
-+        return -EAGAIN;
-     SSL_CTX_set_cert_verify_callback(ctx, ssl_verify_hostname, ev);
-     return 0;
- }
--- 
-1.7.10.4
-
diff --git a/debian/patches/series b/debian/patches/series
index bd2a6ba..e69de29 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +0,0 @@
-#0001-fix-make-check-when-disable-sxhttpd-is-used.patch
-#0002-set-other-paths-needed-to-run-as-non-root.patch
-#0003-fix-manpage-has-bad-whatis-entry.patch
-#0004-backport-fix-1134.patch
-0005-compatibility_with_curl_7.45.0.patch
diff --git a/debian/sx.install b/debian/sx.install
index db18272..f8fc518 100644
--- a/debian/sx.install
+++ b/debian/sx.install
@@ -1,4 +1,5 @@
 etc/
+usr/bin/sxfs
 usr/bin/
 usr/sbin/
 usr/share/doc/sx/
diff --git a/debian/sx.logrotate b/debian/sx.logrotate
index 8ea03a6..8840902 100644
--- a/debian/sx.logrotate
+++ b/debian/sx.logrotate
@@ -8,7 +8,7 @@
 	create 0640
         sharedscripts
 	postrotate
-		[ ! -f /var/run/sxserver/sxhttpd.pid ] || kill -USR1 `cat /var/run/sxserver/sxhttpd.pid`
+		[ ! -s /var/run/sxserver/sxhttpd.pid ] || kill -USR1 `cat /var/run/sxserver/sxhttpd.pid`
 	endscript
 }
 
@@ -22,6 +22,6 @@
 	create 0640
         sharedscripts
 	postrotate
-		[ ! -f /var/run/sxserver/sxfcgi.pid ] || kill -USR1 `cat /var/run/sxserver/sxfcgi.pid`
+		[ ! -s /var/run/sxserver/sxfcgi.pid ] || kill -USR1 `cat /var/run/sxserver/sxfcgi.pid`
 	endscript
 }