Subject: [alpine-aports] [PATCH] main/readline: upgrade to 7.0 patchlevel 003

From: Valery Kartel <[email-masked]>
Date: Mon, 20 Mar 2017 15:12:09 +0200

- fix url
- move static libraries to -dev, remove -static subpackage
- move libhistory library to separate subpackage
- remade APKBUILD for automatic deploy upstream's patches
---
 main/readline/APKBUILD                  |  66 +++---
 main/readline/p0-readline-6.3-008.patch | 394 --------------------------------
 2 files changed, 28 insertions(+), 432 deletions(-)
 delete mode 100644 main/readline/p0-readline-6.3-008.patch

diff --git a/main/readline/APKBUILD b/main/readline/APKBUILD
index a6f6a91bf5..e19ec08fac 100644
--- a/main/readline/APKBUILD
+++ b/main/readline/APKBUILD
@@ -1,42 +1,36 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=readline
-pkgver=6.3.008
+pkgver=7.0.003
+pkgrel=0
 _myver=${pkgver%.*}
-pkgrel=5
 pkgdesc="GNU readline library"
-url="ftp://ftp.cwru.edu/pub/bash/"
+url="https://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
 arch="all"
 license="GPL"
 depends=
 makedepends="ncurses-dev"
-subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
-source="http://ftp.gnu.org/gnu/readline/readline-${_myver}.tar.gz
-	p0-readline-6.3-008.patch
+subpackages="$pkgname-dev $pkgname-doc libhistory"
+source="http://ftp.gnu.org/gnu/$pkgname/$pkgname-$_myver.tar.gz
 	fix-ncurses-underlinking.patch
 	"
 
