[Pkg-cli-apps-commits] [SCM] podsleuth branch, master, updated. upstream/0.6.5-14-g105bcde

Chow Loong Jin hyperair at gmail.com
Wed Dec 9 19:35:56 UTC 2009


The following commit has been merged in the master branch:
commit d8ead3285f0a94a240ad6deb39bbc0a8c9221245
Author: Chow Loong Jin <hyperair at gmail.com>
Date:   Thu Dec 10 03:23:38 2009 +0800

    Add devkit support from upstream
    
    * debian/control, debian/rules:
      + Add quilt support
      + Add autoconf, automake build-dep and call autoreconf during build
    * debian/patches:
      + Add patches 0001-Do-the-bare-minimum-to-get-working-with-DeviceKit.patch
        and 0002-Install-a-dbus-policy-to-fix-podsleuth-rescan.patch to fix iPod
        support with Devkit

diff --git a/debian/changelog b/debian/changelog
index aa01d20..67a379b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+podsleuth (0.6.5-2) UNRELEASED; urgency=low
+
+  * debian/control, debian/rules:
+    + Add quilt support
+    + Add autoconf, automake build-dep and call autoreconf during build
+  * debian/patches:
+    + Add patches 0001-Do-the-bare-minimum-to-get-working-with-DeviceKit.patch
+      and 0002-Install-a-dbus-policy-to-fix-podsleuth-rescan.patch to fix iPod
+      support with Devkit
+
+ -- Chow Loong Jin <hyperair at ubuntu.com>  Thu, 10 Dec 2009 03:21:00 +0800
+
 podsleuth (0.6.5-1) UNRELEASED; urgency=low
 
   [ Martin Pitt ]
diff --git a/debian/control b/debian/control
index c515b35..f9b1145 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,10 @@ Maintainer: Debian CLI Applications Team <pkg-cli-apps-team at lists.alioth.debian.
 Uploaders: Sebastian Dröge <slomo at debian.org>,
            Chow Loong Jin <hyperair at ubuntu.com>
 Build-Depends: debhelper (>= 7.0.50),
+               quilt (>= 0.46-7~),
                cli-common-dev (>= 0.5.7),
+               autoconf (>= 2.13),
+               automake (>= 1.9),
                mono-devel (>= 2.4.2),
                libndesk-dbus1.0-cil (>= 0.4),
                libhal-dev (>= 0.5.6),
