Update prebuilt.py to set permissions correctly on created Packages file.

Since the local Packages file is a temporary file, other users won't have
permissions to read it. rsync copies those permissions over to the remote
server. To ensure remote server has the right permissions, we need to use
chmod a+r on either the local file or the remote file. In this case, I chose
to run rsync on the remote file.

TEST=rsync -av --chmod=a+r foo bar and verify permissions are added to bar.
BUG=chromium-os:5311

Change-Id: Iee4c8df00b36b9f9434546603195ea1906b289f1

Review URL: http://codereview.chromium.org/5501001
This commit is contained in:
David James 2010-12-01 13:43:48 -08:00
parent 7efdebf35f
commit a8ae0bc63b

View File

@ -441,11 +441,12 @@ def UploadPrebuilt(build_path, upload_location, version, binhost_base_url,
ssh_server, remote_path = remote_location.split(':', 1) ssh_server, remote_path = remote_location.split(':', 1)
d = { 'pkg_index': tmp_packages_file.name, d = { 'pkg_index': tmp_packages_file.name,
'pkgs': pkgs, 'pkgs': pkgs,
'remote_packages': '%s/Packages' % remote_location.rstrip('/'),
'remote_path': remote_path, 'remote_path': remote_path,
'remote_location': remote_location, 'remote_location': remote_location,
'ssh_server': ssh_server } 'ssh_server': ssh_server }
cmds = ['ssh %(ssh_server)s mkdir -p %(remote_path)s' % d, cmds = ['ssh %(ssh_server)s mkdir -p %(remote_path)s' % d,
'rsync -av %(pkg_index)s %(remote_location)s/Packages' % d] 'rsync -av --chmod=a+r %(pkg_index)s %(remote_packages)s' % d]
if pkgs: if pkgs:
cmds.append('rsync -Rav %(pkgs)s %(remote_location)s/' % d) cmds.append('rsync -Rav %(pkgs)s %(remote_location)s/' % d)
for cmd in cmds: for cmd in cmds: