ocaml-opam / opam-depext

Attempt to automate the installation of system packages required by OPAM packages
Other
33 stars 28 forks source link

On Fedora depext always asks for sudo password #131

Open ansiwen opened 3 years ago

ansiwen commented 3 years ago

Although all required packages are installed, on Fedora it still asks for the sudo password, because it falsely claims package pkgconfig is not installed and then starts a yum -y update. Later it verifies correctly with the rpm -q --whatprovides pkgconfig command, but does it falsely with sudo again, which is not required for this command. See output below.

The correct way would be to test from the beginning with running rpm -q --whatprovides pkgconfig without sudo and only if that fails to execute commands with sudo.

I know this code goes into opam itself, but I tried it the beta and it doesn't work at all there, so I can't verify the behavior there, and I want to document the problem at least here.

Output of opam depext --yes --update keyfender conf-jq (click to expand) ``` opam depext --yes --update keyfender conf-jq # Detecting depexts using vars: arch=x86_64, os=linux, os-distribution=fedora, os-family=fedora # The following system packages are needed: gmp gmp-devel jq m4 perl-Pod-Html pkgconfig Name : gmp Epoch : 1 Version : 6.1.2 Release : 13.fc32 Architecture: x86_64 Install Date: Di 30 Jun 2020 02:11:35 CEST Group : Unspecified Size : 757940 License : LGPLv3+ or GPLv2+ Signature : RSA/SHA256, Mi 29 Jan 2020 08:44:59 CET, Key ID 6c13026d12c944d0 Source RPM : gmp-6.1.2-13.fc32.src.rpm Build Date : Di 28 Jan 2020 23:34:17 CET Build Host : buildhw-08.phx2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : http://gmplib.org/ Bug URL : https://bugz.fedoraproject.org/gmp Summary : A GNU arbitrary precision library Description : The gmp package contains GNU MP, a library for arbitrary precision arithmetic, signed integers operations, rational numbers and floating point numbers. GNU MP is designed for speed, for both small and very large operands. GNU MP is fast because it uses fullwords as the basic arithmetic type, it uses fast algorithms, it carefully optimizes assembly code for many CPUs' most common inner loops, and it generally emphasizes speed over simplicity/elegance in its operations. Install the gmp package if you need a fast arbitrary precision library. Name : gmp-devel Epoch : 1 Version : 6.1.2 Release : 13.fc32 Architecture: x86_64 Install Date: Di 30 Jun 2020 02:27:48 CEST Group : Unspecified Size : 345118 License : LGPLv3+ or GPLv2+ Signature : RSA/SHA256, Mi 29 Jan 2020 08:44:54 CET, Key ID 6c13026d12c944d0 Source RPM : gmp-6.1.2-13.fc32.src.rpm Build Date : Di 28 Jan 2020 23:34:17 CET Build Host : buildhw-08.phx2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : http://gmplib.org/ Bug URL : https://bugz.fedoraproject.org/gmp Summary : Development tools for the GNU MP arbitrary precision library Description : The libraries, header files and documentation for using the GNU MP arbitrary precision library in applications. If you want to develop applications which will use the GNU MP library, you'll need to install the gmp-devel package. You'll also need to install the gmp package. Name : jq Version : 1.6 Release : 4.fc32 Architecture: x86_64 Install Date: Di 30 Jun 2020 02:27:53 CEST Group : Unspecified Size : 410113 License : MIT and ASL 2.0 and CC-BY and GPLv3 Signature : RSA/SHA256, Mi 29 Jan 2020 22:54:14 CET, Key ID 6c13026d12c944d0 Source RPM : jq-1.6-4.fc32.src.rpm Build Date : Mi 29 Jan 2020 07:23:08 CET Build Host : buildvm-10.phx2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : http://stedolan.github.io/jq/ Bug URL : https://bugz.fedoraproject.org/jq Summary : Command-line JSON processor Description : lightweight and flexible command-line JSON processor jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text. It is written in portable C, and it has zero runtime dependencies. jq can mangle the data format that you have into the one that you want with very little effort, and the program to do so is often shorter and simpler than you'd expect. Name : m4 Version : 1.4.18 Release : 12.fc32 Architecture: x86_64 Install Date: Di 30 Jun 2020 02:14:49 CEST Group : Unspecified Size : 361648 License : GPLv3+ Signature : RSA/SHA256, Do 30 Jan 2020 07:38:38 CET, Key ID 6c13026d12c944d0 Source RPM : m4-1.4.18-12.fc32.src.rpm Build Date : Mi 29 Jan 2020 14:36:59 CET Build Host : buildvm-24.phx2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : http://www.gnu.org/software/m4/ Bug URL : https://bugz.fedoraproject.org/m4 Summary : The GNU macro processor Description : A GNU implementation of the traditional UNIX macro processor. M4 is useful for writing text files which can be logically parsed, and is used by many programs as part of their build process. M4 has built-in functions for including files, running shell commands, doing arithmetic, etc. The autoconf program needs m4 for generating configure scripts, but not for running configure scripts. Install m4 if you need a macro processor. Name : perl-Pod-Html Epoch : 0 Version : 1.24 Release : 456.fc32 Architecture: noarch Install Date: Di 08 Sep 2020 16:42:00 CEST Group : Unspecified Size : 37957 License : GPL+ or Artistic Signature : RSA/SHA256, Di 01 Sep 2020 09:36:19 CEST, Key ID 6c13026d12c944d0 Source RPM : perl-5.30.3-456.fc32.src.rpm Build Date : Di 01 Sep 2020 09:11:35 CEST Build Host : buildvm-a32-25.iad2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : https://www.perl.org/ Bug URL : https://bugz.fedoraproject.org/perl Summary : Convert POD files to HTML Description : This package converts files from POD format (see perlpod) to HTML format. It can automatically generate indexes and cross-references, and it keeps a cache of things it knows how to cross-reference. package pkgconfig is not installed # The following new OS packages need to be installed: pkgconfig The following command needs to be run through "sudo": yum -y update [sudo] password for svanders: Last metadata expiration check: 5:22:13 ago on Mo 28 Sep 2020 21:01:28 CEST. Dependencies resolved. Nothing to do. Complete! # OS package update successful The following command needs to be run through "sudo": yum install -y pkgconfig Last metadata expiration check: 5:22:17 ago on Mo 28 Sep 2020 21:01:28 CEST. Package pkgconf-pkg-config-1.6.3-3.fc32.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete! The following command needs to be run through "sudo": rpm -q --whatprovides pkgconfig pkgconf-pkg-config-1.6.3-3.fc32.x86_64 # OS packages installation successful opam depext --yes --update mirage solo5-bindings-hvt mirage-solo5 # Detecting depexts using vars: arch=x86_64, os=linux, os-distribution=fedora, os-family=fedora # The following system packages are needed: kernel-headers libseccomp-devel m4 pkgconfig Name : kernel-headers Version : 5.8.11 Release : 200.fc32 Architecture: x86_64 Install Date: So 27 Sep 2020 22:34:46 CEST Group : Unspecified Size : 5302965 License : GPLv2 Signature : RSA/SHA256, Mi 23 Sep 2020 21:09:47 CEST, Key ID 6c13026d12c944d0 Source RPM : kernel-headers-5.8.11-200.fc32.src.rpm Build Date : Mi 23 Sep 2020 16:16:39 CEST Build Host : bkernel01.iad2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : http://www.kernel.org/ Bug URL : https://bugz.fedoraproject.org/kernel-headers Summary : Header files for the Linux kernel for use by glibc Description : Kernel-headers includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package. Name : libseccomp-devel Version : 2.5.0 Release : 3.fc32 Architecture: x86_64 Install Date: Mo 24 Aug 2020 00:15:50 CEST Group : Unspecified Size : 114613 License : LGPLv2 Signature : RSA/SHA256, Mi 05 Aug 2020 03:05:03 CEST, Key ID 6c13026d12c944d0 Source RPM : libseccomp-2.5.0-3.fc32.src.rpm Build Date : Mi 05 Aug 2020 02:16:36 CEST Build Host : buildhw-x86-02.iad2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : https://github.com/seccomp/libseccomp Bug URL : https://bugz.fedoraproject.org/libseccomp Summary : Development files used to build applications with libseccomp support Description : The libseccomp library provides an easy to use interface to the Linux Kernel's syscall filtering mechanism, seccomp. The libseccomp API allows an application to specify which syscalls, and optionally which syscall arguments, the application is allowed to execute, all of which are enforced by the Linux Kernel. Name : m4 Version : 1.4.18 Release : 12.fc32 Architecture: x86_64 Install Date: Di 30 Jun 2020 02:14:49 CEST Group : Unspecified Size : 361648 License : GPLv3+ Signature : RSA/SHA256, Do 30 Jan 2020 07:38:38 CET, Key ID 6c13026d12c944d0 Source RPM : m4-1.4.18-12.fc32.src.rpm Build Date : Mi 29 Jan 2020 14:36:59 CET Build Host : buildvm-24.phx2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : http://www.gnu.org/software/m4/ Bug URL : https://bugz.fedoraproject.org/m4 Summary : The GNU macro processor Description : A GNU implementation of the traditional UNIX macro processor. M4 is useful for writing text files which can be logically parsed, and is used by many programs as part of their build process. M4 has built-in functions for including files, running shell commands, doing arithmetic, etc. The autoconf program needs m4 for generating configure scripts, but not for running configure scripts. Install m4 if you need a macro processor. package pkgconfig is not installed # The following new OS packages need to be installed: pkgconfig The following command needs to be run through "sudo": yum -y update Last metadata expiration check: 5:22:23 ago on Mo 28 Sep 2020 21:01:28 CEST. Dependencies resolved. Nothing to do. Complete! # OS package update successful The following command needs to be run through "sudo": yum install -y pkgconfig Last metadata expiration check: 5:22:27 ago on Mo 28 Sep 2020 21:01:28 CEST. Package pkgconf-pkg-config-1.6.3-3.fc32.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete! The following command needs to be run through "sudo": rpm -q --whatprovides pkgconfig pkgconf-pkg-config-1.6.3-3.fc32.x86_64 # OS packages installation successful ```
tizoc commented 3 years ago

