diff options
author | Tharre <tharre3@gmail.com> | 2016-11-01 21:18:38 +0100 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2016-11-01 23:53:07 +0100 |
commit | 395dd2631ff3b0125d6f989e26d856e6139e89c9 (patch) | |
tree | a931b978bad2bbeb4482152e47c1c4d72f76fa68 | |
parent | 6b86ecb97dc5c49993a34092a8edc199201a2056 (diff) | |
download | redo-stamp.tar.gz redo-stamp.tar.xz redo-stamp.zip |
TODO Implement redo-stampredo-stamp
-rwxr-xr-x | build.sh | 1 | ||||
-rw-r--r-- | default.do | 3 | ||||
-rw-r--r-- | env.do | 3 | ||||
-rw-r--r-- | src/build.c | 3 | ||||
-rw-r--r-- | src/redo.c | 15 |
5 files changed, 23 insertions, 2 deletions
@@ -20,5 +20,6 @@ sudo install out/redo /usr/local/bin sudo ln -sf /usr/local/bin/redo /usr/local/bin/redo-ifchange sudo ln -sf /usr/local/bin/redo /usr/local/bin/redo-ifcreate sudo ln -sf /usr/local/bin/redo /usr/local/bin/redo-always +sudo ln -sf /usr/local/bin/redo /usr/local/bin/redo-stamp echo "Finished compiling" @@ -7,6 +7,8 @@ export VERSION="pre-0.01" DESTDIR=${DESTDIR-/usr/local/bin} +printf '%s' $REDO_TEST | redo-stamp + if [ "$1" = "all" ]; then redo-ifchange "$OUTDIR/redo" elif [ "$1" = "clean" ]; then @@ -20,5 +22,6 @@ elif [ "$1" = "install" ]; then ln -sf "$DESTDIR/redo" "$DESTDIR/redo-ifchange" ln -sf "$DESTDIR/redo" "$DESTDIR/redo-ifcreate" ln -sf "$DESTDIR/redo" "$DESTDIR/redo-always" + ln -sf "$DESTDIR/redo" "$DESTDIR/redo-stamp" echo "Finished installing." fi @@ -0,0 +1,3 @@ +echo "Checking if environment changed ..." 2>&1 +printf '%s' "$REDO_TEST" | redo-stamp +echo "c" > $3 diff --git a/src/build.c b/src/build.c index 8253319..48ecb7a 100644 --- a/src/build.c +++ b/src/build.c @@ -442,6 +442,9 @@ static int handle_ident(dep_info *dep, int ident) { return build_target(dep); return 0; + case 's': + debug("Redo-stamp: %s\n", dep->target); + return 1; case 'c': return handle_c(dep); default: @@ -69,6 +69,8 @@ int main(int argc, char *argv[]) { ident = 'e'; else if (!strcmp(argv_base, "redo-always")) ident = 'a'; + else if (!strcmp(argv_base, "redo-stamp")) + ident = 's'; else die("redo: argv set to unkown value\n"); @@ -85,9 +87,17 @@ int main(int argc, char *argv[]) { if (env) DBG_LVL = atoi(env); - if (ident == 'a') + if (ident == 'a') { add_prereq(parent, parent, ident); - else + } else if (ident == 's') { + char buf[41]; + unsigned char *hash = hash_file(stdin); + + sha1_to_hex(hash, buf); + add_prereq(buf, parent, ident); + + free(hash); + } else { for (int i = 1; i < argc; ++i) { do { temp = &argv[rand() % (argc-1) + 1]; @@ -97,6 +107,7 @@ int main(int argc, char *argv[]) { add_prereq_path(*temp, xbasename(parent), ident); *temp = NULL; } + } } return EXIT_SUCCESS; |