git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@456 cd1c1023-2f26-0410-ae45-c471fc1f0318
161 lines
6.8 KiB
Python
161 lines
6.8 KiB
Python
#!/usr/bin/python
|
|
'''
|
|
# DESCRIPTION:
|
|
# Portage tree manager and package builder following specified schemas
|
|
|
|
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')
|
|
from outputTools import *
|
|
|
|
# CONSTANTS
|
|
APPNAME = "enzyme"
|
|
APPVERSION = "1.0"
|
|
def print_help():
|
|
print_info("Sabayon Linux "+APPNAME+" (C - 2007)")
|
|
print_info("General Options:")
|
|
print_info(" --help\t\tthis output")
|
|
print_info(" --version\t\tprint version")
|
|
print_info(" --verbose\t\tbe more verbose")
|
|
print_info(" --nocolor\t\tdisable colorized output")
|
|
print_info(blue("Tools available: "))
|
|
print_info(" \t"+green(bold("world"))+yellow("\t\t to build all the possible new packages"))
|
|
print_info(" \t\t"+red("--empty-tree")+"\t\t rebuild all, including updates")
|
|
print_info(" \t\t"+red("--deep")+"\t\t\t analyzes world dependencies deeply")
|
|
print_info(" \t\t"+red("--pretend")+"\t\t just show what should be done")
|
|
print_info(" \t\t"+red("--ask")+"\t\t\t just ask before doing what should be done")
|
|
print_info(" \t\t"+red("--repackage-installed")+"\t creates binaries of all the installed packages")
|
|
print_info(" \t\t"+red("--skipfirst")+"\t\t skip the first package in the packages list")
|
|
print_info(" \t\t"+red("--skip=n")+"\t\t skip N packages")
|
|
print_info(" \t\t"+red("--nosync")+"\t\t disable activator packages sync")
|
|
print_info(" \t"+green(bold("build"))+yellow("\t\t to build all the packages specified in <atom(s)>"))
|
|
print_info(" \t\t"+red("--force-rebuild")+"\t\t force the building of the package, nevertheless")
|
|
print_info(" \t\t"+red("--force-repackage")+"\t force the repackaging of all the possible package")
|
|
print_info(" \t\t"+red("--deep")+"\t\t\t analyze the dependencies deeply")
|
|
print_info(" \t\t"+red("--nodeps")+"\t\t do not include dependencies and force compilation")
|
|
print_info(" \t\t"+red("--use")+"\t\t\t show packages USE flags")
|
|
print_info(" \t\t"+red("--pretend")+"\t\t just show what should be done")
|
|
print_info(" \t\t"+red("--ask")+"\t\t\t just ask before doing what should be done")
|
|
print_info(" \t\t"+red("--ignore-conflicts")+"\t ignore conflicts between packages")
|
|
print_info(" \t\t"+red("--no-interaction")+"\t disable user interaction, automatic driving")
|
|
print_info(" \t\t"+red("--simulate-building")+"\t compilations are simulated only")
|
|
print_info(" \t\t"+red("--skipfirst")+"\t\t skip the first package in the packages list")
|
|
print_info(" \t\t"+red("--skip=n")+"\t\t skip N packages")
|
|
print_info(" \t\t"+red("--nosync")+"\t\t disable activator packages sync")
|
|
print_info(" \t"+green(bold("uninstall"))+yellow("\t to uninstall one or a list of packages"))
|
|
print_info(" \t\t"+red("--pretend")+"\t\t just show what would be done")
|
|
print_info(" \t\t"+red("--just-prune")+"\t\t with slotted packages, keep only the latest, remove the rest")
|
|
print_info(" \t"+green(bold("overlay"))+yellow("\t\t to manage overlays"))
|
|
print_info(" \t\t "+red("add")+"\t\t\t to add overlays")
|
|
print_info(" \t\t "+red("remove")+"\t\t\t to remove overlays")
|
|
print_info(" \t\t "+red("sync")+"\t\t\t to sync overlays (after this you can specify which overlay)")
|
|
print_info(" \t\t "+red("list")+"\t\t\t to list overlays")
|
|
print_info(" \t"+green(bold("sync"))+yellow("\t\t to just sync portage tree"))
|
|
print_info(" \t\t "+red("--sync-back")+"\t\t sync between Entropy Portage Tree and the official one")
|
|
print_info(" \t\t "+red("--only-sync-back")+"\t only sync between Entropy Portage Tree and the official one")
|
|
print_info(" \t\t "+red("--no-overlay-sync")+"\t disable automatic overlays sync")
|
|
print_info(" \t"+green(bold("search"))+yellow("\t\t to search a package inside the Entropy Portage repository"))
|
|
print_info(" \t"+green(bold("distcc"))+yellow("\t\t distcc manager"))
|
|
print_info(" \t\t "+red("--add-host")+"\t\t add a hostname/ip")
|
|
print_info(" \t\t "+red("--remove-host")+"\t\t remove a hostname/ip")
|
|
print_info(" \t\t "+red("--enable")+"\t\t enable the DistCC funcionality")
|
|
print_info(" \t\t "+red("--disable")+"\t\t disable the DistCC funcionality")
|
|
print_info(" \t\t "+red("--show-hosts")+"\t\t show the currently enabled hosts")
|
|
print_info(" \t"+green(bold("cleanup"))+yellow("\t\t to clean temporary files"))
|
|
|
|
options = sys.argv[1:]
|
|
|
|
# print version
|
|
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
|
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:
|
|
print_error("not enough parameters")
|
|
sys.exit(1)
|
|
|
|
import entropyTools
|
|
import enzymeTools
|
|
from entropyConstants import *
|
|
from serverConstants import *
|
|
|
|
# preliminary options parsing
|
|
_options = []
|
|
for opt in options:
|
|
if (opt == "--nocolor"):
|
|
entropyTools.nocolor()
|
|
elif (opt == "--debug"):
|
|
entropyTools.enableDebug()
|
|
else:
|
|
_options.append(opt)
|
|
options = _options
|
|
|
|
if (not entropyTools.isRoot()):
|
|
print_error("you must be root in order to run "+APPNAME)
|
|
sys.exit(2)
|
|
|
|
# world tool
|
|
if (options[0] == "world"):
|
|
enzymeTools.world(options)
|
|
sys.exit(0)
|
|
# sync tool
|
|
if (options[0] == "sync"):
|
|
enzymeTools.sync(options)
|
|
sys.exit(0)
|
|
# overlay tool
|
|
if (options[0] == "overlay"):
|
|
rc = enzymeTools.overlay(options)
|
|
if (rc):
|
|
sys.exit(0)
|
|
else:
|
|
# an error occoured
|
|
print_help()
|
|
sys.exit(3)
|
|
# build tool
|
|
if (options[0] == "build"):
|
|
enzymeTools.build(options[1:])
|
|
sys.exit(0)
|
|
# uninstall tool
|
|
if (options[0] == "uninstall"):
|
|
enzymeTools.uninstall(options[1:])
|
|
sys.exit(0)
|
|
# search tool
|
|
if (options[0] == "search"):
|
|
enzymeTools.search(options[1:])
|
|
sys.exit(0)
|
|
# distcc tool
|
|
if (options[0] == "distcc"):
|
|
enzymeTools.distcc(options[1:])
|
|
sys.exit(0)
|
|
# orphans tool
|
|
if (options[0] == "orphans"):
|
|
enzymeTools.orphans()
|
|
sys.exit(0)
|
|
# cleanup tool
|
|
if (options[0] == "cleanup"):
|
|
entropyTools.cleanup()
|
|
sys.exit(0) |