pkg: Handle the right control files

The control files in the package are named without the pkg_name. prefix.
We need to add it, not check it is there.
parent 2c8b66be
......@@ -624,15 +624,13 @@ function pkg_merge_control(dir, name, files)
local events = {}
local err
for fname, tp in pairs(ls(dir)) do
if fname:sub(1, plen) ~= prefix then
WARN("Control file for package " .. name .. " has a wrong name " .. fname .. ", skipping")
elseif tp ~= "r" and tp ~= "?" then
if tp ~= "r" and tp ~= "?" then
WARN("Control file " .. fname .. " is not a file, skipping")
else
DBG("Putting control file " .. fname .. " into place")
table.insert(events, run_command(function (ecode, killed, stdout, stderr)
err = stderr
end, nil, nil, cmd_timeout, cmd_kill_timeout, "/bin/cp", "-Lpf", dir .. "/" .. fname, info_dir .. "/" .. fname))
end, nil, nil, cmd_timeout, cmd_kill_timeout, "/bin/cp", "-Lpf", dir .. "/" .. fname, info_dir .. "/" .. name .. '.' .. fname))
end
end
-- Create the list of files
......
......@@ -610,7 +610,7 @@ function test_merge_control()
]]
local src_dir = mkdtemp()
table.insert(tmp_dirs, src_dir)
local f, err = io.open(src_dir .. "/pkg1.control", "w")
local f, err = io.open(src_dir .. "/control", "w")
assert_not_nil(f, err)
f:write("test\n")
f:close()
......@@ -628,7 +628,7 @@ function test_merge_control()
assert_equal("test\n", utils.slurp(dst_dir .. "/pkg1.control"))
assert_equal("file\n", utils.slurp(dst_dir .. "/pkg1.list"))
-- The file stayed at the origin as well
assert_table_equal({["pkg1.control"] = 'r'}, ls(src_dir))
assert_table_equal({["control"] = 'r'}, ls(src_dir))
end
function setup()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment