Hello community,

here is the log from the commit of package lftp for openSUSE:Factory checked in 
at 2018-03-19 23:38:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lftp (Old)
 and      /work/SRC/openSUSE:Factory/.lftp.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lftp"

Mon Mar 19 23:38:06 2018 rev:71 rq:587941 version:4.8.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/lftp/lftp.changes        2018-02-28 
20:03:03.555253065 +0100
+++ /work/SRC/openSUSE:Factory/.lftp.new/lftp.changes   2018-03-19 
23:38:08.433867732 +0100
@@ -1,0 +2,13 @@
+Fri Mar 16 13:12:01 UTC 2018 - [email protected]
+
+- Added openSUSE-specific patches that implement a wrapper script
+  called "ftp" on top of the lftp command that is compatible to
+  lukemftp. Those patches are maintained in a fork of the upstream
+  project at https://github.com/opensuse/lftp. [bsc#1083331]
+  * 0001-Add-content-of-the-SUSE-lftp-vi-1.1-archive.patch
+  * 0002-Add-content-of-lftp-compat-addfiles.patch.patch
+  * 0003-Add-content-of-lftp-completion.patch.patch
+  * 0004-Include-config.h-to-detect-gnulib-macros.patch
+  * 0005-Add-the-wrapper-code-to-the-Makefile-in-order-to-bui.patch
+
+-------------------------------------------------------------------

New:
----
  0001-Add-content-of-the-SUSE-lftp-vi-1.1-archive.patch
  0002-Add-content-of-lftp-compat-addfiles.patch.patch
  0003-Add-content-of-lftp-completion.patch.patch
  0004-Include-config.h-to-detect-gnulib-macros.patch
  0005-Add-the-wrapper-code-to-the-Makefile-in-order-to-bui.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lftp.spec ++++++
--- /var/tmp/diff_new_pack.dTAkER/_old  2018-03-19 23:38:09.201840028 +0100
+++ /var/tmp/diff_new_pack.dTAkER/_new  2018-03-19 23:38:09.205839884 +0100
@@ -23,15 +23,24 @@
 Summary:        Command Line File Transfer Program
 License:        GPL-3.0+
 Group:          Productivity/Networking/Ftp/Clients
-Url:            http://lftp.yar.ru/
+URL:            http://lftp.yar.ru/
 Source:         http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
 Source2:        
http://lav.yar.ru/[email protected]#/%name.keyring
 Source3:        http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz.asc
 # PATCH-FEATURE-OPENSUSE lftp-ssl-cipher.patch [email protected] -- use stronger 
