Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation stops if empty (!) /Applications/Unity folder is present #16

Closed
Geri-Borbas opened this issue Jan 5, 2018 · 10 comments
Closed

Comments

@Geri-Borbas
Copy link

Geri-Borbas commented Jan 5, 2018

Hi,
thanks for the script, I'm using it for months now. 🙏

But now I want to cahce the Unity installation on the Travis CI image, but unfortunately when an empty /Applications/Unity folder is present, the script stops saying:

ERROR: Directory "/Applications/Unity" not recognized as Unity installation.

Details: When I setup caching for Applications/Unity (see the corresponding changes in .travis.yml), Travis seemingly sets up an empty folder. Then the script stops at install-unity.py#L783, as it seems believe there is an existing Unity installation there, but there is not.

...
        # There's another version in the 'Unity' folder, move it to 'Unity VERSION'
        lookup = [vers for vers,name in installs.iteritems() if os.path.basename(name) == 'Unity']
        if len(lookup) != 1:
            error('Directory "%s" not recognized as Unity installation.' % install_path)
...

See error log live at eppz / Unity.Test.eppz / Build #72.


Question is: Could you please help me 🤞 on how to modify / patch the script to proceed with the installation, if /Applications/Unity is present, but empty.

You may even consider to make it part of a release, as installation actually may proceed with an empty but existing target folder.

@Geri-Borbas Geri-Borbas changed the title Installation stops if empty /Applications/Unity folder is present Installation stops if empty (!) /Applications/Unity folder is present Jan 5, 2018
@sttz
Copy link
Owner

sttz commented Jan 5, 2018

The idea was that the script is careful not to overwrite anything and leave it up to the user to explicitly delete unrecognized directories.

I'm bit hesitant to just continue if the directory is empty, since the directory could contain hidden files (at least .DS_Store is common) and it might be confusing if it seemingly only ignores empty directories sometimes.

I thought about adding a flag like --overwrite but that adds a lot of complexity for a simple problem.

What do you think about deleting the directory during the travis installation if it's empty?

E.g. adding

install:
    - rmdir /Applications/Unity || true
    - sudo python2 .scripts/install-unity.py --package Unity 2017.1.1f1

I haven't tested this with travis but rmdir only deletes empty directories and || true should keep travis from aborting the installation if it's not.

@Geri-Borbas
Copy link
Author

Geri-Borbas commented Jan 5, 2018

Wow, thanks for the fast response!
It solved the issue.

Sound like a bit quirky workaround, I'd like to keep travis instruction count low.
But as it is a matter of a one-time setup anyway, I can easily go with that.

@Geri-Borbas
Copy link
Author

Geri-Borbas commented Jan 5, 2018

Well, actually I could run installer just fine, but it invalidated Travis cache as I removed the /Applications/Unity folder.

Could you please suggest a change (only a patch I'd use) in the script that I can safely apply to my instance? I would do it myself, but actually I don't speak python.

@sttz
Copy link
Owner

sttz commented Jan 6, 2018

I realised there was already some code to test for almost empty directories during the cleanup, so I refactored it and the script now overwrites an existing but empty Unity directory (06165fc). Hope that works with travis.

@Geri-Borbas
Copy link
Author

Geri-Borbas commented Jan 6, 2018

Wow, thanks, this just solved the issue perfectly.
Yay, Travis also started to packing new cache archive!

Thanks again for your time on this!

@Geri-Borbas
Copy link
Author

I managed to cache /Applications/Unity just fine, but when I start it, Unity.app just hangs for 10 minutes, then Travis kills the process due to inactivity (see log for this job).

Do you aware of any more Unity installation folder I should cache perhaps?

@sttz
Copy link
Owner

sttz commented Jan 6, 2018

As far as I can tell, Unity.pkg only installs files to /Applications/Unity. Maybe travis doesn't properly restore execution permissions for some files?

You could also try to get the Unity log from ~/Library/Logs/Unity/Editor.log to see if it contains anything helpful.

@Geri-Borbas
Copy link
Author

Thanks, I'll contact Travis then.

@Geri-Borbas
Copy link
Author

Well, they did not addressed the issue, but I can see these folks - https://github.com/watson-developer-cloud/unity-sdk/blob/develop/.travis.yml - to set chmod directly on their scripts.

Should I do the same with /Applications/Unity/MacOS/Unity.app?

@sttz
Copy link
Owner

sttz commented Jan 6, 2018

Seems like the executable bit is set for all files in the Unity.app bundle, so you can apply chmod recursively:
sudo chmod -R ugo+x /Applications/Unity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants