Skip to content

Commit

Permalink
build even if some images failed
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Aug 13, 2023
1 parent b34d22f commit 515ec7c
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions scripts/copy_output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,31 @@ local function clean(image, name)
lib.exec {'rm', '-f', dir..'/'..file}
end

local missing_images = {}

for _, images in pairs(lib.images) do
for _, image in ipairs(images) do
-- Clean first

clean(image, image.image)

for _, alias in ipairs(image.aliases) do
clean(image, alias)
end

local destdir, destname = image:dest_name(image.image)
local source = image_source(image)

lib.exec {'cp', source, destdir..'/'..destname}
if not pcall(function()
lib.exec {'cp', source, destdir..'/'..destname}

for _, alias in ipairs(image.aliases) do
clean(image, alias)

local _, aliasname = image:dest_name(alias)
lib.exec {'ln', '-s', destname, destdir..'/'..aliasname}
for _, alias in ipairs(image.aliases) do
local _, aliasname = image:dest_name(alias)
lib.exec {'ln', '-s', destname, destdir..'/'..aliasname}
end
end) then
print(string.format('Failed to copy (%s) %s, assuming it\'s missing', image.subdir, image.image))
table.insert(missing_images, image)
end
end

Expand Down Expand Up @@ -94,3 +105,10 @@ if (env.GLUON_DEVICES or '') == '' then
mkdir(dest_dir(package_prefix))
lib.exec {'cp', 'openwrt/bin/targets/'..bindir..'/packages/\0', dest_dir(package_prefix)}
end

if #missing_images > 0 then
print('The following images were missing:')
for _, image in ipairs(missing_images) do
print(string.format(' - (%s) %s', image.subdir, image.image))
end
end

0 comments on commit 515ec7c

Please sign in to comment.