Compare commits

...

2 commits

Author SHA1 Message Date
Alex Kladov 8233d4aedf use correct name for topological sort (#5)
I am 0.8 sure this is a typo, I've never seen this being referred to as topographic sorting!

Reviewed-on: #5
Reviewed-by: Jake Hamilton <jake.hamilton@hey.com>
Co-authored-by: Alex Kladov <aleksey.kladov@gmail.com>
Co-committed-by: Alex Kladov <aleksey.kladov@gmail.com>
2024-06-23 18:39:30 +00:00
Steve D a2f0a06426 Fix non-deterministic "missing: Permission denied" errors (#4)
Make 'missing' executable where source tarballs use autotools and are unpacked with untar.  untar doesn't preserve or set mtime, which may result in autotools generated files, e.g. configure, having newer timestamps than their source files (e.g. configure.in.) In these circumstances autotools generated Makefiles will call 'missing' to either regenerate them or fix-up the timestamps.

Reviewed-on: #4
Reviewed-by: isabel roses <isabel@isabelroses.com>
Reviewed-by: Jake Hamilton <jake.hamilton@hey.com>
Co-authored-by: Steve Dodd <steved424@gmail.com>
Co-committed-by: Steve Dodd <steved424@gmail.com>
2024-06-23 17:32:11 +00:00
7 changed files with 12 additions and 9 deletions

View file

@ -68,6 +68,7 @@ in
export CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib"
export ac_cv_func_getpgrp_void=yes
export ac_cv_func_tzset=yes
chmod 0755 missing
bash ./configure \
--build=${platform.build} \
--host=${platform.host} \

View file

@ -58,6 +58,7 @@ in
# Configure
export CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib"
chmod 0755 missing
bash ./configure \
--build=${platform.build} \
--host=${platform.host} \

View file

@ -59,6 +59,7 @@ in
export ac_cv_sizeof_unsigned_long=4
export ac_cv_sizeof_long_long=8
export ac_cv_header_netdb_h=no
chmod 0755 missing
bash ./configure \
--prefix=$out \
--build=${platform.build} \

View file

@ -21,7 +21,7 @@ lib: {
## Apply a topological sort to a DAG.
##
## @type Dag a -> { result :: List a } | { cycle :: List a, loops :: List a }
topographic =
topological =
graph:
let
getEntriesBefore =
@ -43,7 +43,7 @@ lib: {
isBefore = a: b: builtins.elem a.name b.after;
sorted = lib.lists.sort.topographic isBefore entries;
sorted = lib.lists.sort.topological isBefore entries;
in
if sorted ? result then
{

View file

@ -119,11 +119,11 @@ in
};
"sort" = {
"topographic" = {
"topological" = {
"handles an empty graph" =
let
expected = [ ];
actual = lib.dag.sort.topographic { };
actual = lib.dag.sort.topological { };
in
actual.result == expected;
@ -147,7 +147,7 @@ in
value = "d";
}
];
actual = lib.dag.sort.topographic {
actual = lib.dag.sort.topological {
a = lib.dag.entry.anywhere "a";
b = lib.dag.entry.between [ "c" ] [ "a" ] "b";
c = lib.dag.entry.before [ "c" ] "c";

View file

@ -31,15 +31,15 @@ lib: {
in
builtins.map (x: builtins.elemAt x 1) (builtins.sort isLess prepared);
## Perform a topographic sort on a list of items. The predicate function determines whether
## Perform a topological sort on a list of items. The predicate function determines whether
## its first argument comes before the second argument.
##
## @type (a -> a -> Bool) -> List a -> List a
topographic =
topological =
predicate: list:
let
searched = lib.lists.search.depthFirst true predicate list;
results = lib.lists.sort.topographic predicate (searched.visited ++ searched.rest);
results = lib.lists.sort.topological predicate (searched.visited ++ searched.rest);
in
if builtins.length list < 2 then
{ result = list; }

View file

@ -15,7 +15,7 @@ in
package:
let
phases = package.phases;
sorted = lib.dag.sort.topographic phases;
sorted = lib.dag.sort.topological phases;
script = lib.strings.concatMapSep "\n" (
entry: if builtins.isFunction entry.value then entry.value package else entry.value