diff --git a/debian/patches/0001-Do-the-bare-minimum-to-get-working-with-DeviceKit.patch b/debian/patches/0001-Do-the-bare-minimum-to-get-working-with-DeviceKit.patch
new file mode 100644
index 0000000..7b37b63
--- /dev/null
+++ b/debian/patches/0001-Do-the-bare-minimum-to-get-working-with-DeviceKit.patch
@@ -0,0 +1,226 @@
+From 8c1dda626d331b0b7e40ef21e7a828dfc195dd25 Mon Sep 17 00:00:00 2001
+From: Gabriel Burt <gabriel.burt at gmail.com>
+Date: Tue, 8 Dec 2009 18:09:15 -0800
+Subject: [PATCH 1/2] Do the bare minimum to get working with DeviceKit
+
+Is not fully ported to DeviceKit; still relies on HAL extensively.
+But makes podsleuth work where DeviceKit is actually mounting the
+drive but HAL still is running.  The problem was podsleuth was reading
+HAL's volume.is_mounted property, which was false since DK had mounted
+it.
+---
+ src/PodSleuth.Hal/PodSleuth.HalFrontend/DkDisk.cs  |   88 ++++++++++++++++++++
+ .../PodSleuth.HalFrontend/HalClient.cs             |   44 +++++++++-
+ .../PodSleuth.HalFrontend/HalPopulator.cs          |    7 +-
+ 3 files changed, 133 insertions(+), 6 deletions(-)
+ create mode 100644 src/PodSleuth.Hal/PodSleuth.HalFrontend/DkDisk.cs
+
+diff --git a/src/PodSleuth.Hal/PodSleuth.HalFrontend/DkDisk.cs b/src/PodSleuth.Hal/PodSleuth.HalFrontend/DkDisk.cs
+new file mode 100644
+index 0000000..16d05f7
+--- /dev/null
++++ b/src/PodSleuth.Hal/PodSleuth.HalFrontend/DkDisk.cs
+@@ -0,0 +1,88 @@
++using System;
++
++using NDesk.DBus;
++
++namespace PodSleuth.HalFrontend
++{
++    public class DkDisk
++    {
++        public static DkDisk FindByDevice (string device_path)
++        {
++            if (device_path == null)
++                return null;
++
++            if (disks == null)
++                return null;
++
++
++            string disk_path = null;
++            try {
++                disk_path = disks.FindDeviceByDeviceFile (device_path);
++            } catch {}
++
++            if (disk_path == null)
++                return null;
++
++            try {
++                return new DkDisk (disk_path);
++            } catch {}
++
++            return null;
++        }
++
++        private IDkDisk disk;
++        private org.freedesktop.DBus.Properties props;
++
++        private DkDisk (string obj_path)
++        {
++            disk = Bus.System.GetObject<IDkDisk>("org.freedesktop.DeviceKit.Disks",
++                new ObjectPath(obj_path));
++
++            props = Bus.System.GetObject<org.freedesktop.DBus.Properties>("org.freedesktop.DeviceKit.Disks",
++                new ObjectPath(obj_path));
++        }
++
++        public bool IsMounted {
++            get {
++                return (bool) props.Get ("org.freedesktop.DeviceKit.Disks.Device", "DeviceIsMounted");
++            }
++        }
++
++        public bool IsReadOnly {
++            get {
++                return (bool) props.Get ("org.freedesktop.DeviceKit.Disks.Device", "DeviceIsReadOnly");
++            }
++        }
++
++        public string MountPoint {
++            get {
++                var ary = (string[])props.Get ("org.freedesktop.DeviceKit.Disks.Device", "DeviceMountPaths");
++                return ary != null && ary.Length > 0 ? ary[0] : null;
++            }
++        }
++
++        private static IDkDisks disks;
++
++        static DkDisk ()
++        {
++            try {
++                disks = Bus.System.GetObject<IDkDisks>("org.freedesktop.DeviceKit.Disks",
++                    new ObjectPath("/org/freedesktop/DeviceKit/Disks"));
++            } catch {}
++        }
++
++        [Interface("org.freedesktop.DeviceKit.Disks")]
++        internal interface IDkDisks
++        {
++            string FindDeviceByDeviceFile (string deviceFile);
++        }
++
++    }
++
++    [Interface("org.freedesktop.DeviceKit.Disks.Device")]
++    public interface IDkDisk
++    {
++        bool DeviceIsMounted { get; }
++        string [] DeviceMountPaths { get; }
++    }
++}
+diff --git a/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs b/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
+index ce83f27..aebb742 100644
+--- a/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
++++ b/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
+@@ -85,9 +85,8 @@ namespace PodSleuth.HalFrontend
+             foreach(Hal.Device ipod in manager.FindDeviceByStringMatchAsDevice("info.product", "iPod")) {
+                 foreach(Hal.Device volume in ipod.GetChildrenAsDevice(manager)) {
+                     if(!volume.IsVolume || 
+-                        !volume.PropertyExists("volume.is_mounted") ||
++                        !IsVolumeMounted (volume) ||
+                         !volume.PropertyExists("volume.fsusage") ||
+-                        !volume.GetPropertyBoolean("volume.is_mounted") ||
+                         volume.GetPropertyString("volume.fsusage") != "filesystem") {
+                         continue;
+                     }
+@@ -132,7 +131,7 @@ namespace PodSleuth.HalFrontend
+                 Console.WriteLine("   Error: {0}* properties are missing", HalNamespace);
+                 Console.WriteLine("   UDI:          {0}", volume.Udi);
+                 Console.WriteLine("   Block Device: {0}", volume.GetPropertyString("block.device"));
+-                Console.WriteLine("   Mount Point:  {0}", volume.GetPropertyString("volume.mount_point"));
++                Console.WriteLine("   Mount Point:  {0}", MountPoint (volume));
+                 Console.WriteLine();
+                 Console.WriteLine("   Cause: PodSleuth may not be installed properly, the HAL daemon may need");
+                 Console.WriteLine("          to be restarted and/or the device needs to be refreshed.");
+@@ -150,9 +149,46 @@ namespace PodSleuth.HalFrontend
+             
+             DumpSleuthableIpod(volume);
+         }
++
++        private static bool IsVolumeMounted(Hal.Device volume)
++        {
++            bool is_mounted = false;
++
++            var dk_disk = DkDisk.FindByDevice (volume["block.device"] as string);
++            if (dk_disk != null) {
++                is_mounted = dk_disk.IsMounted;
++            }
++
++            if (!is_mounted && volume.PropertyExists("volume.is_mounted")) {
++                is_mounted = volume.GetPropertyBoolean("volume.is_mounted");
++            }
++
++            return is_mounted;
++        }
++
++        private static string MountPoint (Hal.Device volume)
++        {
++            string mount_point = null;
++
++            var dk_disk = DkDisk.FindByDevice (volume["block.device"] as string);
++            if (dk_disk != null) {
++                mount_point = dk_disk.MountPoint;
++            }
++
++            if (mount_point == null) {
++                mount_point = volume["volume.mount_point"];
++            }
++
++            return mount_point;
++        }
+         
+         private static bool IsVolumeReadOnly(Hal.Volume volume)
+         {
++            var dk_disk = DkDisk.FindByDevice (volume["block.device"] as string);
++            if (dk_disk != null) {
++                return dk_disk.IsReadOnly;
++            }
++
+             if(volume.PropertyExists("volume.is_mounted_read_only")) {
+                 return volume.GetPropertyBoolean("volume.is_mounted_read_only");
+             }
+@@ -222,7 +258,7 @@ namespace PodSleuth.HalFrontend
+             Console.WriteLine("iPod Found [{0}]", volume.Udi);
+             Console.WriteLine("  * Generic Device Properties");
+             Console.WriteLine("    - Block Device:       {0}", volume["block.device"]);
+-            Console.WriteLine("    - Mount Point:        {0}", volume["volume.mount_point"]);
++            Console.WriteLine("    - Mount Point:        {0}", MountPoint (volume));
+             Console.WriteLine("    - Read Only:          {0}", IsVolumeReadOnly(volume));
+             Console.WriteLine("    - Volume Size:        {0}", GetVolumeSizeString(volume));
+             Console.WriteLine("  * General iPod Properties");
+diff --git a/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs b/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs
+index 72e3787..13a393b 100644
+--- a/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs
++++ b/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalPopulator.cs
+@@ -14,6 +14,7 @@ namespace PodSleuth.HalFrontend
+         private const string HalNamespace = "org.podsleuth.";
+         
+         private static Hal.Device hal_device;
++        private static DkDisk dk_disk;
+         private static PodSleuth.Device pod_device;
+         private static string mount_point;
+         private static string fs_type;
+@@ -52,15 +53,17 @@ namespace PodSleuth.HalFrontend
+             }
+             
+             hal_device = new Hal.Device(HalEnvironment.Udi);
++
++            dk_disk = DkDisk.FindByDevice (HalEnvironment.BlockDevice ?? hal_device["block.device"]);
+             
+-            bool private_mount = !hal_device.GetPropertyBoolean("volume.is_mounted");
++            bool private_mount = !(hal_device.GetPropertyBoolean("volume.is_mounted") || (dk_disk != null && dk_disk.IsMounted));
+             
+             if(private_mount) {
+                 mount_point = LowLevelMount.GenerateMountPoint();
+                 fs_type = hal_device["volume.fstype"];
+                 LowLevelMount.Mount(HalEnvironment.BlockDevice, mount_point, fs_type, true);
+             } else {
+-                mount_point = hal_device["volume.mount_point"];
++                mount_point = dk_disk == null ? hal_device["volume.mount_point"] : dk_disk.MountPoint;
+             }
+             
+             pod_device = new PodSleuth.Device(HalEnvironment.BlockDevice, mount_point);
+-- 
+1.6.3.3
+
diff --git a/debian/patches/0002-Install-a-dbus-policy-to-fix-podsleuth-rescan.patch b/debian/patches/0002-Install-a-dbus-policy-to-fix-podsleuth-rescan.patch
new file mode 100644
index 0000000..247edfb
--- /dev/null
+++ b/debian/patches/0002-Install-a-dbus-policy-to-fix-podsleuth-rescan.patch
@@ -0,0 +1,83 @@
+From 7d0b3776985ffd6acc3f44a598c0fc27f56f8c08 Mon Sep 17 00:00:00 2001
+From: Gabriel Burt <gabriel.burt at gmail.com>
+Date: Tue, 8 Dec 2009 18:17:47 -0800
+Subject: [PATCH 2/2] Install a dbus policy to fix podsleuth --rescan
+
+You will likely want to run autogen.sh with --sysconfdir=/etc
+---
+ configure.ac        |   12 ++++++++++++
+ data/Makefile.am    |    4 ++++
+ data/podsleuth.conf |   16 ++++++++++++++++
+ 3 files changed, 32 insertions(+), 0 deletions(-)
+ create mode 100644 data/podsleuth.conf
+
+diff --git a/configure.ac b/configure.ac
+index 7ca0143..4f9c50e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -25,6 +25,18 @@ PODSLEUTH_CHECK_HAL(0.5.6)
+ PODSLEUTH_CHECK_SGUTILS
+ PODSLEUTH_CHECK_UPDATE_DIR
+ 
++# taken from HAL's configure.in
++AC_ARG_WITH([dbus-sys],
++        AS_HELP_STRING([--with-dbus-sys=<dir>],
++               [where D-BUS system.d directory is]))
++
++if ! test -z "$with_dbus_sys" ; then
++    DBUS_SYS_DIR="$with_dbus_sys"
++else
++    DBUS_SYS_DIR="$sysconfdir/dbus-1/system.d"
++fi
++AC_SUBST(DBUS_SYS_DIR)
++
+ AC_OUTPUT([
+ 	Makefile
+ 	m4/Makefile
+diff --git a/data/Makefile.am b/data/Makefile.am
+index c9f011b..11cedc9 100644
+--- a/data/Makefile.am
++++ b/data/Makefile.am
+@@ -1,6 +1,9 @@
+ fdidir = $(datadir)/hal/fdi/policy/20thirdparty
+ fdi_DATA = 20-podsleuth.fdi
+ 
++dbusdir = $(DBUS_SYS_DIR)
++dbus_DATA = podsleuth.conf
++
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = podsleuth.pc
+ 
+@@ -9,6 +12,7 @@ edit-table:
+ 
+ EXTRA_DIST = \
+ 	ipod-model-table \
++	podsleuth.conf \
+ 	20-podsleuth.fdi
+ 
+ MAINTAINERCLEANFILES = \
+diff --git a/data/podsleuth.conf b/data/podsleuth.conf
+new file mode 100644
+index 0000000..98254d9
+--- /dev/null
++++ b/data/podsleuth.conf
+@@ -0,0 +1,16 @@
++<!DOCTYPE busconfig PUBLIC
++ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++
++  <!-- This configuration file specifies the required security policies
++       for podsleuth to work. -->
++
++  <!-- Allow anyone to invoke methods on the podsleuth interfaces -->
++  <policy context="default">
++    <allow send_destination="org.freedesktop.Hal"
++           send_interface="org.podsleuth"/>
++  </policy>
++
++</busconfig>
++
+-- 
+1.6.3.3
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..0a8470d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+0001-Do-the-bare-minimum-to-get-working-with-DeviceKit.patch
+0002-Install-a-dbus-policy-to-fix-podsleuth-rescan.patch
diff --git a/debian/rules b/debian/rules
index 15d7df2..1b3b7c0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,11 +1,16 @@
 #!/usr/bin/make -f
 
 include /usr/share/cli-common/cli.make
+include /usr/share/quilt/quilt.make
 
 override_dh_auto_configure:
+	autoreconf -vfi -I m4
 	dh_auto_configure -- --with-hal-callouts-dir=/usr/lib/hal \
 	                     --with-update-dir=/var/lib/podsleuth \
 	                     MCS=/usr/bin/mono-csc
 
+override_dh_auto_clean:
+	dh_auto_clean -- maintainer-clean
+
 %:
-	dh $@
+	dh --with=quilt $@

-- 
podsleuth



More information about the Pkg-cli-apps-commits mailing list