Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 23410 Details for
Bug 35535
[PATCH] `emerge sync` refactoring
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
snapshot module
snapshot.py (text/plain), 2.11 KB, created by
Marius Mauch (RETIRED)
on 2004-01-08 12:11:47 UTC
(
hide
)
Description:
snapshot module
Filename:
MIME Type:
Creator:
Marius Mauch (RETIRED)
Created:
2004-01-08 12:11:47 UTC
Size:
2.11 KB
patch
obsolete
>from aux import * # to be removed >import os,time,portage,shutil >import sync,rsync > >class SnapshotConnection(rsync.RsyncBaseConnection): > def __init__(self, src, dest, settings): > self.transtype = "snapshot" > self.syncuri = src > self.portdir = dest > self.settings = settings > self.synced = False > > > def setup(self): > self.base_setup() > > > def sync(self): > # this is a rewrite of the old emerge-webrsync code > if self.synced: > raise Exception("This method may be called only once") > > attempts = 0 > downloaded = False > minsize = 1024*1024 > syncdir = self.settings["PORTAGE_TMPDIR"]+"/websync" > if not os.path.exists(syncdir+"/portage"): > os.makedirs(syncdir+"/portage", 0755) > os.chdir(syncdir) > while attempts < 40 and not downloaded: > mytime = time.localtime(time.time() - (attempts*24*60*60)) > mysnapshot = "portage-"+time.strftime("%Y%m%d", mytime)+".tar.bz2" > if os.path.exists(self.settings["DISTDIR"]+"/"+mysnapshot): > #and os.lstat(mysnapshot)[6] > minsize: > info("snapshot %s found in %s" % (mysnapshot, self.settings["DISTDIR"])) > downloaded = True > break > for m in self.syncuri.split(): > myfetchcmd = self.settings["FETCHCOMMAND"]+" "+m+"/snapshots/"+mysnapshot > info("trying to download snapshot %s from %s" % (mysnapshot, m)) > if portage.spawn(myfetchcmd, free=1) == 0: > if os.path.exists(mysnapshot) and os.lstat(mysnapshot)[6] > minsize: > info("%s successfully downloaded" % mysnapshot) > downloaded = True > break > attempts += 1 > if not downloaded: > warn("could not download a complete snapshot") > return -1 > > shutil.copy2(self.settings["DISTDIR"]+"/"+mysnapshot, "./"+mysnapshot) > portage.spawn("tar xjvf "+mysnapshot, free=1) > > self.rsyncCmd=self.rsyncCmd+" \'"+syncdir+"/portage/*\' "+os.path.normpath(self.portdir)+"/" > msg(">>> starting rsync with local portage tree ...") > exitcode = portage.spawn(self.rsyncCmd,self.settings,free=1) > self.synced = True > > self.checkRsyncExitcode(exitcode) > shutil.rmtree(syncdir) > return exitcode > >print "Loading snapshot" >sync.addTransport("http", SnapshotConnection) >sync.addTransport("ftp", SnapshotConnection) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 35535
:
22067
|
22068
|
22069
|
23407
|
23408
|
23409
| 23410 |
23411