Merge ~3v1n0/ubuntu-app-platform:master into ubuntu-app-platform:master

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: ~3v1n0/ubuntu-app-platform:master
Merge into: ubuntu-app-platform:master
Diff against target: 287 lines (+2/-134)
2 files modified
dev/null (+0/-134)
snapcraft.yaml (+2/-0)
Reviewer Review Type Date Requested Status
Tim Peeters Pending
Review via email: mp+311951@code.launchpad.net

This proposal supersedes a proposal from 2016-11-23.

This proposal has been superseded by a proposal from 2016-11-28.

Commit message

snapcraft.yaml: load indicator-qt5 remote part

It adds proper support to app-indicators in classic space.

Description of the change

See https://github.com/3v1n0/indicators-examples-snaps for more infos or the part definition at https://github.com/3v1n0/appindicators-snapcraft-parts

Removed also the unneeded and outdated custom plugins (the x-qmake one specifically was pointing to the wrong location, thus causing indicator-qt5 not to compile).

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

Thanks for the MR, but can you separate adding of a dependency and removing the plugins into separate MRs to make it easier to review?

Perhaps a bug report describing the the outdated plugins is useful too.

review: Needs Fixing

Unmerged commits

2b06828... by Marco Trevisan (Treviño)

snapcraft.yaml: load indicator-qt5 remote part

It adds proper support to app-indicators in classic space

df906a2... by Marco Trevisan (Treviño)

plugins: remove unneeded custom plugins.

There's nothing to build here, while
qtbase isn't there anymore.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/parts/plugins/x-autotools.py b/parts/plugins/x-autotools.py
0deleted file mode 1006440deleted file mode 100644
index 4cb33b3..0000000
--- a/parts/plugins/x-autotools.py
+++ /dev/null
@@ -1,131 +0,0 @@
1# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
2#
3# Copyright (C) 2015, 2016 Canonical Ltd
4# Copyright (C) 2016 Harald Sitter <sitter@kde.org>
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License version 3 as
8# published by the Free Software Foundation.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18"""The autotools plugin is used for autotools based parts.
19
20Autotools based projects are the ones that have the usual
21`./configure && make && make install` instruction set.
22
23The plugin tries to build using ./configure first, if it is not there
24it will run ./autogen and if autogen is not there it will run autoreconf.
25
26This plugin uses the common plugin keywords as well as those for "sources".
27For more information check the 'plugins' topic for the former and the
28'sources' topic for the latter.
29
30In addition, this plugin uses the following plugin-specific keywords:
31
32 - configflags:
33 (list of strings)
34 configure flags to pass to the build such as those shown by running
35 './configure --help'
36 - install-via:
37 (enum, 'destdir' or 'prefix')
38 Whether to install via DESTDIR or by using --prefix (default is
39 'destdir')
40"""
41
42import os
43import stat
44
45import snapcraft
46
47
48class AutotoolsPlugin(snapcraft.BasePlugin):
49
50 @classmethod
51 def schema(cls):
52 schema = super().schema()
53 schema['properties']['configflags'] = {
54 'type': 'array',
55 'minitems': 1,
56 'uniqueItems': False,
57 'items': {
58 'type': 'string',
59 },
60 'default': [],
61 }
62
63 schema['properties']['install-via'] = {
64 'enum': ['destdir', 'prefix'],
65 'default': 'destdir',
66 }
67
68 # Inform Snapcraft of the properties associated with building. If these
69 # change in the YAML Snapcraft will consider the build step dirty.
70 schema['build-properties'].extend(['configflags', 'install-via'])
71
72 return schema
73
74 def __init__(self, name, options, project):
75 super().__init__(name, options, project)
76 self.build_packages.extend([
77 'autoconf',
78 'automake',
79 'autopoint',
80 'libtool',
81 'make',
82 ])
83
84 if options.install_via == 'destdir':
85 self.install_via_destdir = True
86 elif options.install_via == 'prefix':
87 self.install_via_destdir = False
88 else:
89 raise RuntimeError('Unsupported installation method: "{}"'.format(
90 options.install_via))
91
92 def build(self):
93 super().build()
94 if not os.path.exists(os.path.join(self.builddir, "configure")):
95 generated = False
96 scripts = ["autogen.sh", "bootstrap"]
97 for script in scripts:
98 path = os.path.join(self.builddir, script)
99 if not os.path.exists(path):
100 continue
101 # Make sure it's executable
102 if not os.access(path, os.X_OK):
103 os.chmod(path,
104 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
105 stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP |
106 stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH)
107 self.run(['env', 'NOCONFIGURE=1', './{}'.format(script)])
108 generated = True
109 break
110 if not generated:
111 self.run(['autoreconf', '-i'])
112
113 configure_command = ['./configure']
114 make_install_command = ['make', 'install']
115
116 if self.install_via_destdir:
117 # Use an empty prefix since we'll install via DESTDIR
118 configure_command.append('--prefix=')
119 make_install_command.append('DESTDIR=' + self.installdir)
120 else:
121 configure_command.append('--prefix=' + self.installdir)
122
123 self.run(configure_command + self.options.configflags)
124 self.run(['make', '-j{}'.format(self.parallel_build_count)])
125 self.run(make_install_command)
126
127 def snap_fileset(self):
128 fileset = super().snap_fileset()
129 # Remove .la files which don't work when they are moved around
130 fileset.append('-**/*.la')
131 return fileset
diff --git a/parts/plugins/x-qmake.py b/parts/plugins/x-qmake.py
132deleted file mode 1006440deleted file mode 100644
index df766c0..0000000
--- a/parts/plugins/x-qmake.py
+++ /dev/null
@@ -1,134 +0,0 @@
1# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
2#
3# Copyright (C) 2016 Canonical Ltd
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17"""The qmake plugin is useful for building qmake-based parts.
18
19These are projects that are built using .pro files.
20
21This plugin uses the common plugin keywords as well as those for "sources".
22For more information check the 'plugins' topic for the former and the
23'sources' topic for the latter.
24
25Additionally, this plugin uses the following plugin-specific keywords:
26
27 - options:
28 (list of strings)
29 additional options to pass to the qmake invocation.
30 - qt-version:
31 (enum, 'qt4' or 'qt5')
32 Version of Qt to use with qmake.
33 - project-files:
34 (list of strings)
35 list of .pro files to pass to the qmake invocation.
36"""
37
38import os
39
40import snapcraft
41from snapcraft import common
42
43
44class QmakePlugin(snapcraft.BasePlugin):
45
46 @classmethod
47 def schema(cls):
48 schema = super().schema()
49 schema['properties']['options'] = {
50 'type': 'array',
51 'minitems': 1,
52 'uniqueItems': True,
53 'items': {
54 'type': 'string',
55 },
56 'default': [],
57 }
58 schema['properties']['qt-version'] = {
59 'enum': ['qt4', 'qt5'],
60 }
61 schema['properties']['project-files'] = {
62 'type': 'array',
63 'minitems': 1,
64 'uniqueItems': True,
65 'items': {
66 'type': 'string',
67 },
68 'default': [],
69 }
70
71 # Qt version must be specified
72 schema['required'].append('qt-version')
73
74 # Inform Snapcraft of the properties associated with building and
75 # pulling so it can mark those steps dirty if they change in the YAML.
76 schema['build-properties'].append('options')
77 schema['pull-properties'].append('qt-version')
78
79 return schema
80
81 def __init__(self, name, options, project):
82 super().__init__(name, options, project)
83
84 self.build_packages.append('make')
85
86 def build(self):
87 super().build()
88
89 env = self._build_environment()
90
91 sources = []
92 if self.options.project_files:
93 sourcedir = self.sourcedir
94 source_subdir = getattr(self.options, 'source_subdir', None)
95 if source_subdir:
96 sourcedir = os.path.join(sourcedir, source_subdir)
97 sources = [os.path.join(sourcedir, project_file)
98 for project_file in self.options.project_files]
99
100 self.run([ self.project.parts_dir + '/qtbase/build/bin/qmake'] + self._extra_config() + self.options.options +
101 sources, env=env)
102
103 self.run(['make', '-j{}'.format(
104 self.parallel_build_count)], env=env)
105
106 self.run(['make', 'install', 'INSTALL_ROOT=' + self.installdir],
107 env=env)
108
109 def _extra_config(self):
110 extra_config = []
111
112 for root in [self.installdir, self.project.stage_dir]:
113 paths = common.get_library_paths(root, self.project.arch_triplet)
114 for path in paths:
115 extra_config.append("LIBS+=\"-L{}\"".format(path))
116
117 paths = common.get_include_paths(root, self.project.arch_triplet)
118 for path in paths:
119 extra_config.append("INCLUDEPATH+=\"{}\"".format(path))
120 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtbase/build/NAP/include'))
121 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtxmlpatterns/build/include'))
122 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtdeclarative/build/include'))
123 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qttools/build/include'))
124 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtmultimedia/build/include'))
125 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtsvg/build/include'))
126 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtgraphicaleffects/build/include'))
127 extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qtpim/build/include'))
128 return extra_config
129
130 def _build_environment(self):
131 env = os.environ.copy()
132 env['QT_SELECT'] = self.options.qt_version
133 env['QTDIR' ] = self.project.parts_dir + '/qtbase/build/'
134 return env
diff --git a/snapcraft.yaml b/snapcraft.yaml
index 534fe16..5abfbfe 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -116,3 +116,5 @@ parts:
116 - usr/share/webbrowser-app116 - usr/share/webbrowser-app
117 - usr/share/X11117 - usr/share/X11
118118
119 after:
120 - indicator-qt5

Subscribers

People subscribed via source and target branches