chiark / gitweb /
nightly: use shutil.move() only so all ops work across filesystems
authorHans-Christoph Steiner <hans@eds.org>
Tue, 5 Dec 2017 08:13:19 +0000 (09:13 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 5 Dec 2017 08:13:19 +0000 (09:13 +0100)
https://gitlab.com/fdroid/fdroidserver/merge_requests/377#note_49998712

fdroidserver/nightly.py

index ddb66ebb02de522630805a7024a22f8eb628734e..50c859f4fe9758a4ee18fa8659818cbe195520c4 100644 (file)
@@ -70,7 +70,7 @@ def _ssh_key_from_debug_keystore():
     rsakey = paramiko.RSAKey.from_private_key_file(privkey)
     fingerprint = base64.b64encode(hashlib.sha256(rsakey.asbytes()).digest()).decode('ascii').rstrip('=')
     ssh_private_key_file = os.path.join(tmp_dir, 'debug_keystore_' + fingerprint + '_id_rsa')
-    os.rename(privkey, ssh_private_key_file)
+    shutil.move(privkey, ssh_private_key_file)
 
     pub = rsakey.get_name() + ' ' + rsakey.get_base64() + ' ' + ssh_private_key_file
     with open(ssh_private_key_file + '.pub', 'w') as fp:
@@ -283,8 +283,8 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
         os.makedirs(os.path.dirname(ssh_dir), exist_ok=True)
         privkey = _ssh_key_from_debug_keystore()
         ssh_private_key_file = os.path.join(ssh_dir, os.path.basename(privkey))
-        os.rename(privkey, ssh_private_key_file)
-        os.rename(privkey + '.pub', ssh_private_key_file + '.pub')
+        shutil.move(privkey, ssh_private_key_file)
+        shutil.move(privkey + '.pub', ssh_private_key_file + '.pub')
         if shutil.rmtree.avoids_symlink_attacks:
             shutil.rmtree(os.path.dirname(privkey))