aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-06-21 18:07:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-06-21 18:08:52 +0300
commitee055f813ce0fc32f0461d18a126564caec2603a (patch)
tree057d276ed971c2e2d11112bdebac20c3aeb77a5a
parentfdfd3e0644095022b61316e220fce3f5a7a1a9ef (diff)
Fix system_package_manager_fedora::install() to always specify system package architecture
-rw-r--r--bpkg/system-package-manager-fedora.cxx30
-rw-r--r--bpkg/system-package-manager-fedora.test.testscript36
2 files changed, 35 insertions, 31 deletions
diff --git a/bpkg/system-package-manager-fedora.cxx b/bpkg/system-package-manager-fedora.cxx
index 5537f7a..920770e 100644
--- a/bpkg/system-package-manager-fedora.cxx
+++ b/bpkg/system-package-manager-fedora.cxx
@@ -910,8 +910,8 @@ namespace bpkg
}
}
- // Execute `dnf install` to install the specified packages (e.g., libfoo or
- // libfoo-1.2.3-1.fc35.x86_64).
+ // Execute `dnf install` to install the specified packages (e.g.,
+ // libfoo.x86_64 or libfoo-1.2.3-1.fc35.x86_64).
//
// Note that the package name can only contain alpha-numeric characters,
// '-', '.', '_', and '+' (see Guidelines for Naming Fedora Packages for
@@ -924,12 +924,12 @@ namespace bpkg
//
// By default, `dnf install` tries to interpret the spec as the
// <name>-[<epoch>:]<version>-<release>.<arch> form prior to trying the
- // <name> form until any matched packages are found (see SPECIFYING PACKAGES
- // section of dnf(8) for more details on the spec matching rules). We could
- // potentially use `dnf install-nevra` command for the package version specs
- // and `dnf install-n` for the package name specs. Let's, however, keep it
- // simple for now given that clashes for our use-case are presumably not
- // very likely.
+ // <name>.<arch> form until any matched packages are found (see SPECIFYING
+ // PACKAGES section of dnf(8) for more details on the spec matching
+ // rules). We could potentially use `dnf install-nevra` command for the
+ // package version specs and `dnf install-na` for the package name specs.
+ // Let's, however, keep it simple for now given that clashes for our
+ // use-case are presumably not very likely.
//
void system_package_manager_fedora::
dnf_install (const strings& pkgs)
@@ -1719,7 +1719,7 @@ namespace bpkg
{
string name;
string version; // Empty if unspecified.
- string arch; // Empty if version is empty.
+ string arch; // Always specified.
};
vector<package> pkgs;
@@ -1739,7 +1739,10 @@ namespace bpkg
// 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.
+ // version, expecting the candidate version to be installed. We, however,
+ // still specify the candidate architecture in this case, since for
+ // reasons unknown dnf may install a package of a different architecture
+ // otherwise.
//
bool install (false);
@@ -1758,7 +1761,7 @@ namespace bpkg
{
string n (pi.name);
string v (fi ? pi.installed_version : string ());
- string a (fi ? pi.installed_arch : string ());
+ string a (fi ? pi.installed_arch : pi.candidate_arch);
auto i (find_if (pkgs.begin (), pkgs.end (),
[&n] (const package& p)
@@ -1797,9 +1800,10 @@ namespace bpkg
{
s += '-';
s += p.version;
- s += '.';
- s += p.arch;
}
+ s += '.';
+ s += p.arch;
+
specs.push_back (move (s));
}
diff --git a/bpkg/system-package-manager-fedora.test.testscript b/bpkg/system-package-manager-fedora.test.testscript
index 95d357f..b1d5b8c 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 libpq-devel
- sudo dnf mark --quiet --assumeno install --cacheonly libpq libpq-devel
+ 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
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 libpq-devel
- sudo dnf mark --quiet --assumeno install --cacheonly libpq libpq-devel
+ 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
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 libpq-devel
- sudo dnf mark --quiet --assumeno install --cacheonly libpq libpq-devel
+ 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
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 libpq-devel
- sudo dnf mark --quiet --assumeno install --cacheonly libpq libpq-devel
+ 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
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 sqlite-devel
- sudo dnf mark --quiet --assumeno install --cacheonly sqlite-libs sqlite-devel
+ 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
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
- sudo dnf mark --quiet --assumeno install --cacheonly sqlite
+ sudo dnf install --quiet --assumeno sqlite.x86_64
+ sudo dnf mark --quiet --assumeno install --cacheonly sqlite.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 ncurses-devel ncurses-c++-libs
- sudo dnf mark --quiet --assumeno install --cacheonly ncurses-libs ncurses-devel ncurses-c++-libs
+ 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
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 ncurses-devel ncurses-c++-libs
- sudo dnf mark --quiet --assumeno install --cacheonly ncurses-libs ncurses-devel ncurses-c++-libs
+ 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
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 libsigc++20-devel
- sudo dnf mark --quiet --assumeno install --cacheonly libsigc++20 libsigc++20-devel
+ 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
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