Skip to content

Commit

Permalink
Merge pull request #158 from flatcar/chewi/exclude-repo-name
Browse files Browse the repository at this point in the history
Exclude profiles/repo_name when syncing with Gentoo
  • Loading branch information
chewi authored Jul 19, 2024
2 parents 58ff732 + f80957c commit 6495dd7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sync-with-gentoo
Original file line number Diff line number Diff line change
Expand Up @@ -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:'
Expand Down Expand Up @@ -105,21 +105,22 @@ 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}"
case "${path}" in
profiles) rsync_opts+=( --exclude /profiles/repo_name )
esac

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
Expand Down

0 comments on commit 6495dd7

Please sign in to comment.