Collected all pending updates
authorkarltk <karltk@gentoo.org>
Mon, 8 Dec 2003 21:21:24 +0000 (21:21 -0000)
committerkarltk <karltk@gentoo.org>
Mon, 8 Dec 2003 21:21:24 +0000 (21:21 -0000)
svn path=/; revision=43

13 files changed:
trunk/Makefile [new file with mode: 0644]
trunk/TODO
trunk/src/ekeyword/ekeyword.1 [new file with mode: 0644]
trunk/src/etc-update/etc-update.1 [new file with mode: 0644]
trunk/src/gentool/gentool
trunk/src/gentool/gentool.1 [new file with mode: 0644]
trunk/src/moo/AUTHORS [new file with mode: 0644]
trunk/src/moo/README [new file with mode: 0644]
trunk/src/moo/TODO [new file with mode: 0644]
trunk/src/moo/moo [new file with mode: 0755]
trunk/src/moo/moo.1 [new file with mode: 0644]
trunk/src/revdep-rebuild/TODO [new file with mode: 0644]
trunk/src/revdep-rebuild/revdep-rebuild.1 [new file with mode: 0644]

diff --git a/trunk/Makefile b/trunk/Makefile
new file mode 100644 (file)
index 0000000..202bdb6
--- /dev/null
@@ -0,0 +1,59 @@
+VERSION=0.2.0
+PYVERSION="`python-config | sed 's/-l//' | sed 's/ -lm.*//'`"
+DESTDIR=
+docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION)
+bindir=$(DESTDIR)/usr/bin
+sbindir=$(DESTDIR)/usr/sbin
+mandir=$(DESTDIR)/usr/share/man/man1
+
+all:
+       echo $(PYVERSION)
+       echo $(VERSION)
+       echo $(docdir)
+       echo $(bindir)
+       echo $(sbindir)
+       echo $(mandir)
+                       
+install:
+
+       install -d $(docdir)
+       install -d $(bindir)
+       install -d $(sbindir)
+       install -d $(mandir)
+                       
+       install -m 0644 {AUTHORS,ChangeLog,COPYING,NEWS,README,TODO} $(docdir)/
+
+       install -m 0755 src/gentool/gentool $(bindir)/
+       install -d $(docdir)/gentool
+       install -m 0644 src/gentool/{README,AUTHORS} $(docdir)/gentool/
+       install -m 0644 src/gentool/gentool.1 $(mandir)/
+       
+       install -m 0755 src/etcat/etcat $(bindir)/
+       install -d $(docdir)/etcat
+       install -m 0644 src/etcat/{README,AUTHORS} $(docdir)/etcat/
+       install -m 0644 src/etcat/etcat.1 $(mandir)/
+
+       install -m 0755 src/qpkg/qpkg $(bindir)/
+       install -d $(docdir)/qpkg       
+       install -m 0644 src/qpkg/{README,AUTHORS,ChangeLog} $(docdir)/qpkg/
+       install -m 0644 src/qpkg/qpkg.1 $(mandir)/
+       
+       install -m 0755 src/etc-update/etc-update $(bindir)/
+       install -d $(docdir)/etc-update
+       install -m 0644 src/etc-update/{AUTHORS,ChangeLog,README} $(docdir)/etc-update/
+       install -m 0644 src/etc-update/etc-update.1 $(mandir)/
+       
+       install -m 0755 src/ekeyword/ekeyword $(bindir)/
+       install -d $(docdir)/ekeyword
+       install -m 0644 src/ekeyword/{AUTHORS,README} $(docdir)/ekeyword/
+       install -m 0644 src/ekeyword/ekeyword.1 $(mandir)/
+
+       install -m 0755 src/echangelog/echangelog $(bindir)/
+       install -d $(docdir)/echangelog 
+       install -m 0644 src/echangelog/{AUTHORS,README} $(docdir)/echangelog/
+       install -m 0644 src/echangelog/echangelog.1 $(mandir)/
+        
+       install -m 0755 src/revdep-rebuild/revdep-rebuild $(sbindir)/
+       install -d $(docdir)/revdep-rebuild     
+       install -m 0644 src/revdep-rebuild/{AUTHORS,README,TODO} $(docdir)/revdep-rebuild/
+       install -m 0644 src/revdep-rebuild/revdep-rebuild.1 $(mandir)/
index 5e897b5474a8424e7a2f9997144c31a52092bbed..2adbf157b64e88c83ddd7956946a5845a4672e64 100644 (file)
@@ -1,3 +1,12 @@
+- rename gentool to equery
+ - add changelog <from> <to> [--last] [--lastentry] [--current]
+  - displays changelog entries
+ - add installed [cat]
+  - displays installed packages (optionally only in a given cat)
+ - add check <pkg-spec> [--full] [--display=pkgnames,full]
+  - check md5 and timestamps (optionally also in CONFIG_PROTECT dirs)
+ - add which
+  - as ewhich
 - merge dep-clean and pkg-clean to use gentoolkit
 - rewrite ekeywords and echangelog to use gentoolkit
 - add deep depends to etcat
