2020-12-01 10:46:58 +01:00
|
|
|
%import re
|
|
|
|
%def repository_identification(%%repository)
|
|
|
|
|
|
|
|
%set %%repository_re = re.compile(r'^((deb)|(deb-src)) (\[ .* \] )?(((http)|(https)|(ftp)|(ftps))://(?P<url>\S+)) (?P<suite>(\S+))(?P<components>(( \S+)+)?)')
|
|
|
|
%set %%elements = %%repository_re.match(%%repository).groupdict()
|
|
|
|
%return 'o={},a={},c={}'.format(%%elements['url'].split('/')[0], %%elements['suite'], %%elements['components'].strip())
|
|
|
|
%return %%repository
|
|
|
|
%end def
|
|
|
|
|
2020-12-01 14:40:55 +01:00
|
|
|
%set %%repositories_detail = {}
|
|
|
|
%for %%additional_repository in %%getVar('additional_repository_name')
|
|
|
|
%silent %%repositories_detail[%%str(%%additional_repository)] = {'source': %%additional_repository.additional_repository_source, 'priority': 500, 'exceptions': []}
|
|
|
|
%end for
|
2020-12-04 17:04:19 +01:00
|
|
|
%for %%priority_settings in %%getVar('additional_repository_priority_target', [])
|
2020-12-01 14:40:55 +01:00
|
|
|
%if %%str(%%priority_settings) in %%repositories_detail
|
|
|
|
%silent %%repositories_detail[%%str(%%priority_settings)]['priority'] = %%priority_settings.additional_repository_global_priority
|
|
|
|
%if %%priority_settings.additional_repository_exempted_packages
|
2020-12-03 15:16:14 +01:00
|
|
|
%silent %%repositories_detail[%%str(%%priority_settings)]['exceptions'] = %%unicode.split(%%priority_settings.additional_repository_exempted_packages)
|
2020-12-01 14:40:55 +01:00
|
|
|
%end if
|
2020-12-01 11:47:54 +01:00
|
|
|
%end if
|
|
|
|
%end for
|
|
|
|
|
|
|
|
%for %%repository in %%repositories_detail
|
2020-12-01 10:46:58 +01:00
|
|
|
Package: *
|
2020-12-01 14:40:55 +01:00
|
|
|
Pin: release %%repository_identification(%%repositories_detail[%%repository]['source'])
|
|
|
|
Pin-Priority: %%repositories_detail[%%repository]['priority']
|
2020-12-01 11:47:54 +01:00
|
|
|
%for %%exception in %%repositories_detail[%%repository]['exceptions']
|
|
|
|
Package: %%exception
|
2020-12-01 14:40:55 +01:00
|
|
|
Pin: release %%repository_identification(%%repositories_detail[%%repository]['source'])
|
2020-12-01 11:47:54 +01:00
|
|
|
Pin-Priority: 500
|
|
|
|
%end for
|
2020-12-01 10:46:58 +01:00
|
|
|
%end for
|
2020-12-01 11:47:54 +01:00
|
|
|
|