Skip to content

Commit

Permalink
Support 32 bit 'tools' accelerating 64 bit binaries
Browse files Browse the repository at this point in the history
If the program is configured to dlopen in /usr/lib64 and sb2 can't
find it (because it's 32 bit) then try in /usr/lib

[scratchbox2] Support 32 bit 'tools' accelerating 64 bit binaries. JB#50161

Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
  • Loading branch information
lbt authored and mkosola committed Jun 11, 2020
1 parent 16dd119 commit 8747162
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 28 deletions.
33 changes: 25 additions & 8 deletions scratchbox2/modes/obs-rpm-build+pp/fs_rules.lua
Expand Up @@ -195,8 +195,6 @@ emulate_mode_rules_bin = {
actions=accelerated_program_actions},
{path="/bin/rmdir",
actions=accelerated_program_actions},
{path="/bin/rpm",
actions=accelerated_program_actions},
{path="/bin/sed",
actions=accelerated_program_actions},
{path="/bin/sh",
Expand Down Expand Up @@ -631,12 +629,31 @@ emulate_mode_rules_usr = {
{if_active_exec_policy_is = "Tools",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib64",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib64",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{ map_to = target_root, protection = readonly_fs_always },
},
},
-- and if the program looks in lib64 and the emulator can't find
-- it (because it's 32 bit) then look in /usr/lib...
{dir = "/usr/lib64", func_class = FUNC_CLASS_DLOPEN,
actions = {
{if_active_exec_policy_is = "Tools",
if_exists_then_replace_by = tools .. "/usr/lib",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Tools",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{ map_to = target_root, protection = readonly_fs_always },
},
},
Expand Down
33 changes: 25 additions & 8 deletions scratchbox2/modes/obs-rpm-build/fs_rules.lua
Expand Up @@ -130,8 +130,6 @@ emulate_mode_rules_bin = {
actions=accelerated_program_actions},
{path="/bin/rmdir",
actions=accelerated_program_actions},
{path="/bin/rpm",
actions=accelerated_program_actions},
{path="/bin/sed",
actions=accelerated_program_actions},
{path="/bin/sh",
Expand Down Expand Up @@ -494,12 +492,31 @@ emulate_mode_rules_usr = {
{if_active_exec_policy_is = "Tools",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib64",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib64",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{ map_to = target_root, protection = readonly_fs_always },
},
},
-- and if the program looks in lib64 and the emulator can't find
-- it (because it's 32 bit) then look in /usr/lib...
{dir = "/usr/lib64", func_class = FUNC_CLASS_DLOPEN,
actions = {
{if_active_exec_policy_is = "Tools",
if_exists_then_replace_by = tools .. "/usr/lib",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Tools",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{ map_to = target_root, protection = readonly_fs_always },
},
},
Expand Down
37 changes: 25 additions & 12 deletions scratchbox2/modes/obs-rpm-install/fs_rules.lua
Expand Up @@ -187,12 +187,6 @@ emulate_mode_rules_bin = {
func_class = FUNC_CLASS_EXEC,
actions = accelerated_program_actions},

-- rpm rules
{path = "/bin/rpm",
func_class = FUNC_CLASS_EXEC,
actions = rpm_program_actions},
-- end of rpm rules

{name = "/bin default rule", dir = "/bin", map_to = target_root,
protection = readonly_fs_if_not_root}
}
Expand Down Expand Up @@ -321,12 +315,31 @@ emulate_mode_rules_usr = {
{if_active_exec_policy_is = "Tools",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib64",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib64",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{ map_to = target_root, protection = readonly_fs_always },
},
},
-- and if the program looks in lib64 and the emulator can't find
-- it (because it's 32 bit) then look in /usr/lib...
{dir = "/usr/lib64", func_class = FUNC_CLASS_DLOPEN,
actions = {
{if_active_exec_policy_is = "Tools",
if_exists_then_replace_by = tools .. "/usr/lib",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Tools",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_replace_by = tools .. "/usr/lib",
protection = readonly_fs_always},
{if_active_exec_policy_is = "Host",
if_exists_then_map_to = tools,
protection = readonly_fs_always},
{ map_to = target_root, protection = readonly_fs_always },
},
},
Expand Down

0 comments on commit 8747162

Please sign in to comment.