alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
288 stars 49 forks source link

Automatically install curl? #338

Closed setton closed 4 years ago

setton commented 4 years ago

Right now, alr fails if curl is not found on the PATH - I guess we could either check for this and exit gracefully, or, better, install it if we can.

mosteo commented 4 years ago

Yup, I guess alr should start using itself for system dependencies.

Fabien-Chouteau commented 4 years ago

I already install git, tar and unzip automatically on msys2.

We can use the system deployers here it will even prompt the user to accept the installation. However this must happen before we read the index, or even if there is no index at all. So we will have to fill package name for each distrib in the source code.

Fabien-Chouteau commented 4 years ago

@setton I worked on a implementation to install the tool when possible or ask the user to do to. If you want to check it out.

setton commented 4 years ago

I checked the branch tools_from_distro and this works perfectly on Ubuntu:

Cloning into '/home/setton/.config/alire/indexes/community/repo'...
remote: Enumerating objects: 2871, done.
remote: Total 2871 (delta 0), reused 0 (delta 0), pack-reused 2871
Receiving objects: 100% (2871/2871), 493.11 KiB | 7.15 MiB/s, done.
Resolving deltas: 100% (1957/1957), done.
Looking for external crate: libhello
Cannot find required tool: CURL
Do you want Alire to install the required tool?
[Y] Yes  [N] No  (default is Yes) Y
[sudo] password for setton: 
Selecting previously unselected package curl.
(Reading database ... 228059 files and directories currently installed.)
Preparing to unpack .../curl_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.8) ...
Setting up curl (7.58.0-2ubuntu3.8) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
######################################################################### 100.0%
######################################################################### 100.0%
setton@boho:~/src/ancr/src/alire/tmp$ ls hello_1.0.1_dcc36a2f/
alire  hello.gpr  LICENSE  README.md  src
setton@boho:~/src/ancr/src/alire/tmp$ 🏆
Fabien-Chouteau commented 4 years ago

Merged :)