Hello community, here is the log from the commit of package backup-manager checked in at Mon Nov 17 16:40:41 CET 2008. -------- --- GNOME/backup-manager/backup-manager.changes 2008-11-07 19:28:31.000000000 +0100 +++ /mounts/work_src_done/STABLE/backup-manager/backup-manager.changes 2008-11-13 18:44:27.000000000 +0100 @@ -1,0 +2,8 @@ +Thu Nov 13 12:02:02 CEST 2008 - crivera@suse.de + +- Set the correct folder in backup-manager-restore. +- Use pwd module instead of os.login (). +- Fix the detection of backup media +- Fix minor bugs in the UI. + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ backup-manager.spec ++++++ --- /var/tmp/diff_new_pack.a24720/_old 2008-11-17 16:40:20.000000000 +0100 +++ /var/tmp/diff_new_pack.a24720/_new 2008-11-17 16:40:20.000000000 +0100 @@ -25,7 +25,7 @@ Requires: python >= 2.6 python-gtk python-setuptools rdiff-backup PolicyKit PolicyKit-gnome dbus-1 dbus-1-python libnotify tango-icon-theme AutoReqProv: on Version: 0.1.0 -Release: 11 +Release: 12 Summary: A simple backup application for GNOME Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -86,6 +86,11 @@ %files lang -f backup_manager.lang %changelog +* Thu Nov 13 2008 crivera@suse.de +- Set the correct folder in backup-manager-restore. +- Use pwd module instead of os.login (). +- Fix the detection of backup media +- Fix minor bugs in the UI. * Fri Nov 07 2008 maw@suse.de - Misc. build fixes - Split out a -lang subpackage. ++++++ backup-manager-0.1.0.tar.gz ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup_manager/applet.py new/backup-manager-0.1.0/backup_manager/applet.py --- old/backup-manager-0.1.0/backup_manager/applet.py 2008-11-03 18:29:49.000000000 +0100 +++ new/backup-manager-0.1.0/backup_manager/applet.py 2008-11-07 23:42:31.000000000 +0100 @@ -10,6 +10,7 @@ import dbus import gettext import math +import pwd from gettext import gettext as _ from pkg_resources import resource_filename from backup_manager.core import * @@ -155,7 +156,7 @@ def backup_manager_running (self): p = subprocess.Popen (["ps x --user %s | grep backup-manager | grep -v grep | awk '{print $1}'" % \ - (os.getlogin ())], stdout=subprocess.PIPE, close_fds=True, shell=True) + pwd.getpwuid (os.getuid ())[0]], stdout=subprocess.PIPE, close_fds=True, shell=True) pids = p.stdout.read ().strip () p.wait () diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup_manager/backup.glade new/backup-manager-0.1.0/backup_manager/backup.glade --- old/backup-manager-0.1.0/backup_manager/backup.glade 2008-09-25 16:23:00.000000000 +0200 +++ new/backup-manager-0.1.0/backup_manager/backup.glade 2008-11-08 01:53:13.000000000 +0100 @@ -1,7 +1,6 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.4.3 on Thu Sep 18 19:36:30 2008 --> +<?xml version="1.0"?> <glade-interface> + <requires-version lib="gtk+" version="2.12"/> <widget class="GtkWindow" id="main_window"> <property name="border_width">6</property> <property name="title" translatable="yes">Backup!</property> @@ -318,8 +317,8 @@ <property name="label" translatable="yes">General</property> </widget> <packing> - <property name="type">tab</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -342,7 +341,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">False</property> - <property name="headers_clickable">True</property> </widget> </child> </widget> @@ -455,9 +453,9 @@ <property name="label" translatable="yes">Exceptions</property> </widget> <packing> - <property name="type">tab</property> <property name="position">1</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> </widget> @@ -530,7 +528,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">False</property> - <property name="headers_clickable">True</property> </widget> </child> </widget> @@ -659,6 +656,7 @@ <widget class="GtkWindow" id="restore_window"> <property name="border_width">6</property> <property name="title" translatable="yes">Restore!</property> + <property name="resizable">False</property> <property name="window_position">GTK_WIN_POS_CENTER</property> <property name="icon_name">gtk-harddisk</property> <child> @@ -687,7 +685,7 @@ <child> <widget class="GtkLabel" id="label13"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Backup Location</b></property> + <property name="label" translatable="yes"><b>Backup Source</b></property> <property name="use_markup">True</property> </widget> <packing> @@ -717,7 +715,7 @@ <child> <widget class="GtkLabel" id="label14"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Restore Location</b></property> + <property name="label" translatable="yes"><b>Restore Destination</b></property> <property name="use_markup">True</property> </widget> <packing> @@ -769,7 +767,7 @@ <widget class="GtkRadioButton" id="restore_manual_button"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Manually select files to restore:</property> + <property name="label" translatable="yes">Restore selected files;</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> </widget> @@ -783,8 +781,34 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="label" translatable="yes">Select Files...</property> <property name="response_id">0</property> + <child> + <widget class="GtkHBox" id="hbox18"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <widget class="GtkImage" id="image12"> + <property name="visible">True</property> + <property name="stock">gtk-index</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label23"> + <property name="visible">True</property> + <property name="label" translatable="yes">Select Files...</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> </widget> <packing> <property name="position">1</property> @@ -1018,7 +1042,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">False</property> - <property name="headers_clickable">True</property> </widget> </child> </widget> @@ -1200,19 +1223,24 @@ </child> </widget> <widget class="GtkDialog" id="backup_message_dialog"> - <property name="border_width">5</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Backup!</property> + <property name="resizable">False</property> <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property> + <property name="default_width">500</property> <property name="destroy_with_parent">True</property> + <property name="icon_name">gtk-harddisk</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_CENTER</property> <property name="has_separator">False</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> - <property name="spacing">2</property> + <property name="spacing">6</property> <child> <widget class="GtkVBox" id="vbox8"> <property name="visible">True</property> - <property name="spacing">3</property> + <property name="spacing">6</property> <child> <widget class="GtkHBox" id="hbox12"> <property name="visible">True</property> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup_manager/core.py new/backup-manager-0.1.0/backup_manager/core.py --- old/backup-manager-0.1.0/backup_manager/core.py 2008-11-05 23:46:53.000000000 +0100 +++ new/backup-manager-0.1.0/backup_manager/core.py 2008-11-08 02:31:09.000000000 +0100 @@ -141,11 +141,11 @@ z.wait () def notify_user (summary, body, user=None): - run_in_user_session (user if user else os.getlogin (), + run_in_user_session (user if user else pwd.getpwuid (os.getuid ())[0], ["notify-send", "--icon=gtk-harddisk", "--urgency=normal", summary, body]) def notify_user_err (summary, body, user=None): - run_in_user_session (user if user else os.getlogin (), + run_in_user_session (user if user else pwd.getpwuid (os.getuid ())[0], ["notify-send", "--icon=gtk-harddisk", "--urgency=critical", summary, body]) def get_log_file_location (): @@ -179,13 +179,31 @@ except dbus.DBusException, e: print >> sys.stderr, "PolicyKit failure: ", str (e) gsu = subprocess.Popen (["gnomesu", "%s" % (resource_filename (__name__, "service.py")), - "--", "--no-dbus", os.getlogin (), + "--", "--no-dbus", pwd.getpwuid (os.getuid ())[0], "%s %s" % (config.backup_schedule, config.backup_time)], stderr=subprocess.PIPE) gsu.wait () if gsu.returncode != 0: raise BackupManagerException ("Failed to schedule backup: %s" % gsu.stderr.read ()) +def block_suspend (): + try: + pm = dbus.SessionBus ().get_object ("org.freedesktop.PowerManagement", + "/org/freedesktop/PowerManagement/Inhibit") + pmi = dbus.Interface (pm, "org.freedesktop.PowerManagement.Inhibit") + return pmi.Inhibit ("backup-manager", "Data is being saved.") + except dbus.DBusException, e: + raise WolfException (str (e)) + +def unblock_suspend (cookie): + try: + pm = dbus.SessionBus ().get_object ("org.freedesktop.PowerManagement", + "/org/freedesktop/PowerManagement/Inhibit") + pmi = dbus.Interface (pm, "org.freedesktop.PowerManagement.Inhibit") + pmi.UnInhibit (dbus.UInt32 (cookie)) + except dbus.DBusException, e: + raise WolfException (str (e)) + def get_directory_size (dir): p = subprocess.Popen (["du", "-shkx", dir], stdout=subprocess.PIPE) output = p.stdout.read () diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup_manager/manager.py new/backup-manager-0.1.0/backup_manager/manager.py --- old/backup-manager-0.1.0/backup_manager/manager.py 2008-11-05 23:52:22.000000000 +0100 +++ new/backup-manager-0.1.0/backup_manager/manager.py 2008-11-08 03:06:35.000000000 +0100 @@ -4,6 +4,7 @@ import subprocess import signal import gettext +import pwd from statvfs import * from gettext import gettext as _ from optparse import OptionParser @@ -36,8 +37,8 @@ os.setsid () os.chdir ("/") os.umask (0) - - pids = get_session_pids (os.getlogin ()) + + pids = get_session_pids (pwd.getpwuid (os.getuid ())[0]) if len (pids) == 0: print "No active sessions. skipping applet launch." os._exit (0) @@ -47,7 +48,13 @@ def backup_now (config): applet_pid = start_applet () - + ck = None + + try: + ck = block_suspend () + except WolfException, e: + print >> sys.stderr, str (e) + try: get_backup_manager ().backup (config) except BackupManagerException, e: @@ -56,7 +63,10 @@ sys.exit (1) else: notify_user (_("Backup"), _("Your data has been backed up")) - + finally: + if ck: + unblock_suspend (ck) + def check_uuid_foreach_session (uuid): p = subprocess.Popen (["ps -C gnome-session -o pid=,user="], stdout=subprocess.PIPE, close_fds=True, shell=True) @@ -64,16 +74,19 @@ p.wait () for line in output.split ("\n"): - pid, user = line.strip ().split () - new_env = get_env_from_pid (pid) - bm = subprocess.Popen (["sudo", "-u", user, "backup-manager", "--check-uuid=%s" % uuid], - close_fds=True, env=new_env) + pid, user = line.strip ().split () + bm = subprocess.Popen (["su", user, "-c", "backup-manager --check-uuid=%s --session-pid=%s" % (uuid, pid)], + close_fds=True) bm.wait () -def check_uuid (config, uuid): +def check_uuid (config, uuid, session_pid): if config.ask_on_insert == False or config.device_uuid != uuid: return False + new_env = get_env_from_pid (session_pid) + for k, v in new_env.iteritems (): + os.putenv (k ,v) + import gtk import gtk.glade @@ -81,7 +94,7 @@ widgets = gtk.glade.XML (resource_filename (__name__, "backup.glade")) md = widgets.get_widget ("backup_message_dialog") ab = widgets.get_widget ("dialog_ask_button") - + res = md.run () md.hide () md.destroy () @@ -98,15 +111,19 @@ parser = OptionParser () parser.add_option ("-k", "--check", dest="check", action="store_true", - default=False, help="Check to see if we should backup now") + default=False, help="Check to see if we should backup now.") parser.add_option ("-c", "--config", dest="config", - default=None, help="Configuration file to use") + default=None, help="Configuration file to use.") parser.add_option ("-n", "--now", dest="now", action="store_true", default=False, help="Backup now") parser.add_option ("-a", "--device-added", dest="device", action="store_true", default=False, help="A storage device was added. See if it's a backup device.") parser.add_option ("-u", "--check-uuid", dest="check_uuid", - default=None, help="Check to see if our backup device matches UUID and backup if necessary") + default=None, help="Check to see if our backup device matches UUID and backup if necessary.") + parser.add_option ("-s", "--session-pid", dest="session_pid", + default=None, help="Provide the pid of the session manager. Only used with --check-uuid.") + parser.add_option ("-m", "--mount-delay", dest="mount_delay", action="store_true", + default=False, help="Wait up to 30 seconds for the backup device to be mounted") (options, args) = parser.parse_args () config_file = get_config_location () @@ -136,10 +153,16 @@ sys.exit (1) check_uuid_foreach_session (uuid) elif options.now: + if options.mount_delay: + for i in xrange (0, 5): + time.sleep (5.0) + vol_info = get_volume_info () + if config.device_uuid and vol_info.has_key (config.device_uuid): + break backup_now (config) elif options.check_uuid: - if check_uuid (config, options.check_uuid): - backup_now (config) + if check_uuid (config, options.check_uuid, options.session_pid): + os.execlp ("backup-manager", "backup-manager", "-m", "--now") else: parser.print_help () diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup_manager/rdiff.py new/backup-manager-0.1.0/backup_manager/rdiff.py --- old/backup-manager-0.1.0/backup_manager/rdiff.py 2008-10-10 05:32:26.000000000 +0200 +++ new/backup-manager-0.1.0/backup_manager/rdiff.py 2008-11-07 23:41:05.000000000 +0100 @@ -41,7 +41,7 @@ def backup (self, config): self.verify_config (config) path = get_backup_path (config) - hd = pwd.getpwnam (os.getlogin ())[5] + hd = pwd.getpwuid (os.getuid ())[5] use_fl = self._generate_file_list (config, get_file_list_location (), hd) os.nice (19) @@ -73,7 +73,7 @@ raise BackupManagerException (_("Failed to find rdiff-backup")) path = get_backup_path (config) - hd = pwd.getpwnam (os.getlogin ())[5] + hd = pwd.getpwuid (os.getuid ())[5] hd_mp, hd_dev, hd_type = get_mount_info (hd) bp_mp, bp_dev, bp_type = get_mount_info (path) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup_manager/restore.py new/backup-manager-0.1.0/backup_manager/restore.py --- old/backup-manager-0.1.0/backup_manager/restore.py 2008-10-10 04:55:14.000000000 +0200 +++ new/backup-manager-0.1.0/backup_manager/restore.py 2008-11-08 00:19:17.000000000 +0100 @@ -109,7 +109,7 @@ fc.set_select_multiple (True) if self._path: - fc.set_filename (self._path) + fc.set_current_folder (self._path) resp = fc.run () if resp == gtk.RESPONSE_OK: @@ -124,7 +124,7 @@ fc.set_select_multiple (True) if self._path: - fc.set_filename (self._path) + fc.set_current_folder (self._path) resp = fc.run () if resp == gtk.RESPONSE_OK: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/backup-manager.spec new/backup-manager-0.1.0/backup-manager.spec --- old/backup-manager-0.1.0/backup-manager.spec 2008-11-06 03:05:47.000000000 +0100 +++ new/backup-manager-0.1.0/backup-manager.spec 2008-11-08 06:22:09.000000000 +0100 @@ -45,17 +45,17 @@ %config %{_sysconfdir}/dbus-1/system.d/backup-manager.conf %dir %{_datadir}/doc/packages/backup-manager %doc %{_datadir}/doc/packages/backup-manager/LICENSES -%doc %{_datadir}/applications/backup-manager-settings.desktop -%doc %{_datadir}/applications/backup-manager-restore.desktop +%{_datadir}/applications/backup-manager-settings.desktop +%{_datadir}/applications/backup-manager-restore.desktop %config %{_datadir}/PolicyKit/policy/org.opensuse.backupmanager.policy %config %{_datadir}/dbus-1/system-services/org.opensuse.BackupManager.service -#%config %{_datadir}/hal/fdi/policy/20thirdparty/99-backup-manager.fdi +#%config %{_datadir}/hal/fdi/policy/10osvendor/99-backup-manager.fdi %{_datadir}/locale/*/LC_MESSAGES/backup_manager.mo %changelog -n backup-manager %post -#ln -s %{_bindir}/backup-manager /usr/lib/hal/scripts/hal-backup-manager +#ln -s %{_bindir}/backup-manager %{_libdir}/hal/scripts/hal-backup-manager #exit 0 %postun diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/conf/99-backup-manager.fdi new/backup-manager-0.1.0/conf/99-backup-manager.fdi --- old/backup-manager-0.1.0/conf/99-backup-manager.fdi 2008-09-25 16:23:00.000000000 +0200 +++ new/backup-manager-0.1.0/conf/99-backup-manager.fdi 2008-11-07 22:03:01.000000000 +0100 @@ -2,7 +2,7 @@ <deviceinfo version="0.2"> <device> - <match key="@block.storage_device:storage.removable" bool="true"> + <match key="@block.storage_device:storage.removable" bool="true"> <match key="volume.fsusage" contains="filesystem"> <append key="info.callouts.add" type="strlist">hal-backup-manager --device-added</append> </match> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/backup-manager-0.1.0/setup.py new/backup-manager-0.1.0/setup.py --- old/backup-manager-0.1.0/setup.py 2008-11-06 02:54:19.000000000 +0100 +++ new/backup-manager-0.1.0/setup.py 2008-11-08 06:21:45.000000000 +0100 @@ -34,7 +34,7 @@ cmdclass = { "install": MyInstallData }, data_files = [("/etc/dbus-1/system.d", ["conf/backup-manager.conf"]), ("/usr/share/doc/packages/backup-manager", ["LICENSES"]), - #("/usr/share/hal/fdi/policy/20thirdparty", ["conf/99-backup-manager.fdi"]), + #("/usr/share/hal/fdi/policy/10osvendor", ["conf/99-backup-manager.fdi"]), ("/usr/share/applications", ["conf/backup-manager-settings.desktop"]), ("/usr/share/applications", ["conf/backup-manager-restore.desktop"]), ("/usr/share/PolicyKit/policy", ["conf/org.opensuse.backupmanager.policy"]), ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org