@@ -17,57 +17,63 @@ use flate2::read::GzDecoder;
1717use tar:: Archive ;
1818use which:: which;
1919
20+ macro_rules! server_and_keys {
21+ ( $s: expr; $( $x: expr, ) * ) => {
22+ [ $( ( $s, $x) , ) * ]
23+ } ;
24+ }
25+
2026const UBUNTU_KEYSERVER : & str = "hkps://keyserver.ubuntu.com" ;
2127/// The default version of zlib to use if the `ZLIB_VERSION` environment variable is not present
2228const ZLIB_DEFAULT_VERSION : & str = "1.3.1" ;
2329/// Key 1: Mark Adler's public key. For zlib 1.3.1 and earlier
24- const ZLIB_GPG_SERVER_AND_KEY_ID : ( & str , & str ) = ( UBUNTU_KEYSERVER , "5ED46A6721D365587791E2AA783FCD8E58BCAFBA" ) ;
30+ const ZLIB_GPG_SERVER_AND_KEY_IDS : [ ( & str , & str ) ; 1 ] =
31+ server_and_keys ! [ UBUNTU_KEYSERVER ; "5ED46A6721D365587791E2AA783FCD8E58BCAFBA" , ] ;
2532const ZLIB_DOWNLOAD_URL_PREFIX : & str = "https://github.com/madler/zlib/releases/download" ;
2633/// The default version of pcre to use if the `PCRE2_VERSION` environment variable is not present
2734const PCRE1_DEFAULT_VERSION : & str = "8.45" ;
2835const PCRE2_DEFAULT_VERSION : & str = "10.42" ;
2936/// Key 1: Phillip Hazel's public key. For PCRE2 10.42 and earlier
30- const PCRE2_GPG_SERVER_AND_KEY_ID : ( & str , & str ) = ( UBUNTU_KEYSERVER , "45F68D54BBE23FB3039B46E59766E084FB0F43D8" ) ;
37+ const PCRE2_GPG_SERVER_AND_KEY_IDS : [ ( & str , & str ) ; 1 ] =
38+ server_and_keys ! [ UBUNTU_KEYSERVER ; "45F68D54BBE23FB3039B46E59766E084FB0F43D8" , ] ;
3139const PCRE1_DOWNLOAD_URL_PREFIX : & str = "https://sourceforge.net/projects/pcre/files/pcre" ;
3240const PCRE2_DOWNLOAD_URL_PREFIX : & str = "https://github.com/PCRE2Project/pcre2/releases/download" ;
3341/// The default version of openssl to use if the `OPENSSL_VERSION` environment variable is not present
3442const OPENSSL1_DEFAULT_VERSION : & str = "1.1.1w" ;
3543const OPENSSL3_DEFAULT_VERSION : & str = "3.2.1" ;
36- const OPENSSL_GPG_SERVER_AND_KEY_IDS : ( & str , & str ) = (
37- UBUNTU_KEYSERVER ,
38- "\
39- EFC0A467D613CB83C7ED6D30D894E2CE8B3D79F5 \
40- A21FAB74B0088AA361152586B8EF1A6BA9DA2D5C \
41- 8657ABB260F056B1E5190839D9C4D26D0E604491 \
42- B7C1C14360F353A36862E4D5231C84CDDCC69C45 \
43- 95A9908DDFA16830BE9FB9003D30A3A9FF1360DC \
44- 7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C \
45- E5E52560DD91C556DDBDA5D02064C53641C25E5D \
46- C1F33DD8CE1D4CC613AF14DA9195C48241FBF7DD",
47- ) ;
44+ const OPENSSL_GPG_SERVER_AND_KEY_IDS : [ ( & str , & str ) ; 8 ] = server_and_keys ! [
45+ UBUNTU_KEYSERVER ;
46+ "EFC0A467D613CB83C7ED6D30D894E2CE8B3D79F5" ,
47+ "A21FAB74B0088AA361152586B8EF1A6BA9DA2D5C" ,
48+ "8657ABB260F056B1E5190839D9C4D26D0E604491" ,
49+ "B7C1C14360F353A36862E4D5231C84CDDCC69C45" ,
50+ "95A9908DDFA16830BE9FB9003D30A3A9FF1360DC" ,
51+ "7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C" ,
52+ "E5E52560DD91C556DDBDA5D02064C53641C25E5D" ,
53+ "C1F33DD8CE1D4CC613AF14DA9195C48241FBF7DD" ,
54+ ] ;
4855const OPENSSL_DOWNLOAD_URL_PREFIX : & str = "https://github.com/openssl/openssl/releases/download" ;
4956/// The default version of NGINX to use if the `NGX_VERSION` environment variable is not present
5057const NGX_DEFAULT_VERSION : & str = "1.24.0" ;
5158
5259/// Key 1: Konstantin Pavlov's public key. For Nginx 1.25.3 and earlier
5360/// Key 2: Sergey Kandaurov's public key. For Nginx 1.25.4
5461/// Key 3: Maxim Dounin's public key. At least used for Nginx 1.18.0
55- const NGX_GPG_SERVER_AND_KEY_IDS : ( & str , & str ) = (
56- UBUNTU_KEYSERVER ,
57- "\
58- 13C82A63B603576156E30A4EA0EA981B66B0D967 \
59- D6786CE303D9A9022998DC6CC8464D549AF75C0A \
60- B0F4253373F8F6F510D42178520A9993A1C052F8",
61- ) ;
62+ const NGX_GPG_SERVER_AND_KEY_IDS : [ ( & str , & str ) ; 3 ] = server_and_keys ! [
63+ UBUNTU_KEYSERVER ;
64+ "13C82A63B603576156E30A4EA0EA981B66B0D967" ,
65+ "D6786CE303D9A9022998DC6CC8464D549AF75C0A" ,
66+ "B0F4253373F8F6F510D42178520A9993A1C052F8" ,
67+ ] ;
6268
6369const NGX_DOWNLOAD_URL_PREFIX : & str = "https://nginx.org/download" ;
6470
6571/// If you are adding another dependency, you will need to add the server/public key tuple below.
66- const ALL_SERVERS_AND_PUBLIC_KEY_IDS : [ ( & str , & str ) ; 4 ] = [
67- ZLIB_GPG_SERVER_AND_KEY_ID ,
68- PCRE2_GPG_SERVER_AND_KEY_ID ,
69- OPENSSL_GPG_SERVER_AND_KEY_IDS ,
70- NGX_GPG_SERVER_AND_KEY_IDS ,
72+ const ALL_SERVERS_AND_PUBLIC_KEY_IDS : & [ ( & str , & str ) ; 13 ] = constcat :: concat_slices! [ [ ( & str , & str ) ] :
73+ & ZLIB_GPG_SERVER_AND_KEY_IDS ,
74+ & PCRE2_GPG_SERVER_AND_KEY_IDS ,
75+ & OPENSSL_GPG_SERVER_AND_KEY_IDS ,
76+ & NGX_GPG_SERVER_AND_KEY_IDS ,
7177] ;
7278
7379/// List of configure switches specifying the modules to build nginx with
@@ -316,12 +322,14 @@ fn keys_indexed_by_key_server() -> HashMap<String, Vec<String>> {
316322 let mut map: HashMap < String , Vec < String > > = HashMap :: new ( ) ;
317323
318324 for tuple in ALL_SERVERS_AND_PUBLIC_KEY_IDS {
319- let key = tuple. 0 . to_string ( ) ;
320- let value: Vec < String > = tuple. 1 . split_whitespace ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ;
321- match map. get_mut ( & key) {
322- Some ( keys) => keys. extend ( value) ,
325+ let server = tuple. 0 . to_string ( ) ;
326+ let key = tuple. 1 . to_string ( ) ;
327+ match map. get_mut ( & server) {
328+ Some ( keys) => {
329+ keys. push ( key) ;
330+ }
323331 None => {
324- map. insert ( key , value ) ;
332+ map. insert ( server , vec ! [ key ] ) ;
325333 }
326334 }
327335 }
0 commit comments