summaryrefslogtreecommitdiff
path: root/trunk/src/etc-update
diff options
context:
space:
mode:
authorkarltk <karltk@gentoo.org>2003-07-26 20:50:03 +0000
committerkarltk <karltk@gentoo.org>2003-07-26 20:50:03 +0000
commit4071f33e9b356f18e8c04c9234188ec6b83ef4fa (patch)
tree86667cfd8ca348744946519bf4bfe3dc0fae8d2a /trunk/src/etc-update
parent211ae13b7e4c3cc390cab780b9b6570a1e27788d (diff)
downloadgentoolkit-4071f33e9b356f18e8c04c9234188ec6b83ef4fa.tar.gz
Preparing for Gentoolkit relaunch; added basic gentoolkit library.
svn path=/; revision=32
Diffstat (limited to 'trunk/src/etc-update')
-rwxr-xr-xtrunk/src/etc-update/etc-update72
1 files changed, 72 insertions, 0 deletions
diff --git a/trunk/src/etc-update/etc-update b/trunk/src/etc-update/etc-update
new file mode 100755
index 0000000..a92159b
--- /dev/null
+++ b/trunk/src/etc-update/etc-update
@@ -0,0 +1,72 @@
+#! /usr/bin/python
+#
+# $Header$
+#
+# Distributed under the terms of the GNU General Public License v2
+# Copyright (c) 2003 Karl Trygve Kalleberg
+
+import portage
+import re
+import os
+
+globals = portage.settings.configdict["globals"]
+
+for i in globals["CONFIG_PROTECT"].split():
+ print i
+
+# list all files in all CONFIG_PROTECT dirs
+# list them in the gui
+# one-by-one:
+# - is update to header only?
+# - is the original unmodified from the previous package? (not checkable - duh!)
+# -
+
+class Config:
+ pass
+
+def loadConfig():
+ cfg = Config()
+ globals = portage.settings.configdict["globals"]
+ cfg.config_protect = globals["CONFIG_PROTECT"].split()
+ return cfg
+
+def _recurseFiles(path):
+ files = []
+ if os.path.exists(path):
+ try:
+ tmpfiles = os.listdir(path)
+ for i in tmpfiles:
+ fn = path + "/" + i
+ if os.path.isdir(fn):
+ files += _recurseFiles(fn)
+ elif os.path.isfile(fn):
+ m = re.search("\._cfg...._",fn)
+ if m:
+ files.append(fn)
+ else:
+ print "What is this anyway?:", fn
+ except OSError:
+ print "Access denied:", path
+
+ return files
+
+def findAllFiles(config):
+ files = []
+ for i in config.config_protect:
+ files += _recurseFiles(i)
+ return files
+
+def displayFiles(config,files):
+ print files
+
+def main():
+ config = loadConfig()
+ files = findAllFiles(config)
+ displayFiles(config,files)
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ print "Operation aborted!"