@@ -30,11 +30,11 @@ const ANY_ADDS: &[&OptName] = &[];
3030
3131// Each HostCompat value disallows certain var names when host_compat
3232// validation is enabled in the config file.
33- // TODO: move these to config
34- const DISTRO_DISALLOWS : & [ & OptName ] = & [ ] ;
35- const ARCH_DISALLOWS : & [ & OptName ] = & [ OptName :: distro ( ) ] ;
36- const OS_DISALLOWS : & [ & OptName ] = & [ OptName :: distro ( ) , OptName :: arch ( ) ] ;
37- const ANY_DISALLOWS : & [ & OptName ] = & [ OptName :: distro ( ) , OptName :: arch ( ) , OptName :: os ( ) ] ;
33+ // TODO: these will be used when the linting is added, so haven't removed them
34+ // const DISTRO_DISALLOWS: &[&OptName] = &[];
35+ // const ARCH_DISALLOWS: &[&OptName] = &[OptName::distro()];
36+ // const OS_DISALLOWS: &[&OptName] = &[OptName::distro(), OptName::arch()];
37+ // const ANY_DISALLOWS: &[&OptName] = &[OptName::distro(), OptName::arch(), OptName::os()];
3838
3939/// Set what level of cross-platform compatibility the built package
4040/// should have.
@@ -106,35 +106,15 @@ impl HostCompat {
106106 Ok ( settings)
107107 }
108108
109- fn names_disallowed ( & self ) -> & [ & OptName ] {
110- match self {
111- HostCompat :: Distro => DISTRO_DISALLOWS ,
112- HostCompat :: Arch => ARCH_DISALLOWS ,
113- HostCompat :: Os => OS_DISALLOWS ,
114- HostCompat :: Any => ANY_DISALLOWS ,
115- }
116- }
117-
118- /// Check the given options are compatible with the HostCompat
119- /// setting.
120- pub fn validate_host_opts ( & self , options : & [ Opt ] ) -> Result < ( ) > {
121- let known = options. iter ( ) . map ( Opt :: full_name) . collect :: < HashSet < _ > > ( ) ;
122-
123- let disallowed_names = self . names_disallowed ( ) ;
124-
125- for name in disallowed_names {
126- // If a name that this setting would add is already in the
127- // given options then flag it as an error.
128- if known. contains ( name) {
129- return Err ( Error :: HostOptionNotAllowedInVariantError (
130- name. to_string ( ) ,
131- self . to_string ( ) ,
132- ) ) ;
133- }
134- }
135-
136- Ok ( ( ) )
137- }
109+ // TODO: comment this back in when adding linting for host_compats
110+ // fn names_disallowed(&self) -> &[&OptName] {
111+ // match self {
112+ // HostCompat::Distro => DISTRO_DISALLOWS,
113+ // HostCompat::Arch => ARCH_DISALLOWS,
114+ // HostCompat::Os => OS_DISALLOWS,
115+ // HostCompat::Any => ANY_DISALLOWS,
116+ // }
117+ //}
138118}
139119
140120/// A set of structured inputs used to build a package.
@@ -198,18 +178,9 @@ impl BuildSpec {
198178 }
199179 }
200180
201- // Optionally, check the opts aren't setting an option
202- // controlled by the host compatibility setting.
203- let config = spk_config:: get_config ( ) ?;
204- if config. host_compat . validate {
205- self . host_compat . validate_host_opts ( & opts) ?;
206- }
207-
208181 // Add any host options that are not already present.
209182 let host_opts = self . host_compat . host_options ( ) ?;
210183 for opt in host_opts. iter ( ) {
211- //let mut opt = Opt::Var(VarOpt::new(name)?);
212- //opt.set_value(value.to_string())?;
213184 if known. insert ( opt. full_name ( ) . to_owned ( ) ) {
214185 opts. push ( opt. clone ( ) ) ;
215186 }
0 commit comments