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

Add capability to find binaries to resolve_spec #340

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

j-mracek
Copy link
Contributor

It will enhance UX when usel want to install package according to binary name without additional search steps.

It will allow to install open-ssh using dnf5 install ssh.

Resolves: #338

@jan-kolarik
Copy link
Member

I was just wondering if we could provide also a unit test for this functionality.

@m-blaha m-blaha self-assigned this Mar 13, 2023
@j-mracek
Copy link
Contributor Author

I was just wondering if we could provide also a unit test for this functionality.

The test would require available pm providing a file. may be CI-test would be more appropriate. What do you think?

@jan-kolarik
Copy link
Member

I was just wondering if we could provide also a unit test for this functionality.

The test would require available pm providing a file. may be CI-test would be more appropriate. What do you think?

Yes, you're right, that would be better in this case.

*p_impl &= filter_result;
return {true, libdnf::rpm::Nevra()};
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this search in the file lists needed? Files from /usr/(s)bin/ should be present in regular provides.

Copy link
Contributor Author

@j-mracek j-mracek Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. Here is a part of primary.xml for DNF5 package and as you can see - binary files are stated as file and not provide.

<package type="rpm">
  <name>dnf5</name>
  <arch>x86_64</arch>
  <version epoch="0" ver="5.0.6" rel="0.20230301010623.5.0.5+82.gc6a09ee9.fc36"/>
  <checksum type="sha256" pkgid="YES">259ff4eb1ad98938e5dcb77f682fd21cde9d3a22be4b18fff5111577a609522d</checksum>
  <summary>Command-line package manager</summary>
  <description>DNF5 is a command-line package manager that automates the process of installing, upgrading, configuring, and removing computer programs in a consistent manner. It supports RPM packages, modulemd modules, and comps groups & environments.</description>
  <packager/>
  <url>https://github.com/rpm-software-management/dnf5</url>
  <time file="1677634031" build="1677633011"/>
  <size package="421507" installed="1100471" archive="1106636"/>
  <location href="05580779-dnf5/dnf5-5.0.6-0.20230301010623.5.0.5+82.gc6a09ee9.fc36.x86_64.rpm"/>
  <format>
    <rpm:license>GPL-2.0-or-later</rpm:license>
    <rpm:vendor>Fedora Copr - user rpmsoftwaremanagement</rpm:vendor>
    <rpm:group>Unspecified</rpm:group>
    <rpm:buildhost>copr-hv-x86-64-03-prod-00940260-20230301-010515</rpm:buildhost>
    <rpm:sourcerpm>dnf5-5.0.6-0.20230301010623.5.0.5+82.gc6a09ee9.fc36.src.rpm</rpm:sourcerpm>
    <rpm:header-range start="5112" end="21437"/>
    <rpm:provides>
      <rpm:entry name="config(dnf5)" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230301010623.5.0.5+82.gc6a09ee9.fc36"/>
      <rpm:entry name="dnf5" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230301010623.5.0.5+82.gc6a09ee9.fc36"/>
      <rpm:entry name="dnf5(x86-64)" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230301010623.5.0.5+82.gc6a09ee9.fc36"/>
    </rpm:provides>
