Merge lp:~ted/snapcraft/pkg-config-sysroot into lp:~snappy-dev/snapcraft/core

Proposed by Ted Gould
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 190
Merged at revision: 205
Proposed branch: lp:~ted/snapcraft/pkg-config-sysroot
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 129 lines (+76/-4)
6 files modified
integration-tests/data/build-tools/Makefile (+6/-0)
integration-tests/data/build-tools/icon.svg (+1/-0)
integration-tests/data/build-tools/snapcraft.yaml (+14/-0)
integration-tests/units/jobs.pxu (+12/-0)
snapcraft/__init__.py (+7/-0)
snapcraft/yaml.py (+36/-4)
To merge this branch: bzr merge lp:~ted/snapcraft/pkg-config-sysroot
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Daniel Holbach (community) Needs Fixing
Review via email: mp+271751@code.launchpad.net

Commit message

Ensure C library configuration tools don't use system paths

Description of the change

Creating a new dev box with Wily and realized that previously some deps were getting pulled from my system. Fixing them.

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Looks good, I'd just move the method to repo.Ubuntu.

Also a small integration or unit test would be great.

review: Needs Fixing
Revision history for this message
Ted Gould (ted) wrote :

Kinda a crazy test, but it does test the feature.

Revision history for this message
Sergio Schvezov (sergiusens) :
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

ty vm

review: Approve
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :
Download full text (3.5 MiB)

The attempt to merge lp:~ted/snapcraft/pkg-config-sysroot into lp:snapcraft failed. Below is the output from the failed tests.

The project has gotten complex.
Here's the list of units exceeding 10:
- ./snapcraft/cmds.py:
  284:1: 'cmd' 13

name: # the name of the snap
version: # the version of the snap
# The vendor for the snap (replace 'Vendor <email address hidden>')
vendor: Vendor <email address hidden>
summary: # 79 char long summary
description: # A longer description for the snap
icon: # A path to an icon for the package
cp --preserve=all -R zzz /tmp/tmphawmcd93/parts/copy/install/zzz
cp --preserve=all -R src /tmp/tmpiw9glgqg/parts/copy/install/dst
cp --preserve=all -R src /tmp/tmpaqsrsx5k/parts/copy/install/dir/dst

deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted
deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted
deb http://ports.ubuntu.com/ubuntu-ports/ trusty universe
deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates universe
deb http://ports.ubuntu.com/ubuntu-ports/ trusty multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates multiverse
deb http://ports.ubuntu.com/ubuntu-ports trusty-security main restricted
deb http://ports.ubuntu.com/ubuntu-ports trusty-security universe
deb http://ports.ubuntu.com/ubuntu-ports trusty-security multiverse

===============================[ Analyzing Jobs ]===============================
=============================[ Session Statistics ]=============================
This session is about 0.00% complete
Estimated duration is 97.30 for automated jobs.
Estimated duration cannot be determined for manual jobs.
Size of the desired job list: 27
Size of the effective execution plan: 27
===========================[ Running Selected Jobs ]============================
--------------[ Running job 1 / 27. Estimated time left: 0:01:37 ]--------------
--------------------------[ 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 are in the right directory? To start a new project, use 'snapcraft init'
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 2 / 27. Estimated time left: 0:01:37 ]--------------
------------------------[ snapcraft/normal/no-yaml-run ]------------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/no-yaml-run
Category: 2013.com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
Could not find snapcraft.yaml. Are you sure you are in the right directory? To start a new project, use 'snapcraft init'
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 3 / 27. Estimated time left: 0:01:37 ]--------------
-----------------[ snapcraft/normal/assemble-meta-externally ]------------------
ID: 2015.com.canonical.snapcraft::snapcraft/normal/assemble-meta-ex...

Revision history for this message
Daniel Holbach (dholbach) wrote :

2015.com.canonical.snapcraft::snapcraft/normal/build-tool-paths: fail

