[gentoo-commits] repo/gentoo:master commit in: net-p2p/mldonkey/, net-p2p/mldonkey/files/

2021-07-15 Thread Sam James
commit: 207859482e3cca4d24bbb1d96e7a0f3511725d38
Author: Jesus P Rey (Chuso)  chuso  net>
AuthorDate: Thu Jul 15 18:56:30 2021 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jul 16 01:33:18 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20785948

net-p2p/mldonkey: Patch for C++17 support.

Signed-off-by: Jesus P Rey  chuso.net>
Closes: https://bugs.gentoo.org/790134
Closes: https://github.com/gentoo/gentoo/pull/21663
Signed-off-by: Sam James  gentoo.org>

 net-p2p/mldonkey/files/cpp17-byte-namespace.patch | 63 +++
 net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild |  2 +
 2 files changed, 65 insertions(+)

diff --git a/net-p2p/mldonkey/files/cpp17-byte-namespace.patch 
b/net-p2p/mldonkey/files/cpp17-byte-namespace.patch
new file mode 100644
index 000..0b1ca44e8ee
--- /dev/null
+++ b/net-p2p/mldonkey/files/cpp17-byte-namespace.patch
@@ -0,0 +1,63 @@
+diff -ur a/src/utils/lib/CryptoPP.cc b/src/utils/lib/CryptoPP.cc
+--- a/src/utils/lib/CryptoPP.cc2021-07-06 22:20:46.675183781 +0200
 b/src/utils/lib/CryptoPP.cc2021-07-06 22:20:51.025182789 +0200
