Merge lp:~mterry/update-notifier/no-gdu into lp:update-notifier/ubuntu

Proposed by Michael Terry
Status: Merged
Merged at revision: 722
Proposed branch: lp:~mterry/update-notifier/no-gdu
Merge into: lp:update-notifier/ubuntu
Diff against target: 316 lines (+69/-97)
11 files modified
autogen.sh (+1/-1)
config.h.in (+1/-4)
configure.ac (+0/-7)
data/apt-cdrom-check (+1/-1)
debian/changelog (+6/-0)
debian/control (+0/-1)
po/POTFILES.in (+1/-1)
src/Makefile.am (+2/-2)
src/cdroms.c (+52/-75)
src/cdroms.h (+1/-1)
src/update-notifier.c (+4/-4)
To merge this branch: bzr merge lp:~mterry/update-notifier/no-gdu
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+116333@code.launchpad.net

Description of the change

This branch does two things:

1) Drop libgdu code, in favor of directly using GIO's GVolumeMonitor to check mounts. I don't have any CD-ROMs or USB sticks with me this week (I'm in the woods of New Hampshire), so if the reviewer can give it a test with actual mounts, I'd be grateful.

2) While I was there, I renamed configure.in to configure.ac. It's 2012! And a bit of renaming elsewhere (like gdu.c -> cdroms.c, etc)

To post a comment you must log in.
Revision history for this message
Andy Whitcroft (apw) wrote :

I tried to build this branch to test, but was unable to build it. There appear to be some files either missing or some build rules missing. There is no configure included in the branch and I needed to add the following incantation to the debian/rules to get it generated:

    override_dh_auto_configure:
 autoreconf -ivf
 dh_auto_configure

