Hi Kde-Windows-Hackers, here are to dirty patches that might come in handy, if a) the network connection to some server is down, but you have the file b) round-robin dns from sourceforge gives you bad servers occasionally
A real solution for b) would be to implement general fetchting retries. For a) we would need to implement a verficiation step that would check a sha1sum or an OpenPGP signature on disk first before trying to use the network. Patch a) is from Bernhard Herzog. They are both too small to claim copyright IMO, but we love credits. :) Happy hacking, Bernhard ps.: If you wonder about the FIXME in the context of one patch: Yes there is the subprocess module. And yes a better way would be to use urllib2 completely and just implement reget with it like urlgrabber does. -- Managing Director - Owner: www.intevation.net (Free Software Company) Germany Coordinator: fsfeurope.org. Coordinator: www.Kolab-Konsortium.com. Intevation GmbH, Osnabrück, DE; Amtsgericht Osnabrück, HRB 18998 Geschäftsführer Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
Emerge downloads quite a few files from the Internet. If the server is
down, emerge stops with errors even if the file it attempted to fetch is
already in emerge's cache of downloaded files.
With this patch, emerge does not even attempt to download a file if it's
already in the cache. This is not really the right way to do it,
though, because the file in the cache may be a partial file left over
from an aborted download attempt, for instance.
Index: bin/utils.py
===================================================================
--- bin/utils.py (revision 797094)
+++ bin/utils.py (working copy)
@@ -80,13 +80,18 @@
return False
+ scheme, host, path, params, qu, fr = urlparse.urlparse( url )
+
+ basename = os.path.basename(path)
+ if os.path.exists(os.path.join(destdir, basename)):
+ print "%s already fetched." % basename
+ return True
+
wgetpath = WGetExecutable
if ( os.path.exists( wgetpath ) ):
return wgetFile( url, destdir )
- scheme, host, path, params, qu, fr = urlparse.urlparse( url )
-
filename = os.path.basename( path )
if verbose() > 0:
print scheme
Dirty patch to KDE4's emerge for Windows
to make several wget attempts to download a file
if it is on downloads.sourceforge.net.
Use case: When one of the sourceforge download servers is down,
your emerge run will stumble each time you hit the bad server,
making it impossible to complete it
when you need to download several dependencies.
20080416 [EMAIL PROTECTED]
Index: bin/utils.py
===================================================================
--- bin/utils.py (Revision 797632)
+++ bin/utils.py (Arbeitskopie)
@@ -108,10 +108,21 @@
if verbose() > 1:
print "wgetfile called"
print "executing this command:", command
+ attempts=1
+ if url.lower().startswith("http://downloads.sourceforge.net"):
+ print "uh sf"
+ attempts=3
+
# FIXME: there needs to be another function instead of os.system
- ret = system( command )
- if verbose() > 0:
- print "wget ret:", ret
+ while(attempts > 0):
+ attempts -= 1
+ ret = system( command )
+ if verbose() > 0:
+ print "wget ret:", ret
+ if ret == True:
+ # success stop early.
+ break;
+
return ret
def getFtpFile( host, path, destdir, filename ):
pgpKxx8bbugA6.pgp
Description: PGP signature
_______________________________________________ Kde-windows mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-windows
