Subject: [alpine-aports] [PATCH] main/postfix: upgrade to 3.2.0

From: Valery Kartel <[email-masked]>
Date: Fri, 3 Mar 2017 14:57:36 +0200

---
 main/postfix/APKBUILD       |  46 ++++----------
 main/postfix/libressl.patch | 144 +++++---------------------------------------
 2 files changed, 27 insertions(+), 163 deletions(-)

diff --git a/main/postfix/APKBUILD b/main/postfix/APKBUILD
index a2afd56146..5a73b028bb 100644
--- a/main/postfix/APKBUILD
+++ b/main/postfix/APKBUILD
@@ -2,7 +2,7 @@
 # Contributor: Łukasz Jendrysik <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=postfix
-pkgver=3.1.4
+pkgver=3.2.0
 pkgrel=0
 pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
 url="http://www.postfix.org/"
@@ -23,29 +23,19 @@ source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgv
 	postfix-install.patch
 	libressl.patch
 	"
+builddir="$srcdir/$pkgname-$pkgver"
 
-_shared_libs() {
-	file --mime-type "$@" | \
-		awk -F: '$2 ~ /sharedlib/ {print $1}'
-}
-
-_builddir="$srcdir"/$pkgname-$pkgver
 prepare() {
-	cd $_builddir
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
+	default_prepare || return 1
 
 	sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
 		-e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/postfix/aliases|" \
-		src/util/sys_defs.h || return 1
-	sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || return 1
+		"$builddir"/src/util/sys_defs.h || return 1
+	sed -i -e "s:/usr/local/:/usr/:g" "$builddir"/conf/master.cf || return 1
 }
 
 build() {
-	cd $_builddir
+	cd "builddir"
 	# needed for dynamic maps.
 	local ccargs="-DHAS_SHL_LOAD -DDEF_DAEMON_DIR=\\\"/usr/lib/postfix\\\""
 	local auxlibs="$LDFLAGS"
@@ -92,9 +82,9 @@ build() {
 		AUXLIBS_SQLITE="$(pkg-config --libs sqlite3)" \
 		dynamicmaps=yes \
 		shared=yes \
-		makefiles || return 1
-
-	make OPT="$CFLAGS" || return 1
+		makefiles \
+		|| return 1
+	make OPT="$CFLAGS"
 }
 
 _mvline() {
@@ -108,7 +98,7 @@ d
 }
 
 package() {
-	cd $_builddir
+	cd "$builddir"
 	make non-interactive-package \
 		install_root="$pkgdir" \
 		readme_directory=/usr/share/doc/$pkgname/readme \
@@ -163,24 +153,14 @@ pgsql() { _mv_dict pgsql ; }
 sqlite() { _mv_dict sqlite ; }
 
 stone() {
-	cd $_builddir
+	cd "$builddir"
 	pkgdesc="Postfix simulation and testing tools"
 	install -Dm755 src/fsstone/fsstone "$subpkgdir"/usr/bin/fsstone
 	find src/smtpstone -perm 0755 -exec cp {} "$subpkgdir"/usr/bin \;
 }
 
-md5sums="878a059d92ee3b093d7d3e97248c915d  postfix-3.1.4.tar.gz
-82c78ea8cb77a55f563d2086b73c36e2  postfix.initd
-b7ed1614fafb5fed6253b1a62f76b709  no-glibc.patch
-3c58426d21611dd4eb1f93e924b349a1  postfix-install.patch
-0dd5ea7b09cdfdf8ee1379cff5664391  libressl.patch"
-sha256sums="f33b470c47ae8b4ff199ab55dc42e86031ff0c535ccbc83069c8cff69b5bd027  postfix-3.1.4.tar.gz
-2f744cfe9c3a0bac8e15c1e2347ff38283cb323617740f853e01d9eade7957ee  postfix.initd
-e8d7c4b3edab2388c9aba6c9ce70ff141ae7aacbd6480e233711241d90b14563  no-glibc.patch
-7185d2b2e4d7cc090b958c1d372c16e15f274465e2123686a0d97db20e2b5943  postfix-install.patch
-ed9864b3ee8ef756f0438b743012dc91cf702d0bfa04736761ca2799156ec1be  libressl.patch"
-sha512sums="4cf8aa8d0cf6d99defa32c2907705370d6f8d047d7e938c84a20a62c68ae07a2bec304f28c178d1072b9610f2969420f83fe2066821ad34c0f95e62bbb5b8c05  postfix-3.1.4.tar.gz
+sha512sums="bfaa4b2125758833997b399bb2f095475924c1e51fba752e631ad73494d8764458548541d175ef8a1ed6566e9dac569f963e0651e1500aa19595f9062b8e86ce  postfix-3.2.0.tar.gz
 2752e69c4e1857bdcf29444ffb458bca818bc60b9c77c20823c5f5b87c36cb5e0f3217a625a7fe5788d5bfcef7570a1f2149e1233fcd23ccf7ee14190aff47a2  postfix.initd
 cf9ef0d07e54011107da57e2855cbda10047c100047e2cc2fdede072ace1fc6c060a6b1cfc8c277417a28a23ecd3c6ffdc061da1673e8f61d2ed11899f1efb25  no-glibc.patch
 25cd34f23ca909d4e33aaf3239d1e397260abc7796d9a4456dee4f005682fd3a58aab8106126e5218c95bdddae415a3ef7e2223cd3b0d7b1e2bd76158bb7eaf8  postfix-install.patch
-753b4e9e5cbad0b6af01152903b73e0b95018ed3f3152a67f366c38497bca7b54b139acb444841e0c8ce2a5efdd0224172fe57c2d24a12a37a9bd8440aa793c2  libressl.patch"
+db43855ac9b8efd908f2196d685118df3fd4e42dc32b2079b1354fbbd49740dbf5213afc0b98dcbbb73621d13867090c4ca71430de0671d97ef11dce340e2ef1  libressl.patch"
diff --git a/main/postfix/libressl.patch b/main/postfix/libressl.patch
index 835edd689f..360d7617e2 100644
--- a/main/postfix/libressl.patch
+++ b/main/postfix/libressl.patch
@@ -1,10 +1,6 @@
-$OpenBSD: patch-src_tls_tls_h,v 1.1 2016/03/05 17:34:24 sthen Exp $
-
-Fix building with LibreSSL
-
---- a/src/tls/tls.h.orig	Sat Feb  6 15:09:41 2016
-+++ b/src/tls/tls.h	Fri Feb 12 20:15:25 2016
-@@ -89,7 +89,7 @@ extern const char *str_tls_level(int);
+--- a/src/tls/tls.h
++++ b/src/tls/tls.h
+@@ -89,7 +89,7 @@
  #endif
  
   /* Backwards compatibility with OpenSSL < 1.1.0 */
@@ -13,126 +9,14 @@ Fix building with LibreSSL
  #define OpenSSL_version_num SSLeay
  #define OpenSSL_version SSLeay_version
  #define OPENSSL_VERSION SSLEAY_VERSION
-diff -urp src/posttls-finger/posttls-finger.c src/posttls-finger/posttls-finger.c
---- a/src/posttls-finger/posttls-finger.c.orig	2016-08-27 22:27:50.000000000 +0200
-+++ b/src/posttls-finger/posttls-finger.c	2016-08-29 15:57:24.941368708 +0200
-@@ -1511,7 +1511,7 @@ static int finger(STATE *state)
-     return (0);
- }
- 
--#if defined(USE_TLS) && OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if defined(USE_TLS) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
- 
- /* ssl_cleanup - free memory allocated in the OpenSSL library */
- 
-@@ -1958,7 +1958,7 @@ int     main(int argc, char *argv[])
-     cleanup(&state);
- 
-     /* OpenSSL 1.1.0 and later (de)initialization is implicit */
--#if defined(USE_TLS) && OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if defined(USE_TLS) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-     ssl_cleanup();
- #endif
- 
-diff -urp src/tls/tls_client.c src/tls/tls_client.c
---- a/src/tls/tls_client.c.orig	2016-08-27 22:27:50.000000000 +0200
-+++ b/src/tls/tls_client.c	2016-08-29 16:00:17.115355822 +0200
-@@ -299,7 +299,7 @@ TLS_APPL_STATE *tls_client_init(const TL
-      */
-     tls_check_version();
- 
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- 
-     /*
-      * Initialize the OpenSSL library by the book! To start with, we must
-@@ -356,7 +356,7 @@ TLS_APPL_STATE *tls_client_init(const TL
-      * TLS_ANY_VERSION macro.
-      */
-     ERR_clear_error();
--#if OPENSSL_VERSION_NUMBER >= 0x10100000L && defined(TLS_ANY_VERSION)
-+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) && defined(TLS_ANY_VERSION)
-     client_ctx = SSL_CTX_new(TLS_client_method());
- #else
-     client_ctx = SSL_CTX_new(SSLv23_client_method());
-@@ -441,7 +441,7 @@ TLS_APPL_STATE *tls_client_init(const TL
-     /*
-      * 2015-12-05: Ephemeral RSA removed from OpenSSL 1.1.0-dev
-      */
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- 
-     /*
-      * According to the OpenSSL documentation, temporary RSA key is needed
-diff -urp src/tls/tls_dane.c src/tls/tls_dane.c
---- a/src/tls/tls_dane.c.orig	2016-08-27 22:27:50.000000000 +0200
-+++ b/src/tls/tls_dane.c	2016-08-29 15:58:30.467363804 +0200
-@@ -2163,7 +2163,7 @@ static SSL_CTX *ctx_init(const char *CAf
-     tls_param_init();
-     tls_check_version();
- 
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-     SSL_load_error_strings();
-     SSL_library_init();
- #endif
-diff -urp src/tls/tls_rsa.c src/tls/tls_rsa.c
---- a/src/tls/tls_rsa.c.orig	2016-01-03 15:49:51.000000000 +0100
-+++ b/src/tls/tls_rsa.c	2016-08-29 15:57:58.067366229 +0200
-@@ -57,7 +57,7 @@
-  /*
-   * 2015-12-05: Ephemeral RSA removed from OpenSSL 1.1.0-dev
-   */
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- 
- /* tls_tmp_rsa_cb - call-back to generate ephemeral RSA key */
- 
-@@ -109,7 +109,7 @@ int     main(int unused_argc, char *cons
-     /*
-      * 2015-12-05: Ephemeral RSA removed from OpenSSL 1.1.0-dev
-      */
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-     RSA    *rsa;
- 
-     msg_vstream_init(argv[0], VSTREAM_ERR);
-diff -urp src/tls/tls_server.c src/tls/tls_server.c
---- a/src/tls/tls_server.c.orig	2016-08-27 22:27:50.000000000 +0200
-+++ b/src/tls/tls_server.c	2016-08-29 15:59:41.807358465 +0200
-@@ -174,7 +174,7 @@ static const char server_session_id_cont
- #endif					/* OPENSSL_VERSION_NUMBER */
- 
-  /* OpenSSL 1.1.0 bitrot */
--#if OPENSSL_VERSION_NUMBER >= 0x10100000L
-+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
- typedef const unsigned char *session_id_t;
- 
- #else
-@@ -377,7 +377,7 @@ TLS_APPL_STATE *tls_server_init(const TL
-      */
-     tls_check_version();
- 
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- 
-     /*
-      * Initialize the OpenSSL library by the book! To start with, we must
-@@ -447,7 +447,7 @@ TLS_APPL_STATE *tls_server_init(const TL
-      * TLS_ANY_VERSION macro.
-      */
-     ERR_clear_error();
--#if OPENSSL_VERSION_NUMBER >= 0x10100000L && defined(TLS_ANY_VERSION)
-+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) && defined(TLS_ANY_VERSION)
-     server_ctx = SSL_CTX_new(TLS_server_method());
- #else
-     server_ctx = SSL_CTX_new(SSLv23_server_method());
-@@ -588,7 +588,7 @@ TLS_APPL_STATE *tls_server_init(const TL
-     /*
-      * 2015-12-05: Ephemeral RSA removed from OpenSSL 1.1.0-dev
-      */
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- 
-     /*
-      * According to OpenSSL documentation, a temporary RSA key is needed when
+--- a/src/tls/tls_dh.c
++++ b/src/tls/tls_dh.c
+@@ -244,7 +244,7 @@
+ 
+ void    tls_auto_eecdh_curves(SSL_CTX *ctx)
+ {
+-#if OPENSSL_VERSION_NUMBER >= 0x1000200fUL && !defined(OPENSSL_NO_ECDH)
++#if OPENSSL_VERSION_NUMBER >= 0x1000200fUL && !defined(LIBRESSL_VERSION_NUMBER)
+     SSL_CTX *tmpctx;
+     int    *nids;
+     int     space = 5;
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo Arena <[email-masked]>
Date: Tue, 6 Jun 2017 09:16:48 +0200

Hi,

>   2 files changed, 27 insertions(+), 163 deletions(-)

this didn't merge any more cleanly, but changes were mostly cosmetic. I 
took the liberty to bump it myself.

Thanks!

/leo

---