From 92cdf5ce4a48233f681a45871ff3644292013245 Mon Sep 17 00:00:00 2001 From: genone Date: Wed, 17 Mar 2004 11:56:00 +0000 Subject: [PATCH] oops, forgot to commit svn path=/; revision=92 --- trunk/src/glsa-check/Makefile | 18 ++ trunk/src/glsa-check/glsa-check | 205 +++++++++++++ trunk/src/glsa-check/glsa.py | 520 ++++++++++++++++++++++++++++++++ 3 files changed, 743 insertions(+) create mode 100644 trunk/src/glsa-check/Makefile create mode 100644 trunk/src/glsa-check/glsa-check create mode 100644 trunk/src/glsa-check/glsa.py diff --git a/trunk/src/glsa-check/Makefile b/trunk/src/glsa-check/Makefile new file mode 100644 index 0000000..126425c --- /dev/null +++ b/trunk/src/glsa-check/Makefile @@ -0,0 +1,18 @@ +# Copyright 2003 Karl Trygve Kalleberg +# Copyright 2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "YADDLETHORPE (vb.) (Of offended pooves.) To exit huffily from a boutique." + +dist: + mkdir -p ../../$(distdir)/src/glsa-check/ + cp {Makefile,glsa.py,glsa-check} ../../$(distdir)/src/glsa-check/ + +install: + install -m 0755 glsa-check $(bindir)/ + install -m 0644 glsa.py $(DESTDIR)/usr/lib/gentoolkit/pym/ diff --git a/trunk/src/glsa-check/glsa-check b/trunk/src/glsa-check/glsa-check new file mode 100644 index 0000000..d59ec08 --- /dev/null +++ b/trunk/src/glsa-check/glsa-check @@ -0,0 +1,205 @@ +#!/usr/bin/python + +# $Header$ +# This program is licensed under the GPL, version 2 + +import os,string,sys +from getopt import getopt,GetoptError + +__program__ = "glsa-check" +__author__ = "Marius Mauch " +__version__ = "0.4" + +optionmap = [ +["-l", "--list", "list all unapplied GLSA"], +["-d", "--dump", "--print", "show all information about the given GLSA"], +["-t", "--test", "test if this system is affected by the given GLSA"], +["-p", "--pretend", "show the necessary commands to apply this GLSA"], +["-f", "--fix", "try to auto-apply this GLSA (experimental)"], +["-i", "--inject", "inject the given GLSA into the checkfile"], +["-h", "--help", "show this help message"], +["-v", "--version", "some information about this tool"] +] + +# print a warning as this is beta code +sys.stderr.write("WARNING: This tool is completely new and not very tested, so it should not be\n") +sys.stderr.write("used on production systems. It's mainly a test tool for the new GLSA release\n") +sys.stderr.write("and distribution system, it's functionality will later be merged into emerge\n") +sys.stderr.write("and equery.\n") +sys.stderr.write("Please read http://www.gentoo.org/proj/en/portage/glsa-integration.xml\n") +sys.stderr.write("before using this tool AND before reporting a bug.\n\n") + +# option parsing +args = [] +params = [] +try: + args, params = getopt(sys.argv[1:], "dplfchivt", \ + ["dump", "print", "list", "pretend", "fix", "inject", "help", "info", "version", "test"]) + args = [a for a,b in args] + + # sanity checking + if len(args) <= 0: + print "no option given: what should I do ?" + mode="help" + elif len(args) > 1: + print "please use only one option per call" + mode = "help" + else: + # in what mode are we ? + args = args[0] + for m in optionmap: + if args in [o for o in m[:-1]]: + mode = m[1][2:] +except GetoptError: + print "unknown option given" + mode = "help" + +# we need a set of glsa for most operation modes +if len(params) <= 0 and mode in ["fix", "test", "pretend", "dump", "inject"]: + print + print "no GLSA given, so we'll do nothing for now. " + print "If you want to run on all GLSA please tell me so " + print "(specify \"all\" as parameter)" + print + mode = "help" +elif len(params) <= 0 and mode == "list": + params.append("new") + +# show help message +if mode == "help": + print + print "Syntax: glsa-check