more work on the portage implementation and on the build() function of enzyme
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@95 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -4,7 +4,6 @@ WHAT'S THAT: Project Entropy
|
||||
|
||||
DEVELOPERS:
|
||||
- Fabio Erculiani (lxnay@sabayonlinux.org)
|
||||
- Christopher Villareal (cvill64@sabayonlinux.org)
|
||||
|
||||
DEPENDENCIES:
|
||||
- >=sys-apps/portage-2.1.2
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
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
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
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
|
||||
|
||||
@@ -67,6 +67,7 @@ ETP_TMPDIR = "/tmp"
|
||||
ETP_REPODIR = "/repository"+"/"+ETP_ARCH_CONST
|
||||
ETP_PORTDIR = "/portage"
|
||||
ETP_DBDIR = "/database"+"/"+ETP_ARCH_CONST
|
||||
ETP_UPLOADDIR = "/upload"+"/"+ETP_ARCH_CONST
|
||||
ETP_STOREDIR = "/store"+"/"+ETP_ARCH_CONST
|
||||
ETP_CONF_DIR = "/etc/entropy"
|
||||
ETP_HEADER_TEXT = "# Entropy specifications file (released under the GPLv2)\n"
|
||||
@@ -75,9 +76,11 @@ MAX_ETP_REVISION_COUNT = 99999
|
||||
etpConst = {
|
||||
'packagestmpdir': ETP_DIR+ETP_TMPDIR, # etpConst['packagestmpdir'] --> temp directory
|
||||
'packagesbindir': ETP_DIR+ETP_REPODIR, # etpConst['packagesbindir'] --> repository where the packages will be stored
|
||||
# by the clients: to query if a package has been already downloaded
|
||||
# by the servers or rsync mirrors: to store already uploaded packages to the main rsync server
|
||||
'packagesdatabasedir': ETP_DIR+ETP_DBDIR, # etpConst['packagesdatabasedir'] --> repository where .etp files will be stored
|
||||
'packagesstoredir': ETP_DIR+ETP_DBDIR, # etpConst['packagesstoredir'] --> directory where .tbz2 files are stored waiting for being processed by entropy-specifications-generator
|
||||
'packagessuploaddir': ETP_DIR+ETP_STOREDIR, # etpConst['packagessuploaddir'] --> directory where .tbz2 files are stored waiting for being uploaded to our main mirror
|
||||
'packagesstoredir': ETP_DIR+ETP_STOREDIR, # etpConst['packagesstoredir'] --> directory where .tbz2 files are stored waiting for being processed by entropy-specifications-generator
|
||||
'packagessuploaddir': ETP_DIR+ETP_UPLOADDIR, # etpConst['packagessuploaddir'] --> directory where .tbz2 files are stored waiting for being uploaded to our main mirror
|
||||
'portagetreedir': ETP_DIR+ETP_PORTDIR, # directory where is stored our local portage tree
|
||||
'overlaysdir': ETP_DIR+ETP_PORTDIR+"/local/layman", # directory where overlays are stored
|
||||
'overlaysconffile': ETP_CONF_DIR+"/layman.cfg", # layman configuration file
|
||||
|
||||
@@ -20,15 +20,21 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
'''
|
||||
|
||||
def initializePortageTree():
|
||||
portage.settings.unlock()
|
||||
portage.settings['PORTDIR'] = etpConst['portagetreedir']
|
||||
portage.settings.lock()
|
||||
portage.portdb.__init__(etpConst['portagetreedir'])
|
||||
|
||||
import portage
|
||||
import portage_const
|
||||
from portage_dep import isvalidatom, isjustname
|
||||
from portage_dep import isvalidatom, isjustname, dep_getkey
|
||||
from entropyConstants import *
|
||||
initializePortageTree()
|
||||
|
||||
# colours support
|
||||
import output
|
||||
from output import bold, colorize, green, red, yellow
|
||||
|
||||
from entropyConstants import *
|
||||
import re
|
||||
|
||||
def isRoot():
|
||||
@@ -40,6 +46,9 @@ def isRoot():
|
||||
def getPortageEnv(var):
|
||||
return portage.config(clone=portage.settings).environ()[var]
|
||||
|
||||
def getThirdPartyMirrors(mirrorname):
|
||||
return portage.thirdpartymirrors[mirrorname]
|
||||
|
||||
# resolve atoms automagically (best, not current!)
|
||||
# sys-libs/application --> sys-libs/application-1.2.3-r1
|
||||
def getBestAtom(atom):
|
||||
@@ -73,12 +82,10 @@ def getInstalledAtom(atom):
|
||||
return atom
|
||||
|
||||
def checkAtom(atom):
|
||||
if (isvalidatom(atom) == 1) or ( isjustname(atom) == 1):
|
||||
if (isvalidatom(atom) == 1) or ( getBestAtom(atom) != ""):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def removeSpaceAtTheEnd(string):
|
||||
if string.endswith(" "):
|
||||
return string[:len(string)-1]
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
'''
|
||||
|
||||
|
||||
import portage
|
||||
import portage_const
|
||||
# Never do "import portage" here, please use entropyTools binding
|
||||
|
||||
from entropyConstants import *
|
||||
from entropyTools import *
|
||||
@@ -31,6 +29,8 @@ import sys
|
||||
import os
|
||||
import commands
|
||||
|
||||
|
||||
|
||||
# Stolen from Porthole 0.5.0 - thanks for your help :-)
|
||||
|
||||
def getSyncTime():
|
||||
@@ -88,7 +88,24 @@ def build(atoms): # FIXME: remember to use listOverlay() as PORTDIR_OVERLAY vari
|
||||
print_error(red(bold("no valid package names specified.")))
|
||||
sys.exit(102)
|
||||
|
||||
# now that we've the list of the packages that we have to build
|
||||
# resolve atom name with the best package available
|
||||
_validAtoms = []
|
||||
for i in validAtoms:
|
||||
_validAtoms.append(getBestAtom(i))
|
||||
validAtoms = _validAtoms
|
||||
|
||||
# check if the package is already installed, if yes, check also::
|
||||
|
||||
# check, one by one, if the package have been already built
|
||||
# 1. check if the .tbz2 file is in:
|
||||
# etpConst['packagessuploaddir']
|
||||
# etpConst['packagesstoredir']
|
||||
# etpConst['packagesbindir']
|
||||
# save the path
|
||||
|
||||
# then extract the info using xpak
|
||||
|
||||
# otherwise, add it to the build list
|
||||
|
||||
def overlay(options):
|
||||
# etpConst['overlaysconffile'] --> layman.cfg
|
||||
@@ -147,16 +164,21 @@ def overlay(options):
|
||||
myownopts = list(set(myopts[1:]))
|
||||
if (myownopts == []):
|
||||
# sync all
|
||||
print_info(green("syncing all the overlays")+bold(i))
|
||||
print_info(green("syncing all the overlays"))
|
||||
rc = spawnCommand(layman+" --config="+etpConst['overlaysconffile']+" -S ", redirect = verbosity)
|
||||
if (rc != 0):
|
||||
print_warning(red(bold("a problem occoured syncing all the overlays.")))
|
||||
else:
|
||||
print_info(green("sync completed."))
|
||||
else:
|
||||
# sync each overlay
|
||||
for i in myownopts:
|
||||
print_info(green("syncing overlay: ")+bold(i))
|
||||
rc = spawnCommand(layman+" --config="+etpConst['overlaysconffile']+" -s "+i, redirect = verbosity)
|
||||
if (rc != 0):
|
||||
print_warning(red(bold("a problem occoured syncing "+i+" overlay.")))
|
||||
else:
|
||||
print_info(green("synced overlay: ")+bold(i))
|
||||
return True
|
||||
elif (myopts[0] == "list"):
|
||||
# add an overlay
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
'''
|
||||
|
||||
import portage
|
||||
import portage_const
|
||||
from portage_dep import dep_getkey
|
||||
# Never do "import portage" here, please use entropyTools binding
|
||||
|
||||
from entropyConstants import *
|
||||
from entropyTools import *
|
||||
@@ -176,7 +174,7 @@ def extractPkgData(package):
|
||||
if i.startswith("mirror://"):
|
||||
# parse what mirror I need
|
||||
x = i.split("/")[2]
|
||||
mirrorlist = portage.thirdpartymirrors[x]
|
||||
mirrorlist = getThirdPartyMirrors(x)
|
||||
mirrorURI = "mirror://"+x
|
||||
out = "="+mirrorURI+"|"
|
||||
for mirror in mirrorlist:
|
||||
|
||||
Reference in New Issue
Block a user