-
Notifications
You must be signed in to change notification settings - Fork 33
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
u3d/dependencies: add command to install Linux dependencies #25
Conversation
A few things make me uncertain about how the current proposal
I would like this to be tested heavily on various systems. Maybe implemented as a separate command ( |
I agree it is a peculiar feature to have. Missing libraries did indeed have no effect on whether the installer completed its job.
This could be a good idea indeed. Especially if we consider the added dependencies needed to build to WebGL or to Tizen/Android, which could be specified in such a command as well. |
Notes for self: detect if something is to be installed on Debian derivative:
Is there a better way? |
I am not sure I want the question: "do you want to install?" everytime.
I prefer the current alternative where I don't want to install all of them. The package manager knows if the packages are there or not. We are not checking version number either. So it's a one shot attempt at getting everything in place.
If it's explicit installation by the user, fail. If it's automatic try installing them, error and return.
I agree it's a small case. I would prefer maybe something like if not packaging system specified
OK I still think we could have a separate action for installing the deps from the CLI to cover the cases. |
I propose we merge this in the following way.
My objective is to be able to test this on master easily. WDYT? |
Seems really good to me! I'll work on doing that. |
7cb70ea
to
ba4b9f3
Compare
Add all Unity dependencies and an API to install them. No command is available right now to install them.
ba4b9f3
to
f97c79a
Compare
lib/u3d/installer.rb
Outdated
class LinuxDependencies | ||
DEPENDENCIES = [ | ||
'gconf-service', | ||
'lib32gcc1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the dependencies marked like that will be good enough.
E.g. The doc states things like
debconf (>= 0.5) | debconf-2.0
lib/u3d/commands.rb
Outdated
@@ -129,6 +129,15 @@ def install(args: [], options: {}) | |||
Installer.install_modules(files, definition.version, installation_path: options[:installation_path]) | |||
end | |||
|
|||
def install_linux_dependencies(options: {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install_dependencies
?
lib/u3d/commands_generator.rb
Outdated
@@ -148,6 +148,15 @@ def run | |||
end | |||
end | |||
|
|||
command :dependencies do |c| | |||
c.syntax = 'u3d dependencies [-p | --package_manager <package manager>]' | |||
c.description = 'Installs Unity dependencies. [Linux only]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summary + description. We can be more verbose on the description part. In particular
- detail how it works for detecting the package_manager, etc.
- link to Linux forum post
- explain how we deal with things like
debconf (>= 0.5) | debconf-2.0
- the fact we only implement the default deps, and not the ones for platforms (WebGL, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
lib/u3d/commands_generator.rb
Outdated
command :dependencies do |c| | ||
c.syntax = 'u3d dependencies [-p | --package_manager <package manager>]' | ||
c.description = 'Installs Unity dependencies. [Linux only]' | ||
c.option '-p', '--package_manager STRING', String, 'Specify which package manager to use (aptitude, rpm...)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
option is unused right now, correct? If so remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed implementation, currently in this PR:
def self.install(prefix: nil)
unless prefix
if `which dpkg` != ''
prefix = 'apt-get -y install'
elsif `which rpm` != ''
prefix = 'yum -y install'
else
raise 'Cannot install dependencies on your Linux distribution'
end
end
if UI.interactive?
return unless UI.confirm "Install dependencies? (#{DEPENDENCIES.length} dependency(ies) to install)"
end
U3dCore::CommandExecutor.execute(command: "#{prefix} #{DEPENDENCIES.join(' ')}", admin: true)
end
lib/u3d/commands_generator.rb
Outdated
c.syntax = 'u3d dependencies [-p | --package_manager <package manager>]' | ||
c.summary = 'Installs Unity dependencies. [Linux only]' | ||
c.description = %( | ||
#{c.summary} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to remove the front spaces here? Not sure how %(
behaves.
lib/u3d/commands_generator.rb
Outdated
c.description = %( | ||
#{c.summary} | ||
|
||
Regarding the package manager: if none if specified, u3d will try to assume it by seeing which one.s is.are installed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
various typos.
lib/u3d/commands_generator.rb
Outdated
Regarding the dependencies themselves: only dependencies for the editor are installed. WebGL, Android and Tizen require others that you will have to install manually. | ||
More on that: https://forum.unity3d.com/threads/unity-on-linux-release-notes-and-known-issues.350256/ | ||
) | ||
c.option '-p', '--package_manager STRING', String, 'Specify which package manager to use (apt-get, yum...)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really want to use it with -p yum
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a great option, but it was the least bad I could think of. Any suggestion?
af445d2
to
1e46967
Compare
lib/u3d/commands_generator.rb
Outdated
Regarding the package manager: if none is specified, u3d will try to assume it by testing which one.s is.are installed. | ||
Only apt-get and yum are tested right now. | ||
|
||
If several package manager are installed on your machine simultaneously, we recommend that you specify the one you want to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: managers
lib/u3d/commands_generator.rb
Outdated
|
||
If several package manager are installed on your machine simultaneously, we recommend that you specify the one you want to use. | ||
|
||
Regarding the dependencies themselves: only dependencies for the editor are installed. WebGL, Android and Tizen require others that you will have to install manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will that work if user doesn't specify -p "apt-get -y" ?
I.e. do we manage input properly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not working properly right now, I'm correcting that
f72f29c
to
1d0400d
Compare
lib/u3d/commands_generator.rb
Outdated
Regarding the dependencies themselves: only dependencies for the editor are installed. WebGL, Android and Tizen require others that you will have to install manually. | ||
More on that: https://forum.unity3d.com/threads/unity-on-linux-release-notes-and-known-issues.350256/ | ||
) | ||
c.option '-p', '--package_manager STRING', String, 'Specify which package manager to use (apt-get, yum...)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
lib/u3d/commands_generator.rb
Outdated
@@ -148,6 +148,23 @@ def run | |||
end | |||
end | |||
|
|||
command :dependencies do |c| | |||
c.syntax = 'u3d dependencies [-p | --package_manager <package manager>]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update
Before installing Unity on Linux, the installer will now install its required dependencies.