diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-06-28 13:30:03 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-06-28 13:30:03 +0300 |
commit | 57d6cdd051ff1d92817e335a70e2d7d8c89b7306 (patch) | |
tree | 3584886d9ee6efbe3b006f4a23ad3ffa901522b2 | |
parent | 8cc72e88f7fbe3a41719225d32b98a051f1e7107 (diff) |
Specify versions for partially/not installed packages on dnf-install command line
-rw-r--r-- | bpkg/system-package-manager-fedora.cxx | 46 | ||||
-rw-r--r-- | bpkg/system-package-manager-fedora.test.testscript | 36 |
2 files changed, 59 insertions, 23 deletions
diff --git a/bpkg/system-package-manager-fedora.cxx b/bpkg/system-package-manager-fedora.cxx index 78d1739..61ded1a 100644 --- a/bpkg/system-package-manager-fedora.cxx +++ b/bpkg/system-package-manager-fedora.cxx @@ -1740,11 +1740,46 @@ namespace bpkg // or not we will also always run `dnf mark install` afterwards for all // the packages to mark them as installed by the user. // - // Note also that for partially/not installed we don't specify the - // version, expecting the candidate version to be installed. We, however, - // still specify the candidate architecture in this case, since for + // Note also that for partially/not installed packages we used to not + // specify the version, expecting the candidate version to always be + // installed (we did specify the candidate architecture though, since for // reasons unknown dnf may install a package of a different architecture - // otherwise. + // otherwise). This, however, turned out to not always be the case. + // Moreover, we have observed such an undocumented behavior, that if the + // package versions are not specified, then the dnf-install command + // outcome may depend on the order of the packages specified on the + // command line: + // + // $ dnf list expat.x86_64 expat-devel.x86_64 + // Installed Packages + // expat.x86_64 2.5.0-3.fc39 @fedora + // Available Packages + // expat.x86_64 2.6.2-1.fc39 updates + // expat-devel.x86_64 2.6.2-1.fc39 updates + // + // $ sudo dnf install expat-devel.x86_64 expat.x86_64 + // Installing: + // expat-devel x86_64 2.6.2-1.fc39 updates 54 k + // Upgrading: + // expat x86_64 2.6.2-1.fc39 updates 114 k + // + // $ sudo dnf install expat.x86_64 expat-devel.x86_64 + // Installing: + // expat-devel x86_64 2.5.0-3.fc39 fedora 52 k + // + // $ sudo dnf install expat.x86_64 + // Nothing to do. + // + // $ sudo dnf install expat-devel.x86_64 + // Installing: + // expat-devel x86_64 2.6.2-1.fc39 updates 54 k + // Upgrading: + // expat x86_64 2.6.2-1.fc39 updates 114 k + // + // Thus, we now explicitly specify the versions for the partially/not + // installed packages as well. While this approach may potentially result + // in unnecessary upgrades (in the above example we would prefer to just + // install expat-devel 2.5.0-3), it feels much simpler and more robust. // bool install (false); @@ -1762,7 +1797,8 @@ namespace bpkg for (const package_info& pi: ps.package_infos) { string n (pi.name); - string v (fi ? pi.installed_version : string ()); + //string v (fi ? pi.installed_version : string ()); + string v (fi ? pi.installed_version : pi.candidate_version); string a (fi ? pi.installed_arch : pi.candidate_arch); auto i (find_if (pkgs.begin (), pkgs.end (), diff --git a/bpkg/system-package-manager-fedora.test.testscript b/bpkg/system-package-manager-fedora.test.testscript index b1d5b8c..3655514 100644 --- a/bpkg/system-package-manager-fedora.test.testscript +++ b/bpkg/system-package-manager-fedora.test.testscript @@ -505,8 +505,8 @@ LC_ALL=C dnf list --all --cacheonly --quiet libpq-devel pq-devel rpm <libpq-devel+pq-devel.info LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" libpq-devel-13.4-1.fc35.x86_64 <libpq-devel.requires LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info - sudo dnf install --quiet --assumeno libpq.x86_64 libpq-devel.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly libpq.x86_64 libpq-devel.x86_64 + sudo dnf install --quiet --assumeno libpq-13.4-1.fc35.x86_64 libpq-devel-13.4-1.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly libpq-13.4-1.fc35.x86_64 libpq-devel-13.4-1.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info EOE libpq 13.4 (libpq 13.4-1.fc35) part installed @@ -567,8 +567,8 @@ LC_ALL=C dnf list --all --cacheonly --quiet libpq-devel pq-devel rpm <libpq-devel+pq-devel.info-fetched LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" libpq-devel-13.4-1.fc35.x86_64 <libpq-devel.requires-fetched LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info-fetched - sudo dnf install --quiet --assumeno libpq.x86_64 libpq-devel.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly libpq.x86_64 libpq-devel.x86_64 + sudo dnf install --quiet --assumeno libpq-13.4-1.fc35.x86_64 libpq-devel-13.4-1.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly libpq-13.4-1.fc35.x86_64 libpq-devel-13.4-1.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info-installed EOE libpq 13.4 (libpq 13.4-1.fc35) part installed @@ -621,8 +621,8 @@ LC_ALL=C dnf list --all --cacheonly --quiet libpq-devel pq-devel rpm <libpq-devel+pq-devel.info LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" libpq-devel-13.3-3.fc35.x86_64 <libpq-devel.requires LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info - sudo dnf install --quiet --assumeno libpq.x86_64 libpq-devel.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly libpq.x86_64 libpq-devel.x86_64 + sudo dnf install --quiet --assumeno libpq-13.3-3.fc35.x86_64 libpq-devel-13.3-3.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly libpq-13.3-3.fc35.x86_64 libpq-devel-13.3-3.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info-installed error: unexpected fedora package version for libpq info: expected: 13.3-3.fc35 @@ -677,8 +677,8 @@ LC_ALL=C dnf list --all --cacheonly --quiet libpq-devel pq-devel rpm <libpq-devel+pq-devel.info LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" libpq-devel-13.4-1.fc35.x86_64 <libpq-devel.requires LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info - sudo dnf install --quiet --assumeno libpq.x86_64 libpq-devel.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly libpq.x86_64 libpq-devel.x86_64 + sudo dnf install --quiet --assumeno libpq-13.4-1.fc35.x86_64 libpq-devel-13.4-1.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly libpq-13.4-1.fc35.x86_64 libpq-devel-13.4-1.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet libpq rpm <libpq.info-installed EOE libpq 13.4 (libpq 13.4-1.fc35) not installed @@ -869,8 +869,8 @@ LC_ALL=C dnf list --all --cacheonly --quiet libsqlite3-devel sqlite-devel rpm <libsqlite3-devel+sqlite-devel.info-fetched LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" sqlite-devel-3.36.0-3.fc35.x86_64 <sqlite-devel.requires-fetched LC_ALL=C dnf list --all --cacheonly --quiet sqlite-libs rpm <sqlite-libs.info-fetched - sudo dnf install --quiet --assumeno sqlite-libs.x86_64 sqlite-devel.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly sqlite-libs.x86_64 sqlite-devel.x86_64 + sudo dnf install --quiet --assumeno sqlite-libs-3.36.0-3.fc35.x86_64 sqlite-devel-3.36.0-3.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly sqlite-libs-3.36.0-3.fc35.x86_64 sqlite-devel-3.36.0-3.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet sqlite-libs rpm <sqlite-libs.info-installed EOE libsqlite3 3.36.0 (sqlite-libs 3.36.0-3.fc35) not installed @@ -971,8 +971,8 @@ LC_ALL=C dnf list --all --cacheonly --quiet sqlite3 sqlite rpm <sqlite3+sqlite.info sudo dnf makecache --quiet --assumeno --refresh LC_ALL=C dnf list --all --cacheonly --quiet sqlite3 sqlite rpm <sqlite3+sqlite.info-fetched - sudo dnf install --quiet --assumeno sqlite.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly sqlite.x86_64 + sudo dnf install --quiet --assumeno sqlite-3.36.0-3.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly sqlite-3.36.0-3.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet sqlite rpm <sqlite.info-installed EOE sqlite3 3.36.0 (sqlite 3.36.0-3.fc35) not installed @@ -1131,8 +1131,8 @@ LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" ncurses-devel-6.2-8.20210508.fc35.x86_64 <ncurses-devel.requires-fetched LC_ALL=C dnf list --all --cacheonly --quiet ncurses-libs rpm <ncurses-libs.info-fetched LC_ALL=C dnf list --all --cacheonly --quiet ncurses-c++-libs ncurses-devel rpm <ncurses-c++-libs+ncurses-devel.info-fetched - sudo dnf install --quiet --assumeno ncurses-libs.x86_64 ncurses-devel.x86_64 ncurses-c++-libs.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly ncurses-libs.x86_64 ncurses-devel.x86_64 ncurses-c++-libs.x86_64 + sudo dnf install --quiet --assumeno ncurses-libs-6.2-8.20210508.fc35.x86_64 ncurses-devel-6.2-8.20210508.fc35.x86_64 ncurses-c++-libs-6.2-8.20210508.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly ncurses-libs-6.2-8.20210508.fc35.x86_64 ncurses-devel-6.2-8.20210508.fc35.x86_64 ncurses-c++-libs-6.2-8.20210508.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet ncurses-libs ncurses-c++-libs rpm <ncurses-libs+ncurses-c++-libs.info-installed EOE libncurses 6.2.0 (ncurses-libs 6.2-8.20210508.fc35) part installed @@ -1215,8 +1215,8 @@ LC_ALL=C dnf repoquery --requires --quiet --cacheonly --resolve --qf "%{name} %{arch} %{epoch}:%{version}-%{release}" ncurses-devel-6.2-8.20210508.fc35.x86_64 <ncurses-devel.requires-fetched LC_ALL=C dnf list --all --cacheonly --quiet ncurses-libs rpm <ncurses-libs.info-fetched LC_ALL=C dnf list --all --cacheonly --quiet ncurses-c++-libs ncurses-devel rpm <ncurses-c++-libs+ncurses-devel.info-fetched - sudo dnf install --quiet --assumeno ncurses-libs.x86_64 ncurses-devel.x86_64 ncurses-c++-libs.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly ncurses-libs.x86_64 ncurses-devel.x86_64 ncurses-c++-libs.x86_64 + sudo dnf install --quiet --assumeno ncurses-libs-6.2-8.20210508.fc35.x86_64 ncurses-devel-6.2-8.20210508.fc35.x86_64 ncurses-c++-libs-6.2-8.20210508.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly ncurses-libs-6.2-8.20210508.fc35.x86_64 ncurses-devel-6.2-8.20210508.fc35.x86_64 ncurses-c++-libs-6.2-8.20210508.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet ncurses-libs ncurses-c++-libs rpm <ncurses-libs+ncurses-c++-libs.info-installed EOE libncurses 6.2.0 (ncurses-libs 6.2-8.20210508.fc35) not installed @@ -1318,8 +1318,8 @@ sudo dnf makecache --quiet --assumeno --refresh LC_ALL=C dnf list --all --cacheonly --quiet libsigc++30 libsigc++30-devel rpm <libsigc++30+libsigc++30-devel.info LC_ALL=C dnf list --all --cacheonly --quiet libsigc++20 libsigc++20-devel rpm <libsigc++20+libsigc++20-devel.info - sudo dnf install --quiet --assumeno libsigc++20.x86_64 libsigc++20-devel.x86_64 - sudo dnf mark --quiet --assumeno install --cacheonly libsigc++20.x86_64 libsigc++20-devel.x86_64 + sudo dnf install --quiet --assumeno libsigc++20-2.10.7-3.fc35.x86_64 libsigc++20-devel-2.10.7-3.fc35.x86_64 + sudo dnf mark --quiet --assumeno install --cacheonly libsigc++20-2.10.7-3.fc35.x86_64 libsigc++20-devel-2.10.7-3.fc35.x86_64 LC_ALL=C dnf list --all --cacheonly --quiet libsigc++20 rpm <libsigc++20.info-installed EOE libsigc++ 2.10.7 (libsigc++20 2.10.7-3.fc35) part installed |