Accepting request 200704 from network:ha-clustering:Factory

csync2 update for 13.1 (includes COPYING in %doc)

- Update to upstream version 2.0-rc2.  Changes since 1.34 too numerous to list, but include:
  + Database abstraction layer (default build uses sqlite3)
  + IPv6 support
  + Native GnuTLS support
  + tempdir and lock-timeout config options
  + do-local-only config option for actions
- Reworked patches and extra source being carried in openSUSE:
  + Added csync2.socket and csync2@.service for use via systemd
  + Added add-ac_prog_cpp.patch
  + Added fix-csync2_ssl_cert-filename.patch
  + Added fix-sonames.patch
  + Added add-COPYING.patch
  + Updated csync2-fix-xinetd.patch
  + Updated README.quickstart
  + Removed fix-missing-sentinels.diff (upstream)
  + Removed csync2-1.34-pure-gnutls-r2.patch (obsolete)
  + Removed force-debug-stderr-off-inetd.patch (obsolete)
  + Removed bind-to-local-hostname.patch (obsolete)

OBS-URL: https://build.opensuse.org/request/show/200704
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/csync2?expand=0&rev=16
This commit is contained in:
Tomáš Chvátal 2013-10-11 06:53:50 +00:00 committed by Git OBS Bridge
commit 41869d8eab
18 changed files with 298 additions and 5355 deletions

16
_service Normal file
View File

@ -0,0 +1,16 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">git://git.linbit.com/csync2.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">2.0+git.%ct.%h</param>
<param name="revision">master</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">csync2*.tar</param>
<param name="compression">bz2</param>
</service>
<service name="set_version" mode="disabled"/>
</services>

13
add-COPYING.patch Normal file
View File

