[Tilesathome] [PATCH] Don't rename uploaded files to ${file}_uploaded if using a common upload directory
Matthias Julius
lists at julius-net.net
Mon Oct 27 18:28:52 GMT 2008
"Ævar Arnfjörð Bjarmason" <avarab at gmail.com> writes:
> I run a t at h setup with multiple clients generating tilesets and a
> single uploader, the typical client configuration is:
>
> WorkingDirectory = /home/avar/src/tah/work/tah-3
> UploadToDirectory = 1
> UploadTargetDirectory = /home/avar/src/tah/uploadable
> DeleteZipFilesAfterUpload=0
>
> And the upload client is:
>
> WorkingDirectory = /home/avar/src/tah/work/tah-upload
> UploadToDirectory = 0
> ForkForUpload = 0
> DeleteZipFilesAfterUpload=0
>
> The uploadable directory in each client's working directory is then
> symlinked to a central uploadable directory everyone uses:
>
> $ file work/tah-{3,upload}/uploadable
> work/tah-3/uploadable: symbolic link to `/home/avar/src/tah/uploadable'
> work/tah-upload/uploadable: symbolic link to `/home/avar/src/tah/uploadable'
I would call that a broken setup. All rendered zip files should now be
in /home/avar/src/tah/uploadable and collect dust.
Each client's uploadable directory is supposed to be private to the
client. If UploadToDirectory is set the client copies all zip files
from there to UploadTargetDirectory. So, instead of symlinking you
should set UploadTargetDirectory to
/home/avar/src/tah/work/tah-upload/uploadable and everything should
work as expected.
>
> Recently this setup broke due to changes in SVN (I don't know what
> change specifically) and all the non-uploading clients started
> dropping zip files with the _uploaded suffix in their upload directory
> even though they weren't uploading them.
I have no idea why this should have ever worked. Since you have made
the uploadable directory of each client the same each client will try
to upload each others zip file to /home/avar/src/tah/uploadable
(whichever client finds it first) and rename it to *_uploaded if
DeleteZipFilesAfterUpload=0 is set.
> To get them uploaded I needed to run:
>
> $ rename 's/_uploaded$//g' *
>
> And then run the upload client.
>
> This patch to Upload.pm I'm submitting causes Upload::upload() not to
> unlink or rename zip files in the uploadable working directory if the
> UploadToDirectory variable is set in the config. It works for me but
> there may be some side effects of this I haven't considered.
>
> Index: lib/Upload.pm
> ===================================================================
> --- lib/Upload.pm (revision 11508)
> +++ lib/Upload.pm (working copy)
> @@ -291,6 +291,11 @@
> {
> unlink($File);
> }
> + elsif ($Config->get("UploadToDirectory"))
> + {
> + # If we're uploading to a common directory unlinking or
> + # renaming is some other client's problem, let them handle it.
> + }
> else
> {
> rename($File, $File."_uploaded");
This will actually only work if DeleteZipFilesAfterUpload=0 is set.
Otherwise it will unlink the file regardless of UploadToDirectory.
Matthias
More information about the Tilesathome
mailing list