[opensuse-buildservice] [patch] [osc] Fallback to plain file, if cpio download isn't available.
Hi ! The new cpio file query needs a fallback option in case of the api being an _old_ api . This is really needed - just think of migration scenarios and for backward compatibility. I hacked up a patch and would like to append it for comments from our osc experts. Best, Jan-Simon Index: fetch.py =================================================================== --- fetch.py (Revision 8854) +++ fetch.py (Arbeitskopie) @@ -184,6 +184,14 @@ pac = pkgs[hdr.filename.rsplit('.', 1)[0]] archive.copyin_file(hdr.filename, os.path.dirname(tmpfile), os.path.basename(tmpfile)) self.move_package(tmpfile, pac.localdir, pac) + except URLGrabError, e: + #retry without cpio for compatibility - please also think of migration scenarios and stay compatible ! + for mynext in pkgs.keys(): + url = makeurl(buildinfo.apiurl, + ['build', project, repo, buildinfo.buildarch, '_repository', mynext]) + self.gr.urlgrab(url, filename = tmpfile, text = 'fetching file \'%s\' for \'%s\'' % (mynext, project)) + pac = pkgs[mynext] + self.move_package(tmpfile, pac.localdir, pac) finally: if os.path.exists(tmparchive): os.unlink(tmparchive)
On 2009-11-09 15:20:02 +0100, Jan-Simon Möller wrote:
Hi !
The new cpio file query needs a fallback option in case of the api being an _old_ api . This is really needed - just think of migration scenarios and for backward compatibility.
It seems you're using a _really old_ API:)
I hacked up a patch and would like to append it for comments from our osc experts.
The patch itself looks ok to me but it breaks python24 compatibility. The "except" has to be nested into an inner try statement: try: try: <old code> except URLGrabError, e: <your code> finally: <old code> But feel free to commit your current version - I'll fix it afterwards. Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Am Montag 09 November 2009 19:25:53 schrieb Marcus Hüwe:
On 2009-11-09 15:20:02 +0100, Jan-Simon Möller wrote:
Hi !
The new cpio file query needs a fallback option in case of the api being an _old_ api . This is really needed - just think of migration scenarios and for backward compatibility.
It seems you're using a _really old_ API:)
No, i got an error with an api of rev.8836 and also with an slightly older version. So I wouldn't consider them "old" - anyway, a fallback doesn't hurt.
I hacked up a patch and would like to append it for comments from our osc experts.
The patch itself looks ok to me but it breaks python24 compatibility. The "except" has to be nested into an inner try statement: try: try: <old code> except URLGrabError, e: <your code> finally: <old code>
Hehe, then I did it right in the first place, but "beautified" the code too much. I'll commit a version with nesting then. Best, Jan-Simon -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On 2009-11-09 19:37:13 +0100, Jan-Simon Möller wrote:
Am Montag 09 November 2009 19:25:53 schrieb Marcus Hüwe:
On 2009-11-09 15:20:02 +0100, Jan-Simon Möller wrote:
Hi !
The new cpio file query needs a fallback option in case of the api being an _old_ api . This is really needed - just think of migration scenarios and for backward compatibility.
It seems you're using a _really old_ API:)
No, i got an error with an api of rev.8836 and also with an slightly older version. So I wouldn't consider them "old" - anyway, a fallback doesn't hurt.
Hmm do you remember the error? The API supports this for a long time (e.g. remote obs instances use the same "trick" to fetch the packages).
I hacked up a patch and would like to append it for comments from our osc experts.
The patch itself looks ok to me but it breaks python24 compatibility. The "except" has to be nested into an inner try statement: try: try: <old code> except URLGrabError, e: <your code> finally: <old code>
Hehe, then I did it right in the first place, but "beautified" the code too much. Yes a try-except-finally is much nicer to read but there are still some people who use python24.
I'll commit a version with nesting then.
Thanks Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (2)
-
Jan-Simon Möller
-
Marcus Hüwe