commit:     e6ffdb6a7e3fb4a8c0e72b1d6b5ae7f6d3b7931a
Author:     Yegor Timoshenko <yegortimoshenko <AT> gmail <DOT> com>
AuthorDate: Sat May 20 23:59:42 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jun 12 21:27:42 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6ffdb6a

dev-libs/libedit: bump to 20170329.3.1, #529422

Closes: https://github.com/gentoo/gentoo/pull/4692

 dev-libs/libedit/Manifest                          |   1 +
 .../libedit-20170329.3.1-el_fn_sh_complete.patch   | 249 +++++++++++++++++++++
 .../libedit-20170329.3.1-ncursesprivate.patch      |  10 +
 dev-libs/libedit/libedit-20170329.3.1.ebuild       |  48 ++++
 4 files changed, 308 insertions(+)

diff --git a/dev-libs/libedit/Manifest b/dev-libs/libedit/Manifest
index da608d81c7b..63a5e608754 100644
--- a/dev-libs/libedit/Manifest
+++ b/dev-libs/libedit/Manifest
@@ -1 +1,2 @@
 DIST libedit-20130712-3.1.tar.gz 483857 SHA256 
5d9b1a9dd66f1fe28bbd98e4d8ed1a22d8da0d08d902407dcc4a0702c8d88a37 SHA512 
9fb3173a65ea2cd2ffa9af0666aa3e227b7d6be26f3e84f30ea3449b0c80fc5e91b618e939f7047bf885b96689ede93733f7eba614d4fdd1a4baff3f130b432e
 WHIRLPOOL 
550553af1cf3bbd863ef4ce86ef5fd7adf257a7f5946ad186a104c5920d0f58216c135d496d52fd2d6ad51a1fb954bb87719d731aa0eebf6980d1c15345d6034
+DIST libedit-20170329-3.1.tar.gz 508504 SHA256 
91f2d90fbd2a048ff6dad7131d9a39e690fd8a8fd982a353f1333dd4017dd4be SHA512 
597ed2282240be6dc3c4a7bb8b4ade31fe16ebfeb2229e3aec58643a65882653cc91deb300343d1b1cc588959dbf95698122c4005e47dfb947efa3e6b134bb82
 WHIRLPOOL 
ae0cc1e6e514bee7cda1a13ccd0c7f7673d4de775a9fe26ee9c32f08d43f3866ba8d9d3f4871ea15d517635be375d5989bbf36e59f00884ece517777c94c3273

