canonical / craft-archives

A library for handling archives/repositories in Craft applications
https://canonical-craft-archives.readthedocs-hosted.com
GNU Lesser General Public License v3.0
0 stars 7 forks source link

sources: only add "compatible" architectures #96

Closed tigarmo closed 11 months ago

tigarmo commented 11 months ago

This commit both fixes the order of the parameters in the call to "dpkg --add-architecture" (the parser is picky) and updates the logic to only make said call if the target architecture (that is, the one coming from the package-repository definition) is "compatible" with the host architecture (that is, the architecture of the system running the code).

This is necessary because incompatible mixes typically break the system. For example, adding "armhf" on an "amd64" system breaks subsequent calls to "apt update" because apt will try to fetch package listings for the "armhf" architecture on the default Ubuntu archives, which don't have them.

Therefore, only the following pairs result in adding the target arch:


codecov[bot] commented 11 months ago

Codecov Report

Merging #96 (127f1bd) into main (f6cddd4) will increase coverage by 0.07%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   90.10%   90.17%   +0.07%     
==========================================
  Files          13       13              
  Lines         687      692       +5     
  Branches      140      141       +1     
==========================================
+ Hits          619      624       +5     
  Misses         50       50              
  Partials       18       18              
Files Changed Coverage Δ
craft_archives/repo/apt_sources_manager.py 94.23% <100.00%> (+0.29%) :arrow_up: