]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
packaging: add ftp.filt, the FTP mirror filter file
authorAndrew Tridgell <tridge60@gmail.com>
Wed, 20 May 2026 05:18:25 +0000 (15:18 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Wed, 20 May 2026 05:36:44 +0000 (15:36 +1000)
The .filt file in /home/ftp/pub/rsync on samba.org controls which
subtrees release.py's FTP mirror excludes (currently /binaries/
and /generated-files/).  Without it, step-10-push-ftp's
'rsync --del' would propagate local deletions to the server even
for those archive subtrees.

Until now the only copy of this two-line file lived on the server.
Bundle it in source at packaging/ftp.filt so it survives a disaster
on samba.org, and have step_1_fetch seed FTP_DIR/.filt from the
bundled copy on every run (with --exclude=/.filt on the rsync pull,
so the server's copy can't silently drift the bundled one).
step-10-push-ftp then propagates any in-source updates to the
filter back to the server.

packaging/ftp.filt [new file with mode: 0644]
packaging/release.py

diff --git a/packaging/ftp.filt b/packaging/ftp.filt
new file mode 100644 (file)
index 0000000..e045545
--- /dev/null
@@ -0,0 +1,2 @@
+- /generated-files/
+- /binaries/
index 6cc7332e2fb14abc8decd99d41bae90ec9a7bb47..4b73318c56284aec082e1777a64f52111c8e3b7b 100755 (executable)
@@ -137,14 +137,19 @@ def step_1_fetch(args):
     section(f"Fetching ftp dir into {FTP_DIR}")
     if not os.path.isdir(FTP_DIR):
         os.makedirs(FTP_DIR)
-    # The .filt file lives in the ftp dir on the server; mirror down using the
-    # transmitted filter, falling back to no filter on the very first pull.
+    # packaging/ftp.filt is the authoritative copy of the .filt filter file
+    # that controls which subtrees rsync excludes from the FTP mirror.
+    # Seed FTP_DIR/.filt from it so the bundled version is what step-1's
+    # rsync uses here, and so step-10-push-ftp propagates it back to the
+    # server.  --exclude=/.filt below stops the server's copy from
+    # overwriting our bundled one on the way down.
     filt = os.path.join(FTP_DIR, '.filt')
-    if os.path.exists(filt):
-        opts = ['-aivOHP', f'-f:_{filt}']
-    else:
-        opts = ['-aivOHP']
-    cmd_chk(['rsync', *opts, f'{host}:{FTP_REMOTE_PATH}/', f'{FTP_DIR}/'])
+    bundled_filt = os.path.realpath('packaging/ftp.filt')
+    if not os.path.isfile(bundled_filt):
+        die(f"{bundled_filt} not found; cannot seed .filt for the FTP pull.")
+    shutil.copyfile(bundled_filt, filt)
+    cmd_chk(['rsync', '-aivOHP', f'-f:_{filt}', '--exclude=/.filt',
+             f'{host}:{FTP_REMOTE_PATH}/', f'{FTP_DIR}/'])
 
     section(f"Snapshotting html dir from {HTML_SRC} into {HTML_DIR}")
     if not os.path.isdir(HTML_SRC):