See https://git.io/vuDJY
Unified · Split
| @@ -241,6 +241,18 @@ local function getItems() · 240 unmodified lines | |||
| 241 | return items, item2deps, item2ver | 241 | return items, item2deps, item2ver |
| 242 | end | 242 | end |
| 243 | 243 | ||
| 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 | |||
| 244 | -- graph is a map from item to a list of destinations | 256 | -- graph is a map from item to a list of destinations |
| 245 | local function transpose(graph) | 257 | local 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))) |
| 374 | end | 386 | end |
| 375 | 387 | ||
| 376 | local function gitCheckout(new_branch, deps) | 388 | local function gitCheckout(new_branch, deps, item2index) |
| 377 | local main_dep = deps[1] | 389 | local main_dep = deps[1] |
| 378 | if main_dep then | 390 | 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 | end | 413 | end |
| 402 | if #deps > 0 then | 414 | if #deps > 0 then |
| 403 | -- prevent accidental rebuilds | 415 | -- 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 | end | 427 | end |
| 406 | end | 428 | end |
| 407 | 429 | ||
| @@ -510,8 +532,8 @@ local function checkFileList(files, item) · 102 unmodified lines | |||
| 510 | end | 532 | end |
| 511 | 533 | ||
| 512 | -- builds package, returns list of new files | 534 | -- builds package, returns list of new files |
| 513 | local function buildItem(item, item2deps, file2item) | 535 | local 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 | end | 769 | end |
| 748 | return false | 770 | return false |
| 749 | end | 771 | 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) do | 774 | for i, item in ipairs(items) do |
| 752 | if not brokenDep(item) then | 775 | 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) then | 779 | if isBuilt(item, files) then |
| 756 | item2files[item] = files | 780 | item2files[item] = files |
| @@ -896,7 +920,7 @@ local build_list = sortForBuild(items, item2deps) · 139 unmodified lines | |||
| 896 | assert(isTopoOrdered(build_list, items, item2deps)) | 920 | assert(isTopoOrdered(build_list, items, item2deps)) |
| 897 | build_list = sliceArray(build_list, max_items) | 921 | build_list = sliceArray(build_list, max_items) |
| 898 | local unbroken, item2files = buildPackages(build_list, item2deps) | 922 | local unbroken, item2files = buildPackages(build_list, item2deps) |
| 899 | gitCheckout(GIT_ALL, unbroken) | 923 | gitCheckout(GIT_ALL, unbroken, makeItem2Index(build_list)) |
| 900 | makeDebs(unbroken, item2deps, item2ver, item2files) | 924 | makeDebs(unbroken, item2deps, item2ver, item2files) |
| 901 | if not no_debs then | 925 | if not no_debs then |
| 902 | makeMxeRequirementsPackage('wheezy') | 926 | makeMxeRequirementsPackage('wheezy') |