@@ -80,6 +80,51 @@ usage(bool fail)
8080 exit (fail ? EXIT_FAILURE : EXIT_SUCCESS );
8181}
8282
83+ static void
84+ show_repo (struct xbps_repo * repo )
85+ {
86+ xbps_data_t pubkey ;
87+ const char * signedby = NULL ;
88+ char * hexfp = NULL ;
89+ uint16_t pubkeysize = 0 ;
90+
91+ printf ("%5zd %s" ,
92+ repo -> idx ? (ssize_t )xbps_dictionary_count (repo -> idx ) : -1 ,
93+ repo -> uri );
94+ printf (" (RSA %s)\n" , repo -> is_signed ? "signed" : "unsigned" );
95+ if (!(repo -> xhp -> flags & XBPS_FLAG_VERBOSE ))
96+ return ;
97+
98+ xbps_dictionary_get_cstring_nocopy (repo -> idxmeta , "signature-by" , & signedby );
99+ xbps_dictionary_get_uint16 (repo -> idxmeta , "public-key-size" , & pubkeysize );
100+ pubkey = xbps_dictionary_get (repo -> idxmeta , "public-key" );
101+ if (pubkey )
102+ hexfp = xbps_pubkey2fp (pubkey );
103+ if (signedby )
104+ printf (" Signed-by: %s\n" , signedby );
105+ if (pubkeysize && hexfp )
106+ printf (" %u %s\n" , pubkeysize , hexfp );
107+ free (hexfp );
108+ }
109+
110+ static int
111+ show_repos (struct xbps_handle * xhp )
112+ {
113+ for (unsigned int i = 0 ; i < xbps_array_count (xhp -> repositories ); i ++ ) {
114+ const char * repouri = NULL ;
115+ struct xbps_repo * repo ;
116+ xbps_array_get_cstring_nocopy (xhp -> repositories , i , & repouri );
117+ repo = xbps_repo_open (xhp , repouri );
118+ if (!repo ) {
119+ printf ("%5zd %s (RSA maybe-signed)\n" , (ssize_t )-1 , repouri );
120+ continue ;
121+ }
122+ show_repo (repo );
123+ xbps_repo_release (repo );
124+ }
125+ return 0 ;
126+ }
127+
83128static int
84129filter_hold (xbps_object_t obj )
85130{
@@ -309,7 +354,7 @@ main(int argc, char **argv)
309354 rv = list_pkgdb (& xh , filter_repolock , format ? format : "{pkgver}\n" , json ) < 0 ;
310355 break ;
311356 case SHOW_REPOS :
312- rv = repo_list (& xh );
357+ rv = show_repos (& xh );
313358 break ;
314359 case SEARCH_FILE :
315360 rv = ownedby (& xh , pkg , repo_mode , regex );
0 commit comments