Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hash for tmp dir location. #4

Merged
merged 2 commits into from
May 7, 2017
Merged

Conversation

matthewbauer
Copy link
Contributor

This sets up the tmp directory to extract the archive. The location
will be /tmp/tmpx-TOKEN where TOKEN is a hash of the dat archive. This
lets us reuse the archive after each run.

Fixes #3.

Depending on support for this, I can make it optional so we can keep the old generated TMPDIR method.

This sets up the tmp directory to extract the archive. The location
will be /tmp/tmpx-TOKEN where TOKEN is a hash of the dat archive. This
lets us reuse the archive after each run.

Fixes solidsnack#3.
@solidsnack
Copy link
Owner

Building and testing this today.

@solidsnack
Copy link
Owner

Instead of moving options processing down into go(), what if we did this instead?

diff --git a/model-scripts/tmpx.sh b/model-scripts/tmpx.sh
index 3898e33..2976b97 100755
--- a/model-scripts/tmpx.sh
+++ b/model-scripts/tmpx.sh
@@ -52,11 +52,12 @@ opts() {
   "$cmd" "$@"
 }
 go () {
-  unpack_env > ./env
-  unpack_run > ./run ; chmod ug+x ./run
-  mkdir dat
+  [ -f env ] || unpack_env > ./env
+  [ -f run ] || unpack_run > ./run
+  chmod ug+x ./run
+  [ -d dat ] || mkdir dat
   cd dat
-  unpack_dat
+  [ -d dat ] || unpack_dat
   if $run
   then
     ( . ../env && ../run "$@" )

@matthewbauer
Copy link
Contributor Author

Ok so tell me your preference on option names. I had a little bit of trouble changing the args to work. I just hacked in the option as "-rm." which might not really make sense because it really doesn't have anything to do with "removing". Modifying the n-tuples for a whole new arg type were causing me problems so this just seemed easier.

Might not be the best name but it was the easiest to link it into the
-rm* family of options. The third Bool in the triple stands for using
the same files if they already exit. This should not affect behavior of anything
else besides what’s changed in tmpx.sh.
@solidsnack
Copy link
Owner

This has been released as 0.2.3. The option for enabling directories shared across runs is --shared. The docs have been updated, too. Please give it a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants