Merge lp:~mzanetti/unity8/install-devices-conf-default into lp:unity8

Proposed by Michael Zanetti on 2016-03-30
Status: Merged
Approved by: Michael Terry on 2016-04-12
Approved revision: 2319
Merged at revision: 2363
Proposed branch: lp:~mzanetti/unity8/install-devices-conf-default
Merge into: lp:unity8
Diff against target: 110 lines (+55/-0)
5 files modified
data/devices.conf (+30/-0)
debian/unity8.install (+1/-0)
doc/devices.conf (+15/-0)
plugins/Utils/deviceconfigparser.cpp (+8/-0)
plugins/Utils/deviceconfigparser.h (+1/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/install-devices-conf-default
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing on 2016-04-12
Michael Terry 2016-03-31 Approve on 2016-04-12
Michael Zanetti Pending
Review via email: mp+290478@code.launchpad.net

Commit Message

install devices.conf by default

Description of the Change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
n
 * Did you perform an exploratory manual test run of your code change and any related functionality?
y
 * Did you make sure that your branch does not contain spurious tags?
y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
y
 * If you changed the UI, has there been a design review?
n/a

To post a comment you must log in.
2314. By Michael Zanetti on 2016-03-30

install devices.conf by default

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2314
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/892/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/475
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/475
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/475
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1199
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1175
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1175
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1173
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1173/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1173
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1173/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1173
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1173/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1173
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1173/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1173
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1173/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1173
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1173/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/892/rebuild

review: Needs Fixing (continuous-integration)
2315. By Michael Zanetti on 2016-03-31

use a separate config for the default install, extend the docs one a bit

2316. By Michael Zanetti on 2016-03-31

drop unneded line in example

2317. By Michael Zanetti on 2016-03-31

search in /system/etc/ubuntu too, in case there is a device tarball override

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2315
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/901/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/483
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/483
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/483
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1210
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1186
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1186
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1184
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1184/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1184
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1184/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1184
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1184/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1184
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1184/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1184
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1184/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1184
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1184/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/901/rebuild

review: Needs Fixing (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2317
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/902/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/484
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/484
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/484
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1211
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1187
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1187
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1185
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1185
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1185
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1185
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1185
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1185
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1185/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/902/rebuild

review: Needs Fixing (continuous-integration)
Michael Terry (mterry) wrote :

I'd feel better if the example in the shipped devices.conf was commented out. No reason to ship a live example.

And maybe a comment in deviceconfigparser.cpp that any new properties or changed defaults should be updated in both doc/devices.conf and data/devices.conf? These could easily get out of sync.

review: Needs Fixing
2318. By Michael Zanetti on 2016-04-12

add a comment

Michael Zanetti (mzanetti) wrote :

> I'd feel better if the example in the shipped devices.conf was commented out.
> No reason to ship a live example.
>
> And maybe a comment in deviceconfigparser.cpp that any new properties or
> changed defaults should be updated in both doc/devices.conf and
> data/devices.conf? These could easily get out of sync.

I've added a comment to keep things in sync.

We need to preinstall something in /etc/ because otherwise it can't be overridden by the device tarball. That's basically the only reason for this branch at all. We landed the support for device config files in /etc and only learned afterwards that the device tarball can't inject new files but only override existing ones.

Michael Terry (mterry) wrote :

Oh, I'm +1 for shipping the file. I'm just saying, comment out the example it contains. Not that we're likely to have a device called "devicename", but seems cleaner not to tempt fate.

2319. By Michael Zanetti on 2016-04-12

comment out the example

Michael Terry (mterry) wrote :

Awesome. Looks good, no bad tags. I +1 the trivial debian/ changes.

review: Approve
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2318
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/984/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/557
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/557
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/557
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1326
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1297
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1297
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1295
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1295/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1295
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1295/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1295
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1295/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1295
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1295/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1295
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1295/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1295
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1295/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/984/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/devices.conf'
2--- data/devices.conf 1970-01-01 00:00:00 +0000
3+++ data/devices.conf 2016-04-12 21:51:01 +0000
4@@ -0,0 +1,30 @@
5+# This file can hold multiple device configs. Devices are separated by sections.
6+#
7+# SupportedOrientations holds a list of all enabled orientations. A standard
8+# phone will usually have Portrait,Landcape,InvertedLandscape in order to
9+# disable upside down usage.
10+#
11+# PrimaryOrientation gives the orientation the device will start up with
12+# when there is no orientations sensor input available (yet) or lock to
13+# when an application specifies to be locked to PrimaryOrientation.
14+#
15+# The other Orientation settings can be used to re-map the orientations.
16+# A device might be used with different orientations than how the screen
17+# is physically mounted on the hardware.
18+#
19+# Category can be phone, tablet, or desktop. This option determines
20+# whether the side stage is shown (tablet) or not (phone). Using
21+# desktop will load the shell in windowed mode. Note that the user
22+# can override/change this by connecting input hardware or change
23+# user settings.
24+#
25+# Any options not listed will default to the values of the example below.
26+
27+# [devicename]
28+# SupportedOrientations=Portrait,InvertedPortrait,Landscape,InvertedLandscape
29+# PrimaryOrientation=PrimaryOrienation
30+# PortraitOrientation=Portrait
31+# InvertedPortraitOrientation=InvertedPortrait
32+# LandscapeOrientation=Landscape
33+# InvertedLandscapeOrientation=InvertedLandscape
34+# Category=phone
35
36=== modified file 'debian/unity8.install'
37--- debian/unity8.install 2015-11-20 13:04:46 +0000
38+++ debian/unity8.install 2016-04-12 21:51:01 +0000
39@@ -2,6 +2,7 @@
40 data/unity8-dash.conf usr/share/upstart/sessions/
41 data/unity8-filewatcher.conf usr/share/upstart/sessions/
42 data/unity8.conf usr/share/upstart/sessions/
43+data/devices.conf etc/ubuntu/
44 usr/bin/unity8
45 usr/bin/unity8-dash
46 usr/share/applications/unity8-dash.desktop
47
48=== modified file 'doc/devices.conf'
49--- doc/devices.conf 2016-02-18 09:12:13 +0000
50+++ doc/devices.conf 2016-04-12 21:51:01 +0000
51@@ -28,3 +28,18 @@
52 LandscapeOrientation=Landscape
53 InvertedLandscapeOrientation=InvertedLandscape
54 Category=phone
55+
56+# Example for the Nexus 7
57+# This device has the screen mounted in portrait, but we run it as a landscape
58+# device and we want the side stage on it.
59+[flo]
60+PrimaryOrientation=LandscapeOrienation
61+Category=tablet
62+
63+# Example for the Nexus 4
64+# The screen is already mounted the way we want it, so no special config
65+# required. However, we don't want the phone to rotate upside down, so lets
66+# restrict that.
67+[mako]
68+SupportedOrientations=Portrait,Landscape,InvertedLandscape
69+Category=phone
70
71=== modified file 'plugins/Utils/deviceconfigparser.cpp'
72--- plugins/Utils/deviceconfigparser.cpp 2016-02-18 16:53:54 +0000
73+++ plugins/Utils/deviceconfigparser.cpp 2016-04-12 21:51:01 +0000
74@@ -23,6 +23,7 @@
75
76 DeviceConfigParser::DeviceConfigParser(QObject *parent): QObject(parent)
77 {
78+ // Local files have highest priority
79 QString path;
80 Q_FOREACH (const QString &standardPath, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
81 if (QFileInfo(standardPath + "/devices.conf").exists()) {
82@@ -31,9 +32,16 @@
83 }
84 }
85
86+ // Check if there is an override in the device tarball (/system/etc/)
87+ if (path.isEmpty() && QFileInfo::exists("/system/etc/ubuntu/devices.conf")) {
88+ path = "/system/etc/ubuntu/devices.conf";
89+ }
90+
91+ // No higher priority files found. Use standard of /etc/
92 if (path.isEmpty()) {
93 path = "/etc/ubuntu/devices.conf";
94 }
95+
96 qDebug() << "Using" << path << "as device configuration file";
97 m_config = new QSettings(path, QSettings::IniFormat, this);
98 }
99
100=== modified file 'plugins/Utils/deviceconfigparser.h'
101--- plugins/Utils/deviceconfigparser.h 2016-02-16 17:20:02 +0000
102+++ plugins/Utils/deviceconfigparser.h 2016-04-12 21:51:01 +0000
103@@ -25,6 +25,7 @@
104 Q_OBJECT
105 Q_PROPERTY(QString name READ name WRITE setName NOTIFY changed)
106
107+ // NOTE: When changing this properties, also update the examples in docs and data
108 Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY changed)
109 Q_PROPERTY(Qt::ScreenOrientations supportedOrientations READ supportedOrientations NOTIFY changed)
110 Q_PROPERTY(Qt::ScreenOrientation landscapeOrientation READ landscapeOrientation NOTIFY changed)

Subscribers

People subscribed via source and target branches