Except packages from priority redefinition

This commit is contained in:
Benjamin Bohard 2020-12-01 11:47:54 +01:00
parent a4ab03368f
commit 85dfc9d2ca
2 changed files with 29 additions and 6 deletions

View File

@ -7,16 +7,24 @@
<variables>
<family name='dépôt tiers'>
<variable name='additional_repository_global_priority' type='number' description='Priorité globale du dépôt'>
<variable name='additional_repository_priority_target' type='string' description='Dépôt avec une priorité personnalisée' mandatory='True' multi='True'/>
<variable name='additional_repository_global_priority' type='number' description='Priorité globale du dépôt' mandatory='True'>
<value>1500</value>
</variable>
<variable name='additional_repository_exempted_packages' type='string' description='Paquets exemptés du changement de priorité'/>
</family>
</variables>
<constraints>
<group master='additionnal_repository_priority_target'>
<slave>additional_repository_global_priority</slave>
<slave>additional_repository_exempted_packages</slave>
</group>
</constraints>
<help>
<variable name='additional_repository_global_priority'>Une valeur supérieure à 500 (valeur par défaut) rend moins prioritaire les paquets du dépôt, une valeur inférieure, plus prioritaire</variable>
<variable name='additional_repository_exempted_packages'>Liste des paquets séparés par des espaces dont la priorité sera celle par défaut plutôt que celle définie globalement pour le dépôt</variable>
</help>
</creole>

View File

@ -7,9 +7,24 @@
%return %%repository
%end def
%for %%repository in %%getVar('additional_repository_name', [])
Package: *
Pin: release %%repository_identification(%%repository.additional_repository_source)
Pin-Priority: %%additional_repository_global_priority
%set %%repositories_detail = {'name': r.additional_repository_name, 'source': r.additional_repository_source, 'priority': 500, 'execptions': [] for r in %%getVar('additional_repository_name')}
%for %%priority_target in %%getVar('additional_repository_priority_target', [])
%if %%priority_target.additional_priority_target in %%repositories_detail
%silent %%repositories_detail[%%priority_target.additional_repository_priority_target]['priority'] = %%priority_target.additional_repository_global_priority
%silent %%repositories_detail[%%priority_target.additional_repository_priority_target]['exceptions'] = %%priority_target.additional_repository_exempted_packages.split()
%end if
%end for
%for %%repository in %%repositories_detail
Package: *
Pin: release %%repository_identification(%%repository['source'])
Pin-Priority: %%repository['priority']
%for %%exception in %%repositories_detail[%%repository]['exceptions']
Package: %%exception
Pin: release %%repository_identification(%%repository['source'])
Pin-Priority: 500
%end for
%end for