1616from .distro import Distro
1717
1818from vinca import config
19- from vinca .utils import get_repodata
19+ from vinca .utils import get_repodata , get_pkg_build_number
2020
2121unsatisfied_deps = set ()
2222distro = None
@@ -218,6 +218,11 @@ def read_vinca_yaml(filepath):
218218
219219 vinca_conf ["trigger_new_versions" ] = vinca_conf .get ("trigger_new_versions" , False )
220220
221+ if (Path (filepath ).parent / "pkg_additional_info.yaml" ).exists ():
222+ vinca_conf ["_pkg_additional_info" ] = yaml .load (open (Path (filepath ).parent / "pkg_additional_info.yaml" ))
223+ else :
224+ vinca_conf ["_pkg_additional_info" ] = {}
225+
221226 return vinca_conf
222227
223228
@@ -671,17 +676,16 @@ def get_selected_packages(distro, vinca_conf):
671676 for i in vinca_conf ["packages_select_by_deps" ]:
672677 i = i .replace ("-" , "_" )
673678 selected_packages = selected_packages .union ([i ])
674- if "skip_all_deps" not in vinca_conf or not vinca_conf ["skip_all_deps" ]:
675- if i in skipped_packages :
676- continue
677- try :
678- pkgs = distro .get_depends (i , ignore_pkgs = skipped_packages )
679- except KeyError :
680- # handle (rare) package names that use "-" as separator
681- pkgs = distro .get_depends (i .replace ("_" , "-" ))
682- selected_packages .remove (i )
683- selected_packages .add (i .replace ("_" , "-" ))
684- selected_packages = selected_packages .union (pkgs )
679+ if i in skipped_packages :
680+ continue
681+ try :
682+ pkgs = distro .get_depends (i , ignore_pkgs = skipped_packages )
683+ except KeyError :
684+ # handle (rare) package names that use "-" as separator
685+ pkgs = distro .get_depends (i .replace ("_" , "-" ))
686+ selected_packages .remove (i )
687+ selected_packages .add (i .replace ("_" , "-" ))
688+ selected_packages = selected_packages .union (pkgs )
685689
686690 result = sorted (list (selected_packages ))
687691 return result
@@ -864,6 +868,7 @@ def main():
864868 base_dir = os .path .abspath (arguments .dir )
865869 vinca_yaml = os .path .join (base_dir , "vinca.yaml" )
866870 vinca_conf = read_vinca_yaml (vinca_yaml )
871+
867872 snapshot = read_snapshot (arguments .snapshot )
868873
869874 from .template import generate_bld_ament_cmake
@@ -946,19 +951,19 @@ def main():
946951 # only URLs
947952 if "://" in fn :
948953 selected_bn = vinca_conf .get ("build_number" , 0 )
949- distro = vinca_conf [ "ros_distro" ]
950- all_pkgs = repodata . get ( "packages" , {})
951- all_pkgs . update ( repodata .get ("packages.conda " , {}) )
952- for pkg_name , pkg in all_pkgs .items ():
953- if pkg_name . startswith ( f"ros- { distro } " ):
954- if pkg_name .rsplit ( "-" , 2 )[ 0 ] in additional_recipe_names :
955- print (
956- f"Skipping additional recipe for build number computation { pkg_name } "
957- )
958- continue
959- selected_bn = max ( selected_bn , pkg [ "build_number" ])
960-
961- print ( f"Selected build number: { selected_bn } " )
954+ if not vinca_conf . get ( "use_explicit_build_number" , True ):
955+ distro = vinca_conf [ "ros_distro" ]
956+ all_pkgs = repodata .get ("packages" , {})
957+ all_pkgs .update ( repodata . get ( "packages.conda" , {}))
958+ for pkg_name , pkg in all_pkgs . items ( ):
959+ if pkg_name .startswith ( f"ros- { distro } " ) :
960+ if pkg_name . rsplit ( "-" , 2 )[ 0 ] in additional_recipe_names :
961+ print (
962+ f"Skipping additional recipe for build number computation { pkg_name } "
963+ )
964+ continue
965+ selected_bn = max ( selected_bn , pkg [ "build_number" ])
966+
962967
963968 explicitly_selected_pkgs = [
964969 f"ros-{ distro } -{ pkg .replace ('_' , '-' )} "
@@ -969,16 +974,9 @@ def main():
969974 for _ , pkg in all_pkgs .items ():
970975 is_built = False
971976 if selected_bn is not None :
972- if vinca_conf .get ("full_rebuild" , True ):
973- if pkg ["build_number" ] == selected_bn :
974- is_built = True
975- else :
976- # remove all packages except explicitly selected ones
977- if (
978- pkg ["name" ] not in explicitly_selected_pkgs
979- or pkg ["build_number" ] == selected_bn
980- ):
981- is_built = True
977+ pkg_build_number = get_pkg_build_number (selected_bn , pkg ["name" ], vinca_conf )
978+ if pkg ["build_number" ] == pkg_build_number :
979+ is_built = True
982980 else :
983981 is_built = True
984982
0 commit comments