Commit graph

486 commits

Author SHA1 Message Date
Avery Pennarun
474f2e71fe shelltest: confirm that 'local' is definitely available.
Supposedly it's not POSIX, but every shell I have seems to support it, so
let's just reject any that don't.  And like magic, anybody using redo can
now count on the 'local' builtin working.
2011-01-18 00:48:51 -08:00
Avery Pennarun
5dbbfd4288 shelltest: die if 'cd ~' can't handle spaces in $HOME.
This fails on ash, dash, and busybox sh (for now).  But it's kind of
important since $HOME often has spaces on Win32.  I hope dash will be fixed
relatively soon.

I downgraded it to a warning since on Unix, this probably isn't a problem.
2011-01-18 00:48:51 -08:00
Jimmy
4a296d676c t/defaults-nested/clean fails on MacOS X.
It seems on OSX find behaves differently (probably from linux):

jtang@exia:~/develop/redo $ make clean
./redo clean
redo  clean
redo    t/clean
redo      t/example/clean
redo      t/curse/clean
redo      t/deps/clean
redo        t/deps/basic/clean
redo        t/deps/dirtest/clean
redo      t/space dir/clean
redo      t/stamp/clean
redo      t/defaults-flat/clean
redo      t/defaults-nested/clean
find: illegal option -- n
find: illegal option -- a
find: illegal option -- m
find: illegal option -- e
find: *~: No such file or directory
redo      t/defaults-nested/clean: exit code 1
redo    t/clean: exit code 1
redo  clean: exit code 1
make: *** [clean] Error 1

This fixes it for me.
2011-01-18 00:48:51 -08:00
Avery Pennarun
340aad1797 state.Lock: destructor: unlock before closing, not the other way around. 2011-01-18 00:48:51 -08:00
Avery Pennarun
642d60a7c9 state.File.set_static(): barf if we set_static() a nonexistent file.
If that ever happens, we probably got our paths mangled (like in the
previous commit) so we should die right away rather than allow weird things
to happen later.
2011-01-18 00:48:51 -08:00
Avery Pennarun
4c06332ea1 builder.py: we weren't stamping .do files correctly if dodir!='.'.
The result was that t/deps/dirtest was actually failing in some cases.  But
it wasn't failing quite reliably enough, because the failing test was
dirtest/dir1/all, which has the same name as some other 'all' files,
confusing the issue.  Renamed dirtest/dir1/all.do to dirtest/dir1/go.do instead.

