@@ -131,6 +131,14 @@ def get_repo_url(repo_name, repo_type, config):
131131
132132 error ('Unknown repository or type: ' + repo_name + '/' + repo_type )
133133
134+ def get_repo_suite (repo_name , repo_type , config ):
135+ for p in config ['repositories' ]:
136+ if p ['name' ] == repo_name and p ['linux_distro' ].lower () == get_linux_distro ():
137+ for t in p ['types' ]:
138+ if t ['name' ] == repo_type :
139+ if 'suite' in t :
140+ return t ['suite' ]
141+ return None
134142
135143def get_sources_list_file_path (repo_name , repo_type ):
136144 filename = f'{ GZDEV_FILE_PREFIX } { repo_name } _{ repo_type } .list'
@@ -188,17 +196,27 @@ def install_repo(repo_name, repo_type, config, linux_distro, gpg_check):
188196 url = get_repo_url (repo_name , repo_type , config )
189197 key = get_repo_key (repo_name , config )
190198 key_url = get_repo_key_url (repo_name , config )
199+ suite = get_repo_suite (repo_name , repo_type , config )
191200
192201 try :
193- key_path = download_key (repo_name , repo_type , key_url )
194- if gpg_check :
195- assert_key_in_file (key , key_path )
202+ trusted_or_signed_str = ""
203+ if key is not None and key_url is not None :
204+ key_path = download_key (repo_name , repo_type , key_url )
205+ if gpg_check :
206+ assert_key_in_file (key , key_path )
207+ trusted_or_signed_str = f"signed-by={ key_path } "
208+ else :
209+ trusted_or_signed_str = "trusted=yes"
196210
197- # if not linux_distro provided, try to guess it
198- if not linux_distro :
199- linux_distro = distro .codename ()
211+ if suite is not None :
212+ distro_component_or_suite_str = f"{ suite } "
213+ else :
214+ # if not linux_distro provided, try to guess it
215+ if not linux_distro :
216+ linux_distro = distro .codename ()
217+ distro_component_or_suite_str = f"{ linux_distro } main"
200218
201- content = f"deb [signed-by= { key_path } ] { url } { linux_distro } main "
219+ content = f"deb [{ trusted_or_signed_str } ] { url } { distro_component_or_suite_str } "
202220 full_path = get_sources_list_file_path (repo_name , repo_type )
203221 if os .path .isfile (full_path ):
204222 warn ("gzdev file with the repositoy already exists in the system:"
@@ -210,7 +228,7 @@ def install_repo(repo_name, repo_type, config, linux_distro, gpg_check):
210228
211229 run_apt_update ()
212230 except PermissionError :
213- print ('No permissiong to make system file modifications. Run the script with sudo.' )
231+ print ('No permission to make system file modifications. Run the script with sudo.' )
214232
215233
216234def disable_repo (repo_name ):
0 commit comments