diff --git 
a/dev-libs/libedit/files/libedit-20170329.3.1-el_fn_sh_complete.patch 
b/dev-libs/libedit/files/libedit-20170329.3.1-el_fn_sh_complete.patch
new file mode 100644
index 00000000000..c54f27600e3
--- /dev/null
+++ b/dev-libs/libedit/files/libedit-20170329.3.1-el_fn_sh_complete.patch
@@ -0,0 +1,249 @@
+--- libedit-20170329-3.1/src/filecomplete.c    2017-03-29 21:15:04.000000000 
+0300
++++ libedit-20170329-3.1/src/filecomplete.c    2017-05-21 02:23:16.000000000 
+0300
+@@ -51,6 +51,7 @@
+ #include "filecomplete.h"
+ 
+ static const wchar_t break_chars[] = L" \t\n\"\\'`@$><=;|&{(";
++static const wchar_t extra_quote_chars[] = L")}*?[$\0";
+ 
+ /********************************/
+ /* completion functions */
+@@ -405,10 +406,14 @@
+       char **(*attempted_completion_function)(const char *, int, int),
+       const wchar_t *word_break, const wchar_t *special_prefixes,
+       const char *(*app_func)(const char *), size_t query_items,
+-      int *completion_type, int *over, int *point, int *end)
++      int *completion_type, int *over, int *point, int *end,
++      const char *(*find_word_start_func)(const char *, const char *),
++      char *(*dequoting_func)(const char *),
++      char *(*quoting_func)(const char *))
+ {
+       const LineInfoW *li;
+       wchar_t *temp;
++      char *dequoted_temp;
+         char **matches;
+       const wchar_t *ctemp;
+       size_t len;
+@@ -429,17 +434,28 @@
+ 
+       /* We now look backwards for the start of a filename/variable word */
+       li = el_wline(el);
++      if (find_word_start_func)
++              ctemp = 
ct_decode_string(find_word_start_func(ct_encode_string(li->buffer,&el->el_scratch),
 ct_encode_string(li->cursor,&el->el_scratch)),&el->el_scratch);
++      else {  
+       ctemp = li->cursor;
+       while (ctemp > li->buffer
+           && !wcschr(word_break, ctemp[-1])
+           && (!special_prefixes || !wcschr(special_prefixes, ctemp[-1]) ) )
+               ctemp--;
++      }
+ 
+       len = (size_t)(li->cursor - ctemp);
+       temp = el_malloc((len + 1) * sizeof(*temp));
+       (void)wcsncpy(temp, ctemp, len);
+       temp[len] = '\0';
+ 
++      if (dequoting_func) {
++              dequoted_temp = 
dequoting_func(ct_encode_string(temp,&el->el_scratch));
++              if (dequoted_temp == NULL)
++                      return retval;
++      } else
++              dequoted_temp = NULL;
++      
+       /* these can be used by function called in completion_matches() */
+       /* or (*attempted_completion_function)() */
+       if (point != NULL)
+@@ -450,14 +466,14 @@
+       if (attempted_completion_function) {
+               int cur_off = (int)(li->cursor - li->buffer);
+               matches = (*attempted_completion_function)(
+-                  ct_encode_string(temp, &el->el_scratch),
++                  dequoted_temp? dequoted_temp : ct_encode_string(temp, 
&el->el_scratch),
+                   cur_off - (int)len, cur_off);
+       } else
+               matches = NULL;
+       if (!attempted_completion_function ||
+           (over != NULL && !*over && !matches))
+               matches = completion_matches(
+-                  ct_encode_string(temp, &el->el_scratch), complet_func);
++                  dequoted_temp? dequoted_temp : ct_encode_string(temp, 
&el->el_scratch), complet_func);
+ 
+       if (over != NULL)
+               *over = 0;
+@@ -472,9 +488,18 @@
+                * possible matches if there is possible completion.
+                */
+               if (matches[0][0] != '\0') {
++                      char *quoted_match;
++                      if (quoting_func) {
++                              quoted_match = quoting_func(matches[0]);
++                              if (quoted_match == NULL)
++                                      goto free_matches;
++                      } else
++                              quoted_match = NULL;
++                
+                       el_deletestr(el, (int) len);
+                       el_winsertstr(el,
+-                          ct_decode_string(matches[0], &el->el_scratch));
++                          ct_decode_string(quoted_match? quoted_match : 
matches[0], &el->el_scratch));
++                      free(quoted_match);
+               }
+ 
+ 
+@@ -545,12 +570,14 @@
+                       retval = CC_NORM;
+               }
+ 
++free_matches:
+               /* free elements of array and the array itself */
+               for (i = 0; matches[i]; i++)
+                       el_free(matches[i]);
+               el_free(matches);
+               matches = NULL;
+       }
++      el_free(dequoted_temp);
+       el_free(temp);
+       return retval;
+ }
+@@ -564,5 +591,102 @@
+ {
+       return (unsigned char)fn_complete(el, NULL, NULL,
+           break_chars, NULL, NULL, (size_t)100,
+-          NULL, NULL, NULL, NULL);
++          NULL, NULL, NULL, NULL,
++          NULL, NULL, NULL);
++}
++
++static const char *
++sh_find_word_start(const char *buffer, const char *cursor)
++{
++      const char *word_start = buffer;
++
++      while (buffer < cursor) {
++              if (*buffer == '\\')
++                      buffer++;
++              else if (strchr(break_chars, *buffer))
++                      word_start = buffer + 1;
++
++              buffer++;
++      }
++
++      return word_start;
++}
++
++
++static char *
++sh_quote(const char *str)
++{
++      const char *src;
++      int extra_len = 0;
++      char *quoted_str, *dst;
++
++      if (*str == '-' || *str == '+')
++              extra_len += 2;
++      for (src = str; *src != '\0'; src++)
++              if (strchr(break_chars, *src) ||
++                  strchr(extra_quote_chars, *src))
++                      extra_len++;
++
++      quoted_str = malloc(sizeof(*quoted_str) *
++          (strlen(str) + extra_len + 1));
++      if (quoted_str == NULL)
++              return NULL;
++
++      dst = quoted_str;
++      if (*str == '-' || *str == '+')
++              *dst++ = '.', *dst++ = '/';
++      for (src = str; *src != '\0'; src++) {
++              if (strchr(break_chars, *src) ||
++                  strchr(extra_quote_chars, *src))
++                      *dst++ = '\\';
++              *dst++ = *src;
++      }
++      *dst = '\0';
++
++      return quoted_str;
++}
++
++
++static char *
++sh_dequote(const char *str)
++{
++      char *dequoted_str, *dst;
++
++      /* save extra space to replace \~ with ./~ */
++      dequoted_str = malloc(sizeof(*dequoted_str) * (strlen(str) + 1 + 1));
++      if (dequoted_str == NULL)
++              return NULL;
++
++      dst = dequoted_str;
++
++      /* dequote \~ at start as ./~ */
++      if (*str == '\\' && str[1] == '~') {
++              str++;
++              *dst++ = '.';
++              *dst++ = '/';
++      }
++
++      while (*str) {
++              if (*str == '\\')
++                      str++;
++              if (*str)
++                      *dst++ = *str++;
++      }
++      *dst = '\0';
++
++      return dequoted_str;
++}
++
++
++/*
++ * completion function using sh quoting rules; for key binding
++ */
++/* ARGSUSED */
++unsigned char
++_el_fn_sh_complete(EditLine *el, int ch __attribute__((__unused__)))
++{
++      return (unsigned char)fn_complete(el, NULL, NULL,
++          break_chars, NULL, NULL, 100,
++          NULL, NULL, NULL, NULL,
++          sh_find_word_start, sh_dequote, sh_quote);
+ }
+
+--- libedit-20170329-3.1/src/readline.c        2017-03-29 21:15:04.000000000 
+0300
++++ libedit-20170329-3.1/src/readline.c        2017-05-21 02:24:57.000000000 
+0300
+@@ -1869,7 +1869,7 @@
+           _rl_completion_append_character_function,
+           (size_t)rl_completion_query_items,
+           &rl_completion_type, &rl_attempted_completion_over,
+-          &rl_point, &rl_end);
++          &rl_point, &rl_end, NULL, NULL, NULL);
+ 
+ 
+ }
+
+--- libedit-20170329-3.1/src/histedit.h        2017-03-29 21:08:21.000000000 
+0300
++++ libedit-20170329-3.1/src/histedit.h        2017-05-21 02:32:04.000000000 
+0300
+@@ -113,6 +113,7 @@
+ int            el_set(EditLine *, int, ...);
+ int            el_get(EditLine *, int, ...);
+ unsigned char _el_fn_complete(EditLine *, int);
++unsigned char _el_fn_sh_complete(EditLine *, int);  
+ 
+ /*
+  * el_set/el_get parameters
+
+--- libedit-20170329-3.1/src/filecomplete.h    2017-03-29 21:08:21.000000000 
+0300
++++ libedit-20170329-3.1/src/filecomplete.h    2017-05-21 02:32:27.000000000 
+0300
+@@ -35,7 +35,10 @@
+     char *(*)(const char *, int),
+     char **(*)(const char *, int, int),
+     const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t,
+-    int *, int *, int *, int *);
++    int *, int *, int *, int *,
++    const char *(*)(const char *, const char *),
++    char *(*)(const char *),
++    char *(*)(const char *));
+ 
+ void fn_display_match_list(EditLine *, char **, size_t, size_t);
+ char *fn_tilde_expand(const char *);

diff --git a/dev-libs/libedit/files/libedit-20170329.3.1-ncursesprivate.patch 
b/dev-libs/libedit/files/libedit-20170329.3.1-ncursesprivate.patch
new file mode 100644
index 00000000000..1d5432fac0b
--- /dev/null
+++ b/dev-libs/libedit/files/libedit-20170329.3.1-ncursesprivate.patch
@@ -0,0 +1,10 @@
+--- libedit-20170329-3.1/libedit.pc.in 2017-03-29 21:08:21.000000000 +0300
++++ libedit-20170329-3.1/libedit.pc.in 2017-05-21 01:28:55.000000000 +0300
+@@ -7,5 +7,6 @@
+ Description: command line editor library provides generic line editing, 
history, and tokenization functions.
+ Version: @VERSION@
+ Requires:
+-Libs: -L${libdir} -ledit @LIBS@
++Libs: -L${libdir} -ledit
++Libs.private: @LIBS@
+ Cflags: -I${includedir} -I${includedir}/editline

diff --git a/dev-libs/libedit/libedit-20170329.3.1.ebuild 
b/dev-libs/libedit/libedit-20170329.3.1.ebuild
new file mode 100644
index 00000000000..d2cdeab27df
--- /dev/null
+++ b/dev-libs/libedit/libedit-20170329.3.1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+inherit multilib-minimal toolchain-funcs
+
+MY_PV=${PV/./-}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="BSD replacement for libreadline"
+HOMEPAGE="http://thrysoee.dk/editline/";
+SRC_URI="http://thrysoee.dk/editline/${MY_P}.tar.gz";
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux 
~ppc-macos ~x64-macos ~x86-macos"
+IUSE="static-libs"
+
+DEPEND=">=sys-libs/ncurses-5.9-r3[static-libs?,${MULTILIB_USEDEP}]
+       !<=sys-freebsd/freebsd-lib-6.2_rc1"
+
+RDEPEND=${DEPEND}
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+       "${FILESDIR}/${P}-ncursesprivate.patch"
+       "${FILESDIR}/${P}-el_fn_sh_complete.patch"
+)
+
+multilib_src_configure() {
+       ECONF_SOURCE="${S}" econf \
+               $(use_enable static-libs static) \
+               --enable-widec \
+               --enable-fast-install
+}
+
+multilib_src_install() {
+       emake DESTDIR="${D}" install
+       gen_usr_ldscript -a edit
+}
+
+multilib_src_install_all() {
+       einstalldocs
+       find "${D}" -name '*.la' -delete || die
+       # file collission with sys-libs/readline
+       rm "${ED%/}/usr/share/man/man3/history.3" || die
+}

Reply via email to