cipher [bnc#857148]
 Patch0:         lftp-default-ssl-cipher.patch
-# PATCH-FIX-UPSTREAM fix-for-upstream-sources.patch bsc#1079168
+# PATCH-FIX-UPSTREAM fix-for-upstream-sources.patch [email protected] -- lftp 
hangs if uploading a 0 byte file [bsc#1079168]
 Patch1:         
https://github.com/lavv17/lftp/commit/b934dbba0cb3.patch#/fix-zero-byte-file-upload-via-ssl.patch
+# PATCH-FEATURE-OPENSUSE patch2-patch6 [email protected] -- maintained at 
https://github.com/opensuse/lftp [bsc#1083331]
+Patch2:         0001-Add-content-of-the-SUSE-lftp-vi-1.1-archive.patch
+Patch3:         0002-Add-content-of-lftp-compat-addfiles.patch.patch
+Patch4:         0003-Add-content-of-lftp-completion.patch.patch
+Patch5:         0004-Include-config.h-to-detect-gnulib-macros.patch
+Patch6:         0005-Add-the-wrapper-code-to-the-Makefile-in-order-to-bui.patch
+BuildRequires:  autoconf
+BuildRequires:  automake
 BuildRequires:  gcc-c++
+BuildRequires:  gettext-tools
 BuildRequires:  libstdc++-devel
 BuildRequires:  libtool
 BuildRequires:  make
@@ -39,11 +48,15 @@
 BuildRequires:  openssl-devel
 BuildRequires:  pkgconfig
 BuildRequires:  readline-devel
+BuildRequires:  update-alternatives
 BuildRequires:  update-desktop-files
 BuildRequires:  pkgconfig(expat)
 BuildRequires:  pkgconfig(libidn2)
 BuildRequires:  pkgconfig(zlib)
 Requires:       less
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
+Conflicts:      ftp
 
 %description
 LFTP is a reliable shell-like command line FTP client. It can retry
@@ -65,6 +78,10 @@
 %autopatch -p1
 
 %build
+# It's necessary to update the Autotools build system, because of patches 2-6
+# that we apply above.
+gettextize --force --copy --no-changelog
+autoreconf --install --force
 %configure \
    --disable-silent-rules \
    --without-included-regex \
@@ -83,27 +100,42 @@
 
 %install
 %make_install
-%suse_update_desktop_file %{name} -G "FTP client" Network FileTransfer
-
-# We don't package the .la files
 find %{buildroot} -type f -name "*.la" -delete -print
-
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
+ln -sf %{_sysconfdir}/alternatives/ftp %{buildroot}%{_bindir}/ftp
+ln -sf %{_sysconfdir}/alternatives/ftp.1.gz 
%{buildroot}%{_mandir}/man1/ftp.1.gz
+%suse_update_desktop_file %{name} -G "FTP client" Network FileTransfer
 %find_lang %{name}
 
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
+%post
+/sbin/ldconfig
+update-alternatives --install %{_bindir}/ftp ftp %{_bindir}/%{name}_wrapper 5 \
+  --slave %{_mandir}/man1/ftp.1.gz ftp.1 %{_mandir}/man1/%{name}.1.gz
+
+%postun
+/sbin/ldconfig
+if [ "$1" = 0 ] ; then
+  update-alternatives --remove ftp %{_bindir}/%{name}_wrapper
+fi
 
 %files -f "lftp.lang"
 %doc BUGS COPYING ChangeLog FAQ FEATURES README* NEWS THANKS TODO
+%ghost %{_sysconfdir}/alternatives/ftp
+%ghost %{_sysconfdir}/alternatives/ftp.1.gz
+%{_bindir}/ftp
+%{_mandir}/man1/ftp.1%{ext_man}
 %config %{_sysconfdir}/lftp.conf
 %{_bindir}/lftp
+%{_bindir}/lftp_wrapper
 %{_bindir}/lftpget
 %{_datadir}/lftp
 %dir %{_libdir}/lftp
 %dir %{_libdir}/lftp/%{version}
+%{_libdir}/lftp/%{version}/compat-mode.so
 %{_libdir}/lftp/%{version}/cmd-mirror.so
 %{_libdir}/lftp/%{version}/cmd-sleep.so
 %{_libdir}/lftp/%{version}/cmd-torrent.so
+%{_libdir}/lftp/%{version}/cmd-edit.so
 %{_libdir}/lftp/%{version}/liblftp-network.so
 %{_libdir}/lftp/%{version}/liblftp-pty.so
 %{_libdir}/lftp/%{version}/proto-file.so

++++++ 0001-Add-content-of-the-SUSE-lftp-vi-1.1-archive.patch ++++++
>From c12b66f8f09070758419cd2ef1f23c47cf0587f3 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <[email protected]>
Date: Wed, 28 Feb 2018 19:06:37 +0100
Subject: [PATCH 1/5] Add content of the SUSE lftp-vi-1.1 archive

---
 src/cmd-edit.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 src/cmd-edit.cc

diff --git a/src/cmd-edit.cc b/src/cmd-edit.cc
new file mode 100644
index 00000000..93230905
--- /dev/null
+++ b/src/cmd-edit.cc
@@ -0,0 +1,45 @@
+#include <config.h>
+#include "CmdExec.h"
+
+const char *extractFilename(const char *path) {
+       // Calculate memory address
+       char *pnt = (char*)path + (strlen(path) * sizeof(char));
+
+       // Go from back to beginning and check for (back)slashes
+       for (pnt--; pnt > path; pnt--)
+               if (*pnt == '/' || *pnt == '\\')
+                       return ++pnt;
+
+       return pnt;
+}
+
+Job *cmd_edit(CmdExec *parent)
+{
+   if (parent->args->count() < 2) {
+          printf("Missing filename.\n");
+          return 0;
+   }
+   const char *filename = parent->args->getarg(1);
+   const char *baseFilename = extractFilename(filename);
+
+   // Allocate enough bytes for the new commandline, but without format strings
+   char *commandline = (char*)xmalloc(52 + strlen(filename));
+   sprintf(commandline, "shell \"/bin/sh -c 'exec ${EDITOR:-vi} 
/tmp/lftp.%s'\"\n", baseFilename);
+
+   char *getcommandline = (char*)xmalloc(22 + (2 * strlen(filename)));
+   sprintf(getcommandline, "get %s -o /tmp/lftp.%s\n", filename, baseFilename);
+
+   char *putcommandline = (char*)xmalloc(22 + (2 * strlen(filename)));
+   sprintf(putcommandline, "put /tmp/lftp.%s -o %s\n", baseFilename, filename);
+
+   parent->FeedCmd(getcommandline);
+   parent->FeedCmd(commandline);
+   parent->FeedCmd(putcommandline);
+
+   return 0;
+}
+
+CDECL void module_init(int argc, const char * const *argv) 
+{
+   CmdExec::RegisterCommand("edit", cmd_edit, "edit <filename>", "Edit the 
file in your EDITOR\n");
+}
-- 
2.16.2

++++++ 0002-Add-content-of-lftp-compat-addfiles.patch.patch ++++++
++++ 1478 lines (skipped)

++++++ 0003-Add-content-of-lftp-completion.patch.patch ++++++
>From 7a4ab7ac5fb9a044fae9da0e3bdda1bfe0ecf6af Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <[email protected]>
Date: Wed, 28 Feb 2018 19:09:14 +0100
Subject: [PATCH 3/5] Add content of lftp-completion.patch

---
 src/complete.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/complete.cc b/src/complete.cc
index 02e3ce6c..cfeaef28 100644
--- a/src/complete.cc
+++ b/src/complete.cc
@@ -480,6 +480,9 @@ static completion_type cmd_completion_type(const char 
*cmd,int start)
       w=skip_word(w);
    }
 
+   if (!strcmp(buf, "edit"))
+          return REMOTE_FILE;
+
    if(!strcmp(buf,"get")
    || !strcmp(buf,"pget")
    || !strcmp(buf,"get1"))
-- 
2.16.2

++++++ 0004-Include-config.h-to-detect-gnulib-macros.patch ++++++
>From 8dcfb0be988646f0cc198f443d2ec0d52912d3a4 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <[email protected]>
Date: Wed, 28 Feb 2018 19:09:55 +0100
Subject: [PATCH 4/5] Include config.h to detect gnulib macros

---
 src/lftp-wrapper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lftp-wrapper.c b/src/lftp-wrapper.c
index f6bbfdfc..8d0d848b 100644
--- a/src/lftp-wrapper.c
+++ b/src/lftp-wrapper.c
@@ -19,6 +19,7 @@
  *                                                                         *
  ***************************************************************************/
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
-- 
2.16.2

++++++ 0005-Add-the-wrapper-code-to-the-Makefile-in-order-to-bui.patch ++++++
>From 6abce26def9e39e0fe3f5cd05660768d2505300b Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <[email protected]>
Date: Wed, 28 Feb 2018 19:11:37 +0100
Subject: [PATCH 5/5] Add the wrapper code to the Makefile in order to build

---
 src/CmdExec.cc  | 32 ++++++++++++++++++++++++++++++++
 src/CmdExec.h   |  3 +++
 src/CopyJob.cc  |  3 ++-
 src/Makefile.am | 12 ++++++++++--
 4 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/src/CmdExec.cc b/src/CmdExec.cc
index 7ce11699..345120ee 100644
--- a/src/CmdExec.cc
+++ b/src/CmdExec.cc
@@ -1234,6 +1234,38 @@ void CmdExec::ChangeSession(FileAccess *new_session)
       ConnectionSlot::Set(slot,session);
 }
 
+void CmdExec::RegisterCompatCommand(const char *name,cmd_creator_t 
creator,const char *short_desc,const char *long_desc)
+{
+   if(dyn_cmd_table==0)
+   {
+      int count=0;
+      for(const cmd_rec *c=static_cmd_table; c->name; c++)
+        count++;
+      dyn_cmd_table.nset(static_cmd_table,count);
+   }
+   for(int i=0; i<dyn_cmd_table.count(); i++)
+   {
+      cmd_rec *const c=&dyn_cmd_table[i];
+      if(!strcmp(c->name,name))
+      {
+          char *lftp_name=(char*)malloc(5+strlen(name)+1);
+          char *short_d = NULL;
+
+          if (c->short_desc) {
+              short_d = (char*)malloc(5+strlen(c->short_desc)+1);
+              sprintf(short_d, "lftp-%s", c->short_desc);
+              c->short_desc = short_d;
+          }
+
+          sprintf(lftp_name, "lftp-%s", name);
+          c->name = lftp_name;
+            break;
+       }
+   }
+   cmd_rec new_entry={name,creator,short_desc,long_desc};
+   dyn_cmd_table.append(new_entry);
+}
+
 const char *CmdExec::CmdByIndex(int i)
 {
    if(dyn_cmd_table)
diff --git a/src/CmdExec.h b/src/CmdExec.h
index 58f20157..6c004294 100644
--- a/src/CmdExec.h
+++ b/src/CmdExec.h
@@ -238,6 +238,9 @@ public:
    static void RegisterCommand(const char *name,cmd_creator_t creator,
       const char *short_name=0,const char *long_name=0);
 
+   static void RegisterCompatCommand(const char *name,cmd_creator_t creator,
+      const char *short_name=0,const char *long_name=0);
+
    Job *builtin_lcd();
    Job *builtin_cd();
    Job *builtin_open();
diff --git a/src/CopyJob.cc b/src/CopyJob.cc
index f6d76361..14f68bba 100644
--- a/src/CopyJob.cc
+++ b/src/CopyJob.cc
@@ -18,6 +18,7 @@
  */
 
 #include <config.h>
+#include <unistd.h>
 #include "CopyJob.h"
 #include "ArgV.h"
 #include "plural.h"
@@ -270,7 +271,7 @@ void CopyJobEnv::SetCopier(FileCopy *c,const char *n)
 
 xstring& CopyJobEnv::FormatFinalWithPrefix(xstring& s,const char *p)
 {
-   if(no_status)
+   if(no_status || !isatty(1))
       return s;
    if(count==errors)
       return s;
diff --git a/src/Makefile.am b/src/Makefile.am
index 3ed14a05..9054b969 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
 pkgverlibdir = $(pkglibdir)/$(VERSION)
 
-bin_PROGRAMS = lftp
+bin_PROGRAMS = lftp lftp_wrapper
 bin_SCRIPTS = lftpget
 pkgdata_SCRIPTS = import-ncftp import-netscape verify-file 
convert-mozilla-cookies xdg-move
 noinst_SCRIPTS = ftpget
@@ -8,9 +8,10 @@ noinst_SCRIPTS = ftpget
 EXTRA_DIST = $(pkgdata_SCRIPTS) $(bin_SCRIPTS) $(noinst_SCRIPTS)
 
 lftp_SOURCES = lftp.cc complete.h complete.cc lftp_rl.c lftp_rl.h attach.cc 
attach.h
+lftp_wrapper_SOURCES = lftp-wrapper.c
 
 TASK_MODULES = liblftp-pty.la liblftp-network.la proto-ftp.la proto-http.la 
proto-file.la proto-fish.la proto-sftp.la
-JOB_MODULES = cmd-mirror.la cmd-sleep.la cmd-torrent.la
+JOB_MODULES = cmd-mirror.la cmd-sleep.la cmd-torrent.la cmd-edit.la 
compat-mode.la
 if WITH_MODULES
   pkgverlib_LTLIBRARIES = $(TASK_MODULES) $(JOB_MODULES)
 else
@@ -30,6 +31,8 @@ cmd_mirror_la_SOURCES = MirrorJob.cc MirrorJob.h
 cmd_sleep_la_SOURCES  = SleepJob.cc SleepJob.h
 cmd_torrent_la_SOURCES= Torrent.cc Torrent.h TorrentTracker.cc 
TorrentTracker.h\
  DHT.cc DHT.h Bencode.cc Bencode.h
+cmd_edit_la_SOURCES   = cmd-edit.cc
+compat_mode_la_SOURCES= CompatMode.cc CompatMode.h
 liblftp_pty_la_SOURCES     = PtyShell.cc PtyShell.h lftp_pty.c lftp_pty.h 
SSH_Access.cc SSH_Access.h
 liblftp_network_la_SOURCES = NetAccess.cc NetAccess.h Resolver.cc Resolver.h\
  lftp_ssl.cc lftp_ssl.h buffer_ssl.cc buffer_ssl.h RateLimit.cc RateLimit.h\
@@ -49,6 +52,8 @@ proto_sftp_la_LDFLAGS = -module -avoid-version -rpath 
$(pkgverlibdir)
 cmd_mirror_la_LDFLAGS = -module -avoid-version -rpath $(pkgverlibdir)
 cmd_sleep_la_LDFLAGS  = -module -avoid-version -rpath $(pkgverlibdir)
 cmd_torrent_la_LDFLAGS= -module -avoid-version -rpath $(pkgverlibdir)
+cmd_edit_la_LDFLAGS  = -module -avoid-version -rpath $(pkgverlibdir)
+compat_mode_la_LDFLAGS  = -module -avoid-version -rpath $(pkgverlibdir)
 liblftp_pty_la_LDFLAGS     = -avoid-version -rpath $(pkgverlibdir)
 liblftp_network_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENSSL_CPPFLAGS) 
$(ZLIB_CPPFLAGS) $(LIBGNUTLS_CFLAGS)
 liblftp_network_la_LDFLAGS = -avoid-version -rpath $(pkgverlibdir)
@@ -98,6 +103,9 @@ lftp_LDFLAGS = -export-dynamic
 lftp_LDADD = liblftp-jobs.la liblftp-tasks.la $(READLINE_LDFLAGS) 
$(READLINE_LIBS)
 lftp_DEPENDENCIES = liblftp-jobs.la
 
+lftp_wrapper_LDADD = $(GNULIB)
+lftp_wrapper_DEPENDENCIES =
+
 CLEANFILES = *.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/trio
-- 
2.16.2




Reply via email to