Commit graph

43 commits

Author SHA1 Message Date
Ankur Kothari
8b2a4e9c37 Fix typo in docs: "an C" should be "in C" 2020-06-15 15:48:00 -04:00
Raphael Das Gupta
f75b69f063 fix typo / grammar in docs landing page 2020-06-15 15:47:36 -04:00
Aidan Holm
3f6e5f5e70 Fix typo. 2020-06-15 15:46:57 -04:00
Avery Pennarun
a60949135d Merge branch 'doc_install_sudo' of git://github.com/BlameJohnny/redo
* 'doc_install_sudo' of git://github.com/BlameJohnny/redo:
  GettingStarted.md: Add -E option to sudo to preserve environment
2020-03-04 15:00:34 -05:00
Avery Pennarun
68d355178e Merge: Add compatibility to Python 3 (and retain Python 2)
Merge branch 'py6' of https://github.com/mlell/redo

* 'py6' of https://github.com/mlell/redo:
  Remove python<3.0 restriction in setup.py
  Make compatible to BeautifulSoup4
  Accept octal representations of Python 2 (0nnn) and Python 3 (0onnn)
  Prevent iterator being changed while iterating
  Python 2/3 compatible treatment of max(n, None)
  Prevent "Exception ... ignored" in `redo-log ... | head`
  Distinguish byte (python2 str type) and unicode strings (python 3 str type)
  Set file descriptor as inheritable for all pythons >=3.4
  Unify print function usage for Python 2 and 3 via __future__ import
  Run 2to3 utility
  Remove python interpreter selection
2020-03-04 14:54:24 -05:00
Avery Pennarun
92f86fc022 docs/cookbook/c: missing quote char. 2020-01-05 02:52:26 -05:00
Johnny Lind
94e9ee60d2 GettingStarted.md: Add -E option to sudo to preserve environment 2019-12-08 01:00:28 +01:00
Moritz Lell
a8fd6a123c Make compatible to BeautifulSoup4 2019-10-30 21:59:01 +01:00
Moritz Lell
e239820afd Distinguish byte (python2 str type) and unicode strings (python 3 str type)
Python 3 strings are python 2 unicode strings. Therefore consistently mark
strings that are sent via pipes or written/read to file as byte strings.
2019-10-30 21:28:49 +01:00
Moritz Lell
62845688e5 Unify print function usage for Python 2 and 3 via __future__ import 2019-10-30 21:28:49 +01:00
Avery Pennarun
bc9cc75bc6 Disable docker container test from toplevel 'redo test'
It's not reliable on all versions of docker, and we haven't had time to
fix it yet, so just turn it off. It's not essential to redo.

Reported-by: fcsmith@gmail.com
2019-07-24 03:27:04 -04:00
Avery Pennarun
12b0d59b9f Merge remote-tracking branch 'origin/experimental/dockrepo'
* origin/experimental/dockrepo:
  docs/cookbook/container: update docker image builder.
2019-05-15 18:55:52 -07:00
Avery Pennarun
fb0a5bd69c Fix more problems with "/usr/bin/env python" picking python3.
Open files in 'rb' (read binary) mode to prevent useless default utf8
encoding in python3, without breaking python2 compatibility.

Reported-by: Tharre <tharre3@gmail.com>
2019-05-15 16:54:21 -07:00
Avery Pennarun
2e4d3d518e cookbook/container/default.sha256.do: use explicit close_fds=False.
Some people have /usr/bin/python as a link to python3. The script is
designed to work in either python2 or python3, but python3's subprocess
model defaults to close_fds=True, which closes the jobserver fds and
causes an error.  Explicitly force close_fds=False to get identical
behaviour on python2 and python3.

Reported-by: Tharre <tharre3@gmail.com>
2019-05-15 15:19:06 -07:00
Avery Pennarun
e24e045a07 docs/cookbook/redoconf-simple: a simple redoconf C++ project.
This is a little simpler than the docs/cookbook/c project, which
doesn't actually have a doc yet because there was too much to explain.
I think I might make that a follow-on cookbook chapter, for people who
have read this simple one.