+ cp -rT /tmp/tarmac/branch.l0nry5/integration-tests/data/build-tools .
+ snapcraft stage
No keyring installed in /tmp/cwd-_o0ohin1.5a9a153f54a0cb00280a728f7f26acc5a87ce06f9284b77abfa4b99251a0153d/parts/make-project/ubuntu/etc/apt/trusted.gpg.d/.No keyring installed in /tmp/cwd-_o0ohin1.5a9a153f54a0cb00280a728f7f26acc5a87ce06f9284b77abfa4b99251a0153d/parts/make-project/ubuntu/etc/apt/trusted.gpg.d/.No keyring installed in /tmp/cwd-_o0ohin1.5a9a153f54a0cb00280a728f7f26acc5a87ce06f9284b77abfa4b99251a0153d/parts/make-project/ubuntu/etc/apt/trusted.gpg.d/.+ snapcraft shell pkg-config --cflags glib-2.0
++ pwd
+ grep -q /tmp/cwd-_o0ohin1.5a9a153f54a0cb00280a728f7f26acc5a87ce06f9284b77abfa4b99251a0153d
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found

review: Needs Fixing
lp:~ted/snapcraft/pkg-config-sysroot updated
188. By Ted Gould

Add 'PKG_CONFIG_PATH' and break up long lines

189. By Ted Gould

Merge trunk

190. By Ted Gould

Make consistent with single quotes

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

