aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2016-11-01 21:18:38 +0100
committerTharre <tharre3@gmail.com>2016-11-01 23:53:07 +0100
commit395dd2631ff3b0125d6f989e26d856e6139e89c9 (patch)
treea931b978bad2bbeb4482152e47c1c4d72f76fa68
parent6b86ecb97dc5c49993a34092a8edc199201a2056 (diff)
downloadredo-stamp.tar.gz
redo-stamp.tar.xz
redo-stamp.zip
TODO Implement redo-stampredo-stamp
-rwxr-xr-xbuild.sh1
-rw-r--r--default.do3
-rw-r--r--env.do3
-rw-r--r--src/build.c3
-rw-r--r--src/redo.c15
5 files changed, 23 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index f1e1cf0..d556329 100755
--- a/build.sh
+++ b/build.sh
@@ -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"
diff --git a/default.do b/default.do
index af491ee..0005756 100644
--- a/default.do
+++ b/default.do
@@ -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
diff --git a/env.do b/env.do
new file mode 100644
index 0000000..a2a3dee
--- /dev/null
+++ b/env.do
@@ -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:
diff --git a/src/redo.c b/src/redo.c
index e28f8fa..59c31ef 100644
--- a/src/redo.c
+++ b/src/redo.c
@@ -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;