commit: 40559d6068501c937cdac88abc502d4f65ffe737
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Jun 18 03:14:25 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 18 09:51:58 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=40559d60
emerge-webrsync: simplify ownership variable logic in sync_local()
As concerns the sync_local() function, have one single if command
determine which value is assigned to the 'ownership' variable. Further,
check whether stat(1) succeeds and exit if it does not.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/emerge-webrsync | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 64bc92fb2c..174df11aad 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -389,17 +389,13 @@ sync_local() {
einfo "Syncing local repository ..."
- ownership="${PORTAGE_USERNAME}:${PORTAGE_GRPNAME}"
- if contains_word usersync "${FEATURES}"; then
- case "${USERLAND}" in
- BSD)
- ownership=$(stat -f '%Su:%Sg'
"${repo_location}")
- ;;
- *)
- ownership=$(stat -c '%U:%G' "${repo_location}")
- ;;
- esac
- fi
+ if ! contains_word usersync "${FEATURES}"; then
+ ownership="${PORTAGE_USERNAME}:${PORTAGE_GRPNAME}"
+ elif [[ ${USERLAND} == BSD ]]; then
+ ownership=$(stat -f '%Su:%Sg' "${repo_location}")
+ else
+ ownership=$(stat -c '%U:%G' "${repo_location}")
+ fi || exit
if type -P tarsync > /dev/null ; then
tarsync_opts=( -s 1 -e /distfiles -e /packages -e /local )