This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
1
[alpine-aports] [PATCH] testing/csync2: some cleanups in strlcpy patch. post-install generate required certificate and setup inetd service
---
testing/csync2/APKBUILD | 39 +++++++++++++---------------
testing/csync2/csync2.initd | 1 -
testing/csync2/csync2.post-install | 24 +++++++++++++++++
testing/csync2/have-strlcpy.patch | 41 ++++++++++++++++++++++++++++++
testing/csync2/rsync-strlcpy-disable.patch | 20 ---------------
5 files changed, 82 insertions(+), 43 deletions(-)
create mode 100644 testing/csync2/csync2.post-install
create mode 100644 testing/csync2/have-strlcpy.patch
delete mode 100644 testing/csync2/rsync-strlcpy-disable.patch
diff --git a/testing/csync2/APKBUILD b/testing/csync2/APKBUILD
index ada4ab4..bdb400f 100644
--- a/testing/csync2/APKBUILD
+++ b/testing/csync2/APKBUILD
@@ -4,22 +4,21 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=csync2
pkgver=2.0
-pkgrel=1
+pkgrel=2
pkgdesc="Cluster synchronization tool"
url="http://oss.linbit.com/csync2/"
arch="all"
-license="GPL2+"
-depends=""
-depends_dev=""
-makedepends="librsync-dev gnutls-dev sqlite-dev mysql-dev postgresql-dev"
-install="$pkgname.post-upgrade"
+license="GPL-2+"
+makedepends="autoconf automake librsync-dev gnutls-dev sqlite-dev mysql-dev postgresql-dev"
subpackages="$pkgname-compare $pkgname-doc"
source="http://oss.linbit.com/$pkgname/$pkgname-$pkgver.tar.gz
longlong-format.patch
- rsync-strlcpy-disable.patch
+ have-strlcpy.patch
$pkgname.initd"
+install="$pkgname.post-install $pkgname.post-upgrade"
_builddir="$srcdir"/$pkgname-$pkgver
+
prepare() {
cd "$_builddir"
for i in $source; do
@@ -27,6 +26,7 @@ prepare() {
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
+ autoreconf --install --force
}
build() {
@@ -45,31 +45,26 @@ build() {
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install || return 1
- cp doc/* "$pkgdir"/usr/share/doc/$pkgname/ || return 1
-
- install -m755 -D "$srcdir"/$pkgname.initd \
- "$pkgdir"/etc/init.d/$pkgname || return 1
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ cp doc/* "$pkgdir"/usr/share/doc/$pkgname/
}
compare() {
subpkgdesc="csync2 compare script"
arch="noarch"
- depends="bash perl-digest-md5"
-
+ depents="bash perl-digest-md5"
mkdir -p "$subpkgdir"/usr/sbin
- mv "$pkgdir"/usr/sbin/$pkgname-compare \
- "$subpkgdir"/usr/sbin/ || return 1
+ mv "$pkgdir"/usr/sbin/$pkgname-compare "$subpkgdir"/usr/sbin/
}
-
md5sums="4069fc9e86e8508c392fe2862059eb91 csync2-2.0.tar.gz
8fc73254db29316f9125761d18f1ed46 longlong-format.patch
-5908c4106d4866ab1c1f88f4c9482c9f rsync-strlcpy-disable.patch
-bf77ad1534addbd596a08d1f7084e85e csync2.initd"
+11d0bb642b3137ede6e97a33e18893d2 have-strlcpy.patch
+0cc2bcbbc3f9dc00bff534bcc785c225 csync2.initd"
sha256sums="11cb37380fb185bce0c22b804fec9b01c385d9d83cc528cfd48d748453834fa2 csync2-2.0.tar.gz
afb1317987cc4b81908bc437269162c7af23b34e6842306483da5b53efce2db3 longlong-format.patch
-339c7f5d91ff7ed3e63de5a5e39cf17efd7533f9c460eb81db76003acb164017 rsync-strlcpy-disable.patch
-0c1488e6bca746d8e5c5e3d893997b94e3c1766de69270d7c5c5a2282fb3b767 csync2.initd"
+ad7af0b971b413eb093dd32dd7cb2d8eb17ad590d3ba8f113015a49bde4b7526 have-strlcpy.patch
+f099fcb55fecbf8f4af5e414db5af57e2eedc7eeb369308acc5757dd9af8c1b9 csync2.initd"
sha512sums="f91fd222f67affe9634471d341b43ff67854a6ed25b620301a454e98a79a9fb80b2a66eb8713546758fd08300d52751e5ca7472c696daa20ee11779b87a830f8 csync2-2.0.tar.gz
38a17cbf23cbccd4996ad1af049851e33179586e619e3f3edbfacbaa36662e44d916839acd59b1cfc67b3af9042c3258068ec9e5b57f7e26c00a41a0e6f0e148 longlong-format.patch
-c44ad7e7fb7093f66fd9582b5309e3929dfdf7b76ef4d234d346fa25158f088b9436db9a1989d036d739570459867210d053af62125facb66e4f5202448c7bea rsync-strlcpy-disable.patch
-5050af0004679c7c63e0eb41a8dfed9ca1d92ce6acaee7c5e2150ce808474c61e6feb84f9b77185a282fbb36de9b981e1eab937ee0fb1ec045ab587960fda812 csync2.initd"
+46a12907e8004d5f92aa3ca6af171512590ba99cfb6ee296b4608d4658d9444a5e8b4b90a95a714ecfd834119a83539663991f141ed8258f8b3a78a26bf36ed5 have-strlcpy.patch
+e28e17dee7c619da4166cf1c172c86cf435079ba964ca5a8eceda61823e49050f24714f9b936280686e1903b89cb51f2d5770f0d4bc401ec67e04746f0f3224b csync2.initd"
diff --git a/testing/csync2/csync2.initd b/testing/csync2/csync2.initd
index 424a1e2..dc5bce0 100644
--- a/testing/csync2/csync2.initd
+++ b/testing/csync2/csync2.initd
@@ -1,6 +1,5 @@
#!/sbin/openrc-run
-name="$SVCNAME"
pidfile="/var/run/$SVCNAME.pid"
command="/usr/sbin/$SVCNAME"
command_args="-ii${CSYNC2_OPTS:+ $CSYNC2_OPTS}"
diff --git a/testing/csync2/csync2.post-install b/testing/csync2/csync2.post-install
new file mode 100644
index 0000000..92aa808
--- /dev/null
+++ b/testing/csync2/csync2.post-install
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+SSL="/etc/csync2/csync2_ssl_"
+SERV="/etc/services"
+INETD="/etc/inetd.conf"
+
+if [ ! -f ${SSL}key.pem -o ! -f ${SSL}cert.pem ]; then
+ openssl genrsa -out ${SSL}key.pem 1024 >/dev/null 2>&1
+ yes '' | openssl req -new -key ${SSL}key.pem -out ${SSL}cert.csr >/dev/null 2>&1
+ openssl x509 -req -days 3600 -in ${SSL}cert.csr -out ${SSL}cert.pem -signkey ${SSL}key.pem >/dev/null 2>&1
+ rm ${SSL}cert.csr
+fi
+
+if [ ! -f ${SERV} ]; then
+ touch ${SERV}
+fi
+grep -q csync2 ${SERV} || echo -e "csync2\t\t30865/tcp" >> ${SERV}
+
+if [ ! -f ${INETD} ]; then
+ touch ${INETD}
+fi
+grep -q csync2 ${INETD} || echo "csync2 stream tcp nowait root /usr/sbin/csync2 csync2 -i" >> ${INETD}
+
+exit 0
diff --git a/testing/csync2/have-strlcpy.patch b/testing/csync2/have-strlcpy.patch
new file mode 100644
index 0000000..4f2278b
--- /dev/null
+++ b/testing/csync2/have-strlcpy.patch
@@ -0,0 +1,41 @@
+--- old/config.h.in
++++ new/config.h.in
+@@ -1,5 +1,8 @@
+ /* config.h.in. Generated from configure.ac by autoheader. */
+
++/* Define to 1 if you have the `strlcpy' function. */
++#undef HAVE_STRLCPY
++
+ /* Define to 1 if you have the `fchmod' function. */
+ #undef HAVE_FCHMOD
+
+--- old/configure.ac
++++ new/configure.ac
+@@ -43,7 +43,7 @@
+
+
+ dnl inspired by rsync's configure.ac
+-AC_CHECK_FUNCS(fchmod setmode open64 mkstemp64)
++AC_CHECK_FUNCS(strlcpy fchmod setmode open64 mkstemp64)
+ AC_CACHE_CHECK([for secure mkstemp],csync_cv_HAVE_SECURE_MKSTEMP,[
+ AC_TRY_RUN([#include <stdlib.h>
+ #include <sys/types.h>
+--- old/rsync.c
++++ new/rsync.c
+@@ -38,7 +38,7 @@
+ #include <w32api/windows.h>
+ #endif
+
+-
++#ifndef HAVE_STRLCPY
+ /* This has been taken from rsync:lib/compat.c */
+
+ /**
+@@ -61,6 +61,7 @@
+ }
+ return ret;
+ }
++#endif
+
+ /* splits filepath at the last '/', if any, like so:
+ * dirname basename filepath
\ No newline at end of file
diff --git a/testing/csync2/rsync-strlcpy-disable.patch b/testing/csync2/rsync-strlcpy-disable.patch
deleted file mode 100644
index 5d28e1d..0000000
--- a/testing/csync2/rsync-strlcpy-disable.patch
@@ -1,20 +0,0 @@
---- old/rsync.c
-+++ new/rsync.c
-@@ -48,7 +48,7 @@
- * @param bufsize is the size of the destination buffer.
- *
- * @return index of the terminating byte.
-- **/
-+ * disabled
- static size_t strlcpy(char *d, const char *s, size_t bufsize)
- {
- size_t len = strlen(s);
-@@ -61,7 +61,7 @@
- }
- return ret;
- }
--
-+ **/
- /* splits filepath at the last '/', if any, like so:
- * dirname basename filepath
- * "/" "" "/"
--
2.5.3
---
Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org
Help: alpine-aports+help@lists.alpinelinux.org
---
On 30.09.15, Valery Kartel wrote:
> --- a/testing/csync2/APKBUILD
> +++ b/testing/csync2/APKBUILD
> @@ -4,22 +4,21 @@
> # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
> pkgname=csync2
> pkgver=2.0
> -pkgrel=1
> +pkgrel=2
> pkgdesc="Cluster synchronization tool"
> url="http://oss.linbit.com/csync2/"
> arch="all"
> -license="GPL2+"
> -depends=""
> -depends_dev=""
> -makedepends="librsync-dev gnutls-dev sqlite-dev mysql-dev postgresql-dev"
> -install="$pkgname.post-upgrade"
> +license="GPL-2+"
> +makedepends="autoconf automake librsync-dev gnutls-dev sqlite-dev mysql-dev postgresql-dev"
> subpackages="$pkgname-compare $pkgname-doc"
> source="http://oss.linbit.com/$pkgname/$pkgname-$pkgver.tar.gz
> longlong-format.patch
> - rsync-strlcpy-disable.patch
> + have-strlcpy.patch
> $pkgname.initd"
> +install="$pkgname.post-install $pkgname.post-upgrade"
>
> _builddir="$srcdir"/$pkgname-$pkgver
> +
> prepare() {
> cd "$_builddir"
> for i in $source; do
> @@ -27,6 +26,7 @@ prepare() {
> *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
> esac
> done
> + autoreconf --install --force
> }
>
> build() {
> @@ -45,31 +45,26 @@ build() {
> package() {
> cd "$_builddir"
> make DESTDIR="$pkgdir" install || return 1
> - cp doc/* "$pkgdir"/usr/share/doc/$pkgname/ || return 1
> -
> - install -m755 -D "$srcdir"/$pkgname.initd \
> - "$pkgdir"/etc/init.d/$pkgname || return 1
> + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
> + cp doc/* "$pkgdir"/usr/share/doc/$pkgname/
> }
>
> compare() {
> subpkgdesc="csync2 compare script"
> arch="noarch"
> - depends="bash perl-digest-md5"
> -
> + depents="bash perl-digest-md5"
> mkdir -p "$subpkgdir"/usr/sbin
> - mv "$pkgdir"/usr/sbin/$pkgname-compare \
> - "$subpkgdir"/usr/sbin/ || return 1
> + mv "$pkgdir"/usr/sbin/$pkgname-compare "$subpkgdir"/usr/sbin/
> }
This only seems to undo changes I explicitly committed in
b5ec9730c022a6686955a4648329868cfdd598af for instance you readded your
`depents` typo in the compare subpackage.
> --- /dev/null
> +++ b/testing/csync2/csync2.post-install
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +
> +SSL="/etc/csync2/csync2_ssl_"
> +SERV="/etc/services"
> +INETD="/etc/inetd.conf"
> +
> +if [ ! -f ${SSL}key.pem -o ! -f ${SSL}cert.pem ]; then
> + openssl genrsa -out ${SSL}key.pem 1024 >/dev/null 2>&1
> + yes '' | openssl req -new -key ${SSL}key.pem -out ${SSL}cert.csr >/dev/null 2>&1
> + openssl x509 -req -days 3600 -in ${SSL}cert.csr -out ${SSL}cert.pem -signkey ${SSL}key.pem >/dev/null 2>&1
> + rm ${SSL}cert.csr
> +fi
> +
> +if [ ! -f ${SERV} ]; then
> + touch ${SERV}
> +fi
> +grep -q csync2 ${SERV} || echo -e "csync2\t\t30865/tcp" >> ${SERV}
> +
> +if [ ! -f ${INETD} ]; then
> + touch ${INETD}
> +fi
> +grep -q csync2 ${INETD} || echo "csync2 stream tcp nowait root /usr/sbin/csync2 csync2 -i" >> ${INETD}
> +
> +exit 0
The post-install script was removed by me for two reason: 1) You modify
existing configuration files in a post-install script thus .apk-new
files won't be created but you will write to the file directly therefore
changing user configuration even if the users doesn't want to have a
csync entry in his/her inetd.conf. 2) You create an openssl certificate
without a configuration file passed to openssl using `-config` since you
pipe it through yes(1) it will use the default values for all fields
which I dislike. Take a look at main/dovecot to see how to do this
correctly.
> index 0000000..4f2278b
> --- /dev/null
> +++ b/testing/csync2/have-strlcpy.patch
> @@ -0,0 +1,41 @@
> +--- old/config.h.in
> ++++ new/config.h.in
> +@@ -1,5 +1,8 @@
> + /* config.h.in. Generated from configure.ac by autoheader. */
> +
> ++/* Define to 1 if you have the `strlcpy' function. */
> ++#undef HAVE_STRLCPY
> ++
> + /* Define to 1 if you have the `fchmod' function. */
> + #undef HAVE_FCHMOD
> +
> +--- old/configure.ac
> ++++ new/configure.ac
> +@@ -43,7 +43,7 @@
> +
> +
> + dnl inspired by rsync's configure.ac
> +-AC_CHECK_FUNCS(fchmod setmode open64 mkstemp64)
> ++AC_CHECK_FUNCS(strlcpy fchmod setmode open64 mkstemp64)
> + AC_CACHE_CHECK([for secure mkstemp],csync_cv_HAVE_SECURE_MKSTEMP,[
> + AC_TRY_RUN([#include <stdlib.h>
> + #include <sys/types.h>
> +--- old/rsync.c
> ++++ new/rsync.c
> +@@ -38,7 +38,7 @@
> + #include <w32api/windows.h>
> + #endif
> +
> +-
> ++#ifndef HAVE_STRLCPY
> + /* This has been taken from rsync:lib/compat.c */
> +
> + /**
> +@@ -61,6 +61,7 @@
> + }
> + return ret;
> + }
> ++#endif
> +
> + /* splits filepath at the last '/', if any, like so:
> + * dirname basename filepath
> \ No newline at end of file
> diff --git a/testing/csync2/rsync-strlcpy-disable.patch b/testing/csync2/rsync-strlcpy-disable.patch
> deleted file mode 100644
> index 5d28e1d..0000000
> --- a/testing/csync2/rsync-strlcpy-disable.patch
> +++ /dev/null
> @@ -1,20 +0,0 @@
> ---- old/rsync.c
> -+++ new/rsync.c
> -@@ -48,7 +48,7 @@
> - * @param bufsize is the size of the destination buffer.
> - *
> - * @return index of the terminating byte.
> -- **/
> -+ * disabled
> - static size_t strlcpy(char *d, const char *s, size_t bufsize)
> - {
> - size_t len = strlen(s);
> -@@ -61,7 +61,7 @@
> - }
> - return ret;
> - }
> --
> -+ **/
> - /* splits filepath at the last '/', if any, like so:
> - * dirname basename filepath
> - * "/" "" "/"
The patches look ok, please submit them without your APKBULID and
post-install script changes.
Sören.
---
Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org
Help: alpine-aports+help@lists.alpinelinux.org
---