snapcraft requires optional VERSION_ID in os-release

Bug #1722650 reported by Miki Habryn
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Medium
Carlo Lobrano

Bug Description

Trying to build a snap on my Debian system fails with:

  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 770, in _find_dependencies
    dependencies += libraries.get_dependencies(elf_file)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/libraries.py", line 100, in get_dependencies
    system_libs = _get_system_libs()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/libraries.py", line 69, in _get_system_libs
    release = common.get_os_release_info()['VERSION_ID']
KeyError: 'VERSION_ID'
miki@slab:~/c/rtl_433$ uname -a
Linux slab 4.12.0-2-amd64 #1 SMP Debian 4.12.13-1 (2017-09-19) x86_64 GNU/Linux
miki@slab:~/c/rtl_433$

/etc/os-release does not contain a VERSION_ID. Adding one allows snapcraft to run successfully, however os-release(5) states that VERSION_ID is optional. Is there something else that this value could be defaulted to?

Tags: bitesize
Revision history for this message
Cris Dywan (kalikiana) wrote :

The function _get_system_libs in snapcraft/internal/libraries.py uses VERSION_ID for the filename listing the .so files to exclude. I think the fix would be to treat no VERSION_ID the same as no file.

tags: added: bitesize
Changed in snapcraft:
status: New → Confirmed
Revision history for this message
Carlo Lobrano (c-lobrano) wrote :

Hello, I'd like to work on this issue

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

@Christian, what do you mean by treating it the same as no file? Which file? We don't account for /etc/os-release not being there at all.

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

I think we just need to have reasonable backup plans for trying to determine distro. And use functions to do that rather than just accessing that dict everywhere.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Sorry for being unclear. I meant the file libraries/16.04 - the code checks if libraries/$VERSION_ID exists and skips if it doesn't. So I was thinking if the property is not provided we could do the same.

Changed in snapcraft:
assignee: nobody → Carlo Lobrano (c-lobrano)
status: Confirmed → In Progress
Changed in snapcraft:
status: In Progress → Fix Committed
milestone: none → 2.35
importance: Undecided → Medium
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Nice job Carlo. I took it a step further here so that it starts working on e.g. Trusty: https://github.com/snapcore/snapcraft/pull/1636 .

Revision history for this message
Carlo Lobrano (c-lobrano) wrote :

Alright, I was trying myself, but I like your version better.

Changed in snapcraft:
status: Fix Committed → Fix Released
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.