<rpm:requires>
<rpm:entry name="dnf-data"/>
<rpm:entry name="libdnf-cli.so.1()(64bit)"/>
<rpm:entry name="libdnf5(x86-64)" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230301010623.5.0.5+82.gc6a09ee9.fc36"/>
<rpm:entry name="libdnf5-cli(x86-64)" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230301010623.5.0.5+82.gc6a09ee9.fc36"/>
<rpm:entry name="libdnf5.so.1()(64bit)"/>
<rpm:entry name="libfmt.so.8()(64bit)"/>
<rpm:entry name="libgcc_s.so.1()(64bit)"/>
<rpm:entry name="libgcc_s.so.1(GCC_3.0)(64bit)"/>
<rpm:entry name="libgcc_s.so.1(GCC_3.3.1)(64bit)"/>
<rpm:entry name="libsmartcols.so.1()(64bit)"/>
<rpm:entry name="libsmartcols.so.1(SMARTCOLS_2.25)(64bit)"/>
<rpm:entry name="libsmartcols.so.1(SMARTCOLS_2.29)(64bit)"/>
<rpm:entry name="libstdc++.so.6()(64bit)"/>
<rpm:entry name="libstdc++.so.6(CXXABI_1.3)(64bit)"/>
<rpm:entry name="libstdc++.so.6(CXXABI_1.3.5)(64bit)"/>
<rpm:entry name="libstdc++.so.6(CXXABI_1.3.9)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.11)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.14)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.15)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.18)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.19)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.20)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.21)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.26)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.29)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.30)(64bit)"/>
<rpm:entry name="libstdc++.so.6(GLIBCXX_3.4.9)(64bit)"/>
<rpm:entry name="rtld(GNU_HASH)"/>
<rpm:entry name="libc.so.6(GLIBC_2.34)(64bit)"/>
</rpm:requires>
<rpm:recommends>
<rpm:entry name="bash-completion"/>
</rpm:recommends>
<file type="dir">/etc/dnf/dnf5-aliases.d</file>
<file>/etc/dnf/dnf5-aliases.d/README</file>
<file>/usr/bin/dnf5</file>
</format>
</package>
<package type="rpm">
<name>dnf5</name>
<arch>src</arch>
<version epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<checksum type="sha256" pkgid="YES">c466a133f5b804c588993cb37659a25374150ca3e8b5b64afff5a3b632555ced</checksum>
<summary>Command-line package manager</summary>
<description>DNF5 is a command-line package manager that automates the process of installing, upgrading, configuring, and removing computer programs in a consistent manner. It supports RPM packages, modulemd modules, and comps groups & environments.</description>
<packager/>
<url>https://github.com/rpm-software-management/dnf5</url>
<time file="1677720406" build="1677719347"/>
<size package="507053" installed="507403" archive="507812"/>
<location href="05584385-dnf5/dnf5-5.0.6-0.20230302010422.5.0.5+91.g09a7f0c7.fc36.src.rpm"/>
<format>
<rpm:license>GPL-2.0-or-later</rpm:license>
<rpm:vendor>Fedora Copr - user rpmsoftwaremanagement</rpm:vendor>
<rpm:group>Unspecified</rpm:group>
<rpm:buildhost>copr-hv-x86-64-01-prod-00947859-20230302-004248</rpm:buildhost>
<rpm:sourcerpm/>
<rpm:header-range start="5112" end="15833"/>
<rpm:provides>
<rpm:entry name="dnf5" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="libdnf5" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="libdnf5-cli" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="dnf5-devel" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="libdnf5-devel" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="libdnf5-cli-devel" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="perl-libdnf5" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="perl-libdnf5-cli" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="python3-libdnf5" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="python3-libdnf5-cli" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="ruby-libdnf5" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="ruby-libdnf5-cli" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="libdnf5-plugin-actions" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="python3-libdnf5-python-plugins-loader" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="dnf5daemon-client" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="dnf5daemon-server" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="dnf5-plugins" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="dnf5-debuginfo" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
<rpm:entry name="dnf5-debugsource" flags="EQ" epoch="0" ver="5.0.6" rel="0.20230302010422.5.0.5+91.g09a7f0c7.fc36"/>
</rpm:provides>
<rpm:requires>
<rpm:entry name="bash-completion"/>
<rpm:entry name="cmake"/>
<rpm:entry name="createrepo_c"/>
<rpm:entry name="doxygen"/>
<rpm:entry name="gcc-c++"/>
<rpm:entry name="gettext"/>
<rpm:entry name="perl(Test::Exception)"/>
<rpm:entry name="perl(Test::More)"/>
<rpm:entry name="perl(strict)"/>
<rpm:entry name="perl(warnings)"/>
<rpm:entry name="perl-devel"/>
<rpm:entry name="perl-generators"/>
<rpm:entry name="pkgconfig(check)"/>
<rpm:entry name="pkgconfig(cppunit)"/>
<rpm:entry name="pkgconfig(fmt)"/>
<rpm:entry name="pkgconfig(json-c)"/>
<rpm:entry name="pkgconfig(libcomps)"/>
<rpm:entry name="pkgconfig(libcrypto)"/>
<rpm:entry name="pkgconfig(librepo)" flags="GE" epoch="0" ver="1.15.0"/>
<rpm:entry name="pkgconfig(libsolv)" flags="GE" epoch="0" ver="0.7.21"/>
<rpm:entry name="pkgconfig(libsolvext)" flags="GE" epoch="0" ver="0.7.21"/>
<rpm:entry name="pkgconfig(modulemd-2.0)" flags="GE" epoch="0" ver="2.5.0"/>
<rpm:entry name="pkgconfig(rpm)" flags="GE" epoch="0" ver="4.17.0"/>
<rpm:entry name="pkgconfig(ruby)"/>
<rpm:entry name="pkgconfig(sdbus-c++)" flags="GE" epoch="0" ver="0.8.1"/>
<rpm:entry name="pkgconfig(smartcols)"/>
<rpm:entry name="pkgconfig(sqlite3)"/>
<rpm:entry name="pkgconfig(zck)" flags="GE" epoch="0" ver="0.9.11"/>
<rpm:entry name="python3-devel"/>
<rpm:entry name="python3dist(breathe)"/>
<rpm:entry name="python3dist(sphinx)" flags="GE" epoch="0" ver="4.1.2"/>
<rpm:entry name="python3dist(sphinx-rtd-theme)"/>
<rpm:entry name="rpm-build"/>
<rpm:entry name="rubygem-test-unit"/>
<rpm:entry name="swig" flags="GE" epoch="0" ver="4"/>
<rpm:entry name="systemd-rpm-macros"/>
<rpm:entry name="toml11-static"/>
</rpm:requires>
</format>
</package>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. So the difference for binaries and config files is that these files are included in primary metadata and we do not need to download filelists. But they still are files. Thanks for clarification.

@j-mracek
Copy link
Contributor Author

Test for the PR rpm-software-management/ci-dnf-stack#1234

It will enhance UX when usel want to install package according to binary
name without additional search steps.

It will allow to install open-ssh using `dnf5 install ssh`.

Resolves: rpm-software-management#338
Copy link
Member

@m-blaha m-blaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@m-blaha m-blaha merged commit dd990eb into rpm-software-management:main Mar 15, 2023
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

Successfully merging this pull request may close these issues.

Extend SPEC capabilities to binary search
3 participants