\o/

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'integration-tests/data/build-tools'
2=== added file 'integration-tests/data/build-tools/Makefile'
3--- integration-tests/data/build-tools/Makefile 1970-01-01 00:00:00 +0000
4+++ integration-tests/data/build-tools/Makefile 2015-09-23 15:54:59 +0000
5@@ -0,0 +1,6 @@
6+
7+all:
8+ @echo "Makin' like a Makefile"
9+
10+install:
11+ @echo "Installin' like a Makefile"
12
13=== added file 'integration-tests/data/build-tools/icon.svg'
14--- integration-tests/data/build-tools/icon.svg 1970-01-01 00:00:00 +0000
15+++ integration-tests/data/build-tools/icon.svg 2015-09-23 15:54:59 +0000
16@@ -0,0 +1,1 @@
17+<svg/>
18
19=== added file 'integration-tests/data/build-tools/snapcraft.yaml'
20--- integration-tests/data/build-tools/snapcraft.yaml 1970-01-01 00:00:00 +0000
21+++ integration-tests/data/build-tools/snapcraft.yaml 2015-09-23 15:54:59 +0000
22@@ -0,0 +1,14 @@
23+name: build-tools-test
24+version: 0.1
25+vendor: Napoleon Bonaparte <napoleon@short-guys-rock.co.fr>
26+summary: one line summary
27+description: a longer description
28+icon: icon.svg
29+
30+parts:
31+ make-project:
32+ source: .
33+ stage-packages:
34+ - libxml2-dev
35+ - libxslt1-dev
36+ - libglib2.0-dev
37
38=== modified file 'integration-tests/units/jobs.pxu'
39--- integration-tests/units/jobs.pxu 2015-09-23 07:14:21 +0000
40+++ integration-tests/units/jobs.pxu 2015-09-23 15:54:59 +0000
41@@ -380,3 +380,15 @@
42 test -f parts/python2/install/usr/lib/python2.7/argparse.py
43 test -f parts/python3/install/usr/lib/python3.4/argparse.py
44 flags: simple has-leftovers
45+
46+id: snapcraft/normal/build-tool-paths
47+plugin: shell
48+estimated_duration: 30
49+command:
50+ set -ex
51+ cp -rT $PLAINBOX_PROVIDER_DATA/build-tools .
52+ ${SNAPCRAFT} stage
53+ ${SNAPCRAFT} shell pkg-config --cflags glib-2.0 | grep -q `pwd`
54+ ${SNAPCRAFT} shell xml2-config --cflags | grep -q `pwd`
55+ ${SNAPCRAFT} shell xslt-config --cflags | grep -q `pwd`
56+flags: simple has-leftovers
57
58=== modified file 'snapcraft/__init__.py'
59--- snapcraft/__init__.py 2015-09-22 23:14:22 +0000
60+++ snapcraft/__init__.py 2015-09-23 15:54:59 +0000
61@@ -117,6 +117,13 @@
62 ubuntu = snapcraft.repo.Ubuntu(self.ubuntudir, sources=self.PLUGIN_STAGE_SOURCES)
63 ubuntu.get(self.PLUGIN_STAGE_PACKAGES + part_stage_packages)
64 ubuntu.unpack(self.installdir)
65+ self._fixup(self.installdir)
66+
67+ def _fixup(self, root):
68+ if os.path.isfile(os.path.join(root, 'usr', 'bin', 'xml2-config')):
69+ self.run(['sed', '-i', '-e', 's|prefix=/usr|prefix={}/usr|'.format(root), os.path.join(root, 'usr', 'bin', 'xml2-config')])
70+ if os.path.isfile(os.path.join(root, 'usr', 'bin', 'xslt-config')):
71+ self.run(['sed', '-i', '-e', 's|prefix=/usr|prefix={}/usr|'.format(root), os.path.join(root, 'usr', 'bin', 'xslt-config')])
72
73
74 def _get_source_handler(source_type, source):
75
76=== modified file 'snapcraft/yaml.py'
77--- snapcraft/yaml.py 2015-09-18 18:04:48 +0000
78+++ snapcraft/yaml.py 2015-09-23 15:54:59 +0000
79@@ -166,14 +166,46 @@
80
81 def runtime_env(self, root):
82 env = []
83- env.append('PATH="{0}/bin:{0}/usr/bin:$PATH"'.format(root))
84- 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()))
85+ env.append('PATH="' + ':'.join([
86+ '{0}/bin',
87+ '{0}/usr/bin',
88+ '$PATH'
89+ ]).format(root) + '"')
90+ env.append('LD_LIBRARY_PATH="' + ':'.join([
91+ '{0}/lib',
92+ '{0}/usr/lib',
93+ '{0}/lib/{1}',
94+ '{0}/usr/lib/{1}',
95+ '$LD_LIBRARY_PATH'
96+ ]).format(root, snapcraft.common.get_arch_triplet()) + '"')
97 return env
98
99 def build_env(self, root):
100 env = []
101- 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()))
102- 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()))
103+ env.append('CFLAGS="' + ' '.join([
104+ '-I{0}/include',
105+ '-I{0}/usr/include',
106+ '-I{0}/include/{1}',
107+ '-I{0}/usr/include/{1}',
108+ '$CFLAGS'
109+ ]).format(root, snapcraft.common.get_arch_triplet()) + '"')
110+ env.append('LDFLAGS="' + ' '.join([
111+ '-L{0}/lib',
112+ '-L{0}/usr/lib',
113+ '-L{0}/lib/{1}',
114+ '-L{0}/usr/lib/{1}',
115+ '$LDFLAGS'
116+ ]).format(root, snapcraft.common.get_arch_triplet()) + '"')
117+ env.append('PKG_CONFIG_SYSROOT_DIR={0}'.format(root))
118+ env.append('PKG_CONFIG_PATH=' + ':'.join([
119+ '{0}/usr/lib/pkgconfig',
120+ '{0}/usr/lib/{1}/pkgconfig',
121+ '{0}/usr/share/pkgconfig',
122+ '{0}/usr/local/lib/pkgconfig',
123+ '{0}/usr/local/lib/{1}/pkgconfig',
124+ '{0}/usr/local/share/pkgconfig',
125+ '$PKG_CONFIG_PATH'
126+ ]).format(root, snapcraft.common.get_arch_triplet()))
127 return env
128
129 def build_env_for_part(self, part):

Subscribers

People subscribed via source and target branches

to all changes: