Package init

This commit is contained in:
overweight 2019-09-30 10:54:45 -04:00
commit 6e71dab024
5 changed files with 241 additions and 0 deletions

View File

@ -0,0 +1,73 @@
From e3a366a103ca699aaf57595c396ea205a50d2b16 Mon Sep 17 00:00:00 2001
From: gilcu3 <828241+gilcu3@users.noreply.github.com>
Date: Fri, 14 Sep 2018 10:19:24 -0400
Subject: [PATCH 07/23] Making remove_tags function more efficient (from
quadratic to linear time worst case)
---
src/misc.cc | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/src/misc.cc b/src/misc.cc
index db088c2..bc3fdb9 100644
--- a/src/misc.cc
+++ b/src/misc.cc
@@ -961,26 +961,37 @@ const xstring& shell_encode(const char *string,int len)
void remove_tags(char *buf)
{
int len=strlen(buf);
- for(;;)
+ int less = -1;
+ for(int i = 0; i < len;i++)
{
- char *less=strchr(buf,'<');
- char *amp=strstr(buf,"&nbsp;");
- if(!less && !amp)
- break;
- if(amp && (!less || amp<less))
- {
- amp[0]=' ';
- memmove(amp+1,amp+6,len-(amp+6-buf)+1);
- len-=amp+6-buf;
- buf=amp+1;
- continue;
+ if(strcmp(buf + i, "&nbsp;") == 0){
+ for(int j = 0; j < 6; j++)buf[i + j] = 0;
+ buf[i] = ' ';
+ i += 6;
+ i--;
+ continue;
}
- char *more=strchr(less+1,'>');
- if(!more)
- break;
- memmove(less,more+1,len-(more+1-buf)+1);
- len-=more+1-buf;
- buf=less;
+ if(buf[i] == '<'){
+ less = i;
+ continue;
+
+ }
+ if(buf[i] == '>'){
+ if(less != -1){
+ for(int j = less; j <= i; j++)buf[j] = 0;
+ less = -1;
+ }
+
+ }
+ }
+ int zero = 0;
+ for(int i = 0; i < len;i++)
+ {
+ while(zero < i && buf[zero] != 0)zero++;
+ if(buf[i] != 0 and zero != i){
+ buf[zero] = buf[i];
+ buf[i] = 0;
+ }
}
}
void rtrim(char *s)
--
1.7.12.4

View File

@ -0,0 +1,56 @@
From b70425a3af79f387295acfa5246d6d0d8ba4e49c Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Sat, 13 Oct 2018 00:10:27 +0300
Subject: [PATCH 06/23] fixed sorting of FileSet when some files begin with a
tilde (fixes #476)
reason: FileSet::Merge no longer sorts the files.
---
src/FileSet.h | 1 +
src/NetAccess.cc | 9 +++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/FileSet.h b/src/FileSet.h
index 88c9563..e686e1a 100644
--- a/src/FileSet.h
+++ b/src/FileSet.h
@@ -204,6 +204,7 @@ public:
void rewind() { ind=0; }
FileInfo *curr();
FileInfo *next();
+ FileInfo *borrow_curr() { return Borrow(ind--); }
void LocalRemove(const char *dir);
void LocalUtime(const char *dir,bool only_dirs=false,bool flat=false);
diff --git a/src/NetAccess.cc b/src/NetAccess.cc
index 62dd8ab..98a8329 100644
--- a/src/NetAccess.cc
+++ b/src/NetAccess.cc
@@ -541,19 +541,20 @@ do_again:
got_fileset:
if(set)
{
- bool need_resort=false;
set->rewind();
for(file=set->curr(); file!=0; file=set->next())
{
// tilde is special.
if(file->name[0]=='~')
{
+ // can't just update the name - it will break sorting
+ file=set->borrow_curr();
file->name.set_substr(0,0,"./");
- need_resort=true;
+ if(!result)
+ result=new FileSet();
+ result->Add(file);
}
}
- if(need_resort && !result)
- result=new FileSet; // Merge will sort the names
if(result)
{
result->Merge(set);
--
1.7.12.4

30
lftp-4.0.9-date_fmt.patch Normal file
View File

@ -0,0 +1,30 @@
diff --git a/src/Http.cc b/src/Http.cc
index 5364c94..0018670 100644
--- a/src/Http.cc
+++ b/src/Http.cc
@@ -26,6 +26,7 @@
#include <errno.h>
#include <stdarg.h>
#include <time.h>
+#include <limits.h>
#include <fnmatch.h>
#include <locale.h>
#include <assert.h>
diff --git a/src/Http.cc b/src/Http.cc
index b84a729..faf0cc5 100644
--- a/src/Http.cc
+++ b/src/Http.cc
@@ -786,9 +786,11 @@ void Http::SendRequest(const char *connection,const char *f)
(long long)((limit==FILE_END || limit>entity_size ? entity_size : limit)-1),
(long long)entity_size);
}
- if(entity_date!=NO_DATE)
+ if((entity_date!=NO_DATE) && (entity_date>0L && entity_date<INT_MAX))
{
- Send("Last-Modified: %s\r\n",FormatLastModified(entity_date).get());
+ char d[256];
+ strftime(d, sizeof(d), "%a, %d %b %H:%M:%S %Y GMT", gmtime(&entity_date));
+ Send("Last-Modified: %s\r\n",d);
Send("X-OC-MTime: %ld\r\n",(long)entity_date); // for OwnCloud
}
break;

BIN
lftp-4.8.4.tar.xz Normal file

Binary file not shown.

82
lftp.spec Normal file
View File

@ -0,0 +1,82 @@
Summary: A sophisticated file transfer program
Name: lftp
Version: 4.8.4
Release: 2
License: GPLv3+
URL: http://lftp.yar.ru/
Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
BuildRequires: ncurses-devel, gnutls-devel, perl-generators, pkgconfig, gettext
BuildRequires: gettext readline-devel, zlib-devel, gcc-c++ desktop-file-utils
Patch1: lftp-4.0.9-date_fmt.patch
Patch6000: fixed-sorting-of-FileSet-when-some-files-begin-with-.patch
Patch6001: Making-remove_tags-function-more-efficient-from-quad.patch
%description
LFTP is a sophisticated file transfer program supporting a number of
network protocols (ftp, http, sftp, fish, torrent). Like BASH, it has
job control and uses the readline library for input. It has bookmarks,
a built-in mirror command, and can transfer several files in parallel.
It was designed with reliability in mind. LFTP is free software,
distributed under the GNU GPL license.
%package scripts
Summary: Scripts for lftp
Requires: lftp >= %{version}-%{release}
BuildArch: noarch
%description scripts
Utility scripts for use with lftp.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
sed -i.norpath -e \
'/sys_lib_dlsearch_path_spec/s|/usr/lib |/usr/lib /usr/lib64 /lib64 |' \
configure
%build
%configure --with-modules --with-gnutls --without-openssl --with-debug
%make_build
%install
export tagname=CC
make DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' install
%delete_la
iconv -f ISO88591 -t UTF8 NEWS -o NEWS.tmp
touch -c -r NEWS NEWS.tmp
mv NEWS.tmp NEWS
desktop-file-install \
--dir=%{buildroot}%{_datadir}/applications \
%{buildroot}/%{_datadir}/applications/lftp.desktop
%ldconfig_scriptlets
%files
%defattr(-,root,root)
%doc COPYING
%{_datadir}/locale/*
%config(noreplace) %{_sysconfdir}/lftp.conf
%{_bindir}/*
%{_libdir}/lftp/%{version}/*.so
%{_libdir}/liblftp-*.so.*
%{_datadir}/applications/*.*
%{_datadir}/icons/hicolor/*/apps/*
%exclude %{_libdir}/*.so
%files scripts
%{_datadir}/lftp
%files help
%defattr(-,root,root)
%doc BUGS ChangeLog FAQ FEATURES NEWS THANKS TODO README*
%{_mandir}/*/*
%changelog
* Wed Aug 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.8.4-2
- Package init