diff options
author | David Kalnischkies <david@kalnischkies.de> | 2021-09-04 16:10:50 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2021-09-04 16:20:12 +0200 |
commit | 70c669e2566d119559d2986635bb6c1d0d368073 (patch) | |
tree | 1584687e9bac78ae75bac737acb1b67a83bcdc79 /apt-private | |
parent | 79a675ddf3320bf640d130e592c86fefd1a460e1 (diff) |
Streamline access to barbarian architecture functionality
APT is not the place this information should be stored at, but it is a
good place to experiment and see what will be (not) needed in the future
for a proper implementation higher up the stack.
This is why "BarbarianArchitectures" is chosen instead of a more neutral
and/or sensible "VeryForeign" and isn't readily exported in the API to
other clients for this PoC as a to be drawn up standard will likely
require potentially incompatible changes. Having a then outdated and
slightly different implementation block a "good" name would be bad.
The functionality itself mostly exists (ignoring bugs) since the
introduction of MultiArch as we always had the risk of encountering
packages of architectures not known to dpkg (forced onto the system,
potentially before MultiArch) we had to deal with somehow and other
edge cases.
All this commit really does is allowing what could previously only be
achieved with editing sources.list and some conf options via a single
config option: -o APT::BarbarianArchitectures=foo,bar
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-source.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index 7eb5a8f4a..db96cb17f 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -638,11 +638,14 @@ static void WriteBuildDependencyPackage(std::ostringstream &buildDepsPkgFile, bool DoBuildDep(CommandLine &CmdL) { std::string hostArch = _config->Find("APT::Get::Host-Architecture"); - if (hostArch.empty() == false) + if (not hostArch.empty()) { - std::vector<std::string> archs = APT::Configuration::getArchitectures(); - if (std::find(archs.begin(), archs.end(), hostArch) == archs.end()) - return _error->Error(_("No architecture information available for %s. See apt.conf(5) APT::Architectures for setup"), hostArch.c_str()); + if (not APT::Configuration::checkArchitecture(hostArch)) + { + auto const veryforeign = _config->FindVector("APT::BarbarianArchitectures"); + if (std::find(veryforeign.begin(), veryforeign.end(), hostArch) == veryforeign.end()) + _error->Warning(_("No architecture information available for %s. See apt.conf(5) APT::Architectures for setup"), hostArch.c_str()); + } } auto const nativeArch = _config->Find("APT::Architecture"); std::string const pseudoArch = hostArch.empty() ? nativeArch : hostArch; |