Merge lp:~3v1n0/unity-settings-daemon/use-and-migrate-unity-monitors-xml into lp:unity-settings-daemon

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4183
Merged at revision: 4180
Proposed branch: lp:~3v1n0/unity-settings-daemon/use-and-migrate-unity-monitors-xml
Merge into: lp:unity-settings-daemon
Diff against target: 115 lines (+47/-5)
7 files modified
debian/changelog (+13/-0)
debian/control (+1/-0)
debian/rules (+3/-1)
debian/unity-settings-daemon.migrations (+1/-0)
gnome-settings-daemon/gsd-rr-config.c (+2/-2)
plugins/xrandr/gsd-xrandr-manager.c (+2/-2)
scripts/01-usd-migration-monitors-xml.sh (+25/-0)
To merge this branch: bzr merge lp:~3v1n0/unity-settings-daemon/use-and-migrate-unity-monitors-xml
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+343230@code.launchpad.net

Commit message

gsd-rr-config: rename monitor config files to unity-monitors.xml*

Description of the change

The migration is using simple bash, as it's simple enough not to require a proper xml parser in python, avoiding any new dependency.

To post a comment you must log in.
4182. By Marco Trevisan (Treviño)

script: monitors-xml migration, make copies instead of moving files

4183. By Marco Trevisan (Treviño)

script: monitors-xml migration, if a monitors-v1-backup is found use it

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your work, that seems fine to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2018-02-16 01:57:58 +0000
3+++ debian/changelog 2018-04-13 20:23:24 +0000
4@@ -1,3 +1,16 @@
5+unity-settings-daemon (15.04.1+18.04.20180216-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * gsd-rr-config: rename monitor config files to unity-monitors.xml*
8+ (LP: #1763806)
9+ * debian:
10+ - build-depends on dh-migrations and run dh_migrations on post-install
11+ - add debian/unity-settings-daemon.migrations to install migration files
12+ * scripts/01-usd-migration-monitors-xml.sh:
13+ - Move monitors.xml to unity-monitors.xml if migration is needed
14+ (LP: #1763806)
15+
16+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Fri, 13 Apr 2018 14:30:18 -0400
17+
18 unity-settings-daemon (15.04.1+18.04.20180216-0ubuntu1) bionic; urgency=medium
19
20 * No-change rebuild against latest gnome-desktop3
21
22=== modified file 'debian/control'
23--- debian/control 2017-09-22 00:32:24 +0000
24+++ debian/control 2018-04-13 20:23:24 +0000
25@@ -7,6 +7,7 @@
26 gnome-pkg-tools,
27 gtk-doc-tools,
28 dh-autoreconf,
29+ dh-migrations,
30 autotools-dev,
31 intltool (>= 0.37.1),
32 libdbus-glib-1-dev (>= 0.74),
33
34=== modified file 'debian/rules'
35--- debian/rules 2018-02-14 12:40:59 +0000
36+++ debian/rules 2018-04-13 20:23:24 +0000
37@@ -29,8 +29,10 @@
38 find debian -name '*.a' -delete
39 find debian -name '*.la' -delete
40
41+binary-post-install/unity-settings-daemon::
42+ dh_migrations
43+
44 common-binary-post-install-arch:: list-missing
45
46 clean::
47 rm -f gnome-settings-daemon/gnome-update-wallpaper-cache
48-
49
50=== added file 'debian/unity-settings-daemon.migrations'
51--- debian/unity-settings-daemon.migrations 1970-01-01 00:00:00 +0000
52+++ debian/unity-settings-daemon.migrations 2018-04-13 20:23:24 +0000
53@@ -0,0 +1,1 @@
54+scripts/*-usd-migration-*
55
56=== modified file 'gnome-settings-daemon/gsd-rr-config.c'
57--- gnome-settings-daemon/gsd-rr-config.c 2014-06-26 02:32:12 +0000
58+++ gnome-settings-daemon/gsd-rr-config.c 2018-04-13 20:23:24 +0000
59@@ -43,8 +43,8 @@
60 #include "edid.h"
61 #include "gsd-rr-private.h"
62
63-#define CONFIG_INTENDED_BASENAME "monitors.xml"
64-#define CONFIG_BACKUP_BASENAME "monitors.xml.backup"
65+#define CONFIG_INTENDED_BASENAME "unity-monitors.xml"
66+#define CONFIG_BACKUP_BASENAME "unity-monitors.xml.backup"
67
68 /* Look for DPI_FALLBACK in:
69 * http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/xsettings/gsd-xsettings-manager.c
70
71=== modified file 'plugins/xrandr/gsd-xrandr-manager.c'
72--- plugins/xrandr/gsd-xrandr-manager.c 2016-05-20 16:50:05 +0000
73+++ plugins/xrandr/gsd-xrandr-manager.c 2018-04-13 20:23:24 +0000
74@@ -560,8 +560,8 @@
75
76 /* ENOENT means the original file didn't exist. That is *not* an error;
77 * the backup was not created because there wasn't even an original
78- * monitors.xml (such as on a first-time login). Note that *here* there
79- * is a "didn't work" monitors.xml, so we must delete that one.
80+ * unity-monitors.xml (such as on a first-time login). Note that *here*
81+ * there is a "didn't work" unity-monitors.xml, so we must delete that one.
82 */
83 if (saved_errno == ENOENT)
84 unlink (intended_filename);
85
86=== added directory 'scripts'
87=== added file 'scripts/01-usd-migration-monitors-xml.sh'
88--- scripts/01-usd-migration-monitors-xml.sh 1970-01-01 00:00:00 +0000
89+++ scripts/01-usd-migration-monitors-xml.sh 2018-04-13 20:23:24 +0000
90@@ -0,0 +1,25 @@
91+#!/bin/bash
92+
93+MONITORS_FILES="monitors.xml monitors.xml.backup monitors-v1-backup.xml"
94+config_path="$HOME/.config"
95+
96+if [ -n "$XDG_CONFIG_HOME" ]; then
97+ config_path="$XDG_CONFIG_HOME";
98+fi
99+
100+for monitor_file in $MONITORS_FILES; do
101+ old_monitors="$config_path/$monitor_file"
102+ new_monitors="$config_path/unity-$monitor_file"
103+
104+ if [ -f "$old_monitors" ]; then
105+ if grep '<monitors[^>]*>' "$old_monitors" | grep -Fq 'version="1"'; then
106+ cp -v "$old_monitors" "$new_monitors"
107+ fi
108+ fi
109+done
110+
111+if [ -f "$config_path/unity-monitors-v1-backup.xml" ] &&
112+ [ ! -f "$config_path/unity-monitors.xml" ]; then
113+ cp -v "$config_path/unity-monitors-v1-backup.xml" \
114+ "$config_path/unity-monitors.xml"
115+fi

Subscribers

People subscribed via source and target branches