Merge lp:~mterry/snapcraft/arch-fixes into lp:~snappy-dev/snapcraft/core

Proposed by Michael Terry on 2015-07-28
Status: Merged
Approved by: Michael Terry on 2015-08-04
Approved revision: 119
Merged at revision: 117
Proposed branch: lp:~mterry/snapcraft/arch-fixes
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 155 lines (+38/-6)
8 files modified
debian/control (+3/-0)
integration-tests/data/assemble/binary1.after (+4/-0)
integration-tests/data/assemble/package.yaml.after (+2/-1)
integration-tests/data/assemble/snappy/package.yaml (+1/-1)
integration-tests/units/jobs.pxu (+4/-0)
snapcraft/cmds.py (+4/-0)
snapcraft/common.py (+16/-0)
snapcraft/yaml.py (+4/-4)
To merge this branch: bzr merge lp:~mterry/snapcraft/arch-fixes
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) 2015-07-28 Approve on 2015-08-04
Review via email: mp+266149@code.launchpad.net

Commit Message

Include the multiarch triplet to LD_LIBRARY_PATH and set the 'architecture' key in package.yaml if not present for the user.

Description of the Change

Include the multiarch triplet to LD_LIBRARY_PATH and set the 'architecture' key in package.yaml if not present for the user.

To post a comment you must log in.
Michael Terry (mterry) wrote :

(I dropped the 'ar gs' bit because quotes are not legal characters in a service stop field and we weren't actually generating a snap file in that test. I don't know how you are supposed to pass arguments with spaces. But that's not snapcraft's problem.)

Ted Gould (ted) :
Michael Terry (mterry) wrote :

Address your comments, Ted. Thanks!

Ricardo Salveti (rsalveti) wrote :

We might need to extend the DEB_BUILD later on if we add support for cross build (since the target arch is different), but this is great for now.

review: Approve
Snappy Tarmac (snappydevtarmac) wrote :
Download full text (124.1 KiB)

The attempt to merge lp:~mterry/snapcraft/arch-fixes into lp:snapcraft failed. Below is the output from the failed tests.

parts:
cp --preserve=all zzz /tmp/tmprb6m7qg2/parts/copy/install/zzz
cp --preserve=all src /tmp/tmpb9baxo95/parts/copy/install/dst
cp --preserve=all src /tmp/tmpbs3pg_c8/parts/copy/install/dir/dst
===============================[ Analyzing Jobs ]===============================
=============================[ Session Statistics ]=============================
This session is about 0.00% complete
Estimated duration is 5.70 for automated jobs.
Estimated duration cannot be determined for manual jobs.
Size of the desired job list: 19
Size of the effective execution plan: 19
===========================[ Running Selected Jobs ]============================
--------------[ Running job 1 / 19. Estimated time left: 0:00:06 ]--------------
--------------------------[ snapcraft/normal/no-yaml ]--------------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/no-yaml
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
Could not find snapcraft.yaml. Are you sure you're in the right directory? To start a new project, use 'snapcraft init'
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 2 / 19. Estimated time left: 0:00:06 ]--------------
---------------------[ snapcraft/normal/assemble-no-meta ]----------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/assemble-no-meta
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
Pulling make-project Building make-project make: Nothing to be done for `all'. cp -a bin /tmp/cwd-gc_t2um1.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/bin cp -a subdir /tmp/cwd-gc_t2um1.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/subdir if [ -e copy-meta ]; then \ cp -arT snappy /tmp/cwd-gc_t2um1.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/meta; \ fi cp -a service-start service-stop binary1 /tmp/cwd-gc_t2um1.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/ make make install DESTDIR=/tmp/cwd-gc_t2um1.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install Staging make-project Snapping make-project Missing snappy metadata file 'meta/package.yaml'. Try specifying 'snappy-metadata' in snapcraft.yaml, pointing to a meta directory in your source tree.
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 3 / 19. Estimated time left: 0:00:05 ]--------------
-----------------[ snapcraft/normal/assemble-meta-externally ]------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/assemble-meta-externally
Category: 2013.com.canonical.plainbox::uncategorised
... 8< ------------------------------------------------------...

Snappy Tarmac (snappydevtarmac) wrote :
Download full text (127.0 KiB)

The attempt to merge lp:~mterry/snapcraft/arch-fixes into lp:snapcraft failed. Below is the output from the failed tests.

parts:
cp --preserve=all zzz /tmp/tmpneqmzl0n/parts/copy/install/zzz
cp --preserve=all src /tmp/tmp5a40or_g/parts/copy/install/dst
cp --preserve=all src /tmp/tmptuomgmgk/parts/copy/install/dir/dst
===============================[ Analyzing Jobs ]===============================
=============================[ Session Statistics ]=============================
This session is about 0.00% complete
Estimated duration is 5.70 for automated jobs.
Estimated duration cannot be determined for manual jobs.
Size of the desired job list: 19
Size of the effective execution plan: 19
===========================[ Running Selected Jobs ]============================
--------------[ Running job 1 / 19. Estimated time left: 0:00:06 ]--------------
--------------------------[ snapcraft/normal/no-yaml ]--------------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/no-yaml
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
Could not find snapcraft.yaml. Are you sure you're in the right directory? To start a new project, use 'snapcraft init'
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 2 / 19. Estimated time left: 0:00:06 ]--------------
---------------------[ snapcraft/normal/assemble-no-meta ]----------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/assemble-no-meta
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
Pulling make-project Building make-project make: Nothing to be done for `all'. cp -a bin /tmp/cwd-mo5sfdqq.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/bin cp -a subdir /tmp/cwd-mo5sfdqq.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/subdir if [ -e copy-meta ]; then \ cp -arT snappy /tmp/cwd-mo5sfdqq.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/meta; \ fi cp -a service-start service-stop binary1 /tmp/cwd-mo5sfdqq.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install/ make make install DESTDIR=/tmp/cwd-mo5sfdqq.9812b6d1dd2c7b455a6d7f3d08d2a5598605734397c3502e75d2d7dec126c0a6/parts/make-project/install Staging make-project Snapping make-project Missing snappy metadata file 'meta/package.yaml'. Try specifying 'snappy-metadata' in snapcraft.yaml, pointing to a meta directory in your source tree.
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 3 / 19. Estimated time left: 0:00:05 ]--------------
-----------------[ snapcraft/normal/assemble-meta-externally ]------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/assemble-meta-externally
Category: 2013.com.canonical.plainbox::uncategorised
... 8< ------------------------------------------------------...

