Merge ~sylvain-pineau/checkbox-core-snap:fix-distro-traceback into checkbox-core-snap:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: ae03a14105e60204892c051198e37a7652be606a
Merged at revision: 226f68a130c7be2df63373ee26f11f69aed84a0a
Proposed branch: ~sylvain-pineau/checkbox-core-snap:fix-distro-traceback
Merge into: checkbox-core-snap:master
Diff against target: 22 lines (+1/-3)
1 file modified
snap/snapcraft.yaml (+1/-3)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+412804@code.launchpad.net

Description of the change

A fix for the following error on Jammy:

+ /usr/bin/python3 -m pip install -U meson
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 297, in run
    session = self.get_default_session(options)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 78, in get_default_session
    self._session = self.enter_context(self._build_session(options))
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 88, in _build_session
    session = PipSession(
  File "/usr/lib/python3/dist-packages/pip/_internal/network/session.py", line 248, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/lib/python3/dist-packages/pip/_internal/network/session.py", line 131, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl/distro.py", line 125, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl/distro.py", line 681, in linux_distribution
    self.version(),
  File "/usr/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/usr/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Failed to build 'glmark2'.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Note that we should only add it for jammy builds (not even sure it's available in the esm repo for 16.04)

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

self-approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
2index 6a9dce9..6a904ad 100644
3--- a/snap/snapcraft.yaml
4+++ b/snap/snapcraft.yaml
5@@ -134,6 +134,7 @@ parts:
6 source: git://git.launchpad.net/checkbox-support
7 stage-packages:
8 # actual requirements
9+ - python3-distro
10 - python3-requests-unixsocket
11 - python3-systemd
12 # added to stage python:
13@@ -163,9 +164,6 @@ parts:
14 build-environment:
15 - C_INCLUDE_PATH: /usr/include/python3.9
16 - PYTHONPATH: $SNAPCRAFT_PART_INSTALL/usr/lib/python3/dist-packages:$PYTHONPATH
17- override-stage: |
18- snapcraftctl stage
19- sed -i 's|except OSError: # Command not found|except subprocess.CalledProcessError: # Command not found|g' lib/python3.*/site-packages/distro.py
20 ################################################################################
21 checkbox-ng:
22 source-tag: ""

Subscribers

People subscribed via source and target branches