- databases now split by branch (first chunk, ServerInterface migrated, EquoInterface and Repository Daemon to go


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2496 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2008-10-08 12:05:00 +00:00
parent 50f82df28a
commit 561db807d5
5 changed files with 906 additions and 1077 deletions
+853 -992
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -23,6 +23,7 @@ if "--port" in sys.argv:
from entropyConstants import *
import entropyTools, exceptionTools
from entropy import SystemManagerServerInterface, SystemManagerExecutorServerRepositoryInterface, SystemManagerRepositoryCommands, ServerInterface
etpConst['community']['mode'] = True
def run_srv(s):
try:
+1 -5
View File
@@ -46,13 +46,11 @@ myopts = [
(0,_('Application Options'),0,None),
None,
(1,'update',3,_('scan the System looking for newly compiled packages')),
(2,'--branch=<branch>',1,_('choose on what branch operating')),
(2,'--seekstore',2,_('analyze the Entropy Store directory directly')),
(2,'--repackage <atoms>',1,_('repackage the specified atoms')),
(2,'--noask',3,_('do not ask anything except critical things')),
None,
(1,'inject <packages>',1,_('add binary packages to repository w/o affecting scopes (multipackages)')),
(2,'--branch=<branch>',1,_('choose on what branch operating')),
None,
(1,'query',3,_('do some searches into repository databases')),
(2,'search',3,_('search packages inside the default repository database')),
@@ -74,11 +72,9 @@ myopts = [
(2,'bump',4,_('manually force a revision bump for the current repository database')),
(3,'--sync',3,_('synchronize the database')),
(2,'remove',4,_('remove the provided atoms from the current repository database')),
(3,'--branch=<branch>',1,_('choose on what branch operating')),
(2,'multiremove',3,_('remove the provided injected atoms (all if no atom specified)')),
(3,'--branch=<branch>',1,_('choose on what branch operating')),
(2,'create-empty-database',2,_('create an empty repository database in the provided path')),
(2,'switchbranch',3,_('switch to the specified branch the provided atoms (or world)')),
(2,'switchbranch <new_branch>',3,_('switch to the specified branch the provided atoms (or world)')),
(2,'md5check',3,_('verify integrity of the provided atoms (or world)')),
(2,'md5remote',3,_('verify remote integrity of the provided atoms (or world)')),
None,
+11 -34
View File
@@ -28,22 +28,18 @@ Entropy = ServerInterface(community_repo = etpConst['community']['mode'])
def inject(options):
branch = etpConst['branch']
mytbz2s = []
for opt in options:
if opt.startswith("--branch=") and len(opt.split("=")) == 2:
branch = opt.split("=")[1]
else:
if not os.path.isfile(opt) or not opt.endswith(etpConst['packagesext']):
print_error(darkred(" * ")+bold(opt)+red(" is invalid."))
return 1
mytbz2s.append(opt)
if not os.path.isfile(opt) or not opt.endswith(etpConst['packagesext']):
print_error(darkred(" * ")+bold(opt)+red(" is invalid."))
return 1
mytbz2s.append(opt)
if not mytbz2s:
print_error(red(_("no package specified.")))
return 2
mytbz2s = [(x,branch,True) for x in mytbz2s]
mytbz2s = [(x,True,) for x in mytbz2s]
idpackages = Entropy.add_packages_to_repository(mytbz2s)
if idpackages:
# checking dependencies and print issues
@@ -259,20 +255,13 @@ def update(options):
entropyTools.printTraceback()
print_info(brown(" !!! ")+bold("%s..." % (_("Ignoring broken Spm entry, please recompile it"),) ))
requested_branch = etpConst['branch']
for i in options:
if ( i.startswith("--branch=") and len(i.split("=")) == 2 ):
mybranch = i.split("=")[1]
if (mybranch):
requested_branch = mybranch
tbz2files = os.listdir(Entropy.get_local_store_directory())
if not tbz2files:
print_info(brown(" * ")+red(_("Nothing to do, check later.")))
# then exit gracefully
return 0
tbz2files = [(os.path.join(Entropy.get_local_store_directory(),x),requested_branch,False) for x in tbz2files]
tbz2files = [(os.path.join(Entropy.get_local_store_directory(),x),False,) for x in tbz2files]
idpackages = Entropy.add_packages_to_repository(tbz2files)
if idpackages:
@@ -373,12 +362,8 @@ def database(options):
print_info(darkgreen(" * ")+red("%s..." % (_("Matching packages to remove"),) ), back = True)
myopts = []
branch = None
for opt in options[1:]:
if (opt.startswith("--branch=")) and (len(opt.split("=")) == 2):
branch = opt.split("=")[1]
else:
myopts.append(opt)
myopts.append(opt)
if not myopts:
print_error(brown(" * ")+red(_("Not enough parameters")))
@@ -387,10 +372,7 @@ def database(options):
dbconn = Entropy.openServerDatabase(read_only = True, no_upload = True)
pkglist = set()
for atom in myopts:
if branch:
pkg = dbconn.atomMatch(atom, matchBranches = (branch,), multiMatch = True)
else:
pkg = dbconn.atomMatch(atom, multiMatch = True)
pkg = dbconn.atomMatch(atom, multiMatch = True)
if pkg[1] == 0:
for idpackage in pkg[0]:
pkglist.add(idpackage)
@@ -420,13 +402,9 @@ def database(options):
print_info(darkgreen(" * ")+red("%s..." % (_("Searching injected packages to remove"),) ), back = True)
branch = etpConst['branch']
atoms = []
for opt in options[1:]:
if (opt.startswith("--branch=")) and (len(opt.split("=")) == 2):
branch = opt.split("=")[1]
else:
atoms.append(opt)
atoms.append(opt)
dbconn = Entropy.openServerDatabase(read_only = True, no_upload = True)
@@ -438,7 +416,7 @@ def database(options):
idpackages.add(idpackage)
else:
for atom in atoms:
match = dbconn.atomMatch(atom, matchBranches = (branch,), multiMatch = True)
match = dbconn.atomMatch(atom, multiMatch = True)
if match[1] == 0:
for x in match[0]:
if dbconn.isInjected(x):
@@ -452,8 +430,7 @@ def database(options):
for idpackage in idpackages:
pkgatom = dbconn.retrieveAtom(idpackage)
branch = dbconn.retrieveBranch(idpackage)
print_info(darkred(" # ")+blue("[")+red(branch)+blue("] ")+brown(pkgatom))
print_info(darkred(" # ")+brown(pkgatom))
# ask to continue
rc = Entropy.askQuestion(_("Would you like to continue ?"))
+40 -46
View File
@@ -508,7 +508,10 @@ class RepositoryManagerMenu(MenuSkel):
self.DataViewButtons[cat][w_id].hide()
def setup_available_repositories(self):
self.EntropyRepositories = {}
self.EntropyRepositories = {
'available': [],
'current': ''
}
self.EntropyRepositoryCombo = self.sm_ui.repoManagerRepositoryCombo
self.EntropyRepositoryStore = gtk.ListStore( gobject.TYPE_STRING )
self.EntropyRepositoryCombo.set_model(self.EntropyRepositoryStore)
@@ -738,19 +741,22 @@ class RepositoryManagerMenu(MenuSkel):
srv = self.Service.get_service_connection(timeout = 5)
if srv == None:
return False, _("No connection to host, please check your data")
session = srv.open_session()
if session == None:
return False, _("Unable to create a remote session. Try again later.")
try:
logged, error = self.Service.login(srv, session)
if not logged:
return False, _("Login failed. Please retry.")
except Exception, e:
return False, "%s: %s" % (_("Connection Error"),e,)
srv.close_session(session)
srv.disconnect()
self.connection_done = True
return True, None
session = srv.open_session()
if session == None:
return False, _("Unable to create a remote session. Try again later.")
try:
logged, error = self.Service.login(srv, session)
if not logged:
return False, _("Login failed. Please retry.")
except Exception, e:
return False, "%s: %s" % (_("Connection Error"),e,)
srv.close_session(session)
srv.disconnect()
self.connection_done = True
return True, None
except exceptionTools.SSLError:
return False,_("SSL Error, are you sure the server supports SSL?")
def load(self):
@@ -1801,8 +1807,6 @@ class RepositoryManagerMenu(MenuSkel):
cell.set_property('markup',"<b>%s</b>: <i>%s</i>" % (_("Action"),cleanMarkupString(obj['text']),))
elif obj['from'] == "uri":
cell.set_property('markup',"<b>%s</b>: <u>%s</u>" % (_("Server"),cleanMarkupString(obj['text']),))
elif obj['from'] == "branch":
cell.set_property('markup',"<b>%s</b>: %s" % (_("Branch"),cleanMarkupString(obj['text']),))
elif obj['from'] == "db":
yes = _("Yes")
no = _("No")
@@ -2237,40 +2241,30 @@ class RepositoryManagerMenu(MenuSkel):
self.DataStore.append( uri_parent, (db_item,))
if data[repoid][uri].has_key('packages'):
for mybranch in data[repoid][uri]['packages']:
branch_master = {
'is_master': True,
'text': mybranch,
'from': "branch",
'color': color,
'repoid': repoid,
'run': (repoid,False,True,) # repoid, dbsync, pkgsync
}
branch_parent = self.DataStore.append( uri_parent, (branch_master,))
for action in data[repoid][uri]['packages']:
for action in data[repoid][uri]['packages'][mybranch]:
if data[repoid][uri]['packages'][action]:
pkgmaster = {
'is_master': True,
'text': action,
'from': "pkg_master",
'color': color,
'repoid': repoid,
'run': (repoid,False,True,)
}
pkg_parent = self.DataStore.append( uri_parent, (pkgmaster,))
if data[repoid][uri]['packages'][mybranch][action]:
pkgmaster = {
'is_master': True,
'text': action,
'from': "pkg_master",
'color': color,
'repoid': repoid,
'run': (repoid,False,True,)
}
pkg_parent = self.DataStore.append( branch_parent, (pkgmaster,))
for mypath, mysize in data[repoid][uri]['packages'][mybranch][action]:
pkg_item = {
'from': "pkg",
'filename': os.path.basename(mypath),
'size': self.entropyTools.bytesIntoHuman(mysize),
'color': color,
'repoid': repoid,
'run': (repoid,False,True,)
}
self.DataStore.append( pkg_parent, (pkg_item,))
for mypath, mysize in data[repoid][uri]['packages'][action]:
pkg_item = {
'from': "pkg",
'filename': os.path.basename(mypath),
'size': self.entropyTools.bytesIntoHuman(mysize),
'color': color,
'repoid': repoid,
'run': (repoid,False,True,)
}
self.DataStore.append( pkg_parent, (pkg_item,))
self.DataView.expand_all()
gtk.gdk.threads_leave()