[game-data-packager] 05/08: prepend MIRROR environment variable to mirror list

Simon McVittie smcv at debian.org
Fri Jan 16 10:31:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 1abb8c4473938bbd9361bcbec960a6e85ec1009e
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Fri Jan 16 10:40:55 2015 +0100

    prepend MIRROR environment variable to mirror list
    
    This is needed if we build a test-suite that tries
    to packages everything from the web;
    without taxing the actual mirrors.
    
    This doesn't include "details.get('path', '.')";
    because the layout of this folder would be flat;
    as there is little risk of name collision.
---
 lib/game_data_packager/__init__.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 5a972eb..d3e3696 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -1021,10 +1021,18 @@ class GameData(object):
             except:
                 logger.warning('Could not open mirror list "%s"', mirror_list,
                         exc_info=True)
+        random.shuffle(mirrors)
+        if 'MIRROR' in os.environ:
+            url = os.environ.get('MIRROR')
+            if url.split(':')[0] not in ('http', 'https', 'ftp'):
+                url = 'http://' + url
+            if not url.endswith('/'):
+                url = url + '/'
+            url = url + details.get('name', wanted.name)
+            mirrors.insert(0, url)
         if not mirrors:
             logger.error('Could not select a mirror for "%s"', wanted.name)
             return []
-        random.shuffle(mirrors)
         return mirrors
 
     def cat_files(self, package, provider, wanted):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list