I think this doc is maybe a little too long; I intended it to be
"here's what you do to get started" but it turned into "here's what you
do to get started, and why it works, in excruciating detail." Not quite
sure how to fix.

(Also updated some other parts of the docs to refer to redoconf as a
real thing now instead of a "maybe someone should write this" thing.)
2019-03-06 03:05:04 -05:00
Avery Pennarun
7845f6ddde docs/cookbook/container: update docker image builder.
Apparently some newer docker versions crash if there is no "repository"
file in the resulting image.  Its syntax seems simple enough, described
in https://github.com/moby/moby/blob/master/image/spec/v1.md

Reported-by: Matthew Singletary <matt.singletary@gmail.com>
2019-03-05 21:49:36 -05:00
Avery Pennarun
2bea74df35 Work around ancient shells where >$3 does not implicitly quote $3.
Also add an entry in shelltest.od to reject any shell exhibiting that
bug.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-03-03 20:56:17 -05:00
Avery Pennarun
0dcc685739 Minor clarifications to redo install instructions.
Reported-by: @DRMacIver on twitter
2019-03-03 19:35:32 -05:00
Avery Pennarun
b196315222 Change -x/-v to only affect top-level targets by default, not recursively.
Because redo targets are nicely isolated (unlike make targets), you
usually only want to debug one of them at a time.  Using -x could be
confusing, because you might end up with a dump of output from a
dependency you're not interested in.

Now, by default we'll disable -x when recursing into sub-targets, so
you only see the trace from the targets you are actually trying to
debug.  To get recursive behaviour, specify -x twice, eg. -xx.

