From 06173e7eda53ba9f334889a64d6d1fc1e3271d6b Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 16 Jul 2024 14:20:15 +0100 Subject: [PATCH 1/3] Sync with rsync instead of git rm and cp This has less disk churn and allows us to exclude certain files. Signed-off-by: James Le Cuirot --- sync-with-gentoo | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sync-with-gentoo b/sync-with-gentoo index 80a4d63..d599d19 100755 --- a/sync-with-gentoo +++ b/sync-with-gentoo @@ -105,21 +105,18 @@ sync_git_prepare() { local path="${1}" local sync='' local gentoo_path="${GLOBAL_gentoo_repo}/${path}" + local rsync_opts=() if [[ ! -e "${gentoo_path}" ]]; then GLOBAL_obsolete_packages+=("${path}") return 0 fi - if [[ -d "${path}" ]]; then - git rm -r --force --quiet "${path}" - sync='x' - elif [[ -e "${path}" ]]; then - git rm --force --quiet "${path}" + if [[ -e "${path}" ]]; then sync='x' fi mkdir --parents "$(dirname ${path})" - cp --archive "${gentoo_path}" "$(dirname ${path})" + rsync --archive --delete-before "${rsync_opts[@]}" "${gentoo_path}" "$(dirname ${path})" git add "${path}" if [[ -n "${sync}" ]]; then return 1 From 22eec640d87bcde6542cc187fef4b3909e19832a Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 16 Jul 2024 14:24:04 +0100 Subject: [PATCH 2/3] Exclude profiles/repo_name when syncing with Gentoo We want to call our own repo portage-stable (or soon gentoo-subset) so stop setting this file back to "gentoo". It wasn't an issue before because we set the name to portage-stable in layout.conf, but you're not supposed to set it there any more. Signed-off-by: James Le Cuirot --- sync-with-gentoo | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sync-with-gentoo b/sync-with-gentoo index d599d19..c6cd8c5 100755 --- a/sync-with-gentoo +++ b/sync-with-gentoo @@ -112,6 +112,10 @@ sync_git_prepare() { return 0 fi + case "${path}" in + profiles) rsync_opts+=( --exclude /profiles/repo_name ) + esac + if [[ -e "${path}" ]]; then sync='x' fi From f80957ce83259344d47921b2ad533e090ebc3174 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 16 Jul 2024 15:53:58 +0100 Subject: [PATCH 3/3] Fix help message when no options are given It was failing due to set -u. Signed-off-by: James Le Cuirot --- sync-with-gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync-with-gentoo b/sync-with-gentoo index c6cd8c5..1a13851 100755 --- a/sync-with-gentoo +++ b/sync-with-gentoo @@ -34,7 +34,7 @@ GLOBAL_gentoo_repo="${GENTOO_REPO:-../gentoo}" GLOBAL_amend_mode='' while true; do - case "${1}" in + case "${1-}" in '--help'|'-h') echo "${0} [OPTIONS] CATEGORY[/PACKAGE_NAME] [CATEGORY[/PACKAGE_NAME] […]]" echo 'OPTIONS:'