[packages/rclone] up to 1.63.0

atler atler at pld-linux.org
Sat Jul 1 23:33:07 CEST 2023


commit 594aadbf944332de557c0fda4428e3832eb86199
Author: Jan Palus <atler at pld-linux.org>
Date:   Sat Jul 1 23:31:21 2023 +0200

    up to 1.63.0

 rclone.spec          |   8 +-
 webdav-modtime.patch | 305 +++++++++++++++++----------------------------------
 2 files changed, 103 insertions(+), 210 deletions(-)
---
diff --git a/rclone.spec b/rclone.spec
index 59595f5..2bc59bc 100644
--- a/rclone.spec
+++ b/rclone.spec
@@ -1,19 +1,19 @@
-%define		vendor_ver	1.62.0
+%define		vendor_ver	1.63.0
 Summary:	rsync for cloud storage
 Name:		rclone
-Version:	1.62.2
+Version:	1.63.0
 Release:	1
 License:	MIT
 Group:		Networking/Utilities
 #Source0Download: https://github.com/rclone/rclone/releases
 Source0:	https://github.com/rclone/rclone/releases/download/v%{version}/%{name}-v%{version}.tar.gz
-# Source0-md5:	56f5b97ff5f465eca072bef5d0f0166e
+# Source0-md5:	256d217761fe35ae3bfab8adbb978048
 # cd rclone-%{version}
 # go mod vendor
 # cd ..
 # tar cJf rclone-vendor-%{version}.tar.xz rclone-v%{version}/vendor
 Source1:	%{name}-vendor-%{vendor_ver}.tar.xz
-# Source1-md5:	1a8938f2f546675e41a3aaaf3c611f2b
+# Source1-md5:	b928c8d2450d8f834d5dc848e878fac2
 Patch0:		webdav-modtime.patch
 URL:		https://rclone.org/
 BuildRequires:	golang >= 1.18
diff --git a/webdav-modtime.patch b/webdav-modtime.patch
index fe715ec..98810e8 100644
--- a/webdav-modtime.patch
+++ b/webdav-modtime.patch
@@ -1,243 +1,136 @@
-From b9c0e1efdb88ac08ae6053eaeb2f3034a3416e51 Mon Sep 17 00:00:00 2001
+From ab4cc10f49ddd4532b37f18b665716ee81c5f6bf Mon Sep 17 00:00:00 2001
 From: Jan Palus <jpalus at fastmail.com>
-Date: Sat, 16 Apr 2022 23:06:53 +0200
-Subject: [PATCH 1/3] webdav: add support for spec compliant modification time
- update
+Date: Mon, 15 May 2023 19:16:22 +0200
+Subject: [PATCH 1/2] webdav: fastmail: adapt modtime update
 
-rfc4918 section 15.7 states that getlastmodified SHOULD be protected
-(read-only) but does not mandate it. implementations are free to choose
-whether it is possible to update modification time. one such
-implementation operating in the wild that allows it is FastMail WebDav
-access. since specification recommends property to be protected make it
-disabled by default.
+to make new logic work with fastmail bring spec compliant update from:
+https://github.com/rclone/rclone/pull/6108
 ---
- backend/webdav/webdav.go | 63 ++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 61 insertions(+), 2 deletions(-)
+ backend/webdav/webdav.go | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
 
 diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
-index 9564ae601..20f2b45ea 100644
+index 206b11bd1..f489a2068 100644
 --- a/backend/webdav/webdav.go
 +++ b/backend/webdav/webdav.go