I think I just got bit by this same issue when building Tezos on a computer running Fedora.

rjbou commented 3 years ago

To check installed package, it first done using rpm -qi in opam-depext, but in opam itself yum -q -C list (for all centos-like) distribs. If there is a different command, or just better command (completeness & speed) for Fedora, please open an issue on opam bugtracker. In opam-depext, the check with rpm -q --whatprovides pkgconfig is done after installing the package.

it doesn't work at all there

What doesn't work? opam install (see test guide), or depext handling on fedora doesn't work at all ? If you can open an issue in opam bugtracker it is very helpful for us.

tizoc commented 3 years ago

I am not OP, but just to add some information. This is from a coworker's computer, which runs Fedora 33, and opam 2.0.6.

Output from this command:

opam depext conf-gmp conf-libev conf-perl conf-pkg-config conf-hidapi ctypes-foreign conf-autoconf conf-libffi

is:

# Detecting depexts using vars: arch=x86_64, os=linux, os-distribution=fedora, os-family=fedora
# The following system packages are needed:
autoconf
gmp
gmp-devel
hidapi-devel
libev-devel
libffi-devel
perl-Pod-Html
pkgconfig
which
Name        : autoconf
Version     : 2.69
Release     : 34.fc33
Architecture: noarch
Install Date: Sat Mar 13 17:34:28 2021
Group       : Unspecified
Size        : 2323020
License     : GPLv2+ and GFDL
Signature   : RSA/SHA256, Thu Jul 30 12:03:30 2020, Key ID 49fd77499570ff31
Source RPM  : autoconf-2.69-34.fc33.src.rpm
Build Date  : Mon Jul 27 21:01:15 2020
Build Host  : buildvm-ppc64le-40.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.gnu.org/software/autoconf/
Bug URL     : https://bugz.fedoraproject.org/autoconf
Summary     : A GNU tool for automatically configuring source code
Description :
GNU's Autoconf is a tool for configuring source code and Makefiles.
Using Autoconf, programmers can create portable and configurable
packages, since the person building the package is allowed to
specify various configuration options.
You should install Autoconf if you are developing software and
would like to create shell scripts that configure your source code
packages. If you are installing Autoconf, you will also need to
install the GNU m4 package.
Note that the Autoconf package is not required for the end-user who
may be configuring software with an Autoconf-generated script;
Autoconf is only required for the generation of the scripts, not
their use.
Name        : gmp
Epoch       : 1
Version     : 6.2.0
Release     : 5.fc33
Architecture: i686
Install Date: Sat Mar 13 17:38:13 2021
Group       : Unspecified
Size        : 735444
License     : LGPLv3+ or GPLv2+
Signature   : RSA/SHA256, Tue Sep 15 20:39:09 2020, Key ID 49fd77499570ff31
Source RPM  : gmp-6.2.0-5.fc33.src.rpm
Build Date  : Tue Sep 15 20:26:35 2020
Build Host  : buildvm-x86-08.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://gmplib.org/
Bug URL     : https://bugz.fedoraproject.org/gmp
Summary     : A GNU arbitrary precision library
Description :
The gmp package contains GNU MP, a library for arbitrary precision
arithmetic, signed integers operations, rational numbers and floating
point numbers. GNU MP is designed for speed, for both small and very
large operands. GNU MP is fast because it uses fullwords as the basic
arithmetic type, it uses fast algorithms, it carefully optimizes
assembly code for many CPUs' most common inner loops, and it generally
emphasizes speed over simplicity/elegance in its operations.
Install the gmp package if you need a fast arbitrary precision
library.
Name        : gmp
Epoch       : 1
Version     : 6.2.0
Release     : 5.fc33
Architecture: x86_64
Install Date: Sat Mar 13 17:32:08 2021
Group       : Unspecified
Size        : 818598
License     : LGPLv3+ or GPLv2+
Signature   : RSA/SHA256, Tue Sep 15 20:39:12 2020, Key ID 49fd77499570ff31
Source RPM  : gmp-6.2.0-5.fc33.src.rpm
Build Date  : Tue Sep 15 20:26:48 2020
Build Host  : buildvm-x86-18.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://gmplib.org/
Bug URL     : https://bugz.fedoraproject.org/gmp
Summary     : A GNU arbitrary precision library
Description :
The gmp package contains GNU MP, a library for arbitrary precision
arithmetic, signed integers operations, rational numbers and floating
point numbers. GNU MP is designed for speed, for both small and very
large operands. GNU MP is fast because it uses fullwords as the basic
arithmetic type, it uses fast algorithms, it carefully optimizes
assembly code for many CPUs' most common inner loops, and it generally
emphasizes speed over simplicity/elegance in its operations.
Install the gmp package if you need a fast arbitrary precision
library.
Name        : gmp-devel
Epoch       : 1
Version     : 6.2.0
Release     : 5.fc33
Architecture: x86_64
Install Date: Sat Mar 13 17:36:16 2021
Group       : Unspecified
Size        : 358942
License     : LGPLv3+ or GPLv2+
Signature   : RSA/SHA256, Tue Sep 15 20:39:12 2020, Key ID 49fd77499570ff31
Source RPM  : gmp-6.2.0-5.fc33.src.rpm
Build Date  : Tue Sep 15 20:26:48 2020
Build Host  : buildvm-x86-18.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://gmplib.org/
Bug URL     : https://bugz.fedoraproject.org/gmp
Summary     : Development tools for the GNU MP arbitrary precision library
Description :
The libraries, header files and documentation for using the GNU MP
arbitrary precision library in applications.
If you want to develop applications which will use the GNU MP library,
you'll need to install the gmp-devel package.  You'll also need to
install the gmp package.
Name        : hidapi-devel
Version     : 0.9.0
Release     : 4.fc33
Architecture: x86_64
Install Date: Sat Mar 13 17:37:24 2021
Group       : Unspecified
Size        : 14558
License     : GPLv3 or BSD
Signature   : RSA/SHA256, Fri Jul 31 07:34:30 2020, Key ID 49fd77499570ff31
Source RPM  : hidapi-0.9.0-4.fc33.src.rpm
Build Date  : Fri Jul 31 07:16:25 2020
Build Host  : buildvm-x86-13.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://github.com/libusb/hidapi
Bug URL     : https://bugz.fedoraproject.org/hidapi
Summary     : Development files for hidapi
Description :
This package contains development files for hidapi which provides access to
USB and Bluetooth HID-class devices.
Name        : libev-devel
Version     : 4.33
Release     : 2.fc33
Architecture: x86_64
Install Date: Sat Mar 13 17:37:46 2021
Group       : Unspecified
Size        : 133637
License     : BSD or GPLv2+
Signature   : RSA/SHA256, Wed Jul 29 20:00:11 2020, Key ID 49fd77499570ff31
Source RPM  : libev-4.33-2.fc33.src.rpm
Build Date  : Wed Jul 29 06:47:51 2020
Build Host  : buildvm-x86-28.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://software.schmorp.de/pkg/libev.html
Bug URL     : https://bugz.fedoraproject.org/libev
Summary     : Development headers for libev
Description :
This package contains the development headers and libraries for libev.
Name        : libffi-devel
Version     : 3.1
Release     : 26.fc33
Architecture: x86_64
Install Date: Sat Mar 13 17:34:12 2021
Group       : Unspecified
Size        : 27392
License     : MIT
Signature   : RSA/SHA256, Wed Jul 29 20:14:40 2020, Key ID 49fd77499570ff31
Source RPM  : libffi-3.1-26.fc33.src.rpm
Build Date  : Wed Jul 29 06:49:27 2020
Build Host  : buildhw-x86-06.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://sourceware.org/libffi
Bug URL     : https://bugz.fedoraproject.org/libffi
Summary     : Development files for libffi
Description :
The libffi-devel package contains libraries and header files for
developing applications that use libffi.
Name        : perl-Pod-Html
Epoch       : 0
Version     : 1.25
Release     : 468.fc33
Architecture: noarch
Install Date: Sat Mar 13 17:37:28 2021
Group       : Unspecified
Size        : 38419
License     : GPL+ or Artistic
Signature   : RSA/SHA256, Fri Mar  5 16:38:24 2021, Key ID 49fd77499570ff31
Source RPM  : perl-5.32.1-468.fc33.src.rpm
Build Date  : Fri Mar  5 15:59:20 2021
Build Host  : buildvm-a32-09.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://www.perl.org/
Bug URL     : https://bugz.fedoraproject.org/perl
Summary     : Convert POD files to HTML
Description :
This package converts files from POD format (see perlpod) to HTML format. It
can automatically generate indexes and cross-references, and it keeps a cache
of things it knows how to cross-reference.
package pkgconfig is not installed
Name        : which
Version     : 2.21
Release     : 20.fc33
Architecture: x86_64
Install Date: Sat Mar 13 17:32:22 2021
Group       : Unspecified
Size        : 82269
License     : GPLv3
Signature   : RSA/SHA256, Fri Jul 31 23:29:59 2020, Key ID 49fd77499570ff31
Source RPM  : which-2.21-20.fc33.src.rpm
Build Date  : Fri Jul 31 01:58:07 2020
Build Host  : buildvm-x86-13.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://savannah.gnu.org/projects/which/
Bug URL     : https://bugz.fedoraproject.org/which
Summary     : Displays where a particular program in your path is located
Description :
The which command shows the full pathname of a specified program, if
the specified program is in your PATH.
# The following new OS packages need to be installed: pkgconfig
The following command needs to be run through "sudo":
    yum install pkgconfig
Allow ? [Y/n] Y
[sudo] password for user: 
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 1:10:12 ago on Wed Apr 28 20:20:05 2021.
Package pkgconf-pkg-config-1.7.3-5.fc33.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
The following command needs to be run through "sudo":
    rpm -q --whatprovides pkgconfig
Allow ? [Y/n] Y
pkgconf-pkg-config-1.7.3-5.fc33.x86_64
# OS packages installation successful

As you can see, it asks permission when running the install commands, and that works. But the commands do nothing because the packages are already installed, it is just that opam depext is failing to detect that they are already installed.

I have never used Fedora myself, so I don't really know what the problem is exactly or how to solve it, posting the above in case it may be useful.