-# generate url's to patches. note: no forks allowed!
+for _patch in $(seq -w 001 ${pkgver##*.}); do
+	_name=$pkgname${_myver//./}-$_patch
+	source="$source $_name.diff::http://ftp.gnu.org/gnu/$pkgname/$pkgname-$_myver-patches/$_name"
+done
 
-_getpatch() {
-	_i=1
-	_suff=${_myver//./}
-	_patchver=${pkgver##*.}
-	while [ $_i -le $_patchver ]; do
-		curl http://ftp.gnu.org/gnu/readline/readline-$_myver-patches/readline$_suff-$(printf "%03d" $_i)
-		_i=$(( $_i + 1))
-	done
-}
+builddir="$srcdir/$pkgname-$_myver"
 
-builddir="$srcdir"/$pkgname-$_myver
 prepare() {
+	local i
 	cd "$builddir"
-	update_config_sub || return 1
 	for i in $source; do
-		case $i in
-		p0-*.patch) msg $i; patch -p0 -i "$srcdir"/$i || return 1;;
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		case ${i%::*} in
+		*.diff) msg ${i#*::}; patch -p0 -i "$srcdir"/${i%::*} || return 1;;
 		esac
 	done
+	default_prepare || return 1
+	update_config_sub
 }
 
 build() {
@@ -53,28 +47,24 @@ build() {
 	make || return 1
 }
 
-static() {
-	pkgdesc="$pkgdesc - static library"
-	mkdir -p "$subpkgdir"/usr/lib
-	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
-}
-
 package() {
-	cd "$builddir"
-	make DESTDIR="$pkgdir" install || return 1
+	make -C "$builddir" DESTDIR="$pkgdir" install || return 1
 	# verfy that its not underlinked as upstream designed it
 	if ! readelf -d "$pkgdir"/usr/lib/libreadline.so | grep 'NEEDED.*ncurses'; then
 		error "readline needs to be linked against ncurses"
 		return 1
 	fi
+	rmdir "$pkgdir"/usr/bin
+}
+
+libhistory() {
+	pkgdesc="GNU History Library"
+	mkdir -p "$subpkgdir"/usr/lib || return 1
+	mv "$pkgdir"/usr/lib/$subpkgname.* "$subpkgdir"/usr/lib || return 1
 }
 
-md5sums="33c8fb279e981274f485fd91da77e94a  readline-6.3.tar.gz
-3e84f443ddc7aedad1e6d527c105a213  p0-readline-6.3-008.patch
-14c0ace483b61e99441acca376acaeac  fix-ncurses-underlinking.patch"
-sha256sums="56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43  readline-6.3.tar.gz
-b1682565724a25b68118f6880257cd2381988ee34e98e6c69e6fa20a0f941701  p0-readline-6.3-008.patch
-351a19e1c8bb4c06b7cacb70a3cf3dda2eefce66bb4eb4635ac93c5716405b1e  fix-ncurses-underlinking.patch"
-sha512sums="f70efaf46d570b85c7637172b0ee2eb9a4aa73ba38a62bb45075e665929d9701b96fba0aea6c767fd9a2a0d39dfe8e70ab06da08f8524aee76a7c502f370a401  readline-6.3.tar.gz
-beab1f333643deea33bde114b7ba3eb6a6d9c84a2a92a66111bb46c6c1d27416d970112cf6ea635a7f3d5a419d4c768718a8f6ff1b4726c0cda8f566a2ad092f  p0-readline-6.3-008.patch
-325dcf74e9f463a74fb116cb6f3ff8d9708dbec24b423a778eeda3a5ac4fe6df131e0e99d034053ad356b01502894ecc8facc09160d4c29b2291bd95cff6b635  fix-ncurses-underlinking.patch"
+sha512sums="18243189d39bf0d4c8a76cddcce75243c1bae8824c686e9b6ba352667607e5b10c5feb79372a1093c1c388d821841670702e940df12eae94bcebdeed90047870  readline-7.0.tar.gz
+325dcf74e9f463a74fb116cb6f3ff8d9708dbec24b423a778eeda3a5ac4fe6df131e0e99d034053ad356b01502894ecc8facc09160d4c29b2291bd95cff6b635  fix-ncurses-underlinking.patch
+4402186905af8cd42c609d640c2e13b9ad61c7778e5a3fd2c2d9da301f0deab05b04d7836f31527262f44f406517823dbb18cb07f2c73931186c806b494699ec  readline70-001.diff
+13d1489578508d4d2c3a1618024198a709dbce74a6bbf0f6d7ec67d2419c55bfec9f0ca9de0ed93f129d21d5c3a94307ccdc49408455bbb301c5e3a772b03185  readline70-002.diff
+eaf962a1480eb3870519017b81ecc5cef171e4c41fcf8c17da61ccbfd0379ed6bca85c17b03e2207ae4d51509f33fd010294c75f4bd0433a52118015d4160385  readline70-003.diff"
diff --git a/main/readline/p0-readline-6.3-008.patch b/main/readline/p0-readline-6.3-008.patch
deleted file mode 100644
index 5a0688c810..0000000000
--- a/main/readline/p0-readline-6.3-008.patch
+++ /dev/null
@@ -1,394 +0,0 @@
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-001
-
-Bug-Reported-by:	Daan van Rossum <[email-masked]>
-Bug-Reference-ID:	<[email-masked]>
-Bug-Reference-URL:	
-
-Bug-Description:
-
-The `.' command in vi mode cannot undo multi-key commands beginning with
-`c', `d', and `y' (command plus motion specifier).
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3/readline.c	2013-10-28 14:58:06.000000000 -0400
---- readline.c	2014-03-07 15:20:33.000000000 -0500
-***************
-*** 965,969 ****
-    if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
-        key != ANYOTHERKEY &&
-!       rl_key_sequence_length == 1 &&	/* XXX */
-        _rl_vi_textmod_command (key))
-      _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
---- 965,969 ----
-    if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
-        key != ANYOTHERKEY &&
-!       _rl_dispatching_keymap == vi_movement_keymap &&
-        _rl_vi_textmod_command (key))
-      _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 5
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 1
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-002
-
-Bug-Reported-by:	Anatol Pomozov <[email-masked]>
-Bug-Reference-ID:	<[email-masked]>
-Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00010.html
-
-Bug-Description:
-
-When in callback mode, some readline commands can cause readline to seg
-fault by passing invalid contexts to callback functions.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3/readline.c	2013-10-28 14:58:06.000000000 -0400
---- readline.c	2014-03-10 14:15:02.000000000 -0400
-***************
-*** 745,749 ****
-  
-    RL_CHECK_SIGNALS ();
-!   if (r == 0)			/* success! */
-      {
-        _rl_keyseq_chain_dispose ();
---- 745,750 ----
-  
-    RL_CHECK_SIGNALS ();
-!   /* We only treat values < 0 specially to simulate recursion. */
-!   if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0))	/* success! or failure! */
-      {
-        _rl_keyseq_chain_dispose ();
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 1
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 2
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-003
-
-Bug-Reported-by:
-Bug-Reference-ID:
-Bug-Reference-URL:
-
-Bug-Description:
-
-There are debugging functions in the readline release that are theoretically
-exploitable as security problems.  They are not public functions, but have
-global linkage.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3/util.c	2013-09-02 13:36:12.000000000 -0400
---- util.c	2014-03-20 10:25:53.000000000 -0400
-***************
-*** 477,480 ****
---- 479,483 ----
-  }
-  
-+ #if defined (DEBUG)
-  #if defined (USE_VARARGS)
-  static FILE *_rl_tracefp;
-***************
-*** 539,542 ****
---- 542,546 ----
-  }
-  #endif
-+ #endif /* DEBUG */
-  
-  
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 2
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 3
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-004
-
-Bug-Reported-by:	Egmont Koblinger <[email-masked]>
-Bug-Reference-ID:	<[email-masked]>
-Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00153.html
-
-Bug-Description:
-
-The signal handling changes to bash and readline (to avoid running any code
-in a signal handler context) cause the cursor to be placed on the wrong
-line of a multi-line command after a ^C interrupts editing.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3-patched/display.c	2013-12-27 13:10:56.000000000 -0500
---- display.c	2014-03-27 11:52:45.000000000 -0400
-***************
-*** 2678,2682 ****
-    if (_rl_echoing_p)
-      {
-!       _rl_move_vert (_rl_vis_botlin);
-        _rl_vis_botlin = 0;
-        fflush (rl_outstream);
---- 2678,2683 ----
-    if (_rl_echoing_p)
-      {
-!       if (_rl_vis_botlin > 0)	/* minor optimization plus bug fix */
-! 	_rl_move_vert (_rl_vis_botlin);
-        _rl_vis_botlin = 0;
-        fflush (rl_outstream);
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 3
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 4
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-005
-
-Bug-Reported-by:	Juergen Daubert <[email-masked]>
-Bug-Reference-ID:	<[email-masked]>
-Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00002.html
-
-Bug-Description:
-
-There are still applications using the deprecated Function/VFunction/etc.
-typedefs in rltypedefs.h.  This patch restores the typedefs, but attempts
-to mark them as deprecated using gcc/clang attributes.  Thanks to Max Horn
-for the suggestion.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3-patched/rltypedefs.h	2011-03-26 14:53:31.000000000 -0400
---- rltypedefs.h	2014-04-10 11:30:45.000000000 -0400
-***************
-*** 27,30 ****
---- 27,49 ----
-  #endif
-  
-+ /* Old-style, attempt to mark as deprecated in some way people will notice. */
-+ 
-+ #if !defined (_FUNCTION_DEF)
-+ #  define _FUNCTION_DEF
-+ 
-+ #if defined(__GNUC__) || defined(__clang__)
-+ typedef int Function () __attribute__ ((deprecated));
-+ typedef void VFunction () __attribute__ ((deprecated));
-+ typedef char *CPFunction () __attribute__ ((deprecated));
-+ typedef char **CPPFunction () __attribute__ ((deprecated));
-+ #else
-+ typedef int Function ();
-+ typedef void VFunction ();
-+ typedef char *CPFunction ();
-+ typedef char **CPPFunction ();
-+ #endif
-+ 
-+ #endif /* _FUNCTION_DEF */
-+ 
-  /* New style. */
-  
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 4
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 5
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-006
-
-Bug-Reported-by:	<[email-masked]>
-Bug-Reference-ID:	<[email-masked]>
-Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00069.html
-
-Bug-Description:
-
-Using reverse-i-search when horizontal scrolling is enabled does not redisplay
-the entire line containing the successful search results.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3-patched/display.c	2014-04-08 18:19:36.000000000 -0400
---- display.c	2014-04-20 18:32:52.000000000 -0400
-***************
-*** 1638,1642 ****
-       the spot of first difference is before the end of the invisible chars,
-       lendiff needs to be adjusted. */
-!   if (current_line == 0 && !_rl_horizontal_scroll_mode &&
-        current_invis_chars != visible_wrap_offset)
-      {
---- 1638,1642 ----
-       the spot of first difference is before the end of the invisible chars,
-       lendiff needs to be adjusted. */
-!   if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */
-        current_invis_chars != visible_wrap_offset)
-      {
-***************
-*** 1826,1831 ****
-  		_rl_last_c_pos += bytes_to_insert;
-  
-  	      if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
-! 		goto clear_rest_of_line;
-  	    }
-  	}
---- 1826,1836 ----
-  		_rl_last_c_pos += bytes_to_insert;
-  
-+ 	      /* XXX - we only want to do this if we are at the end of the line
-+ 		 so we move there with _rl_move_cursor_relative */
-  	      if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
-! 		{
-! 		  _rl_move_cursor_relative (ne-new, new);
-! 		  goto clear_rest_of_line;
-! 		}
-  	    }
-  	}
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 5
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 6
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-007
-
-Bug-Reported-by:	John Lenton
-Bug-Reference-ID:
-Bug-Reference-URL:	https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1317476
-
-Bug-Description:
-
-Readline should allow SIGALRM and SIGVTALRM (if available) to `interrupt'
-rl_getc and cause the handler to run when not in a signal handling context.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3-patched/input.c	2014-01-10 15:07:08.000000000 -0500
---- input.c	2014-05-30 16:20:56.000000000 -0400
-***************
-*** 535,540 ****
---- 538,551 ----
-        else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
-  	return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
-+       /* keyboard-generated signals of interest */
-        else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT)
-          RL_CHECK_SIGNALS ();
-+       /* non-keyboard-generated signals of interest */
-+       else if (_rl_caught_signal == SIGALRM
-+ #if defined (SIGVTALRM)
-+ 		|| _rl_caught_signal == SIGVTALRM
-+ #endif
-+ 	      )
-+         RL_CHECK_SIGNALS ();
-  
-        if (rl_signal_event_hook)
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 6
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 7
-			   READLINE PATCH REPORT
-			   =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-008
-
-Bug-Reported-by:	Jared Yanovich <[email-masked]>
-Bug-Reference-ID:	<[email-masked]>
-Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00070.html
-
-Bug-Description:
-
-When the readline `revert-all-at-newline' option is set, pressing newline
-when the current line is one retrieved from history results in a double free
-and a segmentation fault.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3-patched/misc.c	2012-09-01 18:03:11.000000000 -0400
---- misc.c	2014-06-30 13:41:19.000000000 -0400
-***************
-*** 462,465 ****
---- 462,466 ----
-  	  /* Set up rl_line_buffer and other variables from history entry */
-  	  rl_replace_from_history (entry, 0);	/* entry->line is now current */
-+ 	  entry->data = 0;			/* entry->data is now current undo list */
-  	  /* Undo all changes to this history entry */
-  	  while (rl_undo_list)
-***************
-*** 469,473 ****
-  	  FREE (entry->line);
-  	  entry->line = savestring (rl_line_buffer);
-- 	  entry->data = 0;
-  	}
-        entry = previous_history ();
---- 470,473 ----
-*** ../readline-6.3/patchlevel	2013-11-15 08:11:11.000000000 -0500
---- patchlevel	2014-03-21 08:28:40.000000000 -0400
-***************
-*** 1,3 ****
-  # Do not edit -- exists only for use by patch
-  
-! 7
---- 1,3 ----
-  # Do not edit -- exists only for use by patch
-  
-! 8
-- 
2.11.1

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