Same idea with -v.
2019-03-02 18:46:00 -05:00
Avery Pennarun
1a3c11f220 redoconf: a stub rc_include() now sources ./redoconf.rc automatically.
This lets us remove the awkward ". ./redoconf.rc" line from zillions
of .od scripts, without paying the price of *always* including that
whole file every time default.do.sh is used.
2019-03-02 04:24:58 -05:00
Avery Pennarun
49f85f2156 redoconf: assorted minor fixes.
- libqt4.rc: add detection of the 'moc' command in $MOC.
- libssl.rc: add detection script for openssl.
- default.do.sh: provide a die() function to all .od files.  It's just
  too useful to not have it (I haven't converted everything to it yet).
- When building out/x/y.z, match against $S/default.z.od and
  $S/default.od if they exist.
- *.list files (lists of source/object files to include in a binary)
  can now contain *.o files in addition to *.c, *.cc, etc.
- rename compile() to _compile() to avoid polluting the namespace for
  scripts called from default.do.sh.
- When building a .so file in the top level directory, no need to
  make a symlink of it into the top level directory.
- link.od and link-shlib.od forgot to make use of the $xLIBS variable.
2019-03-02 04:12:25 -05:00
Avery Pennarun
88250334da redoconf: move -Wl,-rpath flags to shlib.rc and add -Wl,-z,origin.
It was kind of ugly to have this kind of special flag directly in
link.od; now we detect whether it's available.  This also gives a
project the ability to override the flag in some other way if they
want.

As a result, rc/shlib.rc needs to be included in all.rc.od if you want
to create or link against shared libraries.

While we're here, also add -Wl,-z,origin on platforms where it works.
This is apparently needed for FreeBSD 8.0 at least, and probably other
platforms.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-03-01 13:55:22 -05:00
Avery Pennarun
e036e2522d docs/cookbook/c/allconfig.do: avoid need for '&' backgrounding.
Instead of running a bunch of separate rc_include statements in the
background, which causes unpredictable ordering of log output and
prevents -j from controlling parallelism, let's do a single
redo-ifchange for all of them (the slow part) followed by sequentially
checking the results (the fast part).
2019-03-01 13:55:22 -05:00
Avery Pennarun
328d4ead7a Fix some build problems on MacOS X.
- Linking shared libraries needs slightly different options.

- We were trying to detect mach_time.h but needed to detect
  mach/mach_time.h instead.

While we're here, add a --disable-shared option to ./configure, which
is different from --enable-static.  --disable-shared does not build
*new* share libraries, but doesn't pass -static to the linker
(apparently there is no static linking posible on MacOS).
2019-02-24 22:29:19 -05:00
Avery Pennarun
017997c035 redoconf: posix.rc: fix abort when timespec is not available.
Now we define HAS_POSIX=1 if it works, and to blank otherwise, to be
consistent with other rc scripts, but it doesn't abort if we can't find
timespec.

Meanwhile, slightly clarify the error message in rc.sh.

Reported-by: Nathaniel Filardo <nwfilardo@gmail.com>
2019-02-23 21:00:26 -05:00
Avery Pennarun
bdb8d8a27d redoconf: better handling of required vs optional detectors.
CC.rc was the only "mandatory" detection, which was weird and
inconsistent.  Instead, make it optional like the others, and have it
set a HAVE_CC variable appropriately (and have CXX.rc work the same
way).  Then, add a default.required.rc.od that checks the HAVE_* for
any variable and aborts if it is not available.

This allows us to fix confusing behaviour in allconfig.do, which would
try every compiler on the system, but redo would print a (non-fatal)
error message (and prevent redo-stamp optimization) when CC.rc failed
for any non-working compilers.  Now CC.rc just politely reports that it
didn't find a compiler.  Then we change all.rc.od to make CC.rc
mandatory.

Reported-by: Nathaniel Filardo <nwfilardo@gmail.com>
2019-02-23 16:51:25 -05:00
Avery Pennarun
337e026ce3 redoconf: clock_gettime() detection needs to depend on -lrt.
More generally, default.func.rc.od wasn't super useful because you
couldn't specify either a header file or library dependencies.  Drop it
and make an explicit clock_gettime.rc.od.  As a bonus, this also checks
that CLOCK_MONOTONIC exists as expected.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-02-23 15:51:30 -05:00
Avery Pennarun
6dae51f4d2 Experimental new redoconf C/C++ build/autoconfiguration system.
To test it out, try this:
	./do -j10 build
	cd docs/cookbook/c
	redo -j10 test

It should detect all the compilers on your system and make three
separate builds for each one: normal, debug, and optimized.  Then it
tries to run a test program under each one.

If there are windows cross compilers and you also have 'wine'
installed, it'll try running the test program under wine as well.

redoconf currently has no documentation other than the example program.
We'll fix that later.
2019-02-23 06:52:25 -05:00
Avery Pennarun
938c6c65c4 cookbook/container/kvm: better handling of \r\n line endings. 2019-02-20 19:14:37 -05:00
Avery Pennarun
6fbda9a7b3 docs/cookbook/container: don't delete *.out and *.code during build.
If mkdocs is running in parallel, it can get upset if one of these
files exists when it lists the directory, but doesn't exist when it
goes to generate the output.  Fundamentally this is a problem in mkdocs
more than in our code, but we might as well avoid it.
2019-02-02 23:54:27 -05:00
Avery Pennarun
3dbdfbc06f Better handling if parent closes REDO_CHEATFDS or MAKEFLAGS fds.
Silently recover if REDO_CHEATFDS file descriptors are closed, because
they aren't completely essential and MAKEFLAGS-related warnings already
get printed if all file descriptors have been closed.

If MAKEFLAGS --jobserver-auth flags are closed, improve the error
message so that a) it's a normal error instead of an exception and b)
we link to documentation about why it happens.  Also write some more
detailed documentation about what's going on here.
2019-01-18 00:11:48 +00:00
Martin Mosegaard Amdisen
cb7d3afc8f cookbook/container: minor proofreading
Fixed a typo found while reading. Also rephrased a sentence about
comm, that at least to me makes it simpler to understand.
2019-01-15 08:24:43 +01:00
Avery Pennarun
909bb62dce cookbook/container: some minor clarifications.
Most of these were suggested by Jeff Stearns <jeff.stearns@gmail.com>.
2019-01-14 02:03:19 -05:00
Avery Pennarun
20fe7a79ec cookbook/container: skip on missing cpio and missing kvm kernel image. 2019-01-14 02:03:19 -05:00
Avery Pennarun
537866b871 cookbook/container: remove unexplained "exec >&2" lines.
These are often a good idea, but not necessary here and are distracting
to the tutorial, so let's just take them out.

