git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@316 cd1c1023-2f26-0410-ae45-c471fc1f0318
116 lines
5.4 KiB
Python
116 lines
5.4 KiB
Python
#!/usr/bin/python
|
|
'''
|
|
# DESCRIPTION:
|
|
# this application gets a .tbz2 file as input and creates a database entry
|
|
# with all the information needed by the Entropy client
|
|
|
|
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
|
|
import databaseTools
|
|
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("enzyme")+entropyTools.yellow("\t\t to analyze enzyme store directory"))
|
|
entropyTools.print_info(" \t\t"+entropyTools.red("--force-bump")+"\t\t to force the revision bumping of the package entries")
|
|
entropyTools.print_info(" \t"+entropyTools.green(entropyTools.bold("database"))+entropyTools.yellow("\t Entropy database tool manager."))
|
|
entropyTools.print_info(" \t\t"+entropyTools.red("--initialize")+"\t\t (Re)Initialize the Entropy packages database [DO NOT USE THIS]")
|
|
entropyTools.print_info(" \t\t"+entropyTools.red("statistics")+"\t\t Show Entropy database statistics.")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("search")+"\t\t\t Search a package inside the Entropy packages database")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("dump-package-info")+"\t Dump the stored information of package atom(s) to a file")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("inject-package-info")+"\t Inject an Entropy dump inside the database (file path is mandatory)")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("restore-package-info")+"\t Reinitialize a package entry looking at the current install")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green(entropyTools.bold("remove"))+"\t\t\t Remove a package or a list of packages")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("create-empty-database")+"\t Create an empty Entropy database file in the specified <path>")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("stabilize")+"\t\t Mark as stable a package, a list of packages, world")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("unstabilize")+"\t\t Mark as unstable a package, a list of packages, world")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green("md5check")+"\t\t Check digest of a package, a list of packages, world")
|
|
#entropyTools.print_info(" \t\t"+entropyTools.green(entropyTools.bold("orphans"))+"\t\t\t Dump the list of files that don't belong on any installed package")
|
|
entropyTools.print_info(" \t\t"+entropyTools.green(entropyTools.bold("sanity-check"))+"\t\t Do a quick check on the database to assure data integrity")
|
|
entropyTools.print_info(" \t"+entropyTools.green(entropyTools.bold("smartapps"))+entropyTools.yellow("\t Entropy application tool to create self-dependant applications [EXPERIMENTAL]"))
|
|
entropyTools.print_info(" \t\t"+entropyTools.green(entropyTools.bold("create"))+"\t\t\t Create a smartapp package using the package names provided")
|
|
entropyTools.print_info(" \t"+entropyTools.green(entropyTools.bold("cleanup"))+entropyTools.yellow("\t\t to clean temporary files"))
|
|
|
|
options = sys.argv[1:]
|
|
|
|
# preliminary options parsing
|
|
_options = []
|
|
for opt in options:
|
|
if (opt == "--nocolor"):
|
|
entropyTools.nocolor()
|
|
elif (opt == "--debug"):
|
|
entropyTools.enableDebug()
|
|
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)
|
|
|
|
|
|
elif (options[0] == "generator"):
|
|
reagentTools.generator(options[1:])
|
|
sys.exit(0)
|
|
|
|
elif (options[0] == "enzyme"):
|
|
reagentTools.enzyme(options[1:])
|
|
sys.exit(0)
|
|
|
|
# database tool
|
|
elif (options[0] == "database"):
|
|
databaseTools.database(options[1:])
|
|
sys.exit(0)
|
|
|
|
# smartapps tool
|
|
elif (options[0] == "smartapps"):
|
|
reagentTools.smartapps(options[1:])
|
|
sys.exit(0)
|
|
|
|
# cleanup
|
|
if (options[0] == "cleanup"):
|
|
entropyTools.cleanup(options[1:])
|
|
sys.exit(0) |