lp:~mterry/snapcraft/arch-fixes updated on 2015-08-04
119. By Michael Terry on 2015-08-04

Also add ubuntu-snappy-cli as build-dep

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-07-31 10:47:12 +0000
3+++ debian/control 2015-08-04 20:46:15 +0000
4@@ -6,6 +6,7 @@
5 cmake,
6 debhelper (>= 9),
7 dh-python,
8+ dpkg-dev,
9 git,
10 pep8,
11 plainbox,
12@@ -15,6 +16,7 @@
13 python3-fixtures,
14 python3-setuptools,
15 python3-yaml,
16+ ubuntu-snappy-cli,
17 xz-utils,
18 Homepage: https://launchpad.net/snapcraft
19 Standards-Version: 3.9.6
20@@ -24,6 +26,7 @@
21 Depends: ${misc:Depends},
22 ${python3:Depends},
23 bzr,
24+ dpkg-dev,
25 git,
26 python3-apt,
27 python3-yaml,
28
29=== added file 'integration-tests/data/assemble/binary1.after'
30--- integration-tests/data/assemble/binary1.after 1970-01-01 00:00:00 +0000
31+++ integration-tests/data/assemble/binary1.after 2015-08-04 20:46:15 +0000
32@@ -0,0 +1,4 @@
33+#!/bin/sh
34+export PATH="$SNAP_APP_PATH/bin:$SNAP_APP_PATH/usr/bin:$PATH"
35+export LD_LIBRARY_PATH="$SNAP_APP_PATH/lib:$SNAP_APP_PATH/usr/lib:$SNAP_APP_PATH/lib/@MULTIARCH@:$SNAP_APP_PATH/usr/lib/@MULTIARCH@:$LD_LIBRARY_PATH"
36+exec "$SNAP_APP_PATH/binary1" $*
37\ No newline at end of file
38
39=== modified file 'integration-tests/data/assemble/package.yaml.after'
40--- integration-tests/data/assemble/package.yaml.after 2015-07-21 19:09:27 +0000
41+++ integration-tests/data/assemble/package.yaml.after 2015-08-04 20:46:15 +0000
42@@ -1,3 +1,4 @@
43+architecture: @ARCH@
44 binaries:
45 - exec: binary1.wrapper
46 name: assemble-bin
47@@ -7,6 +8,6 @@
48 services:
49 - name: assemble-service
50 start: service-start.wrapper
51- stop: service-stop.wrapper with 'ar gs'
52+ stop: service-stop.wrapper with args
53 vendor: mterry@ubuntu.com
54 version: 1.0
55
56=== modified file 'integration-tests/data/assemble/snappy/package.yaml'
57--- integration-tests/data/assemble/snappy/package.yaml 2015-07-21 19:09:27 +0000
58+++ integration-tests/data/assemble/snappy/package.yaml 2015-08-04 20:46:15 +0000
59@@ -4,7 +4,7 @@
60 services:
61 - name: assemble-service
62 start: service-start
63- stop: "./service-stop with ar\\ gs"
64+ stop: "./service-stop with args"
65 binaries:
66 - name: assemble-bin
67 exec: binary1
68
69=== modified file 'integration-tests/units/jobs.pxu'
70--- integration-tests/units/jobs.pxu 2015-07-28 19:55:07 +0000
71+++ integration-tests/units/jobs.pxu 2015-08-04 20:46:15 +0000
72@@ -36,7 +36,11 @@
73 cp -rT $PLAINBOX_PROVIDER_DATA/assemble .
74 echo "snappy-metadata: snappy" >> snapcraft.yaml
75 ${SNAPCRAFT} assemble
76+ test -e "assemble_1.0_$(dpkg-architecture -qDEB_BUILD_ARCH).snap"
77+ sed -i "s/@ARCH@/$(dpkg-architecture -qDEB_BUILD_ARCH)/g" package.yaml.after
78 diff -u package.yaml.after snap/meta/package.yaml
79+ sed -i "s/@MULTIARCH@/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/g" binary1.after
80+ diff -u binary1.after snap/binary1.wrapper
81 export SNAP_APP_PATH=`pwd`/snap
82 test "$(./snap/service-start.wrapper)" = "service-start"
83 test "$(./snap/service-stop.wrapper)" = "service-stop"
84
85=== modified file 'snapcraft/cmds.py'
86--- snapcraft/cmds.py 2015-07-30 18:42:09 +0000
87+++ snapcraft/cmds.py 2015-08-04 20:46:15 +0000
88@@ -144,6 +144,10 @@
89 stopwrap = wrap_exe(stopparts[0])
90 binary['stop'] = replace_cmd(stopparts, stopwrap)
91
92+ # Set architecture if none provided
93+ if 'architecture' not in package and 'architectures' not in package:
94+ package['architecture'] = snapcraft.common.get_arch()
95+
96 with open("snap/meta/package.yaml", 'w') as f:
97 yaml.dump(package, f, default_flow_style=False)
98
99
100=== modified file 'snapcraft/common.py'
101--- snapcraft/common.py 2015-07-23 17:19:25 +0000
102+++ snapcraft/common.py 2015-08-04 20:46:15 +0000
103@@ -25,6 +25,8 @@
104 COMMAND_ORDER = ["pull", "build", "stage", "snap"]
105 _DEFAULT_PLUGINDIR = '/usr/share/snapcraft/plugins'
106 _plugindir = _DEFAULT_PLUGINDIR
107+_arch = None
108+_arch_triplet = None
109
110 env = []
111
112@@ -48,6 +50,20 @@
113 sys.exit(1)
114
115
116+def get_arch():
117+ global _arch
118+ if _arch is None:
119+ _arch = subprocess.check_output(['dpkg-architecture', '-qDEB_BUILD_ARCH']).decode('utf8').strip()
120+ return _arch
121+
122+
123+def get_arch_triplet():
124+ global _arch_triplet
125+ if _arch_triplet is None:
126+ _arch_triplet = subprocess.check_output(['dpkg-architecture', '-qDEB_BUILD_MULTIARCH']).decode('utf8').strip()
127+ return _arch_triplet
128+
129+
130 def get_stagedir():
131 return os.path.join(os.getcwd(), 'stage')
132
133
134=== modified file 'snapcraft/yaml.py'
135--- snapcraft/yaml.py 2015-07-23 17:19:25 +0000
136+++ snapcraft/yaml.py 2015-08-04 20:46:15 +0000
137@@ -113,14 +113,14 @@
138
139 def runtime_env(self, root):
140 env = []
141- env.append("PATH=\"%s/bin:%s/usr/bin:$PATH\"" % (root, root))
142- env.append("LD_LIBRARY_PATH=\"%s/lib:%s/usr/lib:$LD_LIBRARY_PATH\"" % (root, root))
143+ env.append('PATH="{0}/bin:{0}/usr/bin:$PATH"'.format(root))
144+ env.append('LD_LIBRARY_PATH="{0}/lib:{0}/usr/lib:{0}/lib/{1}:{0}/usr/lib/{1}:$LD_LIBRARY_PATH"'.format(root, snapcraft.common.get_arch_triplet()))
145 return env
146
147 def build_env(self, root):
148 env = []
149- env.append("CFLAGS=\"-I%s/include $CFLAGS\"" % root)
150- env.append("LDFLAGS=\"-L%s/lib -L%s/usr/lib $LDFLAGS\"" % (root, root))
151+ env.append('CFLAGS="-I{0}/include -I{0}/usr/include -I{0}/include/{1} -I{0}/usr/include/{1} $CFLAGS"'.format(root, snapcraft.common.get_arch_triplet()))
152+ env.append('LDFLAGS="-L{0}/lib -L{0}/usr/lib -L{0}/lib/{1} -L{0}/usr/lib/{1} $LDFLAGS"'.format(root, snapcraft.common.get_arch_triplet()))
153 return env
154
155 def build_env_for_part(self, part):

Subscribers

People subscribed via source and target branches