Merge: Extend nitpm (formerly picnit) to support package versions and dependencies
authorJean Privat <jean@pryen.org>
Fri, 6 Apr 2018 02:01:35 +0000 (22:01 -0400)
committerJean Privat <jean@pryen.org>
Fri, 6 Apr 2018 02:01:35 +0000 (22:01 -0400)
commitb1d652326fd9a29bb16d80b0ec416da46f48c7fe
treebe99bb7678ee2ec132db676f5509e9e8483d94a7
parent1bbfcd50ebb19cba511b55922f0b585f9a0b0582
parent655ede904715fa2fbea4a0f0138a91d586b811e6
Merge: Extend nitpm (formerly picnit) to support package versions and dependencies

Rename picnit to nitpm and intro 4 main new features.

### Install package versions

Install specific versions of a package using the following command:

~~~
nitpm install gamnit=0.5
~~~

The version string (the `0.5` in the above example) must be a Git branch or tag, it will be used when cloning the package locally. The package will be downloaded to `~/.local/lib/nit/gamnit=0.5/`, allowing multiple versions of the same package to be installed concurrently.

### Dependencies in package.ini

Packages should now declare dependencies to other nitpm packages in the `package.ini` at the `import` key:

~~~
[package]
name=my_package
import=hello_nitpm, gamnit=0.5
~~~

The dependencies can then be installed automatically with `nitpm install` from the root of the package.

Nit tools read the local `package.ini` to redirect imports of `gamnit` inside this package to this specific version. So for `my_package` described above, all references to `gamnit` will use the implementation `gamnit=0.5`.

### Recursive installation

nitpm installs dependencies recursively, so if `gamnit` requires `glesv2`, after an explicit command to install `gamnit` nitpm will also install `glesv2`. This implementation is minimal, it could be improved by precalculating all dependencies and asking for confirmation.

### Customizable install directory

You can now use the env var `NITPM_PATH` to set the path where libraries are installed. This will override the default path at `~/.local/lib/nit/`.

### Others

* `nitpm uninstall` can uninstall many packages at once, it is safer and it accepts the -f option to skip the confirmation.
* `nitpm list` lists packages in alphabetical order.

Pull-Request: #2622
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>