Reported by Prakhar Goel and Berke Durak.
2011-01-18 00:48:51 -08:00
Tim Allen
204ac1411d Fix another "==" -> "=" bashism.
I notice it doesn't quite work on my Ubuntu system - if I "cd version"
and run "../redo", I get the following output:

   redo  all
   redo    vars
   redo      gitvars
   [: 24: %H: unexpected operator
   [: 24: %d: unexpected operator
   [: 24: %ci: unexpected operator

...and then a hang.
2011-01-18 00:48:51 -08:00
Avery Pennarun
94b34ea031 Generate redo version codes in Documentation/*.1 automatically.
We have to go through some pretty scary gyrations to extract this
information from git, but it can be done.  This works with both tarballs
generated by 'git archive', or with your local git repo.

(Requested by 'David' on the mailing list.)
2011-01-17 23:01:40 -08:00
Avery Pennarun
897c218f85 redo.md: explain .do file search-parent-dirs feature. 2011-01-16 16:33:22 -08:00
Michael Stone
62fe9a0df5 md-to-man.do: redo-ifcreate on possible paths to pandoc
This way, if you run

  ./redo
  $PKGMGR install pandoc
  ./redo

you'll still wind up with man pages.
2011-01-16 16:21:48 -08:00
Avery Pennarun
a5536fb25b Merge branch 'master' of git://github.com/danvk/redo
* 'master' of git://github.com/danvk/redo:
  fix a few typos in README.md
2011-01-16 16:14:02 -08:00
Avery Pennarun
fdd8b57403 Update README with latest changes.
- minimal/do is bigger now

- minimal/do is public domain

- link to busybox-w32 as a hint to win32 users

- Instead of talking about "Redofile", just explain how to do it with a case
  statement in default.do

- Don't worry about $1 and $2; djb didn't complain :)

- Explain how the search-parent-dirs feature works.  The semantics are now
  that the .do file runs with $PWD set to the dir containing the .do file,
  not the one containing the target.  (This is backwards compatible since
  the two directories always used to be identical.  So now we just change
  the documentation and it's all good.)

- Mention that you can send messages to the mailing list without
  subscribing.
2011-01-15 22:13:50 -08:00
Avery Pennarun
de94c09048 Merge branch 'search-parent-dirs'
* search-parent-dirs:
  minimal/do: support searching parent dirs for .do files.
  Search parent directories for default*.do.
2011-01-15 21:45:59 -08:00
Avery Pennarun
c7f06448c5 minimal/do: support searching parent dirs for .do files.
Now all tests pass again with both redo and minimal/do.
2011-01-15 21:45:25 -08:00
Avery Pennarun
e98696caef Merge branch 'master' into search-parent-dirs
* master:
  Fixed markdown errors in README - code samples now correctly formatted.
  Fix use of config.sh in example
  log.py, minimal/do: don't use ansi colour codes if $TERM is blank or 'dumb'
  Use named constants for terminal control codes.
  redo-sh: keep testing even after finding a 'good' shell.
  redo-sh.do: hide warning output from 'which' in some shells.
  redo-sh.do: wrap long lines.
  Handle .do files that start with "#!/" to specify an explicit interpreter.
  minimal/do: don't print an error on exit if we don't build anything.
  bash completions: also mark 'do' as a completable command.
  bash completions: work correctly when $cur is an empty string.
  bash completions: call redo-targets for a more complete list.
  bash completions: work correctly with subdirs, ie. 'redo t/<tab>'
  Sample bash completion rules for redo targets.
  minimal/do: faster deletion of stamp files.
  minimal/do: delete .tmp files if a build fails.
  minimal/do: use ".did" stamp files instead of empty target files.
  minimal/do: use posix shell features instead of dirname/basename.
  Automatically select a good shell instead of relying on /bin/sh.

Conflicts:
	t/clean.do
2011-01-15 16:00:12 -08:00
Dan Vanderkam
29d0c5b28c fix a few typos in README.md 2011-01-15 09:55:02 -05:00
Miles Gould
4017495c12 Fixed markdown errors in README - code samples now correctly formatted. 2011-01-11 14:02:49 +00:00
Ryan Kuester
6819010401 Fix use of config.sh in example 2011-01-10 22:32:39 -06:00
Avery Pennarun
f6ea1fd76b log.py, minimal/do: don't use ansi colour codes if $TERM is blank or 'dumb'
Apparently emacs sets TERM=dumb in its tty simulator, so even though
isatty() returns true, we shouldn't use colour codes.  (emacs is therefore
lame. But we knew that.)
2011-01-04 14:11:29 -08:00
Tim Allen
cb1512b14b Use named constants for terminal control codes.
(apenwarr slightly changed the minimal/do tty detection.)
2011-01-04 14:10:20 -08:00
Avery Pennarun
eea3f5446a redo-sh: keep testing even after finding a 'good' shell.
Otherwise we miss out on seeing the results from additional tests.
2011-01-02 12:00:37 -08:00
Henry Gebhardt
d55e329018 redo-sh.do: hide warning output from 'which' in some shells. 2011-01-02 11:49:51 -08:00
Avery Pennarun
f2ef945700 redo-sh.do: wrap long lines. 2011-01-02 11:49:34 -08:00
Avery Pennarun
f641e52e3b Handle .do files that start with "#!/" to specify an explicit interpreter.
Now you can have your .do files interpreted by whatever interpreter you
want.
2011-01-01 22:10:14 -08:00
Avery Pennarun
f24d4f142b minimal/do: don't print an error on exit if we don't build anything. 2011-01-01 22:05:05 -08:00
Avery Pennarun
96347f3d83 bash completions: also mark 'do' as a completable command.
(ie. minimal/do)
2011-01-01 21:59:24 -08:00
Avery Pennarun
3c256dee9b bash completions: work correctly when $cur is an empty string.
Otherwise 'cd t/defaults-flat' then 'redo <tab>' doesn't show all the
possible targets.
2011-01-01 21:57:29 -08:00
Avery Pennarun
70923c5f30 bash completions: call redo-targets for a more complete list.
Also fix handling of filenames needing quoting (like "t/space dir"),
directories, and targets named after directories.
2011-01-01 21:12:50 -08:00
Avery Pennarun
d5beda0ffe bash completions: work correctly with subdirs, ie. 'redo t/<tab>' 2011-01-01 21:12:14 -08:00
Zoran Zaric
fa4b64285d Sample bash completion rules for redo targets. 2011-01-01 17:15:16 -08:00
Avery Pennarun
7142c342ae minimal/do: faster deletion of stamp files.
"while/read/printf | xargs -0" is much faster than while/read/rm, because it
doesn't fork so many times.
2011-01-01 04:15:12 -08:00
Avery Pennarun
8aa27d050b minimal/do: delete .tmp files if a build fails. 2011-01-01 04:14:41 -08:00
Avery Pennarun
fb5275938d minimal/do: use ".did" stamp files instead of empty target files.
If all.do runs and creates no output, we shouldn't create a file called
'all', but we should remember that 'all' has been run successfully.  We do
this by creating 'all.did' during the build.

Since minimal/do always just wipes everything out every time it runs, we can
safely remove the .did files after minimal/do terminates, so this doesn't
clutter things too much in normal use.

This fixes some edge cases, particularly that 'minimal/do clean' no longer
leaves stupid files named "clean" lying around, and the redo-sh directory
can now be rebuilt correctly since we rebuild it as long as redo-sh.did
doesn't exist.  (We don't want to "rm -rf redo-sh" because it makes me
nervous.)
2011-01-01 04:11:20 -08:00
Avery Pennarun
41ef15fde2 minimal/do: use posix shell features instead of dirname/basename.
This avoids a few forks, and is a good example of how to do some "modern" sh
programming.  Plus we now use fewer lines of code.
2011-01-01 04:10:47 -08:00
Avery Pennarun
fb388b3dde Automatically select a good shell instead of relying on /bin/sh.
This includes a fairly detailed test of various known shell bugs from the
autoconf docs.

The idea here is that if redo works on your system, you should be able to
rely on a *good* shell to run your .do files; you shouldn't have to work
around zillions of bugs like autoconf does.
2010-12-21 04:44:39 -08:00
Avery Pennarun
0dcc3f61b6 Search parent directories for default*.do.
Previously, we would only search for default*.do in the same directory in
the target; now we search parent directories as well.

Let's say we're in a/b/ and trying to build foo.o.  If we find
../../default.o.do, then we'll run

	cd ../..; sh default.o.do a/b/foo .o $TMPNAME

In other words, we still always chdir to the same directory as the .do file.
But now $1 might have a path in it, not just a basename.
2010-12-19 05:58:49 -08:00
Avery Pennarun
e207b723b4 Move some of the tests from t/ into t/defaults-flat.
This lets us move t/default.do out of the way; it was confusing otherwise.
2010-12-19 04:54:44 -08:00
Avery Pennarun
2618ebfafb Man pages for redo-targets, redo-sources, redo-ood. 2010-12-19 04:11:05 -08:00
Avery Pennarun
560f95fd77 Don't update the database during redo-ood.
Makes it slightly faster.
2010-12-19 03:50:55 -08:00
Avery Pennarun
3b19ccad9f Add a new redo-ood command.
Prints the list of existing but out-of-date targets.
2010-12-19 03:50:38 -08:00
Avery Pennarun
df85b3d163 Move dependency checking from redo-ifchange into deps.py.
In preparation for sharing between multiple commands.
2010-12-19 03:50:38 -08:00
Avery Pennarun
f2d34fa685 New redo-sources and redo-targets commands.
Suggested by djb in personal email, and on the mailing list.  redo-targets
lists all the targets in the database; redo-sources lists all the existing
sources (ie. files that are referred to but which aren't targets).

redo-ifcreate filenames aren't included in the redo-sources list.
2010-12-19 03:50:38 -08:00
Avery Pennarun
db4c4fc17a Rename redo-oob to redo-unlocked, to more accurately represent its use.
It's still undocumented.  Because you shouldn't run it by hand.  So don't!
It's dangerous!
2010-12-19 01:20:13 -08:00
Avery Pennarun
ca7a1de4e3 Add Documentation/git-{import,export}.do scripts.
These export and import, respectively, the generated man pages to/from the
git branch called 'man'.  You can use it to retrieve the .1 files if you
don't have a working pandoc.
2010-12-19 01:05:52 -08:00
junkblocker
bab7b40a49 Don't rely on GNU find behaviour in clean.do. 2010-12-17 11:40:42 -08:00
Oscar Bonilla
0105b33483 _tty_width() will return zero when redo is run inside an emacs shell 2010-12-16 11:55:09 -08:00
Avery Pennarun
c13eac953e Release minimal/do to the public domain.
This makes it more convenient if you really want to include it as the build
script for your own projects.
2010-12-14 17:58:16 -08:00
Jonathan Wakely
fabe969fd8 Fix a couple of typos in the README. 2010-12-14 17:56:18 -08:00
Avery Pennarun
5f9b6eeaf4 install.do: stub /usr/bin programs: be smarter about finding the libdir.
We were hardcoding the absolute $LIBDIR location, which sounds smart, but not if
you're doing "make install" into a temp dir that will end up somewhere else
later.

Instead, look for ../lib/redo/ from wherever the binary is installed.
2010-12-14 02:51:44 -08:00
Avery Pennarun
3dd8d081be minimal/do: MacOS has /usr/bin/true, not /bin/true. 2010-12-14 02:47:51 -08:00