+@@ -9482,7 +9482,7 @@
+ #define PRIVKEYSIZE 384
+ 
+ static Signer* s_signer = NULL;   
+-static byte m_publicKey[MAXPUBKEYSIZE+1];
++static CryptoPP::byte m_publicKey[MAXPUBKEYSIZE+1];
+ static unsigned long m_publicKeyLen = 0;
+ 
+ void cc_lprintf_nl(const char * msg, bool verb);
+@@ -9555,7 +9555,7 @@
+ 
+ 
+ // return signatureSize (buf)
+-int createSignature(byte *buf, int maxLen, byte *key, int keyLen, uint32_t 
cInt, uint8_t ipType, uint32_t ip) {
++int createSignature(CryptoPP::byte *buf, int maxLen, CryptoPP::byte *key, int 
keyLen, uint32_t cInt, uint8_t ipType, uint32_t ip) {
+ 
+   int result = 0;
+ 
+@@ -9570,7 +9570,7 @@
+   CryptoPP::SecByteBlock sBB(s_signer->SignatureLength());
+   CryptoPP::AutoSeededRandomPool rng;
+   
+-  byte bArray[MAXPUBKEYSIZE+9];
++  CryptoPP::byte bArray[MAXPUBKEYSIZE+9];
+ 
+   memcpy(bArray,key,keyLen);
+   PokeUInt32(bArray+keyLen,cInt);   
+@@ -9597,7 +9597,7 @@
+ 
+ }
+ 
+-int verifySignature(byte *key, int keyLen, byte *sig, int sigLen, uint32_t 
cInt, uint8_t ipType, uint32_t ip) {
++int verifySignature(CryptoPP::byte *key, int keyLen, CryptoPP::byte *sig, int 
sigLen, uint32_t cInt, uint8_t ipType, uint32_t ip) {
+   using namespace CryptoPP;
+ 
+   bool result = false;
+@@ -9607,7 +9607,7 @@
+   StringSource ss_Pubkey(key, keyLen,true,0);
+   Verifier pubKey(ss_Pubkey);
+ 
+-  byte bArray[MAXPUBKEYSIZE+9];
++  CryptoPP::byte bArray[MAXPUBKEYSIZE+9];
+   
+   memcpy(bArray,m_publicKey,m_publicKeyLen);
+   PokeUInt32(bArray+m_publicKeyLen,cInt); 
+diff -ur a/src/utils/lib/CryptoPP.h b/src/utils/lib/CryptoPP.h
+--- a/src/utils/lib/CryptoPP.h 2021-07-06 22:20:46.675183781 +0200
 b/src/utils/lib/CryptoPP.h 2021-07-06 22:20:56.271848200 +0200
+@@ -181,10 +181,9 @@
+ # define __USE_W32_SOCKETS
+ #endif
+ 
+-typedef unsigned char byte;   // put in global namespace to avoid 
ambiguity with other byte typedefs
+-
+ NAMESPACE_BEGIN(CryptoPP)
+ 
++typedef unsigned char byte;   // put in global namespace to avoid 
ambiguity with other byte typedefs
+ typedef unsigned short word16;
+ typedef unsigned int word32;
+ 

diff --git a/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild 
b/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild
index 8557ea1a285..c1bb19df5b6 100644
--- a/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild
+++ b/net-p2p/mldonkey/mldonkey-3.1.7-r2.ebuild
@@ -51,6 +51,8 @@ DEPEND="${COMMON_DEPEND}
 
 RESTRICT="!ocamlopt? ( strip )"
 
+PATCHES=( "${FILESDIR}/cpp17-byte-namespace.patch" )
+
 S="${WORKDIR}/${P}-2"
 
 pkg_setup() {



[gentoo-commits] repo/gentoo:master commit in: net-p2p/mldonkey/, net-p2p/mldonkey/files/

2021-02-18 Thread Joonas Niilola
commit: 30cf999cd2ab9c4d29751305c986d4e692721d2c
Author: Jesus P Rey (Chuso)  chuso  net>
AuthorDate: Sat Jan 30 19:18:29 2021 +
Commit: Joonas Niilola  gentoo  org>
CommitDate: Thu Feb 18 08:24:51 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30cf999c

net-p2p/mldonkey: revision bump to 3.1.7-r1

Adds support to send init.d commands via telnet in addition to http.

Signed-off-by: Jesus P Rey  chuso.net>
Closes: https://bugs.gentoo.org/338017
Signed-off-by: Joonas Niilola  gentoo.org>

 .../files/{mldonkey.confd-2.8 => mldonkey.confd}   |  3 +
 net-p2p/mldonkey/files/mldonkey.initd  | 70 ++
 ...onkey-3.1.7.ebuild => mldonkey-3.1.7-r1.ebuild} |  3 +-
 3 files changed, 50 insertions(+), 26 deletions(-)

diff --git a/net-p2p/mldonkey/files/mldonkey.confd-2.8 
b/net-p2p/mldonkey/files/mldonkey.confd
similarity index 93%
rename from net-p2p/mldonkey/files/mldonkey.confd-2.8
rename to net-p2p/mldonkey/files/mldonkey.confd
index 1d1f282234f..7cdb2b7134e 100644
--- a/net-p2p/mldonkey/files/mldonkey.confd-2.8
+++ b/net-p2p/mldonkey/files/mldonkey.confd
@@ -33,6 +33,9 @@ SERVER="localhost"
 # port for webinterface, usually 4080
 PORT="4080"
 
+# port for telnet interface, usually 4000
+TELNET_PORT="4000"
+
 # to enable password restricted access,
 # uncomment and set BOTH following vars:
 #USERNAME="admin"

diff --git a/net-p2p/mldonkey/files/mldonkey.initd 
b/net-p2p/mldonkey/files/mldonkey.initd
index 12dd599de7b..b7e56137239 100644
--- a/net-p2p/mldonkey/files/mldonkey.initd
+++ b/net-p2p/mldonkey/files/mldonkey.initd
@@ -35,26 +35,55 @@ start() {
eend $?
 }
 
-setup_uri() {
-   BASE="http://;
+send_telnet_commands() {
+   if [ -z "${TELNET_PORT+x}" ]; then
+   return 1
+   fi
+   local cmds=
if [ -n "${USERNAME}" -a -n "${PASSWORD}" ]; then
-   BASE="${BASE}${USERNAME}:${PASSWORD}@"
+   cmds="auth ${USERNAME} ${PASSWORD}\n"
fi
-   BASE="${BASE}${SERVER}:${PORT}"
+   cmds="$cmds\nansi false\n"
+   while [ $# -gt 0 ]; do
+   cmds="$cmds$1\n"
+   shift
+   done
+   printf "$cmds\nexit\n" | nc -w "${MLDONKEY_TIMEOUT}" localhost 
"${TELNET_PORT}" 2> /dev/null
+   return $?
+}
+
+send_http_commands() {
+   if [ -z "${PORT+x}" ]; then
+   return 1
+   fi
+   local base="http://;
+   if [ -n "${USERNAME}" -a -n "${PASSWORD}" ]; then
+   base="${base}${USERNAME}:${PASSWORD}@"
+   fi
+   base="${base}${SERVER}:${PORT}"
+   local retval=0
+   while [ $retval -eq 0 -a $# -gt 0 ]; do
+   wget -q -O /dev/stdout --timeout="${MLDONKEY_TIMEOUT}" 
"${base}/submit?q=${1// /+}" 2> /dev/null
+   retval=$?
+   shift
+   done
+   return $retval
+}
+
+send_commands() {
+   send_telnet_commands "$@" &> /dev/null || send_http_commands "$@" &> 
/dev/null
+   return $?
 }
 
 stop() {
ebegin "Stopping ${SVCNAME} -- please wait"
 
-   setup_uri
-   wget --spider --timeout="${MLDONKEY_TIMEOUT}" 
"${BASE}"/submit?q=close_fds -q
-   wget --spider --timeout="${MLDONKEY_TIMEOUT}" "${BASE}"/submit?q=save -q
-   wget --spider --timeout="${MLDONKEY_TIMEOUT}" "${BASE}"/submit?q=kill -q
+   send_commands close_fds save kill
 
# give it a chance to die:
local timeout=${MLDONKEY_TIMEOUT}
while [ $timeout -gt 0 ]; do
-   if ! start-stop-daemon --test --quiet --stop \
+   if ! start-stop-daemon --test --quiet --quiet --stop \
--exec "${MLDONKEY_BINARY}" \
--pidfile /var/run/"${SVCNAME}".pid ; then
eend 0
@@ -87,32 +116,23 @@ reload() {
 
 slow() {
ebegin "Reducing bandwidth to ${LOW_DOWN}k/${LOW_UP}k"
-   setup_uri
-   wget --spider --timeout="${MLDONKEY_TIMEOUT}" \
-   "${BASE}/submit?q=set+max_hard_download_rate+${LOW_DOWN}" -q
-   wget --spider --timeout=${MLDONKEY_TIMEOUT} \
-   "${BASE}/submit?q=set+max_hard_upload_rate+${LOW_UP}" -q
+   send_commands "set max_hard_download_rate ${LOW_DOWN}" "set 
max_hard_upload_rate ${LOW_UP}"
eend $?
 }
 
 fast() {
ebegin "Increasing bandwidth to ${HIGH_DOWN}k/${HIGH_UP}k"
-
-   setup_uri
-   wget --spider --timeout="${MLDONKEY_TIMEOUT}" \
-   "${BASE}/submit?q=set+max_hard_upload_rate+${HIGH_UP}" -q
-   wget --spider --timeout="${MLDONKEY_TIMEOUT}" \
-   "${BASE}/submit?q=set+max_hard_download_rate+${HIGH_DOWN}" -q
+   send_commands "set max_hard_upload_rate ${HIGH_UP}" "set 
max_hard_download_rate ${HIGH_DOWN}"
eend $?
 }
 
 
 info() {
-   setup_uri
-   local result=$(wget --timeout="${MLDONKEY_TIMEOUT}" \
-   -O - "${BASE}"/submit?q=vo 2>/dev/null | \
-   grep -C1 max_hard_upload | \
-   grep value=\" | cut 

[gentoo-commits] repo/gentoo:master commit in: net-p2p/mldonkey/, net-p2p/mldonkey/files/

2016-05-03 Thread Alexis Ballier
commit: 1ddc06bf06bc144de45139545ff4eb6f660b443c
Author: Alexis Ballier  gentoo  org>
AuthorDate: Sun May  1 16:01:08 2016 +
Commit: Alexis Ballier  gentoo  org>
CommitDate: Tue May  3 09:13:52 2016 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ddc06bf

net-p2p/mldonkey: fix build with ocaml 4.03

Package-Manager: portage-2.2.28
Signed-off-by: Alexis Ballier  gentoo.org>

 net-p2p/mldonkey/files/ocaml-4.03.patch | 145 
 net-p2p/mldonkey/mldonkey-3.1.5.ebuild  |   1 +
 2 files changed, 146 insertions(+)

diff --git a/net-p2p/mldonkey/files/ocaml-4.03.patch 
b/net-p2p/mldonkey/files/ocaml-4.03.patch
new file mode 100644
index 000..fce94c8
--- /dev/null
+++ b/net-p2p/mldonkey/files/ocaml-4.03.patch
@@ -0,0 +1,145 @@
+Index: mldonkey-3.1.5/src/config/unix/os_stubs_c.c
+===
+--- mldonkey-3.1.5.orig/src/config/unix/os_stubs_c.c
 mldonkey-3.1.5/src/config/unix/os_stubs_c.c
+@@ -66,7 +66,7 @@ ssize_t os_read(OS_FD fd, char *buf, siz
+ 
+ void os_ftruncate(OS_FD fd, OFF_T len, /* bool */ int sparse)
+ {
+-  int64 cursize;
++  int64_t cursize;
+   if(!fd) failwith("ftruncate32: file is closed");
+   
+   cursize = os_getfdsize(fd);
+@@ -109,7 +109,7 @@ int os_getdtablesize()
+ 
+ ***/
+ 
+-int64 os_getfdsize(OS_FD fd)
++int64_t os_getfdsize(OS_FD fd)
+ {
+   struct stat buf;
+ 
+@@ -127,7 +127,7 @@ int64 os_getfdsize(OS_FD fd)
+ 
+ ***/
+ 
+-int64 os_getfilesize(char *path)
++int64_t os_getfilesize(char *path)
+ {
+   struct stat buf;
+ 
+Index: mldonkey-3.1.5/src/networks/donkey/donkeyGlobals.ml
+===
+--- mldonkey-3.1.5.orig/src/networks/donkey/donkeyGlobals.ml
 mldonkey-3.1.5/src/networks/donkey/donkeyGlobals.ml
+@@ -781,7 +781,6 @@ let set_client_name c name md4 =
+   c.client_md4 <- md4;
+ end
+ 
+-exception ClientFound of client
+ let find_client_by_name name =
+   try
+ H.iter (fun c ->
+Index: mldonkey-3.1.5/src/utils/cdk/zip.ml
+===
+--- mldonkey-3.1.5.orig/src/utils/cdk/zip.ml
 mldonkey-3.1.5/src/utils/cdk/zip.ml
+@@ -72,8 +72,6 @@ type out_file =
+ mutable of_entries: entry list;
+ of_comment: string }
+ 
+-exception Error of string * string * string
+-
+ (* Return the position of the last occurrence of s1 in s2, or -1 if not
+found. *)
+ 
+Index: mldonkey-3.1.5/src/utils/cdk/zlibstubs.c
+===
+--- mldonkey-3.1.5.orig/src/utils/cdk/zlibstubs.c
 mldonkey-3.1.5/src/utils/cdk/zlibstubs.c
+@@ -191,7 +191,7 @@ value camlzip_inflateEnd(value vzs)
+ 
+ value camlzip_update_crc32(value crc, value buf, value pos, value len)
+ {
+-  return copy_int32(crc32((uint32) Int32_val(crc), 
++  return copy_int32(crc32((uint32_t) Int32_val(crc), 
+   _u(buf, Long_val(pos)),
+   Long_val(len)));
+ }
+Index: mldonkey-3.1.5/src/utils/lib/fst_hash.c
+===
+--- mldonkey-3.1.5.orig/src/utils/lib/fst_hash.c
 mldonkey-3.1.5/src/utils/lib/fst_hash.c
+@@ -197,7 +197,7 @@ unsigned short fst_hash_checksum (unsign
+ 
/*/
+ 
+ // hash file
+-int fst_hash_file (unsigned char *fth, char *file, int64 filesize)
++int fst_hash_file (unsigned char *fth, char *file, int64_t filesize)
+ {
+   FILE *fp;
+   unsigned char *buf;
+@@ -271,7 +271,7 @@ int fst_hash_file (unsigned char *fth, c
+ }
+ 
+ 
+-void fst_hash_string (unsigned char *fth, unsigned char *file, int64 filesize)
++void fst_hash_string (unsigned char *fth, unsigned char *file, int64_t 
filesize)
+ {
+   unsigned char * buf = file;
+   size_t len = filesize;
+Index: mldonkey-3.1.5/src/utils/lib/options.ml4
+===
+--- mldonkey-3.1.5.orig/src/utils/lib/options.ml4
 mldonkey-3.1.5/src/utils/lib/options.ml4
+@@ -332,7 +332,6 @@ let exit_exn = Exit
+ 
+ 
+ let unsafe_get = String.unsafe_get
+-external is_printable : char -> bool = "caml_is_printable"
+ let unsafe_set = String.unsafe_set
+   
+ let escaped s =
+@@ -343,7 +342,7 @@ let escaped s =
+ (match unsafe_get s i with
+'"' | '\\' -> 2
+  | '\n' | '\t' -> 1
+- | c -> if is_printable c then 1 else 4)
++ | c -> 1)
+   done;
+   if !n = String.length s then s
+   else
+@@ -354,16 +353,7 @@ let escaped s =
+ '"' | '\\' as c -> unsafe_set s' !n '\\'; incr n; unsafe_set s' !n c
+   | '\n' | '\t' as c -> unsafe_set s' !n c
+   | c ->
+-  if is_printable c then unsafe_set s' !n c
+-  else
+-let a = int_of_char c