summaryrefslogtreecommitdiff
path: root/trunk/src/etc-update
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/etc-update')
-rw-r--r--trunk/src/etc-update/AUTHORS0
-rw-r--r--trunk/src/etc-update/ChangeLog0
-rw-r--r--trunk/src/etc-update/Makefile20
-rw-r--r--trunk/src/etc-update/README0
-rwxr-xr-xtrunk/src/etc-update/etc-update165
-rw-r--r--trunk/src/etc-update/etc-update.112
6 files changed, 0 insertions, 197 deletions
diff --git a/trunk/src/etc-update/AUTHORS b/trunk/src/etc-update/AUTHORS
deleted file mode 100644
index e69de29..0000000
--- a/trunk/src/etc-update/AUTHORS
+++ /dev/null
diff --git a/trunk/src/etc-update/ChangeLog b/trunk/src/etc-update/ChangeLog
deleted file mode 100644
index e69de29..0000000
--- a/trunk/src/etc-update/ChangeLog
+++ /dev/null
diff --git a/trunk/src/etc-update/Makefile b/trunk/src/etc-update/Makefile
deleted file mode 100644
index 95838ad..0000000
--- a/trunk/src/etc-update/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
-# Copyright 2004 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-#
-# $Header$
-
-include ../../makedefs.mak
-
-all:
- echo "PAPPLE (vb.) To do what babies do to soup with their spoons."
-
-dist:
- mkdir -p ../../$(distdir)/src/etc-update
- cp Makefile AUTHORS README TODO ChangeLog etc-update etc-update.1 ../../$(distdir)/src/etc-update/
-
-install:
- install -m 0755 etc-update $(bindir)/
- install -d $(docdir)/etc-update
- install -m 0644 AUTHORS ChangeLog README $(docdir)/etc-update/
- install -m 0644 etc-update.1 $(mandir)/
diff --git a/trunk/src/etc-update/README b/trunk/src/etc-update/README
deleted file mode 100644
index e69de29..0000000
--- a/trunk/src/etc-update/README
+++ /dev/null
diff --git a/trunk/src/etc-update/etc-update b/trunk/src/etc-update/etc-update
deleted file mode 100755
index f566dff..0000000
--- a/trunk/src/etc-update/etc-update
+++ /dev/null
@@ -1,165 +0,0 @@
-#! /usr/bin/python
-#
-# $Header$
-#
-# Distributed under the terms of the GNU General Public License v2
-# Copyright (c) 2003 Karl Trygve Kalleberg
-#
-# Based on previous versions, by
-# - Brandon Low <lostlogic@gentoo.org>
-# - Jochem Kossen <j.kossen@home.nl>
-# - Leo Lipelis <aeoo@gentoo.org>
-
-from dialog import Dialog
-import portage
-import time
-import re
-import os
-
-__author__ = "Karl Trygve Kalleberg"
-__email__ = "karltk@gentoo.org"
-__version__ = "0.2.0"
-__productname__ = "etc-update"
-__description__ = "Interactive config file updater"
-
-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:
- pass
- # print "Access denied:", path
-
- return files
-
-def findAllFiles(dlg, config):
- files = []
- gauge = dlg.gauge(0,
- "Processing CONFIG_PROTECT directories...",
- 7,
- 60,
- "Gauge",
- sleep=3)
- num_dirs = len(config.config_protect)
- for i in xrange(num_dirs):
- rem = repr(num_dirs - i / num_dirs)
- gauge.update(rem, "Directories remaining: %s" % rem)
- files += _recurseFiles(config.config_protect[i])
- return files
-
-def prettifyFiles(files):
- rx = re.compile("\._cfg...._")
- def strip_cfg(x):
- """Remove ._cfg????_ part """
- m = rx.search(x)
- if m:
- s,e = m.span(0)
- return x[:s] + x[e:]
- return x
- return map(strip_cfg, files)
-
-def updateFile(dlg, original):
-
- # Find candidates
-
- dir = os.path.dirname(original)
- filename = os.path.basename(original)
- rx = re.compile("\._cfg...._" + filename)
- cand = filter(lambda x: rx.search(x), os.listdir(dir))
-
- if len(cand) > 1:
-
- # Add mtimes
- for i in xrange(len(cand)):
- stamp = time.localtime(os.path.getmtime(dir + "/" + cand[i]))
- tstr = time.strftime("%a, %d %b %Y %H:%M:%S", stamp)
- cand[i] = cand[i] + " - " + tstr
-
-
- # Show selection
- replacement = dlg.menu("Files that need updating",
- Dialog.AUTO_SIZE,
- list = cand,
- showHelp = False,
- title="Checklist")
-
- else:
- replacement = cand[0]
-
-
- # Display diff
-
- dlg.yesno("Would you like to update \n" + \
- "[" + original + "]with\n[" + dir + "/" + replacement + "] ?")
-
-def displayFiles(dlg, config, files):
-
- pretty_files = prettifyFiles(files)
-
- while 1:
- result = dlg.menu("Files that need updating",
- Dialog.AUTO_SIZE,
- list = pretty_files,
- showHelp = False,
- title="Checklist")
- if result == None:
- if dlg.ERR_CANCEL:
- break
-
- updateFile(dlg, result)
-
- if len(pretty_files):
- print "!!! Warning: There are still files that require updating."
-
-
-def main():
- dlg = Dialog("etc-update")
-# dlg = None
-
- config = loadConfig()
- files = findAllFiles(dlg, config)
- displayFiles(dlg, config,files)
-
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- print "Operation aborted!"
-
-# TODO:
-# - option for automatically update untouched files
-# - show coloured diff
-# - proper progress bar
diff --git a/trunk/src/etc-update/etc-update.1 b/trunk/src/etc-update/etc-update.1
deleted file mode 100644
index 53477d8..0000000
--- a/trunk/src/etc-update/etc-update.1
+++ /dev/null
@@ -1,12 +0,0 @@
-.TH etc-update "1" "Nov 2003" "gentoolkit"
-.SH NAME
-etc-update \- Gentoo: Configuration Update Utility
-.SH SYNOPSIS
-.B etc-update
-.SH BUGS
-This tool does not yet have a man page. Feel free to submit a bug about it to
-http://bugs.gentoo.org
-.SH AUTHORS
-This informative man page was written by Karl Trygve Kalleberg
-<karltk@gentoo.org>.
-