diff --git a/trunk/src/ekeyword/ekeyword.1 b/trunk/src/ekeyword/ekeyword.1
new file mode 100644 (file)
index 0000000..339f4cd
--- /dev/null
@@ -0,0 +1,12 @@
+.TH ekeyword "1" "Nov 2003" "gentoolkit"
+.SH NAME
+ekeyword \- Gentoo: ebuild Keyword Changer
+.SH SYNOPSIS
+.B ekeyword
+.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>.
+
diff --git a/trunk/src/etc-update/etc-update.1 b/trunk/src/etc-update/etc-update.1
new file mode 100644 (file)
index 0000000..53477d8
--- /dev/null
@@ -0,0 +1,12 @@
+.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>.
+
index c2019f555881e00fbd4dd9c19d65f17e41dcda4f..e4148c963a6a850e5566c08aff2884d843aadfa4 100755 (executable)
@@ -143,7 +143,7 @@ class CmdListFiles(Command):
 
     
 class CmdListBelongs(Command):
-    """List all packages owning file_spec"""
+    """List all packages owning a particular file"""
     def __init__(self):
         self.default_opts = {
             "category": "*",
@@ -219,41 +219,44 @@ class CmdListBelongs(Command):
                "  " + yellow("-c, --category cat") + " - only search in category " + yellow("cat") + "\n" + \
                "  " + yellow("-e, --earlyout") + "     - stop when first match found\n"
     
-def cmdDepends(file_spec):
+class CmdListDepends(Command):
     """List all packages directly or indirectly depending on pkgQuery"""
     pass
 
-def cmdDisplayUSEs(query):
+class CmdDisplayUSEs(Command):
     """Advanced report of a package's USE flags"""
     pass
 
-def cmdDisplayDepGraph(pkgQuery):
+class CmdDisplayDepGraph(Command):
     """Display tree graph of deps for pkgQuery"""
     pass
 
-def cmdDisplayReverseDepGraph(pkgQuery):
-    """Display tree graph of reverse deps for pkgQuery"""
-    pass
-
-def cmdDisplayChanges(pkgQuery):
+class CmdDisplayChanges(Command):
     """Display changes for pkgQuery"""
     pass
 
-def cmdDisplaySize(pkgQuery):
+class CmdDisplaySize(Command):
     """Display disk size consumed by pkgQuery"""
     pass
 
-def cmdCheckIntegrity(pkgQuery):
+class CmdCheckIntegrity(Command):
     """Check timestamps and md5sums for files owned by pkgQuery"""
     pass
 
-def cmdPortageStatistics():
+class CmdDisplayStatistics(Command):
     """Display statistics about installed and uninstalled packages"""
     pass
 
 Known_commands = {
     "files": CmdListFiles(),
-    "belongs": CmdListBelongs()
+    "belongs": CmdListBelongs(),
+    "depends": CmdListDepends(),
+    "uses": CmdDisplayUSEs(),
+    "depgraph": CmdDisplayDepGraph(),
+    "changes": CmdDisplayChanges(),
+    "size": CmdDisplaySize(),
+    "check": CmdCheckIntegrity(),
+    "stats": CmdDisplayStatistics()
     }
 
 Config = {
diff --git a/trunk/src/gentool/gentool.1 b/trunk/src/gentool/gentool.1
new file mode 100644 (file)
index 0000000..0f52b7f
--- /dev/null
@@ -0,0 +1,12 @@
+.TH gentool "1" "Nov 2003" "gentoolkit"
+.SH NAME
+gentool \- Gentoo: Package Query Tool
+.SH SYNOPSIS
+.B gentool
+.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>.
+
diff --git a/trunk/src/moo/AUTHORS b/trunk/src/moo/AUTHORS
new file mode 100644 (file)
index 0000000..fe436cb
--- /dev/null
@@ -0,0 +1 @@
+Karl Trygve Kalleberg <karltk@gentoo.org>
diff --git a/trunk/src/moo/README b/trunk/src/moo/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/trunk/src/moo/TODO b/trunk/src/moo/TODO
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/trunk/src/moo/moo b/trunk/src/moo/moo
new file mode 100755 (executable)
index 0000000..5c925c5
--- /dev/null
@@ -0,0 +1,192 @@
+#! /usr/bin/env python2.2
+
+import os
+import sys
+import time
+import signal
+
+CONFDIR="/tmp/moo"
+
+
+def printUsage():
+    print "Usage: moo <options> [command] <command-options>\n" + \
+              "Where [command] is one of:\n" + \
+              "scan     - scan for available networks\n" + \
+              "list     - list available profiles\n"+ \
+              "select   - select a particular profile\n"
+
+def scanNetworks():
+    pass
+
+def runCmd(cmd):
+    print "Executing \"" + cmd + "\""
+    v = os.system(cmd)
+    print "Result: " + str(v)
+
+class ProfileHandler:
+    def __init__(self):
+        self.profiles = {}
+        self._loadProfiles()
+    def _loadProfiles(self):
+        for x in os.listdir(CONFDIR+"/profiles"):
+            if x[-1] != "~" and x[0] != ".":
+                self.profiles[x] = Profile(CONFDIR+"/profiles/"+x)
+    def listProfiles(self,detailed=0):
+        for x in self.profiles.keys():
+            if detailed:
+                print x + ":"
+                self.profiles[x].dump()
+            else:
+                print x + " [" + self.profiles[x].description + "]"
+    def getProfileNames(self):
+        return self.profiles.keys()
+    def getProfile(self,name):
+        return self.profiles[name]
+
+
+class Profile:
+    def __init__(self, filename):
+        self._loadFromFile(filename)
+    def _loadFromFile(self,filename):
+        self.desc = ""
+        self.ifaceName = ""
+        self.ip = ""
+        self.broadcast = ""
+        self.gateway = ""
+        self.exclusive = "no"
+
+        ins = open(filename)
+        for s in ins.readlines():
+            for x in ["description","ifaceName","ip","broadcast",
+                      "gateway","exclusive"]:
+                if s.find(x+"=") == 0:
+                    val=s.replace(x+"=","").strip()
+                    self.__dict__[x] = val
+    def dump(self):
+        print "description = " + self.description + "\n" + \
+              "iface       = " + self.ifaceName + "\n" + \
+              "ip          = " + self.ip + "\n" + \
+              "broadcast   = " + self.broadcast + "\n" + \
+              "gateway     = " + self.gateway + "\n" + \
+              "exclusive   = " + self.exclusive + "\n"
+
+class Interface:
+    def __init__(self, name):
+        self.name = name
+        self.netmask = ""
+        self.broadcast = ""
+        self.ip = ""
+        self.gateway = ""
+        self._loadIPV4Info()
+    def _loadIPV4Info(self):
+        pass
+    def getNetmask(self):
+        return self.netmask
+    def getName(self):
+        return self.name
+    def getBroadcast(self):
+        return self.broadcast
+    def getGateway(self):
+        return self.gateway
+    def setGateway(self,gw):
+        self.gateway = gw
+    def setBroadcast(self,broadcast):
+        self.broadcast = broadcast
+    def setNetmask(self,netmask):
+        self.netmask = netmask
+    def runDHCP(self):
+        runCmd("dhcpcd " + self.name)
+    def down(self):
+        runCmd("ifconfig " + self.name + " down")
+        pidFile = "/var/run/dhcpcd-" + self.name + ".pid"
+        if os.path.exists(pidFile):
+            ins = open(pidFile)
+            pid = int(ins.readline())
+            os.kill(pid,signal.SIGTERM)
+            time.sleep(1)
+    def up(self):
+        if self.ip:
+            options += self.ip + " "
+        if self.broadcast:
+            options += "broadcast " + self.broadcast + " "
+        if self.netmask:
+            options += "netmask " + self.netmask + " "
+        runCmd("ifconfig " + self.name + " " + options + " up")
+        if self.gateway:
+            runCmd("route add default gw " + self.gateway + " " + self.name)
+            
+class InterfaceHandler:
+    def __init__(self):
+        self.ifaces = {}
+        self._loadAllInterfaces()
+    def _loadAllInterfaces(self):
+        ins=open("/proc/net/dev")
+        for line in ins.readlines():
+            tokens = line.split()
+            ifaceName = tokens[0].strip()
+            if ifaceName[-1] == ":":
+                ifaceName = ifaceName[:-1]
+                iface = Interface(ifaceName)
+                self.ifaces[ifaceName] = iface
+    def getInterface(self,ifaceName):
+        return self.ifaces[ifaceName]
+    def downAll(self):
+        for x in self.ifaces.values():
+            if x.getName() != "lo":
+                x.down()
+
+class Moo:
+    def __init__(self):
+        self.profileHandler = ProfileHandler()
+        self.ifaceHandler = InterfaceHandler()
+    
+    def selectProfile(self,profile):
+        prof = self.profileHandler.getProfile(profile)
+
+        if prof.exclusive == "yes":
+            self.ifaceHandler.downAll()
+
+        iface = self.ifaceHandler.getInterface(prof.ifaceName)
+        
+        if prof.ip == "dhcp":
+            iface.runDHCP()
+        else:
+            iface.setIPAddr(prof.ip)
+            iface.setBroadcast(prof.broadcast)
+            iface.setNetmask(prof.netmask)
+            iface.setGateway(prof.gateway)
+            iface.up()
+            
+    def listProfiles(self,detailed=0):
+        self.profileHandler.listProfiles(detailed)
+        
+def main():
+    if len(sys.argv) < 2:
+        printUsage()
+        sys.exit(1)
+
+    moo = Moo()
+
+    for i in xrange(len(sys.argv)):
+        if sys.argv[i] == "list":
+            detailed = 0
+            for x in sys.argv[i:]:
+                if x == "--detailed":
+                    detailed = 1
+            moo.listProfiles(detailed)
+
+        elif sys.argv[i] == "select":
+            moo.selectProfile(sys.argv[2])
+
+if __name__ == "__main__":
+    main()
+
+
+# TODO
+# - automatically create profile
+# - specify wireless network name
+# - specify wep key
+# - specify access point
+# - specify pre_run/post_run commands
+#   - with parameters
+# 
diff --git a/trunk/src/moo/moo.1 b/trunk/src/moo/moo.1
new file mode 100644 (file)
index 0000000..534aa0c
--- /dev/null
@@ -0,0 +1,12 @@
+.TH moo "1" "Nov 2003" "gentoolkit"
+.SH NAME
+moo \- Gentoo: Configuration Update Utility
+.SH SYNOPSIS
+.B moo
+.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>.
+
diff --git a/trunk/src/revdep-rebuild/TODO b/trunk/src/revdep-rebuild/TODO
new file mode 100644 (file)
index 0000000..7344bd5
--- /dev/null
@@ -0,0 +1,6 @@
+- revdep cache in /var/cache
+ - list all .so files this package depends on
+ - use timestamps of files to know when to rebuild
+  - if ts of cache is older than any of the package's contained
+    files, we must rebuild
+    
diff --git a/trunk/src/revdep-rebuild/revdep-rebuild.1 b/trunk/src/revdep-rebuild/revdep-rebuild.1
new file mode 100644 (file)
index 0000000..9c6eea5
--- /dev/null
@@ -0,0 +1,12 @@
+.TH revdep-rebuild "1" "Nov 2003" "gentoolkit"
+.SH NAME
+revdep-rebuild \- Gentoo: Reverse dependency rebuilder
+.SH SYNOPSIS
+.B revdep-rebuild
+.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>.
+