fix: keep the generated config out of the published tree

A dry-run publish against the real archive caught gdl-sync.config.json
being created in the archive root: it was written into the staging
directory, and staging is rsynced wholesale. It now lives as a sibling of
staging instead, with rsync excludes as a second line of defence.

The dry run is otherwise clean -- 322 files added, 0 deleted, no new
directories -- and confirms the property that matters most: of 74 new
media files, zero duplicate media already held under a different name.
The JD2 and gallery-dl naming really do converge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 21:43:12 -04:00
co-authored by Claude Opus 5
parent 3a34e4359e
commit 68568ef855
+13 -2
View File
@@ -410,7 +410,15 @@ def rsync_command(staging: Path, dest: str, dry_run: bool) -> list[str]:
`dest` may be a local path or any rsync destination (`user@host:/path`), `dest` may be a local path or any rsync destination (`user@host:/path`),
because the archive usually is not writable from the fetch host. because the archive usually is not writable from the fetch host.
""" """
cmd = ["rsync", "-a", "--ignore-existing", "--partial", "--info=stats2"] cmd = ["rsync", "-a", "--ignore-existing", "--partial", "--info=stats2",
# Belt and braces: the config lives outside staging, but nothing
# resembling tooling output should ever reach the archive. Archive
# sidecars are always "<date>_<user> - <code>.json", so none of
# these can match real content.
"--exclude", "gdl-sync*.json",
"--exclude", "*.gdl-config.json",
"--exclude", ".gdl-*",
"--exclude", "*.sqlite", "--exclude", "*.db"]
if dry_run: if dry_run:
cmd.append("--dry-run") cmd.append("--dry-run")
# Trailing slash: copy the *contents* of staging into dest. # Trailing slash: copy the *contents* of staging into dest.
@@ -480,7 +488,10 @@ def main() -> int:
config = build_config(args.rate, list(args.sleep_request), list(args.sleep)) config = build_config(args.rate, list(args.sleep_request), list(args.sleep))
args.staging.mkdir(parents=True, exist_ok=True) args.staging.mkdir(parents=True, exist_ok=True)
config_path = args.staging / "gdl-sync.config.json" # Deliberately a SIBLING of the staging directory, not inside it: staging is
# rsynced wholesale into the archive, and a dry run caught this file being
# published to the archive root.
config_path = args.staging.parent / f"{args.staging.name}.gdl-config.json"
plan: list[tuple[Profile, Source]] = [ plan: list[tuple[Profile, Source]] = [
(prof, src) (prof, src)