History

build-pkg: touch usr/*/installed/* in build order

See https://git.io/vuDJY

Boris Nagaev committed 10 years ago

Commit 53d21fa1 parent 36086a91 file · +30 −6Browse files

Showing the changes to tools/build-pkg.lua (1 of 1 file). Show all

Unified · Split

tools/build-pkg.lua+30−6
@@ -241,6 +241,18 @@ local function getItems() · 240 unmodified lines
241 return items, item2deps, item2ver241 return items, item2deps, item2ver
242end242end
243 243
244local function getInstalled()
245 local installed = {}
246 local f = io.popen('ls usr/*/installed/*')
247 local pattern = '/([^/]+)/installed/([^/]+)'
248 for file in f:lines() do
249 local target, pkg = assert(file:match(pattern))
250 table.insert(installed, makeItem(target, pkg))
251 end
252 f:close()
253 return installed
254end
255
244-- graph is a map from item to a list of destinations256-- graph is a map from item to a list of destinations
245local function transpose(graph)257local function transpose(graph)
246 local transposed = {}258 local transposed = {}
@@ -373,7 +385,7 @@ local function gitCommit(message) · 126 unmodified lines
373 assert(execute(cmd:format(message)))385 assert(execute(cmd:format(message)))
374end386end
375 387
376local function gitCheckout(new_branch, deps)388local function gitCheckout(new_branch, deps, item2index)
377 local main_dep = deps[1]389 local main_dep = deps[1]
378 if main_dep then390 if main_dep then
379 main_dep = itemToBranch(main_dep)391 main_dep = itemToBranch(main_dep)
@@ -401,7 +413,17 @@ local function gitCheckout(new_branch, deps) · 21 unmodified lines
401 end413 end
402 if #deps > 0 then414 if #deps > 0 then
403 -- prevent accidental rebuilds415 -- prevent accidental rebuilds
404 assert(execute('touch usr/*/installed/*'))416 -- touch usr/*/installed/* files in build order
417 -- see https://git.io/vuDJY
418 local installed = getInstalled()
419 table.sort(installed, function(x, y)
420 return item2index[x] < item2index[y]
421 end)
422 for _, item in ipairs(installed) do
423 local target, pkg = assert(parseItem(item))
424 local cmd4 = 'touch -c usr/%s/installed/%s'
425 execute(cmd4:format(target, pkg))
426 end
405 end427 end
406end428end
407 429
@@ -510,8 +532,8 @@ local function checkFileList(files, item) · 102 unmodified lines
510end532end
511 533
512-- builds package, returns list of new files534-- builds package, returns list of new files
513local function buildItem(item, item2deps, file2item)535local function buildItem(item, item2deps, file2item, item2index)
514 gitCheckout(itemToBranch(item), item2deps[item])536 gitCheckout(itemToBranch(item), item2deps[item], item2index)
515 local target, pkg = parseItem(item)537 local target, pkg = parseItem(item)
516 local cmd = '%s %s MXE_TARGETS=%s --jobs=1'538 local cmd = '%s %s MXE_TARGETS=%s --jobs=1'
517 os.execute(cmd:format(tool 'make', pkg, target))539 os.execute(cmd:format(tool 'make', pkg, target))
@@ -747,10 +769,12 @@ local function buildPackages(items, item2deps) · 229 unmodified lines
747 end769 end
748 return false770 return false
749 end771 end
772 local item2index = makeItem2Index(items)
750 local progress_printer = progressPrinter(items)773 local progress_printer = progressPrinter(items)
751 for i, item in ipairs(items) do774 for i, item in ipairs(items) do
752 if not brokenDep(item) then775 if not brokenDep(item) then
753 local files = buildItem(item, item2deps, file2item)776 local files = buildItem(item, item2deps,
777 file2item, item2index)
754 findForeignInstalls(item, files)778 findForeignInstalls(item, files)
755 if isBuilt(item, files) then779 if isBuilt(item, files) then
756 item2files[item] = files780 item2files[item] = files
@@ -896,7 +920,7 @@ local build_list = sortForBuild(items, item2deps) · 139 unmodified lines
896assert(isTopoOrdered(build_list, items, item2deps))920assert(isTopoOrdered(build_list, items, item2deps))
897build_list = sliceArray(build_list, max_items)921build_list = sliceArray(build_list, max_items)
898local unbroken, item2files = buildPackages(build_list, item2deps)922local unbroken, item2files = buildPackages(build_list, item2deps)
899gitCheckout(GIT_ALL, unbroken)923gitCheckout(GIT_ALL, unbroken, makeItem2Index(build_list))
900makeDebs(unbroken, item2deps, item2ver, item2files)924makeDebs(unbroken, item2deps, item2ver, item2files)
901if not no_debs then925if not no_debs then
902 makeMxeRequirementsPackage('wheezy')926 makeMxeRequirementsPackage('wheezy')

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t