@ -0,0 +1,13 @@
Index: csync2-2.0+git.1368794815.cf835a7/Makefile.am
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/Makefile.am
+++ csync2-2.0+git.1368794815.cf835a7/Makefile.am
@@ -40,7 +40,7 @@ CLEANFILES = cfgfile_parser.c cfgfile_pa
DISTCLEANFILES = config.status config.h .deps/*.Po stamp-h1 Makefile Makefile.in configure
-docfiles = ChangeLog README AUTHORS
+docfiles = ChangeLog README AUTHORS COPYING
if HAVE_PDFLATEX

12
add-ac_prog_cpp.patch Normal file
View File

@ -0,0 +1,12 @@
Index: csync2-2.0+git.1368794815.cf835a7/configure.ac
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/configure.ac
+++ csync2-2.0+git.1368794815.cf835a7/configure.ac
@@ -29,6 +29,7 @@ AM_CONFIG_HEADER(config.h)
# Checks for programs.
AC_PROG_CC
+AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_YACC
AM_PROG_LEX

View File

@ -1,38 +0,0 @@
Index: csync2-1.34/conn.c
===================================================================
--- csync2-1.34.orig/conn.c
+++ csync2-1.34/conn.c
@@ -50,7 +50,9 @@ SSL *conn_ssl;
int conn_open(const char *peername)
{
struct sockaddr_in sin;
+ struct sockaddr_in sme;
struct hostent *hp;
+ struct hostent *me;
int on = 1;
hp = gethostbyname(peername);
@@ -69,6 +71,23 @@ int conn_open(const char *peername)
bcopy(hp->h_addr, &sin.sin_addr, hp->h_length);
sin.sin_port = htons(csync_port);
+ /* Try to bind to IP address of local hostname, else in cases where
+ * there's multiple local IPs on the same subnet, we might autobind
+ * to the wrong one, and the remote csync2 instance will fail because
+ * it verifies the expected hostname against the initiating IP.
+ * If the explicit bind fails for some reason though, we'll still
+ * try to connect (it might work, and it can't hurt...).
+ */
+ me = gethostbyname(myhostname);
+ if (me) {
+ sme.sin_family = me->h_addrtype;
+ bcopy(me->h_addr, &sme.sin_addr, me->h_length);
+ sme.sin_port = 0; /* random port */
+ if (bind(conn_fd_in, (struct sockaddr *)&sme, sizeof(sme)) < 0) {
+ csync_debug(1, "Can't bind local socket (attempting connect anyway).\n");
+ }
+ }
+
if (connect(conn_fd_in, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
csync_debug(1, "Can't connect to remote host.\n");
close(conn_fd_in); conn_fd_in = -1;

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:32b250dd4a0353f71015c5c3961174b975dd5e799e4a084e8f6d00792bd8c833
size 222765

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e9613f71d49c15b3b4b1d4d747f0bc9f397ff0823dd9daaf2743ab93bd298781
size 91654

View File

@ -36,7 +36,12 @@ and the connection will fail. To remove the old key from an existing node's
cache, run the following command on each existing node:
csync2-rm-ssl-cert <replaced-hostname>
The csync2 service is disabled by default. To start it on both your hosts :
The csync2 service is disabled by default. To start it on both your hosts
using systemd (preferred):
systemctl enable csync2.socket
systemctl start csync2.socket
If you would prefer to do it the old way with xinetd, run:
chkconfig csync2 on
chkconfig --level 345 xinetd on
service xinetd restart

View File

@ -1,15 +1,17 @@
--- csync2-1.33/csync2.xinetd.fix-xinetd 2007-01-24 21:18:04.000000000 +0100
+++ csync2-1.33/csync2.xinetd 2007-01-24 21:19:47.000000000 +0100
Index: csync2-2.0+git.1368794815.cf835a7/csync2.xinetd
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/csync2.xinetd
+++ csync2-2.0+git.1368794815.cf835a7/csync2.xinetd
@@ -1,4 +1,4 @@
-# default: on
+# default: off
# description: csync2
service csync2
{
@@ -9,7 +9,9 @@
@@ -9,7 +9,9 @@ service csync2
group = root
server = /usr/sbin/csync2
server_args = -i
server_args = -i -l
+ port = 30865
+ type = UNLISTED
#log_on_failure += USERID

View File

@ -15,7 +15,7 @@ END
exit 0
fi
DBFILE=/var/lib/csync2/$(hostname).db
DBFILE=/var/lib/csync2/$(hostname).db3
if [ ! -f "$DBFILE" ]; then
echo "Local csync2 database ($DBFILE) not found."
exit 1
@ -26,7 +26,7 @@ PEERNAME=$(echo $1 | sed -e "s/['\"]//g")
certcount()
{
echo "SELECT COUNT(peername) FROM x509_cert WHERE peername='$1';" | sqlite $DBFILE
echo "SELECT COUNT(peername) FROM x509_cert WHERE peername='$1';" | sqlite3 $DBFILE
}
if [ $(certcount "$PEERNAME") -eq 0 ]; then
@ -34,7 +34,7 @@ if [ $(certcount "$PEERNAME") -eq 0 ]; then
exit 0
fi
echo "DELETE FROM x509_cert WHERE peername='$PEERNAME';" | sqlite $DBFILE
echo "DELETE FROM x509_cert WHERE peername='$PEERNAME';" | sqlite3 $DBFILE
if [ $(certcount "$PEERNAME") -ne 0 ]; then
echo "Error removing certificate for '$PEERNAME' from local database."

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Thu Sep 26 09:07:40 UTC 2013 - tserong@suse.com
- Ensure COPYING file is included in package
+ Added add-COPYING.patch
-------------------------------------------------------------------
Wed Sep 11 05:12:22 UTC 2013 - tserong@suse.com
- Update to upstream version 2.0-rc2. Changes since 1.34 too numerous
to list, but include:
+ Database abstraction layer (default build uses sqlite3)
+ IPv6 support
+ Native GnuTLS support
+ tempdir and lock-timeout config options
+ do-local-only config option for actions
- Reworked patches and extra source being carried in openSUSE:
+ Added csync2.socket and csync2@.service for use via systemd
+ Added add-ac_prog_cpp.patch
+ Added fix-csync2_ssl_cert-filename.patch
+ Added fix-sonames.patch
+ Updated csync2-fix-xinetd.patch
+ Updated README.quickstart
+ Removed fix-missing-sentinels.diff (upstream)
+ Removed csync2-1.34-pure-gnutls-r2.patch (obsolete)
+ Removed force-debug-stderr-off-inetd.patch (obsolete)
+ Removed bind-to-local-hostname.patch (obsolete)
-------------------------------------------------------------------
Fri May 10 12:56:38 UTC 2013 - tserong@suse.com

6
csync2.socket Normal file
View File

@ -0,0 +1,6 @@
[Socket]
ListenStream=30865
Accept=yes
[Install]
WantedBy=sockets.target

View File

@ -17,75 +17,94 @@
Summary: Cluster synchronization tool
License: GPL-2.0+ and LGPL-2.1+
License: GPL-2.0+
Group: Productivity/Clustering/HA
Name: csync2
Version: 1.34
Version: 2.0+git.1368794815.cf835a7
Release: 0
Url: http://oss.linbit.com/csync2/
Source0: http://oss.linbit.com/csync2/%{name}-%{version}.tar.gz
#Source0: http://oss.linbit.com/csync2/%{name}-%{version}.tar.gz
Source0: %{name}-%{version}.tar.bz2
Source1: csync2-README.quickstart
Source2: csync2-rm-ssl-cert
Source3: csync2.socket
Source4: csync2@.service
# PATCH-FIX-UPSTREAM -- csync2-fix-xinetd.patch tserong@suse.com -- disables csync2 in xinetd by default, fixes port.
Patch0: csync2-fix-xinetd.patch
Patch1: fix-missing-sentinels.diff
%if 0%{?suse_version} > 1120
Patch2: csync2-1.34-pure-gnutls-r2.patch
BuildRequires: pkg-config
%endif
Patch3: force-debug-stderr-off-inetd.patch
Patch4: bind-to-local-hostname.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(post): openssl
Requires: gnutls
Requires: sqlite2
Requires: xinetd
# PATCH-FIX-UPSTREAM -- add-ac_prog_cpp.patch tserong@suse.com -- fix ugly ./configure warnings about missing headers
Patch10: add-ac_prog_cpp.patch
# PATCH-FIX-UPSTREAM -- fix-csync2_ssl_cert-filename.patch tserong@suse.com -- correct csync2 ssl cert filename
Patch11: fix-csync2_ssl_cert-filename.patch
# PATCH-FIX-UPSTREAM -- fix-sonames.patch tserong@suse.com -- use properly versioned sonames in dlopen()
Patch12: fix-sonames.patch
# PATCH-FIX-UPSTREAM -- add-COPYING.patch tserong@suse.com -- ensure COPYING is present in docfiles and thus %doc
Patch13: add-COPYING.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: flex
BuildRequires: libgnutls-devel
%if 0%{?sles_version} == 11
BuildRequires: libgnutls-extra-devel
%endif
BuildRequires: libtasn1-devel
BuildRequires: sqlite2-devel
%if 0%{?suse_version} > 1210
BuildRequires: librsync-devel
%else
BuildRequires: librsync
# openssl required at build time due to rpmlint checks which run postinstall script which uses openssl
BuildRequires: openssl
BuildRequires: pkgconfig
BuildRequires: sqlite3-devel
Requires: openssl
Requires: sqlite3
%{?systemd_requires}
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%endif
# texlive is for pdflatex to build PDF version of the manual
BuildRequires: texlive-latex
BuildRequires: texlive-nopageno
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Csync2 is a cluster synchronization tool. It can be used to keep files
on multiple hosts in a cluster in sync. Csync2 can handle complex
setups with much more than just 2 hosts, handle file deletions and can
detect conflicts. It is expedient for HA-clusters, HPC-clusters, COWs
and server farms.
Csync2 is a cluster synchronization tool. It can be used to keep files on
multiple hosts in a cluster in sync. Csync2 can handle complex setups with
much more than just 2 hosts, handle file deletions and can detect conflicts.
It is expedient for HA-clusters, HPC-clusters, COWs and server farms.
%prep
%setup -q
%patch0 -p1 -b .fix-xinetd
%patch1 -p1
%if 0%{?suse_version} > 1120
%patch2 -p1
%endif
%patch3 -p1
%patch4 -p1
install -p -m 644 %{SOURCE1} README.quickstart
%{?suse_update_config:%{suse_update_config}}
%patch0 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%build
%configure --sysconfdir=%{_sysconfdir}/csync2
export CFLAGS="%{optflags}"
if ! [ -f configure ]; then ./autogen.sh; fi
%configure --enable-sqlite3 \
--sysconfdir=%{_sysconfdir}/csync2 --docdir=%{_docdir}/%{name}
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{_var}/lib/csync2
%make_install
mkdir -p %{buildroot}%{_localstatedir}/lib/csync2
install -p -D -m 644 csync2.xinetd %{buildroot}%{_sysconfdir}/xinetd.d/csync2
install -p -m 644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/README.quickstart
install -p -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/csync2-rm-ssl-cert
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/
install -p -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/
# We need these empty files to be able to %%ghost them
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_key.pem
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_cert.pem
%pre
%service_add_pre csync2.socket
%post
%service_add_post csync2.socket
umask 077
if [ ! -f %{_sysconfdir}/csync2/csync2_ssl_key.pem ]; then
/usr/bin/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{_sysconfdir}/csync2/csync2_ssl_key.pem 2>/dev/null
@ -107,23 +126,30 @@ EOF
fi
%preun
%service_del_preun csync2.socket
# Cleanup all databases upon last removal
if [ $1 -eq 0 ]; then
%{__rm} -f %{_var}/lib/csync2/*
rm -f %{_localstatedir}/lib/csync2/*
fi
%postun
%service_del_postun csync2.socket
%files
%defattr(-,root,root,-)
%doc README README.quickstart AUTHORS COPYING paper.pdf
%defattr(-,root,root)
%{_sbindir}/csync2
%{_sbindir}/csync2-compare
%{_unitdir}/csync2.socket
%{_unitdir}/csync2@.service
%dir %{_localstatedir}/lib/csync2/
# Using docdir here ensures correct doc file tagging
%{_docdir}/%{name}
%dir %{_sysconfdir}/csync2/
%config(noreplace) %{_sysconfdir}/csync2/csync2.cfg
%config(noreplace) %{_sysconfdir}/xinetd.d/csync2
%ghost %config %{_sysconfdir}/csync2/csync2_ssl_key.pem
%ghost %config %{_sysconfdir}/csync2/csync2_ssl_cert.pem
%{_sbindir}/csync2
%{_sbindir}/csync2-compare
%{_sbindir}/csync2-rm-ssl-cert
%{_mandir}/man1/csync2.1*
%dir %{_var}/lib/csync2/
%changelog

9
csync2@.service Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=csync2 connection handler
After=syslog.target
[Service]
ExecStart=-/usr/sbin/csync2 -i -v
StandardInput=socket
StandardOutput=socket

View File

@ -0,0 +1,21 @@
commit 456732b
Author: Tim Serong <tserong@suse.com>
Date: Mon Sep 2 16:50:27 2013 +1000
Fix typo in csync2_ssl_cert.pem filename
Signed-off-by: Tim Serong <tserong@suse.com>
diff --git a/conn.c b/conn.c
index 2b3611d..5e54693 100644
--- a/conn.c
+++ b/conn.c
@@ -281,7 +281,7 @@ int conn_activate_ssl(int server_role)
return 0;
ASPRINTF(&ssl_keyfile, "%s/csync2_ssl_key.pem", systemdir);
- ASPRINTF(&ssl_certfile, "%s/csync_ssl_cert.pem", systemdir);
+ ASPRINTF(&ssl_certfile, "%s/csync2_ssl_cert.pem", systemdir);
gnutls_global_init();
gnutls_global_set_log_function(ssl_log);

View File

@ -1,13 +0,0 @@
Index: action.c
===================================================================
--- csync2-1.34/action.c 2007-07-25 05:04:18.000000000 +0800
+++ csync2-1.34/action.c 2009-12-04 17:51:47.000000000 +0800
@@ -107,7 +107,7 @@
/* 1 */ open(logfile_clr, O_WRONLY|O_CREAT|O_APPEND, 0666);
/* 2 */ open(logfile_clr, O_WRONLY|O_CREAT|O_APPEND, 0666);
- execl("/bin/sh", "sh", "-c", real_command, 0);
+ execl("/bin/sh", "sh", "-c", real_command, NULL);
_exit(127);
}

104
fix-sonames.patch Normal file
View File

@ -0,0 +1,104 @@
Index: csync2-2.0+git.1368794815.cf835a7/db_mysql.c
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/db_mysql.c
+++ csync2-2.0+git.1368794815.cf835a7/db_mysql.c
@@ -53,16 +53,16 @@ static void *dl_handle;
static void db_mysql_dlopen(void)
{
- csync_debug(2, "Opening shared library libmysqlclient.so\n");
- dl_handle = dlopen("libmysqlclient.so", RTLD_LAZY);
+ csync_debug(2, "Opening shared library libmysqlclient.so.18\n");
+ dl_handle = dlopen("libmysqlclient.so.18", RTLD_LAZY);
if (dl_handle == NULL) {
csync_fatal
- ("Could not open libmysqlclient.so: %s\n"
+ ("Could not open libmysqlclient.so.18: %s\n"
"Please install Mysql client library (libmysqlclient) or use other database (sqlite, postgres)\n",
dlerror());
}
- csync_debug(2, "Reading symbols from shared library libmysqlclient.so\n");
+ csync_debug(2, "Reading symbols from shared library libmysqlclient.so.18\n");
LOOKUP_SYMBOL(dl_handle, mysql_init);
LOOKUP_SYMBOL(dl_handle, mysql_real_connect);
Index: csync2-2.0+git.1368794815.cf835a7/db_postgres.c
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/db_postgres.c
+++ csync2-2.0+git.1368794815.cf835a7/db_postgres.c
@@ -58,16 +58,16 @@ static void *dl_handle;
static void db_postgres_dlopen(void)
{
- csync_debug(2, "Opening shared library libpq.so\n");
+ csync_debug(2, "Opening shared library libpq.so.5\n");
- dl_handle = dlopen("libpq.so", RTLD_LAZY);
+ dl_handle = dlopen("libpq.so.5", RTLD_LAZY);
if (dl_handle == NULL) {
csync_fatal
- ("Could not open libpq.so: %s\n"
+ ("Could not open libpq.so.5: %s\n"
"Please install postgres client library (libpg) or use other database (sqlite, mysql)\n",
dlerror());
}
- csync_debug(2, "Reading symbols from shared library libpq.so\n");
+ csync_debug(2, "Reading symbols from shared library libpq.so.5\n");
LOOKUP_SYMBOL(dl_handle, PQconnectdb);
LOOKUP_SYMBOL(dl_handle, PQstatus);
Index: csync2-2.0+git.1368794815.cf835a7/db_sqlite.c
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/db_sqlite.c
+++ csync2-2.0+git.1368794815.cf835a7/db_sqlite.c
@@ -56,16 +56,16 @@ static void *dl_handle;
static void db_sqlite3_dlopen(void)
{
- csync_debug(2, "Opening shared library libsqlite3.so\n");
+ csync_debug(2, "Opening shared library libsqlite3.so.0\n");
- dl_handle = dlopen("libsqlite3.so", RTLD_LAZY);
+ dl_handle = dlopen("libsqlite3.so.0", RTLD_LAZY);
if (dl_handle == NULL) {
csync_fatal
- ("Could not open libsqlite3.so: %s\n"
+ ("Could not open libsqlite3.so.0: %s\n"
"Please install sqlite3 client library (libsqlite3) or use other database (postgres, mysql)\n",
dlerror());
}
- csync_debug(2, "Reading symbols from shared library libsqlite3.so\n");
+ csync_debug(2, "Reading symbols from shared library libsqlite3.so.0\n");
LOOKUP_SYMBOL(dl_handle, sqlite3_open);
LOOKUP_SYMBOL(dl_handle, sqlite3_close);
Index: csync2-2.0+git.1368794815.cf835a7/db_sqlite2.c
===================================================================
--- csync2-2.0+git.1368794815.cf835a7.orig/db_sqlite2.c
+++ csync2-2.0+git.1368794815.cf835a7/db_sqlite2.c
@@ -54,20 +54,17 @@ static void *dl_handle;
static void db_sqlite_dlopen(void)
{
- csync_debug(2, "Opening shared library libsqlite.so\n");
+ csync_debug(2, "Opening shared library libsqlite.so.0\n");
- dl_handle = dlopen("libsqlite.so", RTLD_LAZY);
+ dl_handle = dlopen("libsqlite.so.0", RTLD_LAZY);
if (dl_handle == NULL) {
- csync_debug(1, "Libsqlite.so not found, trying libsqlite.so.0\n");
- dl_handle = dlopen("libsqlite.so.0", RTLD_LAZY);
- if (dl_handle == NULL) {
csync_fatal
- ("Could not open libsqlite.so: %s\n"
+ ("Could not open libsqlite.so.0: %s\n"
"Please install sqlite client library (libsqlite) or use other database (postgres, mysql)\n",
dlerror());
}
}
- csync_debug(2, "Opening shared library libsqlite.so\n");
+ csync_debug(2, "Opening shared library libsqlite.so.0\n");
LOOKUP_SYMBOL(dl_handle, sqlite_open);
LOOKUP_SYMBOL(dl_handle, sqlite_close);

View File

@ -1,21 +0,0 @@
Index: csync2-1.34/csync2.c
===================================================================
--- csync2-1.34.orig/csync2.c
+++ csync2-1.34/csync2.c
@@ -458,6 +458,16 @@ int main(int argc, char ** argv)
for (i=0; myhostname[i]; i++)
myhostname[i] = tolower(myhostname[i]);
+ if ( mode == MODE_INETD ) {
+ /* Force debug level below zero when running under inetd,
+ * else stderr junk may be emitted back to some other host
+ * which breaks the protocol. One case is where a target
+ * directory does not exist resulting in allegations of
+ * I/O error during rsync write (bnc#752563)
+ */
+ csync_debug_level = -1;
+ }
+
/* Stand-alone server mode. This is a hack..
*/
if ( mode == MODE_SERVER || mode == MODE_SINGLE ) {