Merge lp:~townsend/libertine/use-snap-user-common into lp:libertine

Proposed by Christopher Townsend
Status: Merged
Approved by: Larry Price
Approved revision: 343
Merged at revision: 344
Proposed branch: lp:~townsend/libertine/use-snap-user-common
Merge into: lp:libertine
Diff against target: 44 lines (+14/-4)
2 files modified
python/libertine/ChrootContainer.py (+1/-1)
python/libertine/utils.py (+13/-3)
To merge this branch: bzr merge lp:~townsend/libertine/use-snap-user-common
Reviewer Review Type Date Requested Status
Larry Price Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+312374@code.launchpad.net

Commit message

Redirect where the container is created when in a snap environment.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:343
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/245/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/512
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=default/405
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/405
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/405
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=vivid+overlay,testname=default/405
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/405
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/405
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/522
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/506
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/506
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/506
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/506
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/506
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/506
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/506/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/245/rebuild

review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/libertine/ChrootContainer.py'
2--- python/libertine/ChrootContainer.py 2016-12-01 17:43:12 +0000
3+++ python/libertine/ChrootContainer.py 2016-12-02 16:40:16 +0000
4@@ -167,7 +167,7 @@
5 def _build_fakechroot_command(self):
6 cmd = 'fakechroot'
7
8- if 'SNAP' in os.environ:
9+ if utils.is_snap_environment():
10 cmd = "{} -b {}/usr/sbin".format(cmd, os.environ['SNAP'])
11
12 return cmd
13
14=== modified file 'python/libertine/utils.py'
15--- python/libertine/utils.py 2016-11-09 20:10:45 +0000
16+++ python/libertine/utils.py 2016-12-02 16:40:16 +0000
17@@ -57,10 +57,13 @@
18
19
20 def get_libertine_containers_dir_path():
21- xdg_cache_home = os.getenv('XDG_CACHE_HOME',
22- os.path.join(os.getenv('HOME'), '.cache'))
23+ if is_snap_environment():
24+ libertine_cache_home = os.path.join(os.getenv('SNAP_USER_COMMON'), '.cache')
25+ else:
26+ libertine_cache_home = os.getenv('XDG_CACHE_HOME',
27+ os.path.join(os.getenv('HOME'), '.cache'))
28
29- return os.path.join(xdg_cache_home, 'libertine-container')
30+ return os.path.join(libertine_cache_home, 'libertine-container')
31
32
33 def get_libertine_database_dir_path():
34@@ -191,3 +194,10 @@
35 return False
36
37 return True
38+
39+
40+def is_snap_environment():
41+ if 'SNAP' in os.environ:
42+ return True
43+ else:
44+ return False

Subscribers

People subscribed via source and target branches