@@ -122,12 +122,7 @@ pub async fn build_update_from(
122122 state. artifact_paths . workspace_dir = Some ( workspace. workspace_dir . clone ( ) ) ;
123123 state. save ( & paths. state_file ) ?;
124124
125- let feature_config = crate :: config:: effective_feature_config_path ( config) ;
126- copy_builder_bundle (
127- bundle_source,
128- & workspace. bundle_dir ,
129- feature_config. as_deref ( ) ,
130- ) ?;
125+ copy_builder_bundle ( bundle_source, & workspace. bundle_dir ) ?;
131126
132127 state. status = UpdateStatus :: PatchingApp ;
133128 state. save ( & paths. state_file ) ?;
@@ -151,7 +146,7 @@ pub async fn build_update_from(
151146 // writes it to a stable per-user path) so the rebuild stages exactly those
152147 // features. Only set it when the file actually exists; an absent path would
153148 // make linux-features.js see an empty enabled set and stage nothing.
154- if let Some ( feature_config) = feature_config {
149+ if let Some ( feature_config) = crate :: config :: effective_feature_config_path ( config ) {
155150 install. env ( "CODEX_LINUX_FEATURES_CONFIG" , & feature_config) ;
156151 }
157152 run_and_log ( & mut install, & workspace. install_log )
@@ -251,11 +246,7 @@ fn package_build_script(bundle_dir: &Path) -> PathBuf {
251246 }
252247}
253248
254- fn copy_builder_bundle (
255- source_root : & Path ,
256- destination_root : & Path ,
257- feature_config : Option < & Path > ,
258- ) -> Result < ( ) > {
249+ fn copy_builder_bundle ( source_root : & Path , destination_root : & Path ) -> Result < ( ) > {
259250 let manifest_path = source_root. join ( UPDATE_BUILDER_MANIFEST ) ;
260251 if manifest_path. exists ( ) {
261252 return copy_builder_bundle_from_manifest ( source_root, destination_root, & manifest_path) ;
@@ -277,34 +268,9 @@ fn copy_builder_bundle(
277268 ) ?;
278269 }
279270
280- if linux_feature_enabled_in_config ( feature_config, "global-dictation" ) {
281- copy_entry (
282- & source_root. join ( "global-dictation-linux" ) ,
283- & destination_root. join ( "global-dictation-linux" ) ,
284- false ,
285- ) ?;
286- }
287-
288271 Ok ( ( ) )
289272}
290273
291- fn linux_feature_enabled_in_config ( feature_config : Option < & Path > , feature_id : & str ) -> bool {
292- let Some ( feature_config) = feature_config else {
293- return false ;
294- } ;
295- let Ok ( contents) = fs:: read_to_string ( feature_config) else {
296- return false ;
297- } ;
298- let Ok ( config) = serde_json:: from_str :: < serde_json:: Value > ( & contents) else {
299- return false ;
300- } ;
301-
302- config
303- . get ( "enabled" )
304- . and_then ( serde_json:: Value :: as_array)
305- . is_some_and ( |enabled| enabled. iter ( ) . any ( |id| id. as_str ( ) == Some ( feature_id) ) )
306- }
307-
308274fn copy_builder_bundle_from_manifest (
309275 source_root : & Path ,
310276 destination_root : & Path ,
984950 Ok ( ( ) )
985951 }
986952
987- fn write_fake_fallback_bundle ( source_root : & Path ) -> Result < ( ) > {
953+ #[ test]
954+ fn bundle_copy_skips_missing_optional_package_scripts ( ) -> Result < ( ) > {
955+ let temp = tempdir ( ) ?;
956+ let source_root = temp. path ( ) . join ( "source" ) ;
957+ let destination_root = temp. path ( ) . join ( "destination" ) ;
958+
988959 fs:: create_dir_all ( source_root. join ( "scripts/lib" ) ) ?;
989960 fs:: create_dir_all ( source_root. join ( "launcher" ) ) ?;
990961 fs:: create_dir_all ( source_root. join ( "packaging/linux" ) ) ?;
991962 fs:: create_dir_all ( source_root. join ( "assets" ) ) ?;
992- write_fake_computer_use_bundle ( source_root) ?;
993- write_fake_linux_features_bundle ( source_root) ?;
994- write_fake_patch_bundle ( source_root) ?;
963+ write_fake_computer_use_bundle ( & source_root) ?;
964+ write_fake_linux_features_bundle ( & source_root) ?;
965+ write_fake_patch_bundle ( & source_root) ?;
995966 fs:: write ( source_root. join ( "install.sh" ) , b"#!/bin/bash\n " ) ?;
996967 fs:: write (
997968 source_root. join ( "launcher/cli-launch-path.py" ) ,
@@ -1032,18 +1003,8 @@ fi
10321003 ) ?;
10331004 fs:: write ( source_root. join ( "assets/codex.png" ) , b"png" ) ?;
10341005 fs:: write ( source_root. join ( "assets/codex-linux.png" ) , b"linux png" ) ?;
1035- Ok ( ( ) )
1036- }
10371006
1038- #[ test]
1039- fn bundle_copy_skips_missing_optional_package_scripts ( ) -> Result < ( ) > {
1040- let temp = tempdir ( ) ?;
1041- let source_root = temp. path ( ) . join ( "source" ) ;
1042- let destination_root = temp. path ( ) . join ( "destination" ) ;
1043-
1044- write_fake_fallback_bundle ( & source_root) ?;
1045-
1046- copy_builder_bundle ( & source_root, & destination_root, None ) ?;
1007+ copy_builder_bundle ( & source_root, & destination_root) ?;
10471008
10481009 assert ! ( destination_root. join( "scripts/build-deb.sh" ) . exists( ) ) ;
10491010 assert ! ( destination_root
@@ -1080,36 +1041,6 @@ fi
10801041 Ok ( ( ) )
10811042 }
10821043
1083- #[ test]
1084- fn fallback_bundle_copies_global_dictation_source_when_enabled ( ) -> Result < ( ) > {
1085- let temp = tempdir ( ) ?;
1086- let source_root = temp. path ( ) . join ( "source" ) ;
1087- let destination_root = temp. path ( ) . join ( "destination" ) ;
1088- let feature_config = temp. path ( ) . join ( "linux-features.json" ) ;
1089-
1090- write_fake_fallback_bundle ( & source_root) ?;
1091- fs:: create_dir_all ( source_root. join ( "global-dictation-linux/src" ) ) ?;
1092- fs:: write (
1093- source_root. join ( "global-dictation-linux/Cargo.toml" ) ,
1094- b"[package]\n name = \" codex-global-dictation-linux\" \n version = \" 0.1.0\" \n edition = \" 2021\" \n " ,
1095- ) ?;
1096- fs:: write (
1097- source_root. join ( "global-dictation-linux/src/main.rs" ) ,
1098- b"fn main() {}\n " ,
1099- ) ?;
1100- fs:: write ( & feature_config, b"{\" enabled\" :[\" global-dictation\" ]}\n " ) ?;
1101-
1102- copy_builder_bundle ( & source_root, & destination_root, Some ( & feature_config) ) ?;
1103-
1104- assert ! ( destination_root
1105- . join( "global-dictation-linux/Cargo.toml" )
1106- . exists( ) ) ;
1107- assert ! ( destination_root
1108- . join( "global-dictation-linux/src/main.rs" )
1109- . exists( ) ) ;
1110- Ok ( ( ) )
1111- }
1112-
11131044 #[ test]
11141045 fn bundle_copy_prefers_packaged_update_builder_manifest ( ) -> Result < ( ) > {
11151046 let temp = tempdir ( ) ?;
11311062 b"# generated\n assets/codex-linux.png\n record-replay-linux/Cargo.toml\n " ,
11321063 ) ?;
11331064
1134- copy_builder_bundle ( & source_root, & destination_root, None ) ?;
1065+ copy_builder_bundle ( & source_root, & destination_root) ?;
11351066
11361067 assert ! ( destination_root. join( "assets/codex-linux.png" ) . exists( ) ) ;
11371068 assert ! ( destination_root
11511082 fs:: create_dir_all ( source_root. join ( ".codex-linux" ) ) ?;
11521083 fs:: write ( source_root. join ( UPDATE_BUILDER_MANIFEST ) , b"../escape\n " ) ?;
11531084
1154- let error = copy_builder_bundle ( & source_root, & destination_root, None )
1085+ let error = copy_builder_bundle ( & source_root, & destination_root)
11551086 . expect_err ( "manifest parent path should be rejected" ) ;
11561087 assert ! ( error
11571088 . to_string( )
11681099 fs:: create_dir_all ( source_root. join ( ".codex-linux" ) ) ?;
11691100 fs:: write ( source_root. join ( UPDATE_BUILDER_MANIFEST ) , b"/tmp/escape\n " ) ?;
11701101
1171- let error = copy_builder_bundle ( & source_root, & destination_root, None )
1102+ let error = copy_builder_bundle ( & source_root, & destination_root)
11721103 . expect_err ( "manifest absolute path should be rejected" ) ;
11731104 assert ! ( error
11741105 . to_string( )
0 commit comments