-@@ -124,6 +124,11 @@ You can set multiple headers, e.g. '"Cookie","name=value","Authorization","xxx"'
- `,
- 			Default:  fs.CommaSepList{},
- 			Advanced: true,
-+		}, {
-+			Name:     "update_modtime",
-+			Help:     "Adjust modification time on servers which allow DAV:getlastmodified property update",
-+			Default:  false,
-+			Advanced: true,
- 		}},
- 	})
- }
-@@ -138,6 +143,7 @@ type Options struct {
- 	BearerTokenCommand string               `config:"bearer_token_command"`
- 	Enc                encoder.MultiEncoder `config:"encoding"`
- 	Headers            fs.CommaSepList      `config:"headers"`
-+	UpdateModTime      bool                 `config:"update_modtime"`
- }
- 
- // Fs represents a remote webdav
-@@ -405,6 +411,13 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
- 		return nil, err
- 	}
- 
-+	var precision time.Duration
-+	if opt.UpdateModTime {
-+		precision = time.Second
-+	} else {
-+		precision = fs.ModTimeNotSupported
-+	}
-+
- 	f := &Fs{
- 		name:        name,
- 		root:        root,
-@@ -412,7 +425,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
- 		endpoint:    u,
- 		endpointURL: u.String(),
- 		pacer:       fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),
--		precision:   fs.ModTimeNotSupported,
-+		precision:   precision,
- 	}
- 
- 	client := fshttp.NewClient(ctx)
-@@ -634,6 +647,16 @@ var owncloudProps = []byte(`<?xml version="1.0"?>
-  </d:prop>
- </d:propfind>
- `)
-+var modtimeUpdatePropStart = `<?xml version="1.0"?>
-+<d:propertyupdate xmlns:d="DAV:">
-+ <d:set>
-+ <d:prop>
-+ <d:getlastmodified>`
-+var modtimeUpdatePropEnd = `</d:getlastmodified>
-+ </d:prop>
-+ </d:set>
-+</d:propertyupdate>
-+`
- 
- // list the objects into the function supplied
+@@ -176,6 +176,7 @@ type Fs struct {
+ 	canStream          bool          // set if can stream
+ 	useOCMtime         bool          // set if can use X-OC-Mtime
+ 	propsetMtime       bool          // set if can use propset
++	propNameMtime      string        // name of property to set for mtime
+ 	retryWithZeroDepth bool          // some vendors (sharepoint) won't list files when Depth is 1 (our default)
+ 	checkBeforePurge   bool          // enables extra check that directory to purge really exists
+ 	hasOCMD5           bool          // set if can use owncloud style checksums for MD5
+@@ -578,18 +579,22 @@ func (f *Fs) setQuirks(ctx context.Context, vendor string) error {
+ 		f.canStream = true
+ 		f.precision = time.Second
+ 		f.useOCMtime = true
++		f.propsetMtime = true
++		f.propNameMtime = "getlastmodified"
+ 		f.hasMESHA1 = true
+ 	case "owncloud":
+ 		f.canStream = true
+ 		f.precision = time.Second
+ 		f.useOCMtime = true
+ 		f.propsetMtime = true
++		f.propNameMtime = "lastmodified"
+ 		f.hasOCMD5 = true
+ 		f.hasOCSHA1 = true
+ 	case "nextcloud":
+ 		f.precision = time.Second
+ 		f.useOCMtime = true
+ 		f.propsetMtime = true
++		f.propNameMtime = "lastmodified"
+ 		f.hasOCSHA1 = true
+ 		f.canChunk = true
+ 		if err := f.verifyChunkConfig(); err != nil {
+@@ -1305,11 +1310,11 @@ func (o *Object) ModTime(ctx context.Context) time.Time {
+ // Set modified time using propset
  //
-@@ -1251,7 +1274,37 @@ func (o *Object) ModTime(ctx context.Context) time.Time {
- 
+ // <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"><d:response><d:href>/ocm/remote.php/webdav/office/wir.jpg</d:href><d:propstat><d:prop><d:lastmodified/></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
+-var owncloudPropset = `<?xml version="1.0" encoding="utf-8" ?>
++var mtimePropset = `<?xml version="1.0" encoding="utf-8" ?>
+ <D:propertyupdate xmlns:D="DAV:">
+  <D:set>
+   <D:prop>
+-   <lastmodified xmlns="DAV:">%d</lastmodified>
++   <D:%s>%s</D:%s>
+   </D:prop>
+  </D:set>
+ </D:propertyupdate>
+@@ -1318,11 +1323,17 @@ var owncloudPropset = `<?xml version="1.0" encoding="utf-8" ?>
  // SetModTime sets the modification time of the local fs object
  func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error {
--	return fs.ErrorCantSetModTime
-+	if !o.fs.opt.UpdateModTime {
-+		return fs.ErrorCantSetModTime
-+	}
-+	opts := rest.Opts{
-+		Method: "PROPPATCH",
-+		Path:   o.filePath(),
-+	}
-+	var body bytes.Buffer
-+	body.WriteString(modtimeUpdatePropStart)
-+	body.WriteString(modTime.Format(time.RFC1123))
-+	body.WriteString(modtimeUpdatePropEnd)
-+	opts.Body = &body
-+
-+	var result api.Multistatus
-+	var resp *http.Response
-+	var err error
-+	err = o.fs.pacer.Call(func() (bool, error) {
-+		resp, err = o.fs.srv.CallXML(ctx, &opts, nil, &result)
-+		return o.fs.shouldRetry(ctx, resp, err)
-+	})
-+	if err != nil {
-+		return err
-+	}
-+	if len(result.Responses) < 1 {
-+		return fs.ErrorObjectNotFound
-+	}
-+	item := result.Responses[0]
-+	if !item.Props.StatusOK() {
-+		return fs.ErrorObjectNotFound
-+	}
-+	return nil
- }
- 
- // Storable returns a boolean showing whether this object storable
-@@ -1337,6 +1390,12 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
- 		_ = o.Remove(ctx)
- 		return err
- 	}
-+	if !o.fs.useOCMtime && o.fs.opt.UpdateModTime {
-+		err = o.SetModTime(ctx, src.ModTime(ctx))
-+		if err != nil {
-+			return fmt.Errorf("Update ModTime failed: %w", err)
+ 	if o.fs.propsetMtime {
++		var modTimeStr string
++		if o.fs.propNameMtime == "getlastmodified" {
++			modTimeStr = modTime.Format(time.RFC1123)
++		} else {
++			modTimeStr = strconv.FormatInt(modTime.Unix(), 10)
 +		}
-+	}
- 	// read metadata from remote
- 	o.hasMetaData = false
- 	return o.readMetaData(ctx)
+ 		opts := rest.Opts{
+ 			Method:     "PROPPATCH",
+ 			Path:       o.filePath(),
+ 			NoRedirect: true,
+-			Body:       strings.NewReader(fmt.Sprintf(owncloudPropset, modTime.Unix())),
++			Body:       strings.NewReader(fmt.Sprintf(mtimePropset, o.fs.propNameMtime, modTimeStr, o.fs.propNameMtime)),
+ 		}
+ 		var result api.Multistatus
+ 		var resp *http.Response
 -- 
-2.37.0
+2.41.0
 
-From 9394b57866019df139fc0ce96a7a3572fad57666 Mon Sep 17 00:00:00 2001
+From 105f65b7f3892c69d72956331b63b661b2ff2a3b Mon Sep 17 00:00:00 2001
 From: Jan Palus <jpalus at fastmail.com>
-Date: Wed, 27 Apr 2022 10:17:51 +0200
-Subject: [PATCH 2/3] webdav: switch to tristate for update_modtime
+Date: Mon, 15 May 2023 19:20:32 +0200
+Subject: [PATCH 2/2] webdav: fastmail: support for update_modtime config opt
 
+for compatibility with:
+https://github.com/rclone/rclone/pull/6108
 ---
- backend/webdav/webdav.go | 17 ++++++++++-------
- 1 file changed, 10 insertions(+), 7 deletions(-)
+ backend/webdav/webdav.go | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
 
 diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
-index 20f2b45ea..d4c331de8 100644
+index f489a2068..5c26588cf 100644
 --- a/backend/webdav/webdav.go
 +++ b/backend/webdav/webdav.go
-@@ -125,9 +125,12 @@ You can set multiple headers, e.g. '"Cookie","name=value","Authorization","xxx"'
- 			Default:  fs.CommaSepList{},
+@@ -144,6 +144,14 @@ Set to 0 to disable chunked uploading.
+ `,
  			Advanced: true,
- 		}, {
--			Name:     "update_modtime",
--			Help:     "Adjust modification time on servers which allow DAV:getlastmodified property update",
--			Default:  false,
+ 			Default:  10 * fs.Mebi, // Default NextCloud `max_chunk_size` is `10 MiB`. See https://github.com/nextcloud/server/blob/0447b53bda9fe95ea0cbed765aa332584605d652/apps/files/lib/App.php#L57
++		}, {
 +			Name: "update_modtime",
 +			Help: `Adjust modification time on servers which allow DAV:getlastmodified property update.
 +
 +Use provider's default if unset.
 +`,
 +			Default:  fs.Tristate{},
- 			Advanced: true,
++			Advanced: true,
  		}},
  	})
-@@ -143,7 +146,7 @@ type Options struct {
- 	BearerTokenCommand string               `config:"bearer_token_command"`
- 	Enc                encoder.MultiEncoder `config:"encoding"`
+ }
+@@ -160,6 +168,7 @@ type Options struct {
  	Headers            fs.CommaSepList      `config:"headers"`
--	UpdateModTime      bool                 `config:"update_modtime"`
+ 	PacerMinSleep      fs.Duration          `config:"pacer_min_sleep"`
+ 	ChunkSize          fs.SizeSuffix        `config:"nextcloud_chunk_size"`
 +	UpdateModTime      fs.Tristate          `config:"update_modtime"`
  }
  
  // Fs represents a remote webdav
-@@ -412,7 +415,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
- 	}
- 
- 	var precision time.Duration
--	if opt.UpdateModTime {
-+	if opt.UpdateModTime.Valid && opt.UpdateModTime.Value {
- 		precision = time.Second
- 	} else {
- 		precision = fs.ModTimeNotSupported
-@@ -1274,7 +1277,7 @@ func (o *Object) ModTime(ctx context.Context) time.Time {
- 
- // SetModTime sets the modification time of the local fs object
- func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error {
--	if !o.fs.opt.UpdateModTime {
-+	if !o.fs.opt.UpdateModTime.Valid || !o.fs.opt.UpdateModTime.Value {
- 		return fs.ErrorCantSetModTime
- 	}
- 	opts := rest.Opts{
-@@ -1390,7 +1393,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
- 		_ = o.Remove(ctx)
- 		return err
- 	}
--	if !o.fs.useOCMtime && o.fs.opt.UpdateModTime {
-+	if !o.fs.useOCMtime && o.fs.opt.UpdateModTime.Valid && o.fs.opt.UpdateModTime.Value {
- 		err = o.SetModTime(ctx, src.ModTime(ctx))
- 		if err != nil {
- 			return fmt.Errorf("Update ModTime failed: %w", err)
--- 
-2.37.0
-
-From 6775d10cc030e2e4b78ca774087bbb494cb0f79b Mon Sep 17 00:00:00 2001
-From: Jan Palus <jpalus at fastmail.com>
-Date: Thu, 28 Apr 2022 22:20:40 +0200
-Subject: [PATCH 3/3] webdav: add fastmail provider
-
-enables by default modtime update with PROPPATCH
----
- backend/webdav/webdav.go | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
-index d4c331de8..50152503e 100644
---- a/backend/webdav/webdav.go
-+++ b/backend/webdav/webdav.go
-@@ -87,6 +87,9 @@ func init() {
- 			}, {
- 				Value: "sharepoint-ntlm",
- 				Help:  "Sharepoint with NTLM authentication, usually self-hosted or on-premises",
-+			}, {
-+				Value: "fastmail",
-+				Help:  "Fastmail",
- 			}, {
- 				Value: "other",
- 				Help:  "Other site/service or software",
-@@ -596,6 +599,12 @@ func (f *Fs) setQuirks(ctx context.Context, vendor string) error {
- 		// so we must perform an extra check to detect this
- 		// condition and return a proper error code.
- 		f.checkBeforePurge = true
-+	case "fastmail":
-+		if !f.opt.UpdateModTime.Valid {
-+			f.precision = time.Second
-+			f.opt.UpdateModTime.Valid = true
-+			f.opt.UpdateModTime.Value = true
+@@ -579,8 +588,10 @@ func (f *Fs) setQuirks(ctx context.Context, vendor string) error {
+ 		f.canStream = true
+ 		f.precision = time.Second
+ 		f.useOCMtime = true
+-		f.propsetMtime = true
+-		f.propNameMtime = "getlastmodified"
++		if !f.opt.UpdateModTime.Valid || f.opt.UpdateModTime.Valid && f.opt.UpdateModTime.Value {
++			f.propsetMtime = true
++			f.propNameMtime = "getlastmodified"
 +		}
- 	case "other":
- 	default:
- 		fs.Debugf(f, "Unknown vendor %q", vendor)
+ 		f.hasMESHA1 = true
+ 	case "owncloud":
+ 		f.canStream = true
 -- 
-2.37.0
+2.41.0
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rclone.git/commitdiff/594aadbf944332de557c0fda4428e3832eb86199



More information about the pld-cvs-commit mailing list