From: Andrew Tridgell Date: Wed, 20 May 2026 05:18:25 +0000 (+1000) Subject: packaging: add ftp.filt, the FTP mirror filter file X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=7e7372a0c537d785d1c9d7ef0d87f2a622d488d3;p=thirdparty%2Frsync.git packaging: add ftp.filt, the FTP mirror filter file 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. --- diff --git a/packaging/ftp.filt b/packaging/ftp.filt new file mode 100644 index 00000000..e0455456 --- /dev/null +++ b/packaging/ftp.filt @@ -0,0 +1,2 @@ +- /generated-files/ +- /binaries/ diff --git a/packaging/release.py b/packaging/release.py index 6cc7332e..4b73318c 100755 --- a/packaging/release.py +++ b/packaging/release.py @@ -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):