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
241241 return items, item2deps, item2ver
242242 end
243243
244+local 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
254+end
255+
244256 -- graph is a map from item to a list of destinations
245257 local function transpose(graph)
246258 local transposed = {}
@@ -373,7 +385,7 @@ local function gitCommit(message) · 126 unmodified lines
373385 assert(execute(cmd:format(message)))
374386 end
375387
376−local function gitCheckout(new_branch, deps)
388+local function gitCheckout(new_branch, deps, item2index)
377389 local main_dep = deps[1]
378390 if main_dep then
379391 main_dep = itemToBranch(main_dep)
@@ -401,7 +413,17 @@ local function gitCheckout(new_branch, deps) · 21 unmodified lines
401413 end
402414 if #deps > 0 then
403415 -- 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
405427 end
406428 end
407429
@@ -510,8 +532,8 @@ local function checkFileList(files, item) · 102 unmodified lines
510532 end
511533
512534 -- builds package, returns list of new files
513−local function buildItem(item, item2deps, file2item)
514− gitCheckout(itemToBranch(item), item2deps[item])
535+local function buildItem(item, item2deps, file2item, item2index)
536+ gitCheckout(itemToBranch(item), item2deps[item], item2index)
515537 local target, pkg = parseItem(item)
516538 local cmd = '%s %s MXE_TARGETS=%s --jobs=1'
517539 os.execute(cmd:format(tool 'make', pkg, target))
@@ -747,10 +769,12 @@ local function buildPackages(items, item2deps) · 229 unmodified lines
747769 end
748770 return false
749771 end
772+ local item2index = makeItem2Index(items)
750773 local progress_printer = progressPrinter(items)
751774 for i, item in ipairs(items) do
752775 if not brokenDep(item) then
753− local files = buildItem(item, item2deps, file2item)
776+ local files = buildItem(item, item2deps,
777+ file2item, item2index)
754778 findForeignInstalls(item, files)
755779 if isBuilt(item, files) then
756780 item2files[item] = files
@@ -896,7 +920,7 @@ local build_list = sortForBuild(items, item2deps) · 139 unmodified lines
896920 assert(isTopoOrdered(build_list, items, item2deps))
897921 build_list = sliceArray(build_list, max_items)
898922 local unbroken, item2files = buildPackages(build_list, item2deps)
899−gitCheckout(GIT_ALL, unbroken)
923+gitCheckout(GIT_ALL, unbroken, makeItem2Index(build_list))
900924 makeDebs(unbroken, item2deps, item2ver, item2files)
901925 if not no_debs then
902926 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