From f49ec5b17128bc9d3550fa9193e01990d2f92994 Mon Sep 17 00:00:00 2001 From: Tomasz Gajewski Date: Wed, 14 Apr 2021 10:10:25 +0200 Subject: [PATCH] tool/run: extract function to copy files Issue #4073 --- repos/gems/run/depot_deploy.run | 4 ++-- repos/gems/run/depot_download.run | 4 ++-- repos/gems/run/driver_manager.run | 4 ++-- repos/gems/run/leitzentrale.run | 10 +++++----- repos/gems/run/sculpt.run | 24 ++++++++++++------------ repos/gems/run/wm.run | 2 +- repos/os/run/test.run | 2 +- repos/ports/run/microcode.run | 7 ++++--- repos/ports/run/verify.run | 2 +- repos/ports/run/vim.run | 2 +- repos/ports/run/virtualbox6.run | 2 +- tool/run/boot_dir/fiasco | 12 ++++++------ tool/run/boot_dir/foc | 12 ++++++------ tool/run/boot_dir/hw | 6 +++--- tool/run/boot_dir/linux | 2 +- tool/run/boot_dir/nova | 6 +++--- tool/run/boot_dir/okl4 | 2 +- tool/run/boot_dir/pistachio | 12 ++++++------ tool/run/boot_dir/sel4 | 4 ++-- tool/run/depot.inc | 2 +- tool/run/run | 7 ++++++- 21 files changed, 67 insertions(+), 61 deletions(-) diff --git a/repos/gems/run/depot_deploy.run b/repos/gems/run/depot_deploy.run index a39155ea41..c006561d31 100644 --- a/repos/gems/run/depot_deploy.run +++ b/repos/gems/run/depot_deploy.run @@ -270,8 +270,8 @@ install_config { build { app/depot_query app/depot_deploy } -file copy -force [genode_dir]/repos/gems/run/sculpt/fonts.config [run_dir]/genode/ -file copy -force [genode_dir]/repos/ports/recipes/raw/system_shell/system_shell.config [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/fonts.config [run_dir]/genode/ +copy_file [genode_dir]/repos/ports/recipes/raw/system_shell/system_shell.config [run_dir]/genode/ # # Pin the nitpicker focus to the window manager by providing a static focus ROM diff --git a/repos/gems/run/depot_download.run b/repos/gems/run/depot_download.run index c7447db9db..a08ff69e27 100644 --- a/repos/gems/run/depot_download.run +++ b/repos/gems/run/depot_download.run @@ -164,8 +164,8 @@ close $fd install_config $config -file copy -force [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \ - [run_dir]/genode/depot_download.config +copy_file [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \ + [run_dir]/genode/depot_download.config build { app/depot_download_manager app/depot_query } diff --git a/repos/gems/run/driver_manager.run b/repos/gems/run/driver_manager.run index f26810fb03..de875dd367 100644 --- a/repos/gems/run/driver_manager.run +++ b/repos/gems/run/driver_manager.run @@ -144,8 +144,8 @@ close $fd # with the (possibly modified) version found in the source tree. This avoids # the need to re-create the pkg while testing modifications of this file. # -file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \ - [run_dir]/genode/drivers.config +copy_file [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \ + [run_dir]/genode/drivers.config build_boot_image { driver_manager test-driver_manager ld.lib.so } diff --git a/repos/gems/run/leitzentrale.run b/repos/gems/run/leitzentrale.run index 57db385864..62c31ff33b 100644 --- a/repos/gems/run/leitzentrale.run +++ b/repos/gems/run/leitzentrale.run @@ -326,11 +326,11 @@ install_config { } -file copy -force [genode_dir]/repos/gems/run/sculpt/fonts.config [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/run/sculpt/leitzentrale.config [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/run/sculpt/vimrc [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/fonts.config [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/leitzentrale.config [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/vimrc [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/ proc install_rom_module { name content } { set fd [open [run_dir]/genode/$name w] diff --git a/repos/gems/run/sculpt.run b/repos/gems/run/sculpt.run index 3553a031ac..b01aec20f7 100644 --- a/repos/gems/run/sculpt.run +++ b/repos/gems/run/sculpt.run @@ -506,7 +506,7 @@ install_config { } foreach file [glob "[genode_dir]/repos/gems/run/sculpt/*.config"] { - file copy -force $file [run_dir]/genode/ } + copy_file $file [run_dir]/genode/ } # @@ -516,29 +516,29 @@ foreach file [glob "[genode_dir]/repos/gems/run/sculpt/*.config"] { # files. This is just a hack to accelerate the work flow. # -file copy -force [genode_dir]/repos/gems/recipes/pkg/sculpt/README [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/recipes/pkg/sculpt/README [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/run/sculpt/vimrc [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/vimrc [run_dir]/genode/ foreach file { en_us.chargen de_ch.chargen de_de.chargen fr_ch.chargen fr_fr.chargen special.chargen } { - file copy -force [genode_dir]/repos/os/src/server/event_filter/$file \ + copy_file [genode_dir]/repos/os/src/server/event_filter/$file \ [run_dir]/genode/$file } -file copy -force [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \ +copy_file [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \ [run_dir]/genode/depot_download.config -file copy -force [genode_dir]/VERSION [run_dir]/genode/ +copy_file [genode_dir]/VERSION [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/ -file copy -force [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/ if {[have_board pc]} { - file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config \ - [run_dir]/genode/event_filter.config + copy_file [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config \ + [run_dir]/genode/event_filter.config - file copy -force [genode_dir]/repos/gems/run/sculpt/machine.vbox [run_dir]/genode/ + copy_file [genode_dir]/repos/gems/run/sculpt/machine.vbox [run_dir]/genode/ - file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \ + copy_file [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \ [run_dir]/genode/drivers.config exec gzip -dc [genode_dir]/repos/gems/run/sculpt/machine.vdi.gz > [run_dir]/genode/machine.vdi diff --git a/repos/gems/run/wm.run b/repos/gems/run/wm.run index bbb8e4f99c..0032922587 100644 --- a/repos/gems/run/wm.run +++ b/repos/gems/run/wm.run @@ -154,7 +154,7 @@ set fd [open [run_dir]/genode/focus w] puts $fd " focus\"/>" close $fd -file copy -force [genode_dir]/repos/gems/recipes/raw/motif_wm/wm.config [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/recipes/raw/motif_wm/wm.config [run_dir]/genode/ build { app/window_layouter app/decorator server/nitpicker server/wm test/nitpicker } diff --git a/repos/os/run/test.run b/repos/os/run/test.run index 9cdfa2f40f..f9599e9132 100644 --- a/repos/os/run/test.run +++ b/repos/os/run/test.run @@ -258,7 +258,7 @@ build $sorted_build_targets create_boot_directory foreach file $files_from_raw_archives { - file copy -force $file [run_dir]/genode/ } + copy_file $file [run_dir]/genode/ } install_config { diff --git a/repos/ports/run/microcode.run b/repos/ports/run/microcode.run index bbb034ef57..b52b1f7a07 100644 --- a/repos/ports/run/microcode.run +++ b/repos/ports/run/microcode.run @@ -15,9 +15,9 @@ if { [get_cmd_switch --autopilot] } { assert_spec nova if { [have_spec x86_64] } { - file copy -force $path_microcode/06-3c-03 bin/micro.code + copy_file $path_microcode/06-3c-03 bin/micro.code } else { - file copy -force $path_microcode/06-17-06 bin/micro.code + copy_file $path_microcode/06-17-06 bin/micro.code } } @@ -52,7 +52,8 @@ install_config { } -file copy -force {*}$microcode_files bin/ +foreach file $microcode_files { + copy_file $file bin/ } set boot_modules { core ld.lib.so init test-microcode } diff --git a/repos/ports/run/verify.run b/repos/ports/run/verify.run index c93f89ae2b..079edd52a9 100644 --- a/repos/ports/run/verify.run +++ b/repos/ports/run/verify.run @@ -50,7 +50,7 @@ build { app/verify } exec tar cf [run_dir]/genode/test.tar -C [genode_dir]/repos/ports/src/app/verify/test . -file copy [genode_dir]/depot/nfeske/pubkey [run_dir]/genode/pubkey +copy_file [genode_dir]/depot/nfeske/pubkey [run_dir]/genode/pubkey build_boot_image { verify libc.lib.so vfs.lib.so } diff --git a/repos/ports/run/vim.run b/repos/ports/run/vim.run index d4074b0007..c7cc9d410e 100644 --- a/repos/ports/run/vim.run +++ b/repos/ports/run/vim.run @@ -214,7 +214,7 @@ set fd [open [run_dir]/genode/focus w] puts $fd " focus\" domain=\"default\"/>" close $fd -file copy -force [genode_dir]/repos/gems/recipes/raw/motif_wm/wm.config [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/recipes/raw/motif_wm/wm.config [run_dir]/genode/ build { server/wm server/clipboard server/terminal } diff --git a/repos/ports/run/virtualbox6.run b/repos/ports/run/virtualbox6.run index 36bd9c3a85..140fed9447 100644 --- a/repos/ports/run/virtualbox6.run +++ b/repos/ports/run/virtualbox6.run @@ -262,7 +262,7 @@ append config { install_config $config -file copy -force [genode_dir]/repos/ports/run/virtualbox6.vbox bin/ +copy_file [genode_dir]/repos/ports/run/virtualbox6.vbox bin/ # # Instruct vesa_drv to use maximum resolution diff --git a/tool/run/boot_dir/fiasco b/tool/run/boot_dir/fiasco index 4f1e510c77..6696655bab 100644 --- a/tool/run/boot_dir/fiasco +++ b/tool/run/boot_dir/fiasco @@ -27,9 +27,9 @@ proc run_boot_dir {binaries} { if {[llength $targets]} { build $targets } if {$kernel_arg != ""} { - file copy -force [pwd]/bin/fiasco [run_dir]/genode/fiasco - file copy -force [pwd]/bin/sigma0-fiasco [run_dir]/genode/sigma0-fiasco - file copy -force [pwd]/bin/bootstrap-fiasco [run_dir]/genode/bootstrap-fiasco + copy_file [pwd]/bin/fiasco [run_dir]/genode/fiasco + copy_file [pwd]/bin/sigma0-fiasco [run_dir]/genode/sigma0-fiasco + copy_file [pwd]/bin/bootstrap-fiasco [run_dir]/genode/bootstrap-fiasco } build_core_image $binaries @@ -39,9 +39,9 @@ proc run_boot_dir {binaries} { # we can remove [run_dir]/genode after the core image has been built. # exec mkdir -p [run_dir]/boot - file copy -force [run_dir]/genode/fiasco [run_dir]/boot/kernel - file copy -force [run_dir]/genode/sigma0-fiasco [run_dir]/boot/sigma0 - file copy -force [run_dir]/genode/bootstrap-fiasco [run_dir]/boot/bootstrap + copy_file [run_dir]/genode/fiasco [run_dir]/boot/kernel + copy_file [run_dir]/genode/sigma0-fiasco [run_dir]/boot/sigma0 + copy_file [run_dir]/genode/bootstrap-fiasco [run_dir]/boot/bootstrap remove_genode_dir exec mv [run_dir]/image.elf [run_dir]/boot/image.elf diff --git a/tool/run/boot_dir/foc b/tool/run/boot_dir/foc index bd67d9f990..196a8f385d 100644 --- a/tool/run/boot_dir/foc +++ b/tool/run/boot_dir/foc @@ -71,9 +71,9 @@ proc run_boot_dir_x86 {binaries} { if {[llength $targets]} { build $targets } if {$kernel_arg != ""} { - file copy -force [pwd]/bin/foc-[board] [run_dir]/genode/foc - file copy -force [pwd]/bin/sigma0-foc-[board] [run_dir]/genode/sigma0-foc - file copy -force [pwd]/bin/bootstrap-foc-[board] [run_dir]/genode/bootstrap-foc + copy_file [pwd]/bin/foc-[board] [run_dir]/genode/foc + copy_file [pwd]/bin/sigma0-foc-[board] [run_dir]/genode/sigma0-foc + copy_file [pwd]/bin/bootstrap-foc-[board] [run_dir]/genode/bootstrap-foc } build_core_image $binaries @@ -83,9 +83,9 @@ proc run_boot_dir_x86 {binaries} { # we can remove [run_dir]/genode after the core image has been built. # exec mkdir -p [run_dir]/boot - file copy -force [run_dir]/genode/foc [run_dir]/boot/kernel - file copy -force [run_dir]/genode/sigma0-foc [run_dir]/boot/sigma0 - file copy -force [run_dir]/genode/bootstrap-foc [run_dir]/boot/bootstrap + copy_file [run_dir]/genode/foc [run_dir]/boot/kernel + copy_file [run_dir]/genode/sigma0-foc [run_dir]/boot/sigma0 + copy_file [run_dir]/genode/bootstrap-foc [run_dir]/boot/bootstrap remove_genode_dir exec mv [run_dir]/image.elf [run_dir]/boot/image.elf diff --git a/tool/run/boot_dir/hw b/tool/run/boot_dir/hw index d94ca8dbea..f1f5ec9393 100644 --- a/tool/run/boot_dir/hw +++ b/tool/run/boot_dir/hw @@ -55,9 +55,9 @@ proc run_boot_dir {binaries} { set build_args "$bootstrap_arg $core_arg $ld_arg" if {[llength $build_args]} { build $build_args } - if {$ld_arg != ""} { file copy -force bin/ld-hw.lib.so [run_dir]/genode/ld.lib.so } - if {$core_arg != ""} { file copy -force bin/core-hw-[board].a [run_dir]/genode/ } - if {$bootstrap_arg != ""} { file copy -force bin/bootstrap-hw-[board].o [run_dir]/genode/ } + if {$ld_arg != ""} { copy_file bin/ld-hw.lib.so [run_dir]/genode/ld.lib.so } + if {$core_arg != ""} { copy_file bin/core-hw-[board].a [run_dir]/genode/ } + if {$bootstrap_arg != ""} { copy_file bin/bootstrap-hw-[board].o [run_dir]/genode/ } # # Copy specified modules to the run directory, excluding core. diff --git a/tool/run/boot_dir/linux b/tool/run/boot_dir/linux index 3451e9359b..6ec260a654 100644 --- a/tool/run/boot_dir/linux +++ b/tool/run/boot_dir/linux @@ -35,7 +35,7 @@ proc run_boot_dir {binaries} { build_initrd $binaries - file copy -force [genode_dir]/tool/boot/vmlinuz [run_dir]/vmlinuz + copy_file [genode_dir]/tool/boot/vmlinuz [run_dir]/vmlinuz if {[have_include "image/iso"]} { install_iso_bootloader_to_run_dir diff --git a/tool/run/boot_dir/nova b/tool/run/boot_dir/nova index 18abbf8df3..8ca43dba19 100644 --- a/tool/run/boot_dir/nova +++ b/tool/run/boot_dir/nova @@ -42,9 +42,9 @@ proc run_boot_dir {binaries} { set targets "$kernel_arg $core_arg $ld_arg" if {[llength $targets]} { build $targets } - if {$kernel_arg != ""} { file copy -force bin/hypervisor [run_dir]/genode/hypervisor } - if {$core_arg != ""} { file copy -force bin/core-nova.a [run_dir]/genode/core-nova.a } - if {$ld_arg != ""} { file copy -force bin/ld-nova.lib.so [run_dir]/genode/ld.lib.so } + if {$kernel_arg != ""} { copy_file bin/hypervisor [run_dir]/genode/hypervisor } + if {$core_arg != ""} { copy_file bin/core-nova.a [run_dir]/genode/core-nova.a } + if {$ld_arg != ""} { copy_file bin/ld-nova.lib.so [run_dir]/genode/ld.lib.so } # # Collect contents of the ISO image diff --git a/tool/run/boot_dir/okl4 b/tool/run/boot_dir/okl4 index 4251d505ac..ea006292d4 100644 --- a/tool/run/boot_dir/okl4 +++ b/tool/run/boot_dir/okl4 @@ -120,7 +120,7 @@ proc run_boot_dir {binaries} { if {![file exists [run_dir]/genode/ld.lib.so]} { set ld_arg lib/ld/okl4 } set targets "$kernel_arg $ld_arg" if {[llength $targets]} { build $targets } - if {$kernel_arg != ""} { file copy -force bin/okl4 [run_dir]/genode/okl4 } + if {$kernel_arg != ""} { copy_file bin/okl4 [run_dir]/genode/okl4 } build_core_image $binaries exec mv [run_dir]/image.elf [run_dir].image diff --git a/tool/run/boot_dir/pistachio b/tool/run/boot_dir/pistachio index b960cac16f..db2d2afc80 100644 --- a/tool/run/boot_dir/pistachio +++ b/tool/run/boot_dir/pistachio @@ -26,9 +26,9 @@ proc run_boot_dir {binaries} { if {[llength $targets]} { build $targets } if {$kernel_arg != ""} { - file copy -force bin/pistachio [run_dir]/genode/pistachio - file copy -force bin/sigma0-pistachio [run_dir]/genode/sigma0-pistachio - file copy -force bin/kickstart-pistachio [run_dir]/genode/kickstart-pistachio + copy_file bin/pistachio [run_dir]/genode/pistachio + copy_file bin/sigma0-pistachio [run_dir]/genode/sigma0-pistachio + copy_file bin/kickstart-pistachio [run_dir]/genode/kickstart-pistachio } build_core_image $binaries @@ -38,9 +38,9 @@ proc run_boot_dir {binaries} { # we can remove [run_dir]/genode after the core image has been built. # exec mkdir -p [run_dir]/boot - file copy -force [run_dir]/genode/pistachio [run_dir]/boot/kernel - file copy -force [run_dir]/genode/sigma0-pistachio [run_dir]/boot/sigma0 - file copy -force [run_dir]/genode/kickstart-pistachio [run_dir]/boot/kickstart + copy_file [run_dir]/genode/pistachio [run_dir]/boot/kernel + copy_file [run_dir]/genode/sigma0-pistachio [run_dir]/boot/sigma0 + copy_file [run_dir]/genode/kickstart-pistachio [run_dir]/boot/kickstart remove_genode_dir exec mv [run_dir]/image.elf [run_dir]/boot/image.elf diff --git a/tool/run/boot_dir/sel4 b/tool/run/boot_dir/sel4 index 8eb7951864..1d169368ef 100644 --- a/tool/run/boot_dir/sel4 +++ b/tool/run/boot_dir/sel4 @@ -39,7 +39,7 @@ proc run_boot_dir {binaries} { if {[llength $targets]} { build $targets } if {$kernel_arg != ""} { - file copy -force [pwd]/bin/sel4-[board] [run_dir]/genode/sel4 + copy_file [pwd]/bin/sel4-[board] [run_dir]/genode/sel4 } build_core_image $binaries @@ -49,7 +49,7 @@ proc run_boot_dir {binaries} { # we can remove [run_dir]/genode after the core image has been built. # exec mkdir -p [run_dir]/boot - file copy -force [run_dir]/genode/sel4 [run_dir]/boot/sel4 + copy_file [run_dir]/genode/sel4 [run_dir]/boot/sel4 remove_genode_dir exec mv [run_dir]/image.elf [run_dir]/boot/image.elf diff --git a/tool/run/depot.inc b/tool/run/depot.inc index ba5a56f6ab..e71c62bb81 100644 --- a/tool/run/depot.inc +++ b/tool/run/depot.inc @@ -108,7 +108,7 @@ proc _copy_directory_content_to_run_dir { dir } { exit 1 } - foreach file [glob -directory $dir *] { file copy -force $file [run_dir]/genode/ } + foreach file [glob -directory $dir *] { copy_file $file [run_dir]/genode/ } } diff --git a/tool/run/run b/tool/run/run index 908255c97a..0d4d3a9bf8 100755 --- a/tool/run/run +++ b/tool/run/run @@ -648,10 +648,15 @@ proc kernel_specific_binary { binary {silent ""} } { } +proc copy_file {src dst} { + file copy -force $src $dst +} + + proc copy_genode_binaries_to_run_dir { binaries } { foreach binary $binaries { - file copy -force bin/[kernel_specific_binary $binary] [run_dir]/genode/$binary + copy_file bin/[kernel_specific_binary $binary] [run_dir]/genode/$binary } }