Reported-by: Jeff Stearns <jeff.stearns@gmail.com>
2019-01-14 02:03:19 -05:00
Eric Anderson
a6db325998 cookbook/container: add missing PS1 to sh example 2019-01-13 20:38:54 -08:00
Avery Pennarun
3923a7d3f8 cookbook/container: example of building+running docker containers.
This got... long... and complicated.  But I think it's a really good
demonstration of getting redo to do complicated things elegantly.  At
least, I hope it is.
2019-01-08 01:42:33 -05:00
Avery Pennarun
01497f55e9 mkdocs: enforce sufficiently new version, and use mkdocs-exclude.
We want to use the mkdocs-exclude plugin, which lets us exclude
particular files from the output directory.  But plugins aren't
available in the debian-stable version of mkdocs, so ensure that we're
running a sufficiently new version.  If we aren't, gracefully just skip
building the documentation.
2019-01-08 01:33:47 -05:00
Avery Pennarun
22dd0cdd6b Move _all.do -> all.do and slightly update docs.
all.do's main job was to print a "nothing much to do" message after
running.  Nowadays it actually does do stuff, so we can remove the
warning, making _all.do redundant.
2018-12-31 15:07:18 -05:00
Avery Pennarun
539a26d264 Minor copyediting of index.md. 2018-12-10 05:03:20 +00:00
Avery Pennarun
2b7da63c66 Fix a few lagging doc references to old-style build+test layout. 2018-12-10 04:33:57 +00:00
Avery Pennarun
99188bef0d Rename redo/python -> redo/py.
This avoids a name overlap with the system-installed copy of python.
Since redo adds the redo/ dir to the $PATH before running .do files,
python.do might see its own previously-created target instead of the
"real" python when testing, and create an infinite loop by accident.
2018-12-05 02:27:04 -05:00
Avery Pennarun
f6fe00db5c Directory reorg: move code into redo/, generate binaries in bin/.
It's time to start preparing for a version of redo that doesn't work
unless we build it first (because it will rely on C modules, and
eventually be rewritten in C altogether).

To get rolling, remove the old-style symlinks to the main programs, and
rename those programs from redo-*.py to redo/cmd_*.py.  We'll also move
all library functions into the redo/ dir, which is a more python-style
naming convention.

Previously, install.do was generating wrappers for installing in
/usr/bin, which extend sys.path and then import+run the right file.
This made "installed" redo work quite differently from running redo
inside its source tree.  Instead, let's always generate the wrappers in
bin/, and not make anything executable except those wrappers.

Since we're generating wrappers anyway, let's actually auto-detect the
right version of python for the running system; distros can't seem to
agree on what to call their python2 binaries (sigh). We'll fill in the
right #! shebang lines.  Since we're doing that, we can stop using
/usr/bin/env, which will a) make things slightly faster, and b) let us
use "python -S", which tells python not to load a bunch of extra crap
we're not using, thus improving startup times.

Annoyingly, we now have to build redo using minimal/do, then run the
tests using bin/redo.  To make this less annoying, we add a toplevel
./do script that knows the right steps, and a Makefile (whee!) for
people who are used to typing 'make' and 'make test' and 'make clean'.
2018-12-04 02:53:40 -05:00