Use python to lookup the user and group corresponding to PORTAGE_INST_UID and PORTAGE...
authorZac Medico <zmedico@gentoo.org>
Tue, 30 May 2006 09:10:18 +0000 (09:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 30 May 2006 09:10:18 +0000 (09:10 -0000)
svn path=/main/trunk/; revision=3442

bin/emerge-webrsync

index 636b036e843f94de4f5db4ae4fa9651f0f0efc18..44e0dba8f9e0560d0a649ea977e8f0ba047e251d 100755 (executable)
@@ -53,7 +53,10 @@ fi
 sync_local() {
        echo Syncing local tree...
        if type -p tarsync &> /dev/null; then
-               if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} -e /distfiles -e /packages -e /local; then
+               # tarsync doesn't take numeric uid/gid so we need to convert them.
+               local inst_user="$(python -c "import pwd; print pwd.getpwuid(int('${PORTAGE_INST_UID:-0}'))[0]")"
+               local inst_group="$(python -c "import grp; print grp.getgrgid(int('${PORTAGE_INST_GID:-0}'))[0]")"
+               if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${inst_user} -g ${inst_group} -e /distfiles -e /packages -e /local; then
                        echo "tarsync failed; tarball is corrupt?"
                        exit 1;
                fi