You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2022/07/15 10:48:47 UTC

Re: svn commit: r1902722 - in /subversion/trunk/tools/dist: make-keys.sh release.py

dsahlberg@apache.org wrote on Thu, Jul 14, 2022 at 19:40:58 -0000:
> Author: dsahlberg
> Date: Thu Jul 14 19:40:57 2022
> New Revision: 1902722
> 
> URL: http://svn.apache.org/viewvc?rev=1902722&view=rev
> Log:
> Follow-up to r1902582: Improvements to the release.py script
> 
> Suggested by: danielsh
> 
> * tools/dist/make-keys.sh:
>   Make the -c argument expect the NAME of the COMMITTERS file, to make it
>   easier in the future to point to a file with another (temporary) name.
> 
> * tools/dist/release.py
>   (get_keys): Better use of NamedTemporaryFile. Doesn't work on Windows
>   (according to Python docs) but there are other release process
>   requirements mandating the use of *nix so it should be ok.

The callsite in roll_tarballs() hasn't been updated.

> +++ subversion/trunk/tools/dist/release.py Thu Jul 14 19:40:57 2022
> @@ -1469,11 +1469,10 @@ def check_sigs(args):
>  
>  def get_keys(args):
>      'Import the LDAP-based KEYS file to gpg'
> -    with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
> +    with tempfile.NamedTemporaryFile() as tmpfile:
>        keyspath = tmpfile.name
> -    subprocess.check_call([os.path.dirname(__file__) + '/make-keys.sh', '-c', os.path.dirname(__file__) + '/../..', '-o', keyspath])
> -    subprocess.check_call(['gpg', '--import', keyspath])
> -    os.remove(keyspath)
> +      subprocess.check_call([os.path.dirname(__file__) + '/make-keys.sh', '-c', os.path.dirname(__file__) + '/../../COMMITTERS', '-o', keyspath])
> +      subprocess.check_call(['gpg', '--import', keyspath])

Thanks.  LGTM.  And considering the code did replaces did already do the
urlopen() thing, here's a stab at it:

[[[
Index: release.py
===================================================================
--- release.py	(revision 1902730)
+++ release.py	(working copy)
@@ -1470,11 +1470,18 @@ def check_sigs(args):
 def get_keys(args):
     'Import the LDAP-based KEYS file to gpg'
     with tempfile.NamedTemporaryFile() as keysfile:
-      subprocess.check_call([
-          os.path.dirname(__file__) + '/make-keys.sh',
-          '-c', os.path.dirname(__file__) + '/../../COMMITTERS',
-          '-o', keysfile.name,
-      ])
+      with tempfile.NamedTemporaryFile() as committersfile:
+        shutil.copyfileobj(
+            urlopen(svn_repos + "/trunk/COMMITTERS"),
+            committersfile,
+        )
+        committersfile.flush()
+        #committersfile.seek(0) # Remember to uncomment this line if needed
+        subprocess.check_call([
+            os.path.dirname(__file__) + '/make-keys.sh',
+            '-c', committersfile.name,
+            '-o', keysfile.name,
+        ])
       subprocess.check_call(['gpg', '--import', keysfile.name])
 
 def add_to_changes_dict(changes_dict, audience, section, change, revision):
]]]

WDYT, Daniel?

If this works we can also revert the HACKING change on staging to reduce
the dependencies of rolling.

Cheers,

Daniel