--- /dev/null
+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)/
+- 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
--- /dev/null
+.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>.
+
--- /dev/null
+.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>.
+
class CmdListBelongs(Command):
- """List all packages owning file_spec"""
+ """List all packages owning a particular file"""
def __init__(self):
self.default_opts = {
"category": "*",
" " + 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 = {
--- /dev/null
+.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>.
+
--- /dev/null
+Karl Trygve Kalleberg <karltk@gentoo.org>
--- /dev/null
+#! /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
+#
--- /dev/null
+.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>.
+
--- /dev/null
+- 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
+
--- /dev/null
+.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>.
+