Skip to content

Commit 0f40c8c

Browse files
committed
Remove stale formatting, options, settings, &c
1 parent 2f8dea0 commit 0f40c8c

15 files changed

Lines changed: 210 additions & 225 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
cabal.project.local
2+
cabal.project.local~
13
dist/
2-
docs/.build
4+
dist-newstyle/
5+
docs/.build

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ ubuntu-build-deps:
5252
python-sphinx cabal-install
5353
cabal install --only-dependencies
5454

55-
tmp/arx.cabal: dist/build/arx/arx
55+
tmp/arx.cabal: cabal
5656
mkdir -p tmp
57-
cp dist/build/arx/arx $@
57+
cp dist-newstyle/build/*/*/*/build/arx/arx $@
5858
strip $@
5959

6060
dist/build/arx/arx: cabal
@@ -67,5 +67,4 @@ doc:
6767
cd docs && make blessed
6868

6969
clean:
70-
rm -rf tmp arx dist/build
71-
70+
rm -rf tmp arx dist-newstyle/build

README

Lines changed: 89 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,152 @@
11
SYNOPSIS
2+
23
arx (-h | -[?] | --help)
34
arx (-v | --version)
45
arx shdat (-b <size>)? (-o <output file>)? < input
56
arx shdat (-b <size>)? (-o <output file>)? <input file>+
67
arx tmpx <option,archive>* (//+ <command> (//+ <option,archive>*)?)?
78

89
DESCRIPTION
9-
A UNIX executable is a simple thing -- a file the kernel can execute,
10-
one way or another, via an interpreter or directly as object code.
11-
Every executable induces a family of executions -- instances of execu-
12-
tion with different command line arguments, with different files in the
13-
working directory and with different environment variables present.
14-
15-
The arx tool captures the parameters of an execution and encodes them
16-
as an executable, making for easy, consistent transfer and repetition
17-
of a particular run. The generated executable ensures that each run
18-
occurs in a freshly allocated temporary directory, with only the
19-
desired files in scope; it uses traps to ensure the cleanup of this
20-
directory; and its format is a simple POSIX shell script, relying on
10+
A UNIX executable is a simple thing -- a file the kernel can execute,
11+
one way or another, via an interpreter or directly as object code.
12+
Every executable induces a family of executions -- instances of
13+
execution with different command line arguments, with different files
14+
in the working directory and with different environment variables
15+
present.
16+
17+
The arx tool captures the parameters of an execution and encodes them
18+
as an executable, making for easy, consistent transfer and repetition
19+
of a particular run. The generated executable ensures that each run
20+
occurs in a freshly allocated temporary directory, with only the
21+
desired files in scope; it uses traps to ensure the cleanup of this
22+
directory; and its format is a simple POSIX shell script, relying on
2123
just a few shell tools.
2224

2325
DEPENDENCIES
24-
The arx tool relies on the presence of sed, tr, date, head, tar, hex-
25-
dump and sh. When unpacking tar archives, it may use the -j or -z
26+
The arx tool relies on the presence of sed, tr, date, head, tar,
27+
hexdump and sh. When unpacking tar archives, it may use the -j or -z
2628
(bzip2 and gzip, respectively) options of tar. Scripts have been tested
27-
with dash and the GNU tools as well as the sh implementation and user-
28-
land tools that are part of busybox.
29+
with dash and the GNU tools as well as the sh implementation and
30+
userland tools that are part of busybox.
2931

3032
APPLICATION
31-
The tmpx subcommand of arx offers a variety of options for bundling
32-
code and a task to run. The shdat subcommand exposes the lower-level
33-
functionality of encoding binary data in a shell script that outputs
34-
that binary data, using HERE documents and some odd replacement rules
33+
The tmpx subcommand of arx offers a variety of options for bundling
34+
code and a task to run. The shdat subcommand exposes the lower-level
35+
functionality of encoding binary data in a shell script that outputs
36+
that binary data, using HERE documents and some odd replacement rules
3537
for nulls.
3638

37-
Scripts generated by tmpx and shdat may be fed to sh over STDIN to exe-
38-
cute them. This can be helpful when using ssh and sudo to set up an
39+
Scripts generated by tmpx and shdat may be fed to sh over STDIN to
40+
execute them. This can be helpful when using ssh and sudo to set up an
3941
execution context; for example:
4042

4143
arx tmpx ... | ssh user@host.com sudo sh
4244

43-
Scripts generated by tmpx will pass their arguments to the contained
45+
Scripts generated by tmpx will pass their arguments to the contained
4446
script or command. To pass arguments when piping to sh, use -s:
4547

4648
arx tmpx ... | ssh user@host.com sudo sh -s a b c
4749

48-
Some arguments to the generated script will be treated specially,
49-
namely, --extract, --no-rm and --no-run. Please see the section on
50+
Some arguments to the generated script will be treated specially,
51+
namely, --extract, --no-rm and --no-run. Please see the section on
5052
Passing Arguments, below, for more information about these options.
5153

5254
ARX COMMANDLINE PROCESSING
53-
For all subcommands, when options overlap in their effect -- for exam-
54-
ple, setting the output with -o -- the rightmost option takes prece-
55-
dence. Whenever -h, -? or --help is present on the command line, help
56-
is displayed and the program exits.
55+
For all subcommands, when options overlap in their effect -- for
56+
example, setting the output with -o -- the rightmost option takes
57+
precedence. Whenever -h, -? or --help is present on the command line,
58+
help is displayed and the program exits.
5759

58-
When paths are specified on an arx command line, they must be quali-
59-
fied, starting with /, ./ or ../. This simplifies the command line syn-
60-
tax, overall, without introducing troublesome ambiguities.
60+
When paths are specified on an arx command line, they must be
61+
qualified, starting with /, ./ or ../. This simplifies the command line
62+
syntax, overall, without introducing troublesome ambiguities.
6163

6264
TMPX
6365
The tmpx subcommand bundles together archives, environment settings and
64-
an executable or shell command in to a Bourne-compatible script that
65-
runs the command or executable in a temporary directory, after having
66+
an executable or shell command in to a Bourne-compatible script that
67+
runs the command or executable in a temporary directory, after having
6668
unpacked the archives and set the environment.
6769

68-
Any number of file path arguments may be specified; they will be inter-
69-
preted as tar archives to include in bundled script. If - is given,
70-
then STDIN will be included as an archive stream. If no arguments are
71-
given, it is assumed that no archives are desired and only the command
72-
and environment are bundled.
70+
Any number of file path arguments may be specified; they will be
71+
interpreted as tar archives to include in bundled script. If - is
72+
given, then STDIN will be included as an archive stream. If no
73+
arguments are given, it is assumed that no archives are desired and
74+
only the command and environment are bundled.
7375

74-
The temporary directory created by the script is different for each
75-
invocation, with a name of the form /tmp/tmpx-<timestamp>-<randomhex>.
76-
The timestamp format is %Y.%m.%dT%H.%M.%SZ, in UTC. One happy conse-
77-
quence of this is that earlier jobs sort ASCIIbetically before later
78-
jobs. After execution, the temporary directory is removed (or not,
79-
depending on the -rm[10!_] family of options).
76+
The temporary directory created by the script is different for each
77+
invocation, with a name of the form /tmp/tmpx-<timestamp>-<randomhex>.
78+
The timestamp format is %Y.%m.%dT%H.%M.%SZ, in UTC. One happy
79+
consequence of this is that earlier jobs sort ASCIIbetically before
80+
later jobs. After execution, the temporary directory is removed (or
81+
not, depending on the -rm[10!_] family of options).
8082

8183
-rm0, -rm1, -rm_, -rm!
82-
By default, the temporary directory created by the script
84+
By default, the temporary directory created by the script
8385
will be deleted no matter the exit status status of the task.
8486
These options cause a script to be generated that deletes the
85-
temporary directory only on success, only on failure, always
87+
temporary directory only on success, only on failure, always
8688
(the default) or never.
8789

8890
--shared
89-
Causes the temporary directory to be identified by a hash of
90-
the ARX archive, instead of by date and time. Different runs
91-
of the same archive will share the same directory. Note that
91+
Causes the temporary directory to be identified by a hash of
92+
the ARX archive, instead of by date and time. Different runs
93+
of the same archive will share the same directory. Note that
9294
this implies shared state and every disadvantage thereof.
9395

9496
-b <size>
95-
Please see the documentation for this option, shared with
97+
Please see the documentation for this option, shared with
9698
shdat, below.
9799

98100
-o <path>
99-
By default, the generated script is sent to STDOUT. With -o,
101+
By default, the generated script is sent to STDOUT. With -o,
100102
output is redirected to the given path.
101103

102104
-e <path>
103-
Causes the file specified to be packaged as the task to be
104-
run. A binary executable, a Ruby script or a longish shell
105+
Causes the file specified to be packaged as the task to be
106+
run. A binary executable, a Ruby script or a longish shell
105107
script all fit here.
106108

107-
In addition to these options, arguments of the form VAR=VALUE are rec-
108-
ognized as environment mappings and stored away in the script, to be
109+
In addition to these options, arguments of the form VAR=VALUE are
110+
recognized as environment mappings and stored away in the script, to be
109111
sourced on execution.
110112

111-
Without -e, the tmpx subcommand tries to find the task to be run as a
112-
sequence of arguments delimited by a run of slashes. The following
113+
Without -e, the tmpx subcommand tries to find the task to be run as a
114+
sequence of arguments delimited by a run of slashes. The following
113115
forms are all recognized:
114116

115117
arx tmpx ...some args... // ...command...
116118
arx tmpx ...some args... // ...command... // ...more args...
117119
arx tmpx // ...command... // ...some args...
118120

119-
The slash runs must have the same number of slashes and must be the
120-
longest continuous runs of slashes on the command line. The command
121+
The slash runs must have the same number of slashes and must be the
122+
longest continuous runs of slashes on the command line. The command
121123
will be included as-is in a Bourne shell script.
122124

123125
SHDAT
124-
The shdat subcommand translates binary data in to a shell script which
125-
outputs the binary data. The data is encoded in HERE documents in such
126-
a way that data without NULs is not changed and that data with NULs is
127-
minimally expanded: about 1% for randomish data like compressed tar-
128-
balls and about 10% in pathological cases.
126+
The shdat subcommand translates binary data in to a shell script which
127+
outputs the binary data. The data is encoded in HERE documents in such
128+
a way that data without NULs is not changed and that data with NULs is
129+
minimally expanded: about 1% for randomish data like compressed
130+
tarballs and about 10% in pathological cases.
129131

130-
The shdat subcommand can be given any number of paths, which will be
132+
The shdat subcommand can be given any number of paths, which will be
131133
concatenated in the order given. If no path is given, or if - is given,
132134
then STDIN will be read.
133135

134136
-b <size>
135-
The size of data chunks to place in each HERE document. The
136-
argument is a positive integer followed by suffixes like B,
137-
K, KiB, M and MiB, in the manner of dd, head and many other
138-
tools. The default is 4MiB. This is unlikely to make a dif-
139-
ference for you unless the generated script is intended to be
140-
run on a memory-constrained system.
137+
The size of data chunks to place in each HERE document. The
138+
argument is a positive integer followed by suffixes like B,
139+
K, KiB, M and MiB, in the manner of dd, head and many other
140+
tools. The default is 4MiB. This is unlikely to make a
141+
difference for you unless the generated script is intended to
142+
be run on a memory-constrained system.
141143

142144
-o <path>
143-
By default, the generated script is sent to STDOUT. With -o,
145+
By default, the generated script is sent to STDOUT. With -o,
144146
output is redirected to the given path.
145147

146148
EXAMPLES
149+
147150
# Installer script that preserves failed builds.
148151
git archive HEAD | bzip2 | arx tmpx -rm0 - // make install > go.sh
149152
# Now install as root; but don't log in as root.
@@ -164,22 +167,22 @@ EXAMPLES
164167

165168
PASSING ARGUMENTS TO GENERATED SCRIPTS
166169
The scripts generated by tmpx treat some arguments as special, internal
167-
options, to allow for inspecting them should there be a need to deter-
168-
mine their contents.
170+
options, to allow for inspecting them should there be a need to
171+
determine their contents.
169172

170173
--extract
171174
Unpack the data in the present directory and do nothing else.
172175

173176
--no-rm
174-
Run the script as normal but do not delete the generated tem-
175-
porary directory.
177+
Run the script as normal but do not delete the generated
178+
temporary directory.
176179

177180
--no-run
178-
Unpack into a temporary directory as normal but do not run
181+
Unpack into a temporary directory as normal but do not run
179182
the user's command.
180183

181-
To prevent arguments from being specially treated, use // in the argu-
182-
ment list:
184+
To prevent arguments from being specially treated, use // in the
185+
argument list:
183186

184187
a-tmpx-script.sh --no-rm // a b c --extract
185188

@@ -190,16 +193,16 @@ PASSING ARGUMENTS TO GENERATED SCRIPTS
190193
arx tmpx // printf "'%s\n'" '"$@"' | sh -s // ab c --no-rm
191194

192195
NOTES
193-
The timestamp is not the common ISO 8601 format, %Y-%m-%dT%H:%M:%SZ,
194-
because of software and build processes that attach special meaning to
196+
The timestamp is not the common ISO 8601 format, %Y-%m-%dT%H:%M:%SZ,
197+
because of software and build processes that attach special meaning to
195198
colons in pathnames.
196199

197200
BUGS
198-
The command line parser offers no hints or help of any kind; it fails
199-
with the simple message "argument error". The two most common mistakes
201+
The command line parser offers no hints or help of any kind; it fails
202+
with the simple message "argument error". The two most common mistakes
200203
I make are:
201204

202-
o Not qualifying paths with /, ./ or ../.
205+
Not qualifying paths with /, ./ or ../.
203206

204-
o Not specifying a subcommand (tmpx or shdat).
207+
Not specifying a subcommand (tmpx or shdat).
205208

System/Posix/ARX.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ module System.Posix.ARX (
1010
import System.Posix.ARX.Programs
1111
import System.Posix.ARX.Sh
1212
import System.Posix.ARX.Tar
13-

System/Posix/ARX/CLI.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,3 @@ err b | Char8.last b == '\n' = Char8.hPutStr stderr b
181181
| otherwise = Char8.hPutStr stderr (b `Char8.snoc` '\n')
182182

183183
die msg = err msg >> exitFailure
184-

System/Posix/ARX/CLI/CLTokens.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,3 @@ size = (*) <$> decimal <*> suffix
188188
-}
189189
sizeBounded :: forall b . (Bounded b, Integral b) => Parser b
190190
sizeBounded = fromInteger . min (toInteger (maxBound :: b)) <$> size
191-

System/Posix/ARX/CLI/Options.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,3 @@ slashes = listToMaybe . longestFirst . catMaybes <$> manyTill classify eof
174174
classify = Just <$> satisfy slashRun <|> Nothing <$ anyArg
175175
longestFirst = sortBy (comparing (negate . Bytes.length))
176176
slashRun s = Char8.all (== '/') s && Bytes.length s > 1
177-

System/Posix/ARX/HEREDat.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ encoded :: Chunk -> Bool
204204
encoded (SafeChunk _) = False
205205
encoded (EncodedChunk _ _ _ _) = True
206206

207-
{-|
207+
{-|
208208
-}
209209
script block = mconcat $ case block of
210210
SafeChunk bytes -> [script (chunk bytes)] -- Convert to Encoded
@@ -241,4 +241,3 @@ script block = mconcat $ case block of
241241
- more compact than base 64; but whether shell decoders can effectively
242242
- realize this efficiency is another matter.
243243
-}
244-

System/Posix/ARX/Programs.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ instance ARX SHDAT LazyB.ByteString where
4141
("", "") -> []
4242
(a , "") -> [chunkIt a]
4343
(a , b) -> chunkIt a : chunked b
44-
where
44+
where
4545
chunkIt = script . chunk . mconcat . LazyB.toChunks
4646

4747

@@ -78,5 +78,3 @@ instance ARX TMPX [(Tar, LazyB.ByteString)] where
7878
[ ] -> ""
7979
shdat = interpret encoder
8080
unblz = Blaze.toLazyByteString
81-
82-

System/Posix/ARX/Sh.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,3 @@ class Render t where
6666

6767
class Raw t where
6868
raw :: t -> ByteString
69-

0 commit comments

Comments
 (0)