using an invalid architecture in stage-packages causes a mess

Bug #1660903 reported by Leo Arias
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
In Progress
Undecided
Cris Dywan

Bug Description

Adding a stage package like this one:

stage-packages: ['hello:invalid']

results in the following suggestion:

You may need to add support for this architecture with 'dpkg --add-architecture invalid'.

If you actually go ahead an run that command, dpkg will not complain about the invalid architecture, which leaves you with invalid apt sources. You won't be able to run apt update, and thus you won't be able to run snapcraft.

I think we should only suggest to add the architecture if it is a valid one.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

> If you actually go ahead an run that command, dpkg will not complain about the invalid architecture, which leaves you with invalid apt sources.

Oh gross, I didn't know that :( . We should probably check against `dpkg-architecture -L`, then.

Cris Dywan (kalikiana)
Changed in snapcraft:
assignee: nobody → Christian Dywan (kalikiana)
status: New → Confirmed
Revision history for this message
Cris Dywan (kalikiana) wrote :

So, in my PR 31348 [1] to setup the host for multiple architectures, I'm using 'dpkg --print-architecture' followed by 'dpkg --print-foreign-architectures' to tell what's already installed, and if not tell you what's required to add it. The error message will replace the error being discussed here, if I also use 'dpkg-architecture -L' in the error as per Kyle's suggestion.
Although if preferred I can make it two separate PRs.

[1] https://github.com/snapcore/snapcraft/pull/1348

Cris Dywan (kalikiana)
Changed in snapcraft:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.