eb185e9675
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@200 cd1c1023-2f26-0410-ae45-c471fc1f0318
92 lines
3.2 KiB
Python
92 lines
3.2 KiB
Python
#!/usr/bin/python
|
|
'''
|
|
# DESCRIPTION:
|
|
# this application gets a .tbz2 file as input and creates the dependency binary metafile
|
|
# that another application could handle using portage and binpackages extensions directly
|
|
|
|
Copyright (C) 2007 Fabio Erculiani
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
'''
|
|
|
|
# Never do "import portage" here, please use entropyTools binding
|
|
|
|
import os
|
|
import sys
|
|
import string
|
|
|
|
sys.path.append('../libraries')
|
|
import entropyTools
|
|
import reagentTools
|
|
from entropyConstants import *
|
|
|
|
# CONSTANTS
|
|
APPNAME = "reagent"
|
|
APPVERSION = "1.0"
|
|
def print_help():
|
|
entropyTools.print_info("Sabayon Linux "+APPNAME+" (C - 2007)")
|
|
entropyTools.print_info("General Options:")
|
|
entropyTools.print_info(" --help\t\tthis output")
|
|
entropyTools.print_info(" --version\t\tprint version")
|
|
entropyTools.print_info(" --nocolor\t\tdisable colorized output")
|
|
entropyTools.print_info(entropyTools.blue("Tools available: "))
|
|
entropyTools.print_info(" \t"+entropyTools.green("generator")+entropyTools.yellow("\t to create .etp file from a specified .tbz2 file"))
|
|
entropyTools.print_info(" \t"+entropyTools.green("digest")+entropyTools.yellow("\t\t to digest a specified directory"))
|
|
entropyTools.print_info(" \t"+entropyTools.green("enzyme")+entropyTools.yellow("\t\t to analyze enzyme store directory"))
|
|
entropyTools.print_info(" \t"+entropyTools.green(entropyTools.bold("cleanup"))+entropyTools.yellow("\t\t to clean temporary files"))
|
|
|
|
options = sys.argv[1:]
|
|
|
|
# no color parsing
|
|
_options = []
|
|
for opt in options:
|
|
if (opt == "--nocolor"):
|
|
entropyTools.nocolor()
|
|
else:
|
|
_options.append(opt)
|
|
options = _options
|
|
|
|
# print version
|
|
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
|
entropyTools.print_generic(APPNAME+": "+APPVERSION)
|
|
sys.exit(0)
|
|
|
|
# print help
|
|
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
|
print_help()
|
|
if len(options) < 1:
|
|
entropyTools.print_error("not enough parameters")
|
|
sys.exit(1)
|
|
|
|
if (not entropyTools.isRoot()):
|
|
print_error("you must be root in order to run "+APPNAME)
|
|
|
|
# digest tool (creates a digest on the specified directory)
|
|
if (options[0] == "digest"):
|
|
reagentTools.createDigest(options[1])
|
|
sys.exit(0)
|
|
|
|
elif (options[0] == "generator"):
|
|
reagentTools.generator(options[1])
|
|
sys.exit(0)
|
|
|
|
elif (options[0] == "enzyme"):
|
|
reagentTools.enzyme()
|
|
sys.exit(0)
|
|
|
|
# cleanup
|
|
if (options[0] == "cleanup"):
|
|
entropyTools.cleanup(options[1:])
|
|
sys.exit(0) |