chiark / gitweb /
shutil.move() in apk_strip_signature() to work across filesystems
authorHans-Christoph Steiner <hans@eds.org>
Fri, 1 Dec 2017 13:08:42 +0000 (14:08 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 4 Dec 2017 21:52:41 +0000 (22:52 +0100)
os.rename() only works if source and destination are on the same file
system, shutil.move() works across file systems.

OSError: [Errno 18] Invalid cross-device link: '/builds/eighthave/fdroidclient/app/build/outputs/apk/app-debug.apk' -> '/tmp/tmp966vh75f/tmp.apk'

fdroidserver/common.py

index 24c695e2fbd74e4f568ae30d4187f5652e7702ca..e15651d35550981a45115a787aff51c4e35c5685 100644 (file)
@@ -2368,7 +2368,7 @@ def apk_strip_signatures(signed_apk, strip_manifest=False):
     """
     with tempfile.TemporaryDirectory() as tmpdir:
         tmp_apk = os.path.join(tmpdir, 'tmp.apk')
-        os.rename(signed_apk, tmp_apk)
+        shutil.move(signed_apk, tmp_apk)
         with ZipFile(tmp_apk, 'r') as in_apk:
             with ZipFile(signed_apk, 'w') as out_apk:
                 for info in in_apk.infolist():