You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ds...@apache.org on 2022/07/14 19:40:58 UTC

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

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.


Modified:
    subversion/trunk/tools/dist/make-keys.sh
    subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/make-keys.sh
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/make-keys.sh?rev=1902722&r1=1902721&r2=1902722&view=diff
==============================================================================
--- subversion/trunk/tools/dist/make-keys.sh (original)
+++ subversion/trunk/tools/dist/make-keys.sh Thu Jul 14 19:40:57 2022
@@ -26,21 +26,21 @@ while getopts ":c:o:h" ARG; do
 	o) OUTPUT=$OPTARG ;;
 	h) echo "USAGE: $0 [-c PATH/TO/COMMITTERS] [-o PATH/TO/OUTPUT/KEYS] [-h]";
 	   echo "";
-	   echo "-c  Set the path to the COMMITTERS file. Default current directory.";
+	   echo "-c  Set the path/name to the COMMITTERS file. Default current directory/COMMITTERS.";
 	   echo "-o  Set the path/name of the resulting KEYS file. Default current directory/KEYS.";
 	   echo "-h  Display this message";
 	   return ;;
     esac
 done
 
-if [ ! -f $COMMITTERS/COMMITTERS ]; then
+if [ ! -f $COMMITTERS ]; then
 	echo "COMMITTERS file not found."
 	exit 1
 fi
 
 cd $TMP
 
-for availid in $( perl -anE 'say $F[0] if (/^Blanket/../END ACTIVE FULL.*SCRIPTS LOOK FOR IT/ and /@/)' < $COMMITTERS/COMMITTERS )
+for availid in $( perl -anE 'say $F[0] if (/^Blanket/../END ACTIVE FULL.*SCRIPTS LOOK FOR IT/ and /@/)' < $COMMITTERS )
 do
 	key_url=https://people.apache.org/keys/committer/${availid}.asc
 	

Modified: subversion/trunk/tools/dist/release.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1902722&r1=1902721&r2=1902722&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ 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])
 
 def add_to_changes_dict(changes_dict, audience, section, change, revision):
     # Normalize arguments



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

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
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

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

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
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