summaryrefslogtreecommitdiff
path: root/lua_scripts/pathmaps
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2008-12-08 16:24:29 +0200
committerLauri Leukkunen <lle@rahina.org>2008-12-11 23:45:01 +0200
commit52f61f715c3f53e0eb52e13400c1b979b8f26ab4 (patch)
tree62e39027c26cd3fece7561e0b759cdd94924909e /lua_scripts/pathmaps
parente03ba444bb3c3df5da30d05a9995c800121b4034 (diff)
Performance optimization: Support for rule trees (and restructured "devel" mode)
- Previously, rules were searched from rule lists. Made it possible to build search trees; this improves performance - "devel" mode was restructured to use this possibility. It is faster now.. also included: - A bugfix to "dir" rule checking logic (which was introduced some time ago, but not used before this commit) - Since both the C/Lua and Lua/Lua interfaces were modified, both version numbers were incremented.
Diffstat (limited to 'lua_scripts/pathmaps')
-rw-r--r--lua_scripts/pathmaps/devel/00_default.lua298
-rw-r--r--lua_scripts/pathmaps/emulate/00_default.lua2
-rw-r--r--lua_scripts/pathmaps/install/00_default.lua2
-rw-r--r--lua_scripts/pathmaps/simple/00_default.lua2
-rw-r--r--lua_scripts/pathmaps/tools/00_default.lua2
5 files changed, 188 insertions, 118 deletions
diff --git a/lua_scripts/pathmaps/devel/00_default.lua b/lua_scripts/pathmaps/devel/00_default.lua
index 12062d3..938b708 100644
--- a/lua_scripts/pathmaps/devel/00_default.lua
+++ b/lua_scripts/pathmaps/devel/00_default.lua
@@ -8,7 +8,7 @@
-- Rule file interface version, mandatory.
--
-rule_file_interface_version = "16"
+rule_file_interface_version = "17"
----------------------------------
tools = tools_root
@@ -98,92 +98,10 @@ test_first_tools_default_is_target = {
-- =========== Mapping rule chains ===========
-simple_chain = {
- next_chain = nil,
- binary = nil,
+-- Used when dir = "/usr/share/aclocal":
+devel_mode_rules_usr_share_aclocal = {
rules = {
-- -----------------------------------------------
- -- 1. General SB2 environment:
-
- {prefix = "/usr/bin/sb2-",
- use_orig_path = true, readonly = true},
- {prefix = "/usr/share/scratchbox2/host_usr",
- replace_by = "/usr", readonly = true},
- {prefix = "/usr/share/scratchbox2",
- use_orig_path = true, readonly = true},
-
- -- -----------------------------------------------
- -- 2. Development environment special destinations:
-
- {prefix = "/sb2/wrappers",
- replace_by = session_dir .. "/wrappers." .. active_mapmode,
- readonly = true},
-
- {prefix = "/sb2/scripts",
- replace_by = sbox_dir.."/share/scratchbox2/scripts",
- readonly = true},
-
- -- tools_root should not be mapped twice.
- {prefix = tools, use_orig_path = true, readonly = true},
-
- -- -----------------------------------------------
- -- 5. Maemo SDK+
-
- {prefix = "/opt/maemo",
- use_orig_path = true, readonly = true},
-
- -- -----------------------------------------------
- -- 10. Home directories
-
- {prefix = sbox_user_home_dir, use_orig_path = true},
-
- -- "user" is a special username at least on the Maemo platform:
- -- (but note that if the real user name is "user",
- -- our previous rule handled that and this rule won't be used)
- {prefix = "/home/user", map_to = target_root},
-
- -- Home directories = not mapped, R/W access
- {prefix = "/home", use_orig_path = true},
-
- -- -----------------------------------------------
- -- 20. /bin/* and /usr/bin/*:
- -- tools that need special processing:
-
- {path = "/bin/sh",
- replace_by = tools .. "/bin/bash", readonly = true},
- {prefix = "/usr/bin/host-",
- use_orig_path = true, readonly = true},
-
- -- "localedef" *must* be used from the target, the version
- -- which exists in tools_root appers to work but doesn't..
- {path = "/usr/bin/localedef", map_to = target_root,
- readonly = true},
-
- -- -----------------------------------------------
- -- 30. /lib/*
-
- {prefix = "/lib", map_to = target_root, readonly = true},
-
- -- -----------------------------------------------
- -- 40. /usr/lib/*
- -- Most of /usr/lib should come from target_root, but
- -- there are exceptions: Some tools have private subdirectories
- -- there.
-
- {prefix = "/usr/lib/gcc", map_to = tools, readonly = true},
- {prefix = "/usr/lib/perl", map_to = tools, readonly = true},
- {prefix = "/usr/lib/dpkg", map_to = tools, readonly = true},
- {prefix = "/usr/lib/apt", map_to = tools, readonly = true},
- {prefix = "/usr/lib/cdbs", map_to = tools, readonly = true},
- {prefix = "/usr/lib/libfakeroot", map_to = tools, readonly = true},
- {prefix = "/usr/lib/man-db", map_to = tools, readonly = true},
-
- -- /usr/lib/python* from tools_root
- {prefix = "/usr/lib/python", map_to = tools, readonly = true},
-
- {prefix = "/usr/lib", map_to = target_root, readonly = true},
-
- -- -----------------------------------------------
-- 45. /usr/share/aclocal*
-- This is more than a bit complex, we must mix files from
-- both places:
@@ -222,6 +140,22 @@ simple_chain = {
-- exists, but default is target_root
{prefix = "/usr/share/aclocal",
actions = test_first_tools_default_is_target},
+ }
+}
+
+-- Used when dir = "/usr/share":
+devel_mode_rules_usr_share = {
+ rules = {
+ {dir = "/usr/share/aclocal",
+ chain = devel_mode_rules_usr_share_aclocal},
+
+ -- -----------------------------------------------
+ -- 1. General SB2 environment:
+
+ {prefix = "/usr/share/scratchbox2/host_usr",
+ replace_by = "/usr", readonly = true},
+ {prefix = "/usr/share/scratchbox2",
+ use_orig_path = true, readonly = true},
-- -----------------------------------------------
-- 46. /usr/share/* (other than /usr/share/aclocal*)
@@ -279,9 +213,53 @@ simple_chain = {
{prefix = "/usr/share/modest", map_to = target_root,
readonly = true},
- -- default rules:
- {path = "/usr/share", map_to = tools, readonly = true},
- {prefix = "/usr/share/", map_to = tools, readonly = true},
+ -- -----------------------------------------------
+ -- 100. DEFAULT RULES:
+ {dir = "/usr/share", map_to = tools, readonly = true},
+ }
+}
+
+-- Used when dir = "/usr":
+devel_mode_rules_usr = {
+ rules = {
+ {dir = "/usr/share", chain = devel_mode_rules_usr_share},
+
+ -- -----------------------------------------------
+ -- 1. General SB2 environment:
+
+ {prefix = "/usr/bin/sb2-",
+ use_orig_path = true, readonly = true},
+
+ -- -----------------------------------------------
+ -- 20. /bin/* and /usr/bin/*:
+ -- tools that need special processing:
+
+ {prefix = "/usr/bin/host-",
+ use_orig_path = true, readonly = true},
+
+ -- "localedef" *must* be used from the target, the version
+ -- which exists in tools_root appers to work but doesn't..
+ {path = "/usr/bin/localedef", map_to = target_root,
+ readonly = true},
+
+ -- -----------------------------------------------
+ -- 40. /usr/lib/*
+ -- Most of /usr/lib should come from target_root, but
+ -- there are exceptions: Some tools have private subdirectories
+ -- there.
+
+ {prefix = "/usr/lib/gcc", map_to = tools, readonly = true},
+ {prefix = "/usr/lib/perl", map_to = tools, readonly = true},
+ {prefix = "/usr/lib/dpkg", map_to = tools, readonly = true},
+ {prefix = "/usr/lib/apt", map_to = tools, readonly = true},
+ {prefix = "/usr/lib/cdbs", map_to = tools, readonly = true},
+ {prefix = "/usr/lib/libfakeroot", map_to = tools, readonly = true},
+ {prefix = "/usr/lib/man-db", map_to = tools, readonly = true},
+
+ -- /usr/lib/python* from tools_root
+ {prefix = "/usr/lib/python", map_to = tools, readonly = true},
+
+ {prefix = "/usr/lib", map_to = target_root, readonly = true},
-- -----------------------------------------------
-- 50. /usr/src/*
@@ -303,6 +281,20 @@ simple_chain = {
readonly = true},
-- -----------------------------------------------
+ -- 100. DEFAULT RULES:
+ -- the root directory must not be mapped:
+
+ -- "standard" directories are mapped to tools_root,
+ -- but everything else defaults to the host system
+ -- (so that things like /mnt, /media and /opt are
+ -- used from the host)
+ {prefix = "/usr", map_to = tools, readonly = true},
+ }
+}
+
+devel_mode_rules_etc = {
+ rules = {
+ -- -----------------------------------------------
-- 70. /etc/*
--
{prefix = "/etc/gconf/2", map_to = target_root,
@@ -325,9 +317,12 @@ simple_chain = {
use_orig_path = true, readonly = true},
-- default rules:
- {path = "/etc", map_to = tools, readonly = true},
- {prefix = "/etc/", map_to = tools, readonly = true},
+ {dir = "/etc", map_to = tools, readonly = true},
+ }
+}
+devel_mode_rules_var = {
+ rules = {
-- -----------------------------------------------
-- 80. /var/*
@@ -355,33 +350,18 @@ simple_chain = {
{prefix = "/var/log", map_to = target_root,
readonly = true},
- -- -----------------------------------------------
- -- 85. /tmp
- {prefix = session_dir, use_orig_path = true},
- {prefix = "/tmp", map_to = session_dir},
-
- -- -----------------------------------------------
- -- 90. Top-level directories that must not be mapped:
- {prefix = "/dev", use_orig_path = true},
- {prefix = "/proc", use_orig_path = true},
- {prefix = "/sys",
- use_orig_path = true, readonly = true},
-
- -- -----------------------------------------------
- -- 95. Some virtual paths:
- {prefix = "/host_usr", map_to = target_root, readonly = true},
-
- -- unmodified view of the rootstrap, can be used as destination
- -- directory when installing stuff to the rootstrap
- -- This provides is R/W access to the target_root!
- {prefix = "/target_root", replace_by = target_root},
+ -- default rules:
+ {dir = "/var", map_to = tools, readonly = true},
+ }
+}
+devel_mode_rules_scratchbox1 = {
+ rules = {
-- -----------------------------------------------
-- 98. Scratchbox 1 emulation rules
-- (some packages have hard-coded paths to the SB1 enviroment;
-- replace those by the correct locations in our environment)
-- (these are marked "virtual"; these won't be reversed)
-
-- "libtool" for arm
{prefix = "/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arch_tools/share/libtool",
replace_by = sb2_share_dir .. "/libtool",
@@ -407,6 +387,99 @@ simple_chain = {
-- otherwise, don't map /scratchbox, some people still
-- keep their projects there.
{prefix = "/scratchbox", use_orig_path = true},
+ }
+}
+
+simple_chain = {
+ next_chain = nil,
+ binary = nil,
+ rules = {
+
+ -- -----------------------------------------------
+ -- 2. Development environment special destinations:
+
+ {prefix = "/sb2/wrappers",
+ replace_by = session_dir .. "/wrappers." .. active_mapmode,
+ readonly = true},
+
+ {prefix = "/sb2/scripts",
+ replace_by = sbox_dir.."/share/scratchbox2/scripts",
+ readonly = true},
+
+ -- tools_root should not be mapped twice.
+ {prefix = tools, use_orig_path = true, readonly = true},
+
+ -- -----------------------------------------------
+ -- 5. Maemo SDK+
+
+ {prefix = "/opt/maemo",
+ use_orig_path = true, readonly = true},
+
+ -- -----------------------------------------------
+ -- 10. Home directories
+
+ {prefix = sbox_user_home_dir, use_orig_path = true},
+
+ -- "user" is a special username at least on the Maemo platform:
+ -- (but note that if the real user name is "user",
+ -- our previous rule handled that and this rule won't be used)
+ {prefix = "/home/user", map_to = target_root},
+
+ -- Home directories = not mapped, R/W access
+ {prefix = "/home", use_orig_path = true},
+
+ -- -----------------------------------------------
+ -- 20. /bin/*:
+ -- tools that need special processing:
+
+ {path = "/bin/sh",
+ replace_by = tools .. "/bin/bash", readonly = true},
+
+ -- -----------------------------------------------
+ -- 30. /lib/*
+
+ {prefix = "/lib", map_to = target_root, readonly = true},
+
+ -- -----------------------------------------------
+ -- 40. /usr
+ {dir = "/usr", chain = devel_mode_rules_usr},
+
+ -- -----------------------------------------------
+ -- 70. /etc/*
+ --
+ {dir = "/etc", chain = devel_mode_rules_etc},
+
+ -- -----------------------------------------------
+ -- 80. /var/*
+ {dir = "/var", chain = devel_mode_rules_var},
+
+ -- -----------------------------------------------
+ -- 85. /tmp
+ {prefix = session_dir, use_orig_path = true},
+ {prefix = "/tmp", map_to = session_dir},
+
+ -- -----------------------------------------------
+ -- 90. Top-level directories that must not be mapped:
+ {prefix = "/dev", use_orig_path = true},
+ {prefix = "/proc", use_orig_path = true},
+ {prefix = "/sys",
+ use_orig_path = true, readonly = true},
+
+ -- -----------------------------------------------
+ -- 95. Some virtual paths:
+ {prefix = "/host_usr", map_to = target_root, readonly = true},
+
+ -- unmodified view of the rootstrap, can be used as destination
+ -- directory when installing stuff to the rootstrap
+ -- This provides is R/W access to the target_root!
+ {prefix = "/target_root", replace_by = target_root},
+
+ -- -----------------------------------------------
+ -- 98. Scratchbox 1 emulation rules
+ -- (some packages have hard-coded paths to the SB1 enviroment;
+ -- replace those by the correct locations in our environment)
+ -- (these are marked "virtual"; these won't be reversed)
+ {dir = "/scratchbox", chain = devel_mode_rules_scratchbox1},
-- -----------------------------------------------
-- 100. DEFAULT RULES:
@@ -418,10 +491,7 @@ simple_chain = {
-- (so that things like /mnt, /media and /opt are
-- used from the host)
{prefix = "/bin", map_to = tools, readonly = true},
- {prefix = "/etc", map_to = tools, readonly = true},
{prefix = "/sbin", map_to = tools, readonly = true},
- {prefix = "/usr", map_to = tools, readonly = true},
- {prefix = "/var", map_to = tools, readonly = true},
-- Default = Host, R/W access
{prefix = "/", use_orig_path = true}
diff --git a/lua_scripts/pathmaps/emulate/00_default.lua b/lua_scripts/pathmaps/emulate/00_default.lua
index 530db6f..052222e 100644
--- a/lua_scripts/pathmaps/emulate/00_default.lua
+++ b/lua_scripts/pathmaps/emulate/00_default.lua
@@ -3,7 +3,7 @@
-- Rule file interface version, mandatory.
--
-rule_file_interface_version = "16"
+rule_file_interface_version = "17"
----------------------------------
sb1_compat_dir = sbox_target_root .. "/scratchbox1-compat"
diff --git a/lua_scripts/pathmaps/install/00_default.lua b/lua_scripts/pathmaps/install/00_default.lua
index 199bf13..9721d5b 100644
--- a/lua_scripts/pathmaps/install/00_default.lua
+++ b/lua_scripts/pathmaps/install/00_default.lua
@@ -4,7 +4,7 @@
-- Rule file interface version, mandatory.
--
-rule_file_interface_version = "16"
+rule_file_interface_version = "17"
----------------------------------
if (tools_root and tools_root ~= "/") then
diff --git a/lua_scripts/pathmaps/simple/00_default.lua b/lua_scripts/pathmaps/simple/00_default.lua
index b66f02c..617cf27 100644
--- a/lua_scripts/pathmaps/simple/00_default.lua
+++ b/lua_scripts/pathmaps/simple/00_default.lua
@@ -7,7 +7,7 @@
-- Rule file interface version, mandatory.
--
-rule_file_interface_version = "16"
+rule_file_interface_version = "17"
----------------------------------
tools = tools_root
diff --git a/lua_scripts/pathmaps/tools/00_default.lua b/lua_scripts/pathmaps/tools/00_default.lua
index 29b3b23..9320d58 100644
--- a/lua_scripts/pathmaps/tools/00_default.lua
+++ b/lua_scripts/pathmaps/tools/00_default.lua
@@ -6,7 +6,7 @@
-- Rule file interface version, mandatory.
--
-rule_file_interface_version = "16"
+rule_file_interface_version = "17"
----------------------------------
-- If the permission token exists and contains "root", tools_root directories