Skip to content

Commit

Permalink
Merge branch 'jb52528' [#42]
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaodan committed Apr 16, 2021
2 parents cc1bcb9 + 2b57227 commit af53575
Show file tree
Hide file tree
Showing 124 changed files with 80 additions and 28,533 deletions.
1 change: 1 addition & 0 deletions rpm/scratchbox2.spec
Expand Up @@ -9,6 +9,7 @@ Prefix: /usr
ExclusiveArch: %{ix86}
BuildRequires: make
BuildRequires: autoconf
BuildRequires: pkgconfig(lua)
Requires: fakeroot
Requires: libsb2 = %{version}-%{release}

Expand Down
1 change: 0 additions & 1 deletion scratchbox2/Makefile
Expand Up @@ -66,7 +66,6 @@ subdirs = preload luaif sblib pathmapping execs network rule_tree utils sb2d wra

CFLAGS += -O2 -g -Wall -W
CFLAGS += -I$(OBJDIR)/include -I$(SRCDIR)/include
CFLAGS += -I$(SRCDIR)/luaif/lua-5.1.4/src
CFLAGS += -D_GNU_SOURCE=1 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1
CFLAGS += $(MACH_CFLAG)
LDFLAGS += $(MACH_CFLAG)
Expand Down
2 changes: 1 addition & 1 deletion scratchbox2/autogen.sh
Expand Up @@ -3,7 +3,7 @@
#automake_version=1.9

rm -rf configure autom4te.cache
#aclocal
aclocal
autoheader
autoconf

4 changes: 2 additions & 2 deletions scratchbox2/config.mak.in
Expand Up @@ -5,6 +5,6 @@ CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
LIBOBJS=@LIBOBJS@

#LUA51_LIBS=@LUA51_LIBS@
#LUA51_CFLAGS=@LUA51_CFLAGS@
LUA_LIBS=@LUA_LIBS@
LUA_CFLAGS=@LUA_CFLAGS@

6 changes: 3 additions & 3 deletions scratchbox2/configure.ac
Expand Up @@ -19,7 +19,7 @@ AC_PROG_MAKE_SET
# Checks for libraries.
AC_CHECK_LIB([dl], [dlsym])

#PKG_CHECK_MODULES(LUA51, lua5.1 >= 5.1.0)
PKG_CHECK_MODULES([LUA], lua >= 5.2.0)

# Checks for header files.
AC_HEADER_DIRENT
Expand Down Expand Up @@ -222,7 +222,7 @@ AC_SUBST(CXX, ${CXX})
AC_SUBST(CFLAGS, ${CFLAGS})
AC_SUBST(LDFLAGS, ${LDFLAGS})

#AC_SUBST(LUA51_LIBS, ${LUA51_LIBS})
#AC_SUBST(LUA51_CFLAGS, ${LUA51_CFLAGS})
AC_SUBST(LUA_LIBS, ${LUA_LIBS})
AC_SUBST(LUA_CFLAGS, ${LUA_CFLAGS})

AC_OUTPUT
6 changes: 3 additions & 3 deletions scratchbox2/execs/exec_postprocess.c
Expand Up @@ -664,7 +664,7 @@ int exec_postprocess_native_executable(
* if (updated_args == 1) then
* -- Add components from original argv[]
* local i
* for i = first_argv_element_to_copy, table.maxn(argv) do
* for i = first_argv_element_to_copy, #argv do
* table.insert(new_argv, argv[i])
* end
*
Expand Down Expand Up @@ -849,7 +849,7 @@ static int exec_postprocess_qemu(
* table.insert(new_argv, conf_cputransparency.cmd)
* new_filename = conf_cputransparency.cmd
* else
* for i = 1, table.maxn(conf_cputransparency.qemu_argv) do
* for i = 1, #conf_cputransparency.qemu_argv do
* table.insert(new_argv, conf_cputransparency.qemu_argv[i])
* end
* new_filename = conf_cputransparency.qemu_argv[1]
Expand Down Expand Up @@ -884,7 +884,7 @@ static int exec_postprocess_qemu(
}

/* if conf_cputransparency.qemu_env ~= nil then
* for i = 1, table.maxn(conf_cputransparency.qemu_env) do
* for i = 1, #conf_cputransparency.qemu_env do
* table.insert(new_envp, conf_cputransparency.qemu_env[i])
* end
* end
Expand Down
12 changes: 6 additions & 6 deletions scratchbox2/lua_scripts/add_rules_to_rule_tree.lua
Expand Up @@ -72,14 +72,14 @@ function get_rule_tree_offset_for_union_dir_list(union_dir_list)

local union_dir_rule_list_index = ruletree.objectlist_create(#union_dir_list)

for n=1,table.maxn(union_dir_list) do
for n=1,#union_dir_list do
local component_path = union_dir_list[n]
local new_str_index = ruletree.new_string(component_path)

ruletree.objectlist_set(union_dir_rule_list_index, n-1, new_str_index)
end
if debug_messages_enabled then
print("-- Added union dir to rule db: ",table.maxn(union_dir_list),
print("-- Added union dir to rule db: ",#union_dir_list,
"rules, idx=", union_dir_rule_list_index)
end
return union_dir_rule_list_index
Expand Down Expand Up @@ -280,20 +280,20 @@ function add_list_of_rules(rules, modename)
local rule_list_index = 0

if rules ~= nil then
local num_rules = table.maxn(rules)
local num_rules = #rules

if num_rules > 0 then
rule_list_index = ruletree.objectlist_create(num_rules)

for n=1,table.maxn(rules) do
for n=1,#rules do
local rule = rules[n]
local new_rule_index

new_rule_index = add_one_rule_to_rule_tree(rule, modename)
ruletree.objectlist_set(rule_list_index, n-1, new_rule_index)
end
if debug_messages_enabled then
print("-- Added to rule db: ",table.maxn(rules),"rules, idx=", rule_list_index)
print("-- Added to rule db: ",#rules,"rules, idx=", rule_list_index)
end
end
end
Expand Down Expand Up @@ -354,7 +354,7 @@ end

function add_all_exec_policies(modename_in_ruletree)
if (all_exec_policies ~= nil) then
for i = 1, table.maxn(all_exec_policies) do
for i = 1, #all_exec_policies do
local ep_name = all_exec_policies[i].name
if ep_name then
sblib.log("debug", "Adding Exec policy "..ep_name)
Expand Down
14 changes: 7 additions & 7 deletions scratchbox2/lua_scripts/argvenvp_gcc.lua
Expand Up @@ -124,7 +124,7 @@ function add_cross_compiler(gccrule, version)

if require_version == false then
-- Compiler tools without version suffix
for i = 1, table.maxn(gcc_compilers) do
for i = 1, #gcc_compilers do
local tmp = {}
local compiler_name = gcc_compilers[i]
tmp.name = prefix .. compiler_name
Expand All @@ -144,7 +144,7 @@ function add_cross_compiler(gccrule, version)
end

-- Compiler tools with version suffix
for i = 1, table.maxn(gcc_compilers_with_version) do
for i = 1, #gcc_compilers_with_version do
local tmp = {}
tmp.name = prefix .. gcc_compilers_with_version[i] .. "-" ..
gccrule.cross_gcc_shortversion
Expand All @@ -157,7 +157,7 @@ function add_cross_compiler(gccrule, version)

if require_version == false then
-- just map the filename for linkers and tools
for i = 1, table.maxn(gcc_linkers) do
for i = 1, #gcc_linkers do
local tmp = {}
tmp.name = prefix .. gcc_linkers[i]
tmp.new_filename = gccrule.cross_gcc_dir .. "/" .. gccrule.cross_gcc_subst_prefix .. gcc_linkers[i]
Expand All @@ -175,7 +175,7 @@ function add_cross_compiler(gccrule, version)
end
register_gcc_component_path(tmp, gccrule)
end
for i = 1, table.maxn(gcc_tools) do
for i = 1, #gcc_tools do
local tmp = {}
tmp.name = prefix .. gcc_tools[i]
tmp.new_filename = gccrule.cross_gcc_dir .. "/" .. gccrule.cross_gcc_subst_prefix .. gcc_tools[i]
Expand All @@ -188,7 +188,7 @@ end
if (sbox_host_gcc_prefix_list and sbox_host_gcc_prefix_list ~= "") then
-- deal with host-gcc functionality, disables mapping
for prefix in string.gmatch(sbox_host_gcc_prefix_list, "[^:]+") do
for i = 1, table.maxn(gcc_compilers) do
for i = 1, #gcc_compilers do
local tmp = {}
tmp.name = prefix .. gcc_compilers[i]
tmp.new_filename = sbox_host_gcc_dir .. "/" .. sbox_host_gcc_subst_prefix .. gcc_compilers[i]
Expand All @@ -209,14 +209,14 @@ if (sbox_host_gcc_prefix_list and sbox_host_gcc_prefix_list ~= "") then
end

-- just map the filename for linkers and tools
for i = 1, table.maxn(gcc_linkers) do
for i = 1, #gcc_linkers do
local tmp = {}
tmp.name = prefix .. gcc_linkers[i]
tmp.new_filename = sbox_host_gcc_dir .. "/" .. sbox_host_gcc_subst_prefix .. gcc_linkers[i]
tmp.disable_mapping = 1
register_gcc_component_path(tmp, nil)
end
for i = 1, table.maxn(gcc_tools) do
for i = 1, #gcc_tools do
local tmp = {}
tmp.name = prefix .. gcc_tools[i]
tmp.new_filename = sbox_host_gcc_dir .. "/" .. sbox_host_gcc_subst_prefix .. gcc_tools[i]
Expand Down
12 changes: 6 additions & 6 deletions scratchbox2/lua_scripts/create_reverse_rules.lua
Expand Up @@ -16,7 +16,7 @@ local reversing_disabled_message = ""
-- Order of reverse rules is not necessarily the same as order of forward rules
function test_rev_rule_position(output_rules, d_path)
local n
for n=1,table.maxn(output_rules) do
for n=1,#output_rules do
local rule = output_rules[n]
local cmp_result
cmp_result = sblib.test_path_match(d_path,
Expand Down Expand Up @@ -46,7 +46,7 @@ function reverse_conditional_actions(output_rules, rev_rule_name, rule, n, forwa
end

local a
for a = 1, table.maxn(actions) do
for a = 1, #actions do
-- actions are only partial rules; the "selector" is in
-- "rule", but we must copy it temporarily to action[a],
-- otherwise reverse_one_rule_xxxx() won't be able to
Expand Down Expand Up @@ -239,7 +239,7 @@ end

function reverse_rules(ofile, output_rules, input_rules, modename)
local n
for n=1,table.maxn(input_rules) do
for n=1,#input_rules do
local rule = input_rules[n]

if rule.virtual_path then
Expand All @@ -260,13 +260,13 @@ end

function print_rules(ofile, rules)
local n
for n=1,table.maxn(rules) do
for n=1,#rules do
local rule = rules[n]

ofile:write(string.format("\t{name=\"%s\",\n", rule.name))

local k
for k=1,table.maxn(rule.comments) do
for k=1,#rule.comments do
ofile:write(rule.comments[k].."\n")
end

Expand Down Expand Up @@ -322,7 +322,7 @@ function print_rules(ofile, rules)
end
ofile:write("\t},\n")
end
ofile:write(string.format("-- Printed\t%d\trules\n",table.maxn(rules)))
ofile:write(string.format("-- Printed\t%d\trules\n",#rules))
end

for m_index,m_name in pairs(all_modes) do
Expand Down
2 changes: 1 addition & 1 deletion scratchbox2/lua_scripts/init2.lua
Expand Up @@ -39,7 +39,7 @@ function add_to_cputr_config(configsetname, key, t, val)
key, ruletree.new_boolean(val))
elseif t == "table" then
local list_index = ruletree.objectlist_create(#val)
for i = 1, table.maxn(val) do
for i = 1, #val do
local t2 = type(val[i])
if t2 == "string" then
local new_str_index = ruletree.new_string(val[i])
Expand Down
2 changes: 1 addition & 1 deletion scratchbox2/lua_scripts/init_argvmods_rules.lua
Expand Up @@ -44,7 +44,7 @@ end

function stringlist_to_ruletree(stringlist)
local stringlist_index = ruletree.objectlist_create(#stringlist)
for k = 1, table.maxn(stringlist) do
for k = 1, #stringlist do
local string_index = ruletree.new_string(stringlist[k])
ruletree.objectlist_set(stringlist_index, k-1, string_index)
end
Expand Down
2 changes: 1 addition & 1 deletion scratchbox2/lua_scripts/init_autogen_usr_bin_rules.lua
Expand Up @@ -29,7 +29,7 @@ function argvmods_to_mapping_rules(rule_file, prefix)
if process_now and not rule.argvmods_processed then
rule.argvmods_processed = true
local k
for k=1,table.maxn(rule.path_prefixes) do
for k=1,#rule.path_prefixes do
if rule.path_prefixes[k] == "/usr/bin/" and
rule.new_filename ~= nil then
-- this rule maps "n" from /usr/bin to
Expand Down
4 changes: 2 additions & 2 deletions scratchbox2/lua_scripts/init_modeconfig.lua
Expand Up @@ -19,8 +19,8 @@ for m_index,m_name in pairs(all_modes) do

-- Exec policy selection table
if exec_policy_selection ~= nil then
local epsrule_list_index = ruletree.objectlist_create(table.maxn(exec_policy_selection))
for i = 1, table.maxn(exec_policy_selection) do
local epsrule_list_index = ruletree.objectlist_create(#exec_policy_selection)
for i = 1, #exec_policy_selection do
local epsrule = exec_policy_selection[i]
local ruletype = 0
local selectorstr = 0
Expand Down
6 changes: 3 additions & 3 deletions scratchbox2/lua_scripts/init_net_modes.lua
Expand Up @@ -155,12 +155,12 @@ function add_net_rule_chain(net_modename, chain_name, rules)
local rule_list_index = 0

if rules ~= nil then
local num_rules = table.maxn(rules)
local num_rules = #rules

if num_rules > 0 then
rule_list_index = ruletree.objectlist_create(num_rules)

for n=1,table.maxn(rules) do
for n=1,#rules do
local rule = rules[n]
local new_rule_index

Expand All @@ -173,7 +173,7 @@ function add_net_rule_chain(net_modename, chain_name, rules)
net_modename, chain_name, n))
end
end
print("-- Added to rule db: ",table.maxn(rules),"rules, idx=", rule_list_index)
print("-- Added to rule db: ",#rules,"rules, idx=", rule_list_index)
else
io.stderr:write(string.format(
"empty net rule chain (%s,%s)\n",
Expand Down
23 changes: 4 additions & 19 deletions scratchbox2/luaif/Makefile
@@ -1,5 +1,3 @@
LUASRC = luaif/lua-5.1.4/src

# Not needed anymore, because Lua was dropped from libsb2:
# $(D)/luaif.o $(D)/argvenvp.o

Expand All @@ -8,27 +6,14 @@ objs := $(D)/sblib_luaif.o
$(D)/sblib_luaif.o: preload/exported.h

luaif/libluaif.a: $(objs)
luaif/libluaif.a: override CFLAGS := $(CFLAGS) -O2 -g -fPIC -Wall -W -I$(SRCDIR)/$(LUASRC) -I$(OBJDIR)/preload -I$(SRCDIR)/preload \
$(WERROR) -Wmissing-prototypes -Wstrict-prototypes
luaif/libluaif.a: override CFLAGS := $(CFLAGS) -O2 -g -fPIC -Wall -W -I$(OBJDIR)/preload -I$(SRCDIR)/preload \
$(WERROR) -Wmissing-prototypes -Wstrict-prototypes $(LUA_CFLAGS)
luaif/libluaif.a: override LDFLAGS := $(LDFLAGS)
luaif/libluaif.a: override LIBS :=


lua_sources := loadlib.c lstate.c ldebug.c liolib.c llex.c lauxlib.c ldump.c \
ltablib.c lstrlib.c ldo.c lmathlib.c lapi.c lvm.c ltable.c lgc.c \
lbaselib.c lopcodes.c linit.c lfunc.c lparser.c lstring.c ldblib.c \
lzio.c loslib.c ltm.c lundump.c lobject.c lmem.c lcode.c

lua_sources_expanded = $(foreach v,$(lua_sources),$(LUASRC)/$(v))
luaif/libluaif.a: override LIBS := $(LUA_LIBS)

lua_objs := $(lua_sources_expanded:.c=.o)

luaif/sb_log.o: include/scratchbox2_version.h

luaif/liblua.a: $(lua_objs)
luaif/liblua.a: override CFLAGS := -O2 -Dfopen=fopen_nomap -g -fPIC -Wall -W $(CFLAGS)
luaif/liblua.a: override LDFLAGS := $(LDFLAGS)
luaif/liblua.a: override LIBS :=

targets := $(targets) $(D)/libluaif.a $(D)/liblua.a
targets := $(targets) $(D)/libluaif.a

34 changes: 0 additions & 34 deletions scratchbox2/luaif/lua-5.1.4/COPYRIGHT

This file was deleted.

0 comments on commit af53575

Please sign in to comment.