From 45c68bceb89550d45f68c0b0be5f976433c8e146 Mon Sep 17 00:00:00 2001 From: eroen Date: Sat, 16 Nov 2013 18:07:41 +0100 Subject: add url to annex --- ga_wrapper/wrapper.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ga_wrapper/wrapper.py b/ga_wrapper/wrapper.py index 72676b9..e4d3ba1 100644 --- a/ga_wrapper/wrapper.py +++ b/ga_wrapper/wrapper.py @@ -17,6 +17,13 @@ def fallthrough(args): return proc.wait() +def ga_addurl(src, outfile, repo='.'): + os.chdir(repo) + proc = subprocess.Popen(['git', 'annex', 'addurl', + '--file={f}'.format(f=outfile), src]) + proc.communicate() + + def wget_wrapper(args): print('emulating wget for ', ' '.join(args)) if args[0].endswith('wget'): @@ -40,8 +47,9 @@ def wget_wrapper(args): os.chdir(repo) # portage silently deletes symlinks - proc = subprocess.Popen(['git', 'checkout', outfile]) + proc = subprocess.Popen(['git', 'checkout', '--', outfile]) proc.communicate() + ga_addurl(src, outfile) proc = subprocess.Popen(['git', 'annex', 'whereis', outfile], stdout=subprocess.PIPE) (stdoutdata, _) = proc.communicate() -- cgit v1.2.1