Even with that I then found the configure phase failed as below:

  config.status:1003: error: cannot find input file: `po/Makefile.in.in'

Could you confirm whether you are able to build this at all in a clean checkout.

Revision history for this message
Michael Terry (mterry) wrote :

It's common to not have generated files kept in upstream bzr. When checking out an autoconf projects, the custom is to run ./autogen.sh to create all the generated files needed for a debuild. So the following steps should do you, without any edits to debian/rules:

./autogen.sh
debuild

Revision history for this message
Andy Whitcroft (apw) wrote :

Ok following that I have built this and installed it locally. It is detecting both USB and CDROM devices with packages on (alternate images).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autogen.sh'
2--- autogen.sh 2012-06-13 20:45:43 +0000
3+++ autogen.sh 2012-07-23 17:41:22 +0000
4@@ -8,7 +8,7 @@
5
6 PKG_NAME="Update Notifier"
7
8-(test -f $srcdir/configure.in \
9+(test -f $srcdir/configure.ac \
10 && test -f $srcdir/README) || {
11 echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
12 echo " top-level gnome directory"
13
14=== modified file 'config.h.in'
15--- config.h.in 2011-09-27 09:57:41 +0000
16+++ config.h.in 2012-07-23 17:41:22 +0000
17@@ -1,4 +1,4 @@
18-/* config.h.in. Generated from configure.in by autoheader. */
19+/* config.h.in. Generated from configure.ac by autoheader. */
20
21 /* always defined to indicate that i18n is enabled */
22 #undef ENABLE_NLS
23@@ -18,9 +18,6 @@
24 /* Define to 1 if you have the `dcgettext' function. */
25 #undef HAVE_DCGETTEXT
26
27-/* Use gnome-disk-utility */
28-#undef HAVE_GDU
29-
30 /* Define if the GNU gettext() function is already present or preinstalled. */
31 #undef HAVE_GETTEXT
32
33
34=== renamed file 'configure.in' => 'configure.ac'
35--- configure.in 2011-09-27 09:57:41 +0000
36+++ configure.ac 2012-07-23 17:41:22 +0000
37@@ -15,13 +15,6 @@
38
39 pkg_modules="gtk+-3.0 libnotify gio-2.0 >= 2.26 x11"
40
41-PKG_CHECK_EXISTS(gdu, [ HAVE_GDU=1 ])
42-if test "x$HAVE_GDU" != "x"; then
43- pkg_modules="$pkg_modules gdu"
44- AC_DEFINE(HAVE_GDU, 1, [Use gnome-disk-utility])
45-else
46- AC_WARN(No gnome-disk-utility, disable CD-ROM checking)
47-fi
48 PKG_CHECK_EXISTS(gudev-1.0, [ HAVE_GUDEV=1 ])
49 if test "x$HAVE_GUDEV" != "x"; then
50 pkg_modules="$pkg_modules gudev-1.0"
51
52=== modified file 'data/apt-cdrom-check'
53--- data/apt-cdrom-check 2011-03-09 15:15:15 +0000
54+++ data/apt-cdrom-check 2012-07-23 17:41:22 +0000
55@@ -8,7 +8,7 @@
56 # 2 - dist-upgrader CD
57 # 3 - addon CD
58 # 4 - aptoncd media
59-# (if the returncodes change, make sure to update src/gdu.c)
60+# (if the returncodes change, make sure to update src/cdroms.c)
61 #
62
63 mount_point="$1"
64
65=== modified file 'debian/changelog'
66--- debian/changelog 2012-07-02 17:07:43 +0000
67+++ debian/changelog 2012-07-23 17:41:22 +0000
68@@ -1,3 +1,9 @@
69+update-notifier (0.119ubuntu16) UNRELEASED; urgency=low
70+
71+ * Convert from libgdu to gio's GVolumeMonitor (LP: #1028040)
72+
73+ -- Michael Terry <mterry@ubuntu.com> Mon, 23 Jul 2012 13:34:43 -0400
74+
75 update-notifier (0.119ubuntu15) quantal; urgency=low
76
77 * Undo the Python 3 conversion until python3-debian is ready
78
79=== modified file 'debian/control'
80--- debian/control 2012-07-02 17:07:43 +0000
81+++ debian/control 2012-07-23 17:41:22 +0000
82@@ -5,7 +5,6 @@
83 Build-Depends: debhelper (>= 7.0.50~),
84 libgtk-3-dev,
85 libglib2.0-dev (>= 2.26),
86- libgdu-dev,
87 intltool,
88 libnotify-dev (>= 0.7),
89 libgudev-1.0-dev,
90
91=== modified file 'po/POTFILES.in'
92--- po/POTFILES.in 2012-03-22 18:51:22 +0000
93+++ po/POTFILES.in 2012-07-23 17:41:22 +0000
94@@ -8,7 +8,7 @@
95 data/cddistupgrader
96 src/crash.c
97 src/avahi.c
98-src/gdu.c
99+src/cdroms.c
100 src/hooks.c
101 src/reboot.c
102 src/update.c
103
104=== modified file 'src/Makefile.am'
105--- src/Makefile.am 2011-09-29 10:01:42 +0000
106+++ src/Makefile.am 2012-07-23 17:41:22 +0000
107@@ -30,8 +30,8 @@
108 release.h\
109 uevent.c\
110 uevent.h\
111- gdu.c\
112- gdu.h \
113+ cdroms.c\
114+ cdroms.h \
115 trayappletui.h\
116 trayappletui.c
117
118
119=== renamed file 'src/gdu.c' => 'src/cdroms.c'
120--- src/gdu.c 2011-08-10 13:46:45 +0000
121+++ src/cdroms.c 2012-07-23 17:41:22 +0000
122@@ -2,7 +2,6 @@
123 #ifdef HAVE_CONFIG_H
124 #include "config.h"
125 #endif
126-#ifdef HAVE_GDU
127 #include <glib.h>
128 #include <glib-object.h>
129
130@@ -10,9 +9,7 @@
131 #include <sys/wait.h>
132
133 #include "update-notifier.h"
134-#define GDU_API_IS_SUBJECT_TO_CHANGE
135-#include <gdu/gdu.h>
136-#include "gdu.h"
137+#include "cdroms.h"
138
139 #define CDROM_CHECKER PACKAGE_LIB_DIR"/update-notifier/apt-cdrom-check"
140
141@@ -39,9 +36,10 @@
142 CD_WITH_APTONCD
143 };
144
145-void distro_cd_detected(UpgradeNotifier *un,
146- int cdtype,
147- const char *mount_point)
148+static void
149+distro_cd_detected(UpgradeNotifier *un,
150+ int cdtype,
151+ const char *mount_point)
152 {
153 GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
154 GTK_MESSAGE_QUESTION,
155@@ -149,11 +147,12 @@
156 gtk_widget_destroy (dialog);
157 }
158
159-void
160-up_check_mount_point_for_packages (const char *mount_point, gpointer data)
161+static void
162+check_mount_point_for_packages (const char *mount_point, gpointer data)
163 {
164 if (!mount_point)
165 return;
166+ //g_print("checking mount point %s\n", p);
167
168 char *ubuntu_dir = g_strdup_printf("%s/ubuntu",mount_point);
169 char *cdromupgrade = g_strdup_printf("%s/cdromupgrade",mount_point);
170@@ -193,69 +192,47 @@
171 g_free(cmd);
172 }
173
174-void
175-up_device_changed (GduPool *pool, GduDevice *device, gpointer data)
176-{
177- //g_print("up_device_changed %s\n", gdu_device_get_device_file (device));
178-
179- // if its a partition, do the removable check on the parent
180- GduDevice *removable = NULL;
181- if (gdu_device_is_partition(device)) {
182- removable = gdu_device_find_parent(device);
183- } else {
184- removable = device;
185- g_object_ref(device);
186- }
187-
188- // check if that is a removable device
189- if (!gdu_device_is_removable(removable)) {
190- g_object_unref(removable);
191- return;
192- }
193-
194- // we only care about the first mount point
195- const gchar *p = gdu_device_get_mount_path (device);
196- //g_print("checking mount point %s\n", p);
197- up_check_mount_point_for_packages (p, data);
198-}
199-
200-
201-void
202-up_check_mounted_devices (GduPool *pool, gpointer data)
203-{
204- GList *devices = gdu_pool_get_devices (pool);
205-
206- while(devices != NULL) {
207- up_device_changed (pool, devices->data, data);
208- devices = g_list_next(devices);
209- }
210- g_list_free(devices);
211-}
212-
213-gboolean
214-up_do_hal_init (UpgradeNotifier *un)
215-{
216- GduPool *pool = gdu_pool_new ();
217- if (pool == NULL)
218- return FALSE;
219-
220- g_signal_connect (pool, "device_changed", (GCallback)up_device_changed, un);
221- // now check what devices we have
222- up_check_mounted_devices(pool, un);
223-
224- return TRUE;
225-}
226-
227-
228-#else
229-#include <glib.h>
230-
231-#include "update-notifier.h"
232-
233-gboolean
234-up_do_hal_init (UpgradeNotifier *un)
235-{
236- g_warning("Detection and monitoring of CD-ROMs disabled.");
237- return FALSE;
238-}
239-#endif // HAVE_GUDEV
240+static void
241+check_one_mount (GVolumeMonitor *monitor, GMount *mount, gpointer data)
242+{
243+ if (!g_mount_can_eject(mount))
244+ return;
245+
246+ GFile *root = g_mount_get_root(mount);
247+ gchar *p = g_file_get_path(root);
248+ check_mount_point_for_packages(p, data);
249+ g_free(p);
250+ g_object_unref(root);
251+}
252+
253+static void
254+check_all_mounts (GVolumeMonitor *monitor, gpointer data)
255+{
256+ GList *mounts = g_volume_monitor_get_mounts(monitor);
257+ GList *iter;
258+
259+ for (iter = mounts; iter; iter = iter->next) {
260+ check_one_mount(monitor, mounts->data, data);
261+ g_object_unref(mounts->data);
262+ }
263+ g_list_free(mounts);
264+}
265+
266+gboolean
267+cdroms_init (UpgradeNotifier *un)
268+{
269+ static GVolumeMonitor *monitor = NULL;
270+ if (monitor != NULL)
271+ return TRUE;
272+
273+ monitor = g_volume_monitor_get();
274+ if (monitor == NULL)
275+ return FALSE;
276+
277+ g_signal_connect(monitor, "mount-added", (GCallback)check_one_mount, un);
278+ g_signal_connect(monitor, "mount-changed", (GCallback)check_one_mount, un);
279+ check_all_mounts(monitor, un);
280+
281+ return TRUE;
282+}
283+
284
285=== renamed file 'src/gdu.h' => 'src/cdroms.h'
286--- src/gdu.h 2010-06-01 13:28:36 +0000
287+++ src/cdroms.h 2012-07-23 17:41:22 +0000
288@@ -1,1 +1,1 @@
289-gboolean up_do_hal_init ();
290+gboolean cdroms_init ();
291
292=== modified file 'src/update-notifier.c'
293--- src/update-notifier.c 2012-03-20 21:03:59 +0000
294+++ src/update-notifier.c 2012-07-23 17:41:22 +0000
295@@ -40,7 +40,7 @@
296 #include "update-notifier.h"
297 #include "update.h"
298 #include "hooks.h"
299-#include "gdu.h"
300+#include "cdroms.h"
301 #include "reboot.h"
302 #include "uevent.h"
303 #include "crash.h"
304@@ -648,9 +648,9 @@
305 // initial check for avahi
306 avahi_disabled_check();
307
308- /* setup hal so that inserted cdroms can be checked */
309- if(!up_do_hal_init(un)) {
310- g_warning("initializing gdu failed");
311+ /* setup inserted-cdroms checker */
312+ if(!cdroms_init(un)) {
313+ g_warning("initializing cdroms failed");
314 }
315
316 // init release checker

Subscribers

People subscribed via source and target branches

to all changes: