added more options to sync()
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@151 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
1
README
1
README
@@ -9,6 +9,7 @@ DEPENDENCIES:
|
||||
- >=sys-apps/portage-2.1.2
|
||||
- >=app-portage/portage-utils-0.1.23 (not mandatory)
|
||||
- >=app-portage/layman-1.0.8 (if you use overlays)
|
||||
- net-misc/rsync-2.6.x
|
||||
- app-arch/tar
|
||||
|
||||
INSTALLATION:
|
||||
|
||||
@@ -48,7 +48,7 @@ def print_help():
|
||||
print "* opts * : \t\t"+entropyTools.red("--update")+"\t\t used with --rebuild-all it also updates all the packages"
|
||||
print "* info * : \t"+entropyTools.green(entropyTools.bold("build"))+"\t\t to build all the packages specified in <atom(s)>"
|
||||
print "* opts * : \t\t"+entropyTools.red("--force-rebuild")+"\t\t force the building of the package, nevertheless"
|
||||
print "* opts * : \t\t"+entropyTools.red("--force-repackage")+"\t\t force the repackaging of all the possible package"
|
||||
print "* opts * : \t\t"+entropyTools.red("--force-repackage")+"\t force the repackaging of all the possible package"
|
||||
print "* opts * : \t\t"+entropyTools.red("--update")+"\t\t build all the updateable dependencies"
|
||||
print "* opts * : \t\t"+entropyTools.red("--pretend")+"\t\t just show what should be done"
|
||||
print "* opts * : \t\t"+entropyTools.red("--ignore-conflicts")+"\t ignore conflicts between packages"
|
||||
@@ -60,6 +60,9 @@ def print_help():
|
||||
print "* opts * : \t\t "+entropyTools.red("sync")+"\t\t\t to sync overlays (after this you can specify which overlay)"
|
||||
print "* opts * : \t\t "+entropyTools.red("list")+"\t\t\t to list overlays"
|
||||
print "* info * : \t"+entropyTools.green(entropyTools.bold("sync"))+"\t\t to just sync portage tree"
|
||||
print "* opts * : \t\t "+entropyTools.red("--no-sync-back")+"\t\t disable sync between Entropy Portage Tree and the official one"
|
||||
print "* opts * : \t\t "+entropyTools.red("--only-sync-back")+"\t only sync between Entropy Portage Tree and the official one"
|
||||
print "* opts * : \t\t "+entropyTools.red("--no-overlay-sync")+"\t disable automatic overlays sync"
|
||||
print "* info * : \t"+entropyTools.green(entropyTools.bold("data-cleanup"))+"\t to clean all the old packages or stale files"
|
||||
print "* info * : \t"+entropyTools.green(entropyTools.bold("data-reset"))+"\t to remove all and start over"
|
||||
print
|
||||
|
||||
@@ -62,15 +62,76 @@ def listOverlays():
|
||||
|
||||
# fetch the latest updates from Gentoo rsync mirrors
|
||||
def sync(options):
|
||||
myopts = options[1:]
|
||||
enzymeNoSyncBack = False
|
||||
enzymeOnlySyncBack = False
|
||||
enzymeNoOverlaySync = False
|
||||
syncMiscRedirect = "> /dev/null"
|
||||
for i in options:
|
||||
if i.startswith("--verbose") or i.startswith("-v"):
|
||||
|
||||
# check if rsync is installed
|
||||
rsync = commands.getoutput("which rsync")
|
||||
if (not rsync.startswith("/")):
|
||||
print_error(red(bold("net-misc/rsync is not installed. Please install.")))
|
||||
sys.exit(100)
|
||||
|
||||
for i in myopts:
|
||||
if ( i == "--verbose" ) or ( i == "-v" ):
|
||||
syncMiscRedirect = None
|
||||
print_info(green("syncing the Portage tree at: "+etpConst['portagetreedir']))
|
||||
rc = spawnCommand(vdbPORTDIR+"="+etpConst['portagetreedir']+" "+cdbEMERGE+" --sync ", redirect = syncMiscRedirect) # redirect = "/dev/null"
|
||||
if (rc != 0):
|
||||
print_error(red("an error occoured while syncing the Portage tree. Are you sure that your Internet connection works?"))
|
||||
sys.exit(101)
|
||||
elif ( i == "--no-sync-back" ):
|
||||
enzymeNoSyncBack = True
|
||||
elif ( i == "--only-sync-back" ):
|
||||
enzymeOnlySyncBack = True
|
||||
elif ( i == "--no-overlay-sync" ):
|
||||
enzymeNoOverlaySync = True
|
||||
|
||||
if (not enzymeOnlySyncBack):
|
||||
print_info(green("Syncing Entropy Portage Tree at: "+etpConst['portagetreedir']))
|
||||
rc = spawnCommand(vdbPORTDIR+"="+etpConst['portagetreedir']+" "+cdbEMERGE+" --sync ", redirect = syncMiscRedirect) # redirect = "/dev/null"
|
||||
if (rc != 0):
|
||||
print_error(red("an error occoured while syncing the Portage tree. Are you sure that your Internet connection works?"))
|
||||
sys.exit(101)
|
||||
if (not enzymeNoOverlaySync):
|
||||
# syncing overlays
|
||||
rc = overlay(['overlay','sync'])
|
||||
if (not rc):
|
||||
print_warning(red("an error occoured while syncing the overlays. Please check if it's all fine."))
|
||||
|
||||
else:
|
||||
print_info(green("Not syncing Entropy Portage Tree at: "+etpConst['portagetreedir']))
|
||||
|
||||
if (not enzymeNoSyncBack):
|
||||
print
|
||||
print_info(green("Syncing back Entropy Portage Tree at: ")+bold(etpConst['portagetreedir'])+green(" to the official Portage Tree"))
|
||||
# sync back to /usr/portage, but firstly, get user's PORTDIR
|
||||
if os.path.isfile("/etc/make.conf"):
|
||||
f = open("/etc/make.conf","r")
|
||||
makeConf = f.readlines()
|
||||
f.close()
|
||||
officialPortageTreeDir = "/usr/portage"
|
||||
for line in makeConf:
|
||||
if line.startswith("PORTDIR="):
|
||||
# found it !
|
||||
line = line.strip()
|
||||
officialPortageTreeDir = line.split('PORTDIR=')[1]
|
||||
# remove quotes
|
||||
if officialPortageTreeDir.startswith('"') and officialPortageTreeDir.endswith('"'):
|
||||
officialPortageTreeDir = officialPortageTreeDir.split('"')[1]
|
||||
if officialPortageTreeDir.startswith("'") and officialPortageTreeDir.endswith("'"):
|
||||
officialPortageTreeDir = officialPortageTreeDir.split("'")[1]
|
||||
else:
|
||||
officialPortageTreeDir = "/usr/portage"
|
||||
|
||||
# officialPortageTreeDir must not end with /
|
||||
if officialPortageTreeDir.endswith("/"):
|
||||
officialPortageTreeDir = officialPortageTreeDir[:len(officialPortageTreeDir)-1]
|
||||
|
||||
# sync back
|
||||
rc = spawnCommand("rsync --recursive --links --safe-links --perms --times --force --whole-file --delete --delete-after --exclude=/distfiles --exclude=/packages "+etpConst['portagetreedir']+" "+officialPortageTreeDir, redirect = syncMiscRedirect)
|
||||
if (rc != 0):
|
||||
print_error(red("an error occoured while syncing back the official Portage Tree."))
|
||||
sys.exit(101)
|
||||
else:
|
||||
print_info(yellow("Official Portage Tree sync-back disabled"))
|
||||
|
||||
|
||||
def build(atoms):
|
||||
@@ -108,9 +169,6 @@ def build(atoms):
|
||||
_atoms.append(i)
|
||||
atoms = _atoms
|
||||
|
||||
#if (enzymeRequestVerbose): print "verbose: "+str(enzymeRequestVerbose)
|
||||
#if (enzymeRequestVerbose): print "force build: "+str(enzymeRequestForceRepackage)
|
||||
|
||||
# translate dir variables
|
||||
etpConst['packagessuploaddir'] = translateArch(etpConst['packagessuploaddir'],getPortageEnv('CHOST'))
|
||||
etpConst['packagesstoredir'] = translateArch(etpConst['packagesstoredir'],getPortageEnv('CHOST'))
|
||||
|
||||
Reference in New Issue
Block a user