r20699 - in /desktop/unstable/gconf/debian: changelog update-gconf-defaults

joss at users.alioth.debian.org joss at users.alioth.debian.org
Tue Jul 14 18:57:20 UTC 2009


Author: joss
Date: Tue Jul 14 18:57:16 2009
New Revision: 20699

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=20699
Log:
* update-gconf-defaults:
  + Support comments. Closes: #535569.
  + Add --only-if-changed option, which makes the script a no-op 
    if no source files are more recent than the generated 
    configuration.

Modified:
    desktop/unstable/gconf/debian/changelog
    desktop/unstable/gconf/debian/update-gconf-defaults

Modified: desktop/unstable/gconf/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gconf/debian/changelog?rev=20699&op=diff
==============================================================================
--- desktop/unstable/gconf/debian/changelog (original)
+++ desktop/unstable/gconf/debian/changelog Tue Jul 14 18:57:16 2009
@@ -1,3 +1,13 @@
+gconf (2.26.2-3) unstable; urgency=low
+
+  * update-gconf-defaults:
+    + Support comments. Closes: #535569.
+    + Add --only-if-changed option, which makes the script a no-op 
+      if no source files are more recent than the generated 
+      configuration.
+
+ -- Josselin Mouette <joss at debian.org>  Tue, 14 Jul 2009 20:57:10 +0200
+
 gconf (2.26.2-2) unstable; urgency=low
 
   [ Emilio Pozuelo Monfort ]

Modified: desktop/unstable/gconf/debian/update-gconf-defaults
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gconf/debian/update-gconf-defaults?rev=20699&op=diff
==============================================================================
--- desktop/unstable/gconf/debian/update-gconf-defaults (original)
+++ desktop/unstable/gconf/debian/update-gconf-defaults Tue Jul 14 18:57:16 2009
@@ -1,5 +1,5 @@
 #! /usr/bin/python
-# -*- coding: UTF-8 -*-
+# -*- coding: utf-8 -*-
 #
 # © 2005 Josselin Mouette <joss at debian.org>
 # Licensed under the GNU LGPL, see /usr/share/common-licenses/LGPL-2.1
@@ -18,6 +18,8 @@
                   help="select mandatory settings directories")
 parser.add_option("--no-signal", action="store_false", default=True, dest="signal",
                   help="do not send SIGHUP the running gconfd-2 processes")
+parser.add_option("--only-if-changed", action="store_true", default=False, dest="ifchanged",
+                  help="only regenerate configuration if needed")
 
 (options, args) = parser.parse_args()
 
@@ -33,11 +35,6 @@
     parser.error("Source directory is not readable.")
 if not os.access(options.dest_dir,os.W_OK|os.X_OK):
     parser.error("Destination directory is not writable.")
-
-tmp_dir=tempfile.mkdtemp(prefix="gconf-")
-tmp_home=tmp_dir+'/home'
-tmp_gconf=tmp_dir+'/gconf'
-tmp_file=tmp_dir+'/temp.entries'
 
 save_stdout=os.dup(1)
 os.close(1)
@@ -118,17 +115,38 @@
 def read_entries(filename):
   for line in file(filename):
     l = line.rstrip('\n').split(None,1)
-    if len(l) == 2:
+    if len(l) == 2 and not l[0].startswith('#'):
       gconf_val[l[0]] = l[1]
 
 
-defaults_files = os.listdir(options.source_dir)
-defaults_files.sort()
-for f in defaults_files:
-  realname=options.source_dir+'/'+f
+defaults_files = []
+for f in os.listdir(options.source_dir):
   for ext in ['.dpkg-tmp', '.bak', '.tmp', '~', '.sav', '.save']:
     if f.endswith(ext):
-      continue
+      break
+  else:
+    defaults_files.append(f)
+defaults_files.sort()
+
+if options.ifchanged:
+  source_stamp = os.stat(options.source_dir).st_mtime
+  for f in defaults_files:
+    realname=os.path.join(options.source_dir,f)
+    source_stamp = max(os.stat(realname).st_mtime,source_stamp)
+  try:
+    dest_stamp = os.stat(os.path.join(options.dest_dir, treefile)).st_mtime
+  except OSError:
+    dest_stamp = 0
+  if source_stamp < dest_stamp:
+    sys.exit(0)
+
+tmp_dir=tempfile.mkdtemp(prefix="gconf-")
+tmp_home=tmp_dir+'/home'
+tmp_gconf=tmp_dir+'/gconf'
+tmp_file=tmp_dir+'/temp.entries'
+
+for f in defaults_files:
+  realname=os.path.join(options.source_dir,f)
   if f.endswith('.entries'):
     if gconf_val:
       write_and_apply_entries(tmp_file)




More information about the pkg-gnome-commits mailing list