Compare commits
434 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d505d5010 | ||
|
|
196333cbf8 | ||
|
|
9962197fc5 | ||
|
|
e1cc84259c | ||
|
|
b3fc016061 | ||
|
|
3815d2d463 | ||
|
|
beee18de88 | ||
|
|
eff573f563 | ||
|
|
9e08f5efe1 | ||
|
|
8791ffbc88 | ||
|
|
99ef620c8c | ||
|
|
8396b59286 | ||
|
|
5d769de8a3 | ||
|
|
6f2bfd92b6 | ||
|
|
d98f750fd8 | ||
|
|
34427a7b43 | ||
|
|
a3fd53b9eb | ||
|
|
59ef0aaf3f | ||
|
|
407c9fd520 | ||
|
|
0ef3bd3c37 | ||
|
|
4a7ece698b | ||
|
|
bd4f1b4bb8 | ||
|
|
96fa456a0a | ||
|
|
5fd44654db | ||
|
|
3837fb233c | ||
|
|
d20c3011a0 | ||
|
|
84e6c43e85 | ||
|
|
cfe35ca0e0 | ||
|
|
853252ac66 | ||
|
|
ac19b333b3 | ||
|
|
7581cfdee4 | ||
|
|
f316b6c1a9 | ||
|
|
91a01e6fcf | ||
|
|
88d422567e | ||
|
|
0212feeed6 | ||
|
|
070e07ed5a | ||
|
|
30c7db85d8 | ||
|
|
e2eed05224 | ||
|
|
4ad6fb7ea3 | ||
|
|
015ac7c7da | ||
|
|
a9a6356ffc | ||
|
|
e47d42536f | ||
|
|
5ca45d085e | ||
|
|
02f2335712 | ||
|
|
3632019b73 | ||
|
|
d43565c3e8 | ||
|
|
68ae953d8a | ||
|
|
76c9710091 | ||
|
|
e347033f71 | ||
|
|
0e705391db | ||
|
|
e47e0c2dbe | ||
|
|
df8873e14a | ||
|
|
2ab4bc44c7 | ||
|
|
d315210612 | ||
|
|
c02a44183f | ||
|
|
8a1ab709a4 | ||
|
|
666babbbfa | ||
|
|
385c6f8737 | ||
|
|
d22d7565f3 | ||
|
|
b43aeadbc9 | ||
|
|
4cab35d1a6 | ||
|
|
25df501704 | ||
|
|
0bd5eb71a0 | ||
|
|
4e91d8621f | ||
|
|
ee5040421f | ||
|
|
1bdc152931 | ||
|
|
1b804f88e4 | ||
|
|
0623359fbc | ||
|
|
22d13d6ec2 | ||
|
|
947e645789 | ||
|
|
a060adf165 | ||
|
|
7dd342e482 | ||
|
|
ee6cf99660 | ||
|
|
6dbed1bf38 | ||
|
|
07cec27848 | ||
|
|
9488ae7357 | ||
|
|
e0afaf1857 | ||
|
|
86cbd93ec1 | ||
|
|
5c38c863bd | ||
|
|
f00bc4c94c | ||
|
|
01d169f817 | ||
|
|
feb63da431 | ||
|
|
a04a65d7a5 | ||
|
|
2e210b2387 | ||
|
|
89ac8db74f | ||
|
|
a89a201598 | ||
|
|
fc195519b5 | ||
|
|
bafc1690fc | ||
|
|
e5a6c09b12 | ||
|
|
4be5443882 | ||
|
|
2382a729e0 | ||
|
|
e3ce954582 | ||
|
|
75068e7d75 | ||
|
|
aab8812732 | ||
|
|
7974aae81c | ||
|
|
de90fdf908 | ||
|
|
c9586b6c3f | ||
|
|
c25f688e23 | ||
|
|
354d58b3d7 | ||
|
|
f93f7b75be | ||
|
|
dce1afdc67 | ||
|
|
3151bdea55 | ||
|
|
547b119f25 | ||
|
|
2132d9ddeb | ||
|
|
1f6616dabf | ||
|
|
1ec9f55741 | ||
|
|
1fca76870b | ||
|
|
8a6080eb14 | ||
|
|
4b66cebe7b | ||
|
|
e5678b3435 | ||
|
|
e64c4f5742 | ||
|
|
bf738f0070 | ||
|
|
3e8dccf6ab | ||
|
|
215ec2ddc6 | ||
|
|
f793caf936 | ||
|
|
da25d80152 | ||
|
|
943ab38a0d | ||
|
|
f41297fdce | ||
|
|
9638f3f393 | ||
|
|
b19cebc513 | ||
|
|
38f18aa6d4 | ||
|
|
4a053bfdfd | ||
|
|
68515b5a96 | ||
|
|
561a07f51d | ||
|
|
93d9797eda | ||
|
|
1a9a1f2768 | ||
|
|
cc0505f033 | ||
|
|
4874fd2d9a | ||
|
|
24e234a2fa | ||
|
|
22ba63df16 | ||
|
|
18e4ac0fc6 | ||
|
|
fe101fa785 | ||
|
|
2670642733 | ||
|
|
bfe19b3c37 | ||
|
|
3e5b68068b | ||
|
|
7455fd8835 | ||
|
|
4250b641d8 | ||
|
|
92f7dfa5b7 | ||
|
|
d19b6521fc | ||
|
|
3e239a37ff | ||
|
|
f1aa71a92f | ||
|
|
a18d02e0b0 | ||
|
|
c0bfcbdd45 | ||
|
|
a0607be7f4 | ||
|
|
5a6b45e252 | ||
|
|
a61129c48c | ||
|
|
f1947cce93 | ||
|
|
1854f84e83 | ||
|
|
dcff8cdb76 | ||
|
|
f4a502a09a | ||
|
|
981eff065b | ||
|
|
339e6f0e1d | ||
|
|
0e267e2625 | ||
|
|
4750f6c5ed | ||
|
|
fcb784051f | ||
|
|
a29b64a231 | ||
|
|
4fde308ec0 | ||
|
|
601a8eab79 | ||
|
|
6ac237e242 | ||
|
|
4661282fde | ||
|
|
c11839d7b2 | ||
|
|
ca2238cf81 | ||
|
|
2317d8f671 | ||
|
|
0e6dc72a7a | ||
|
|
b11aeb2c4b | ||
|
|
5744dd5480 | ||
|
|
7a3a5d1608 | ||
|
|
f4c5531d92 | ||
|
|
88acffa20a | ||
|
|
b545c669a0 | ||
|
|
57751fdb55 | ||
|
|
9c3099d328 | ||
|
|
7adaa6d446 | ||
|
|
dcded7da47 | ||
|
|
a4273156c4 | ||
|
|
410760c5ab | ||
|
|
ee2cf45d76 | ||
|
|
eca30e12e1 | ||
|
|
c15f544356 | ||
|
|
ebcccbd358 | ||
|
|
88e54153dc | ||
|
|
4f3725b167 | ||
|
|
e10b830251 | ||
|
|
2b4b0658fa | ||
|
|
d51aede4af | ||
|
|
a945fb7905 | ||
|
|
f4a3a280db | ||
|
|
dbf6d7e783 | ||
|
|
cc51f9c539 | ||
|
|
5bb3444032 | ||
|
|
b35735d8b2 | ||
|
|
0e783e5579 | ||
|
|
d7f40357e3 | ||
|
|
c937b73622 | ||
|
|
588cb0eade | ||
|
|
49de87132f | ||
|
|
48e4a3231b | ||
|
|
b454977909 | ||
|
|
3a68622dda | ||
|
|
370af25eff | ||
|
|
23960e92df | ||
|
|
2d456fc35a | ||
|
|
bb84984f3f | ||
|
|
50fe85f016 | ||
|
|
04cf72287b | ||
|
|
1390ce4142 | ||
|
|
b1c63dc362 | ||
|
|
c7d9397fc9 | ||
|
|
58b4198ed8 | ||
|
|
d764409d97 | ||
|
|
b5988004d6 | ||
|
|
9d72bf8835 | ||
|
|
e3c07782d1 | ||
|
|
c54287eafe | ||
|
|
8b5aa91aa7 | ||
|
|
5cabd47394 | ||
|
|
310e605995 | ||
|
|
0832956089 | ||
|
|
9840368cad | ||
|
|
6980544467 | ||
|
|
b803fb95cb | ||
|
|
db0d865ec4 | ||
|
|
052cefe1bd | ||
|
|
d300b4383d | ||
|
|
68174bdc7d | ||
|
|
c791e94aee | ||
|
|
b52e711910 | ||
|
|
11ae2d1e7a | ||
|
|
dc719e6ba5 | ||
|
|
ae55e79541 | ||
|
|
dca43ef795 | ||
|
|
7276e194ee | ||
|
|
0064599a27 | ||
|
|
6cecad2be0 | ||
|
|
cce31b739c | ||
|
|
6fca1b82ae | ||
|
|
de8f2d061c | ||
|
|
e18c93169c | ||
|
|
0748331b70 | ||
|
|
03162f8f47 | ||
|
|
ef2d4a2da9 | ||
|
|
b69e469328 | ||
|
|
49ce8b57dd | ||
|
|
20675feeab | ||
|
|
05bb644890 | ||
|
|
fdea084c36 | ||
|
|
37d1b1cafd | ||
|
|
a33fb2d287 | ||
|
|
2b3b6c9b34 | ||
|
|
4ada6db1fc | ||
|
|
9811815429 | ||
|
|
18c321308d | ||
|
|
b90c00e63f | ||
|
|
922697c8b2 | ||
|
|
6dca5c9099 | ||
|
|
9088dee9e2 | ||
|
|
fa72ae1e9c | ||
|
|
c8bfb11b34 | ||
|
|
7ba1fd2029 | ||
|
|
120f00c04f | ||
|
|
2d54312f87 | ||
|
|
78d84f5631 | ||
|
|
2167bf6b72 | ||
|
|
70dee0f8ca | ||
|
|
e136532800 | ||
|
|
74166f2f44 | ||
|
|
1bdceb421f | ||
|
|
d822bf32e4 | ||
|
|
fa95f4be3f | ||
|
|
80b5c71684 | ||
|
|
e3daee919d | ||
|
|
ea9c35d3cc | ||
|
|
30d051ff14 | ||
|
|
b6780b9e10 | ||
|
|
b602d2dfdf | ||
|
|
b90787290d | ||
|
|
089c41a0c2 | ||
|
|
ca0b23c831 | ||
|
|
5cb6c42088 | ||
|
|
8cd646b6af | ||
|
|
e48bd8c8b5 | ||
|
|
458820df6c | ||
|
|
6b8bb8d74a | ||
|
|
84c4631221 | ||
|
|
a4c63c6e8e | ||
|
|
85793fa438 | ||
|
|
e2f16b9cae | ||
|
|
5168f9bb00 | ||
|
|
9d3bee50ad | ||
|
|
17f39049cf | ||
|
|
43fa1c20e7 | ||
|
|
928cce5922 | ||
|
|
fcec32a2c5 | ||
|
|
f0d6318dd1 | ||
|
|
ddb78dfc3d | ||
|
|
46f0cb0869 | ||
|
|
7a3e715980 | ||
|
|
58fc420b36 | ||
|
|
4ddd5ff39c | ||
|
|
889ef564fd | ||
|
|
345a95afe9 | ||
|
|
651ab439cf | ||
|
|
d6f586d0ea | ||
|
|
e8475bbd5b | ||
|
|
2d2e28d02c | ||
|
|
0ca0a4da9f | ||
|
|
da0a6b6499 | ||
|
|
982399bb14 | ||
|
|
c6120352b3 | ||
|
|
b505f9eaf5 | ||
|
|
9e51abc7dc | ||
|
|
f848a45739 | ||
|
|
4eb637c799 | ||
|
|
8688e83194 | ||
|
|
f8aadf14c3 | ||
|
|
287d0ef41c | ||
|
|
e771e59178 | ||
|
|
39f50db731 | ||
|
|
4db4b61380 | ||
|
|
81de538e46 | ||
|
|
b90daaaf6c | ||
|
|
6e2eaaec96 | ||
|
|
d9d6ff9f8e | ||
|
|
8291f6d968 | ||
|
|
9e4ffc43a2 | ||
|
|
3eba483692 | ||
|
|
151f10dbc7 | ||
|
|
83424eb71b | ||
|
|
db2275cb99 | ||
|
|
1029716a8a | ||
|
|
e4d4969ae9 | ||
|
|
5b527901ae | ||
|
|
04be39734f | ||
|
|
0f8d3c871b | ||
|
|
52d20ef124 | ||
|
|
1440419b45 | ||
|
|
1d2460ee5d | ||
|
|
f96d2dea26 | ||
|
|
4b9e7f59ca | ||
|
|
3c5619c7e4 | ||
|
|
530b27df1e | ||
|
|
5144f750c4 | ||
|
|
b1eed6b586 | ||
|
|
11a8dc76d6 | ||
|
|
ab5c6bb3a3 | ||
|
|
d87549c1c7 | ||
|
|
8463f27d8c | ||
|
|
18bbcb1214 | ||
|
|
a33b561a6b | ||
|
|
eb268a7f95 | ||
|
|
dfffd92568 | ||
|
|
760264bffe | ||
|
|
dc528128cc | ||
|
|
44409f52c1 | ||
|
|
b7f008fc35 | ||
|
|
9311ab76a5 | ||
|
|
5bf939885a | ||
|
|
1f285cf556 | ||
|
|
221c79013f | ||
|
|
f0856fd905 | ||
|
|
92d599c6a7 | ||
|
|
e932c40f8e | ||
|
|
1b43fbd8e4 | ||
|
|
13b089c890 | ||
|
|
f1b3a418fa | ||
|
|
439823ae80 | ||
|
|
7ef574e5d0 | ||
|
|
32282abcea | ||
|
|
15ff877438 | ||
|
|
0f133ae8d2 | ||
|
|
dfbf520ec2 | ||
|
|
62412c5874 | ||
|
|
cec2be64f3 | ||
|
|
b87b9c0d1f | ||
|
|
0e0041b2b6 | ||
|
|
0e38578433 | ||
|
|
d47e03fccd | ||
|
|
ed4de220d2 | ||
|
|
ebfe57166d | ||
|
|
4578a490ce | ||
|
|
fbedf6056e | ||
|
|
607a2f01e6 | ||
|
|
95304172a5 | ||
|
|
a864aca44c | ||
|
|
8d06842a76 | ||
|
|
89cd0f57b1 | ||
|
|
ef9e2c8e73 | ||
|
|
25d217684b | ||
|
|
f4fe3bd5b1 | ||
|
|
db1a4227a3 | ||
|
|
c28b8eb699 | ||
|
|
6f044ab39c | ||
|
|
d34fa9a6cc | ||
|
|
846b53bde4 | ||
|
|
5c0770ac84 | ||
|
|
1b62c2eba3 | ||
|
|
d1d0271996 | ||
|
|
7f384d9c1b | ||
|
|
896c0b92f3 | ||
|
|
5818e8eeaf | ||
|
|
025086edea | ||
|
|
ed1db42915 | ||
|
|
deb75bb414 | ||
|
|
116e939d57 | ||
|
|
55b84357a1 | ||
|
|
cf2bb91ec8 | ||
|
|
699073c337 | ||
|
|
cb44aa03b8 | ||
|
|
2bcd65ecf6 | ||
|
|
e1a6fb7870 | ||
|
|
08c53923db | ||
|
|
714b7256cd | ||
|
|
0399365675 | ||
|
|
2fd22c6360 | ||
|
|
c680f835c9 | ||
|
|
f450c8ea2f | ||
|
|
800a6ff845 | ||
|
|
78c72bf10e | ||
|
|
991a130b1e | ||
|
|
e6899794ae | ||
|
|
33efb52e02 | ||
|
|
3fae65d4cc | ||
|
|
4c20a08293 | ||
|
|
1a67154d41 | ||
|
|
0f827cc607 | ||
|
|
2135e7c041 | ||
|
|
6f82a78de7 | ||
|
|
6f91f02f75 | ||
|
|
9590009a74 | ||
|
|
f797cb5855 | ||
|
|
a5ceb5bc0b | ||
|
|
d4879b4dfe | ||
|
|
22d3587f3b | ||
|
|
928a7c06dc |
644
COPYING
644
COPYING
@@ -1,221 +1,397 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
the Library or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
@@ -225,116 +401,104 @@ impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
|
||||
14
Makefile.am
14
Makefile.am
@@ -1,6 +1,6 @@
|
||||
SUBDIRS = externals src scripts corepkgs doc misc tests
|
||||
EXTRA_DIST = substitute.mk nix.spec nix.spec.in bootstrap.sh \
|
||||
svn-revision nix.conf.example
|
||||
svn-revision nix.conf.example NEWS
|
||||
|
||||
include ./substitute.mk
|
||||
|
||||
@@ -14,9 +14,9 @@ relname:
|
||||
|
||||
install-data-local: init-state
|
||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
||||
$(INSTALL_DATA) nix.conf.example $(DESTDIR)$(sysconfdir)/nix
|
||||
$(INSTALL_DATA) $(srcdir)/nix.conf.example $(DESTDIR)$(sysconfdir)/nix
|
||||
if ! test -e $(DESTDIR)$(sysconfdir)/nix/nix.conf; then \
|
||||
$(INSTALL_DATA) nix.conf.example $(DESTDIR)$(sysconfdir)/nix/nix.conf; \
|
||||
$(INSTALL_DATA) $(srcdir)/nix.conf.example $(DESTDIR)$(sysconfdir)/nix/nix.conf; \
|
||||
fi
|
||||
|
||||
if INIT_STATE
|
||||
@@ -36,7 +36,8 @@ init-state:
|
||||
$(INSTALL) $(INIT_FLAGS) $(GROUP_WRITABLE) -d $(DESTDIR)$(localstatedir)/nix/gcroots/channels
|
||||
rm -f $(DESTDIR)$(localstatedir)/nix/gcroots/profiles
|
||||
ln -s $(localstatedir)/nix/profiles $(DESTDIR)$(localstatedir)/nix/gcroots/profiles
|
||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(prefix)/store
|
||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/userpool
|
||||
$(INSTALL) $(INIT_FLAGS) -m 1777 -d $(DESTDIR)$(prefix)/store
|
||||
$(INSTALL) $(INIT_FLAGS) $(GROUP_WRITABLE) -d $(DESTDIR)$(localstatedir)/nix/manifests
|
||||
# $(bindir)/nix-store --init
|
||||
else
|
||||
@@ -45,3 +46,8 @@ endif
|
||||
|
||||
svn-revision:
|
||||
svnversion . > svn-revision
|
||||
|
||||
all-local: NEWS
|
||||
|
||||
NEWS: doc/manual/NEWS.txt
|
||||
cp $(srcdir)/doc/manual/NEWS.txt NEWS
|
||||
|
||||
261
NEWS
261
NEWS
@@ -1,261 +0,0 @@
|
||||
Version 0.9
|
||||
|
||||
* Unpacking of patch sequences is much faster now by not doing
|
||||
redundant unpacking and repacking of intermediate paths.
|
||||
|
||||
|
||||
Version 0.8 (April 11, 2005)
|
||||
|
||||
NOTE: the hashing scheme in Nix 0.8 changed (as detailed below). As a
|
||||
result, `nix-pull' manifests and channels built for Nix 0.7 and below
|
||||
will now work anymore. However, the Nix expression language has not
|
||||
changed, so you can still build from source. Also, existing user
|
||||
environments continue to work. Nix 0.8 will automatically upgrade the
|
||||
database schema of previous installations when it is first run.
|
||||
|
||||
If you get the error message
|
||||
|
||||
you have an old-style manifest `/nix/var/nix/manifests/[...]';
|
||||
please delete it
|
||||
|
||||
you should delete previously downloaded manifests:
|
||||
|
||||
$ rm /nix/var/nix/manifests/*
|
||||
|
||||
If `nix-channel' gives the error message
|
||||
|
||||
manifest `http://catamaran.labs.cs.uu.nl/dist/nix/channels/[channel]/MANIFEST'
|
||||
is too old (i.e., for Nix <= 0.7)
|
||||
|
||||
then you should unsubscribe from the offending channel (`nix-channel
|
||||
--remove URL'; leave out `/MANIFEST'), and subscribe to the same URL,
|
||||
with `channels' replaced by `channels-v3' (e.g.,
|
||||
http://catamaran.labs.cs.uu.nl/dist/nix/channels-v3/nixpkgs-unstable).
|
||||
|
||||
Nix 0.8 has the following improvements:
|
||||
|
||||
* The cryptographic hashes used in store paths are now 160 bits long,
|
||||
but encoded in base-32 so that they are still only 32 characters
|
||||
long (e.g., /nix/store/csw87wag8bqlqk7ipllbwypb14xainap-atk-1.9.0).
|
||||
(This is actually a 160 bit truncation of a SHA-256 hash.)
|
||||
|
||||
* Big cleanups and simplifications of the basic store semantics. The
|
||||
notion of "closure store expressions" is gone (and so is the notion
|
||||
of "successors"); the file system references of a store path are now
|
||||
just stored in the database.
|
||||
|
||||
For instance, given any store path, you can query its closure:
|
||||
|
||||
$ nix-store -qR $(which firefox)
|
||||
... lots of paths ...
|
||||
|
||||
Also, Nix now remembers for each store path the derivation that
|
||||
built it (the "deriver"):
|
||||
|
||||
$ nix-store -qR $(which firefox)
|
||||
/nix/store/4b0jx7vq80l9aqcnkszxhymsf1ffa5jd-firefox-1.0.1.drv
|
||||
|
||||
So to see the build-time dependencies, you can do
|
||||
|
||||
$ nix-store -qR $(nix-store -qd $(which firefox))
|
||||
|
||||
or, in a nicer format:
|
||||
|
||||
$ nix-store -q --tree $(nix-store -qd $(which firefox))
|
||||
|
||||
File system references are also stored in reverse. For instance,
|
||||
you can query all paths that directly or indirectly use a certain
|
||||
Glibc:
|
||||
|
||||
$ nix-store -q --referers-closure \
|
||||
/nix/store/8lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4
|
||||
|
||||
* The concept of fixed-output derivations has been formalised.
|
||||
Previously, functions such as `fetchurl' in Nixpkgs used a hack
|
||||
(namely, explicitly specifying a store path hash) to prevent changes
|
||||
to, say, the URL of the file from propagating upwards through the
|
||||
dependency graph, causing rebuilds of everything. This can now be
|
||||
done cleanly by specifying the `outputHash' and `outputHashAlgo'
|
||||
attributes. Nix itself checks that the content of the output has
|
||||
the specified hash. (This is important for maintaining certain
|
||||
invariants necessary for future work on secure shared stores.)
|
||||
|
||||
* One-click installation :-) It is now possible to install any
|
||||
top-level component in Nixpkgs directly, through the web - see,
|
||||
e.g., http://catamaran.labs.cs.uu.nl/dist/nixpkgs-0.8/. All you
|
||||
have to do is associate `/nix/bin/nix-install-package' with the MIME
|
||||
type `application/nix-package' (or the extension `.nixpkg'), and
|
||||
clicking on a package link will cause it to be installed, with all
|
||||
appropriate dependencies. If you just want to install some specific
|
||||
application, this is easier than subscribing to a channel.
|
||||
|
||||
* `nix-store -r PATHS' now builds all the derivations PATHS in
|
||||
parallel. Previously it did them sequentially (though exploiting
|
||||
possible parallelism between subderivations). This is nice for
|
||||
build farms.
|
||||
|
||||
* `nix-channel' has new operations `--list' and `--remove'.
|
||||
|
||||
* New ways of installing components into user environments:
|
||||
|
||||
- Copy from another user environment:
|
||||
|
||||
$ nix-env -i --from-profile .../other-profile firefox
|
||||
|
||||
- Install a store derivation directly (bypassing the Nix expression
|
||||
language entirely):
|
||||
|
||||
$ nix-env -i /nix/store/z58v41v21xd3...-aterm-2.3.1.drv
|
||||
|
||||
(This is used to implement `nix-install-package', which is
|
||||
therefore immune to evolution in the Nix expression language.)
|
||||
|
||||
- Install an already built store path directly:
|
||||
|
||||
$ nix-env -i /nix/store/hsyj5pbn0d9i...-aterm-2.3.1
|
||||
|
||||
- Install the result of a Nix expression specified as a command-line
|
||||
argument:
|
||||
|
||||
$ nix-env -f .../i686-linux.nix -i -E 'x: x.firefoxWrapper'
|
||||
|
||||
The difference with the normal installation mode is that `-E' does
|
||||
not use the `name' attributes of derivations. Therefore, this can
|
||||
be used to disambiguate multiple derivations with the same name.
|
||||
|
||||
* A hash of the contents of a store path is now stored in the database
|
||||
after a succesful build. This allows you to check whether store
|
||||
paths have been tampered with: `nix-store --verify --check-contents'.
|
||||
|
||||
* Implemented a concurrent garbage collector. It is now always safe
|
||||
to run the garbage collector, even if other Nix operations are
|
||||
happening simultaneously.
|
||||
|
||||
However, there can still be GC races if you use `nix-instantiate'
|
||||
and `nix-store -r' directly to build things. To prevent races, use
|
||||
the `--add-root' flag of those commands.
|
||||
|
||||
* The garbage collector now finally deletes paths in the right order
|
||||
(i.e., topologically sorted under the `references' relation), thus
|
||||
making it safe to interrupt the collector without risking a store
|
||||
that violates the closure invariant.
|
||||
|
||||
* Likewise, the substitute mechanism now downloads files in the right
|
||||
order, thus preserving the closure invariant at all times.
|
||||
|
||||
* The result of `nix-build' is now registered as a root of the garbage
|
||||
collector. If the `./result' link is deleted, the GC root
|
||||
disappears automatically.
|
||||
|
||||
* The behaviour of the garbage collector can be changed globally by
|
||||
setting options in `/nix/etc/nix/nix.conf'.
|
||||
|
||||
- `gc-keep-derivations' specifies whether deriver links should be
|
||||
followed when searching for live paths.
|
||||
|
||||
- `gc-keep-outputs' specifies whether outputs of derivations should
|
||||
be followed when searching for live paths.
|
||||
|
||||
- `env-keep-derivations' specifies whether user environments should
|
||||
store the paths of derivations when they are added (thus keeping
|
||||
the derivations alive).
|
||||
|
||||
* New `nix-env' query flags `--drv-path' and `--out-path'.
|
||||
|
||||
* `fetchurl' allows SHA-1 and SHA-256 in addition to MD5. Just
|
||||
specify the attribute `sha1' or `sha256' instead of `md5'.
|
||||
|
||||
* Manual updates.
|
||||
|
||||
|
||||
Version 0.7 (January 12, 2005)
|
||||
|
||||
* Binary patching. When upgrading components using pre-built binaries
|
||||
(through nix-pull / nix-channel), Nix can automatically download and
|
||||
apply binary patches to already installed components instead of full
|
||||
downloads. Patching is "smart": if there is a *sequence* of patches
|
||||
to an installed component, Nix will use it. Patches are currently
|
||||
generated automatically between Nixpkgs (pre-)releases.
|
||||
|
||||
* Simplifications to the substitute mechanism.
|
||||
|
||||
* Nix-pull now stores downloaded manifests in /nix/var/nix/manifests.
|
||||
|
||||
* Metadata on files in the Nix store is canonicalised after builds:
|
||||
the last-modified timestamp is set to 0 (00:00:00 1/1/1970), the
|
||||
mode is set to 0444 or 0555 (readable and possibly executable by
|
||||
all; setuid/setgid bits are dropped), and the group is set to the
|
||||
default. This ensures that the result of a build and an
|
||||
installation through a substitute is the same; and that timestamp
|
||||
dependencies are revealed.
|
||||
|
||||
|
||||
Version 0.6 (November 14, 2004)
|
||||
|
||||
Major changes include the following:
|
||||
|
||||
* Rewrite of the normalisation engine.
|
||||
|
||||
* Multiple builds can now be performed in parallel (option `-j').
|
||||
|
||||
* Distributed builds. Nix can now call a shell script to forward
|
||||
builds to Nix installations on remote machines, which may or may
|
||||
not be of the same platform type.
|
||||
|
||||
* Option `--fallback' allows recovery from broken substitutes.
|
||||
|
||||
* Option `--keep-going' causes building of other (unaffected)
|
||||
derivations to continue if one failed.
|
||||
|
||||
* Improvements to the garbage collector (i.e., it should actually work
|
||||
now).
|
||||
|
||||
* Setuid Nix installations allow a Nix store to be shared among
|
||||
multiple users.
|
||||
|
||||
* Substitute registration is much faster now.
|
||||
|
||||
* A utility `nix-build' to build a Nix expression and create a symlink
|
||||
to the result int the current directory; useful for testing Nix
|
||||
derivations.
|
||||
|
||||
* Manual updates.
|
||||
|
||||
* `nix-env' changes:
|
||||
|
||||
* Derivations for other platforms are filtered out (which can be
|
||||
overriden using `--system-filter').
|
||||
|
||||
* `--install' by default now uninstall previous derivations with the
|
||||
same name.
|
||||
|
||||
* `--upgrade' allows upgrading to a specific version.
|
||||
|
||||
* New operation `--delete-generations' to remove profile
|
||||
generations (necessary for effective garbage collection).
|
||||
|
||||
* Nicer output (sorted, columnised).
|
||||
|
||||
* More sensible verbosity levels all around (builder output is now
|
||||
shown always, unless `-Q' is given).
|
||||
|
||||
* Nix expression language changes:
|
||||
|
||||
* New language construct: `with E1; E2' brings all attributes
|
||||
defined in the attribute set E1 in scope in E2.
|
||||
|
||||
* Added a `map' function.
|
||||
|
||||
* Various new operators (e.g., string concatenation).
|
||||
|
||||
* Expression evaluation is much faster.
|
||||
|
||||
* An Emacs mode for editing Nix expressions (with syntax highlighting
|
||||
and indentation) has been added.
|
||||
|
||||
* Many bug fixes.
|
||||
|
||||
|
||||
Version 0.5 and earlier
|
||||
|
||||
Please refer to the Subversion commit log messages.
|
||||
184
aterm-gc.supp
Normal file
184
aterm-gc.supp
Normal file
@@ -0,0 +1,184 @@
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:AT_isValidSymbol
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_isValidSymbol
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_isInsideValidTerm
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:AT_isInsideValidTerm
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_markTerm_young
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:AT_markTerm_young
|
||||
fun:mark_memory_young
|
||||
fun:mark_phase_young
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:AT_isValidSymbol
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_isValidSymbol
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_isInsideValidTerm
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:AT_isInsideValidTerm
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:AT_markTerm
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_markTerm
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:AT_markTerm
|
||||
fun:mark_memory
|
||||
fun:mark_phase
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Cond
|
||||
fun:mark_phase_young
|
||||
fun:AT_collect_minor
|
||||
}
|
||||
|
||||
{
|
||||
ATerm library conservatively scans for GC roots
|
||||
Memcheck:Value4
|
||||
fun:mark_phase_young
|
||||
fun:AT_collect_minor
|
||||
}
|
||||
|
||||
{
|
||||
<insert a suppression name here>
|
||||
Memcheck:Cond
|
||||
fun:AT_isValidSymbol
|
||||
fun:mark_phase_young
|
||||
fun:AT_collect_minor
|
||||
}
|
||||
|
||||
{
|
||||
<insert a suppression name here>
|
||||
Memcheck:Value4
|
||||
fun:AT_isValidSymbol
|
||||
fun:mark_phase_young
|
||||
fun:AT_collect_minor
|
||||
}
|
||||
|
||||
{
|
||||
<insert a suppression name here>
|
||||
Memcheck:Value4
|
||||
fun:AT_isInsideValidTerm
|
||||
fun:mark_phase_young
|
||||
fun:AT_collect_minor
|
||||
}
|
||||
|
||||
{
|
||||
<insert a suppression name here>
|
||||
Memcheck:Cond
|
||||
fun:AT_isInsideValidTerm
|
||||
fun:mark_phase_young
|
||||
fun:AT_collect_minor
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
#! /bin/sh -e
|
||||
mkdir -p config
|
||||
libtoolize --copy
|
||||
aclocal
|
||||
autoheader
|
||||
automake --add-missing --copy
|
||||
|
||||
115
configure.ac
115
configure.ac
@@ -1,25 +1,28 @@
|
||||
AC_INIT(nix, "0.9")
|
||||
AC_INIT(nix, 0.10)
|
||||
AC_CONFIG_SRCDIR(README)
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
|
||||
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
|
||||
|
||||
# Change to `1' to produce a `stable' release (i.e., the `preREVISION'
|
||||
# suffix is not added).
|
||||
STABLE=0
|
||||
STABLE=1
|
||||
|
||||
# Put the revision number in the version.
|
||||
if test "$STABLE" != "1"; then
|
||||
if REVISION=`test -d $srcdir/.svn && svnversion $srcdir 2> /dev/null`; then
|
||||
VERSION="${VERSION}pre${REVISION}"
|
||||
VERSION=${VERSION}pre${REVISION}
|
||||
elif REVISION=`cat $srcdir/svn-revision 2> /dev/null`; then
|
||||
VERSION="${VERSION}pre${REVISION}"
|
||||
VERSION=${VERSION}pre${REVISION}
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(NIX_VERSION, ["$(echo $VERSION)"], [version])
|
||||
|
||||
AC_PREFIX_DEFAULT(/nix)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
|
||||
# Construct a Nix system name (like "i686-linux").
|
||||
AC_MSG_CHECKING([for the canonical Nix system name])
|
||||
cpu_name=$(uname -p | tr 'A-Z ' 'a-z_')
|
||||
@@ -29,6 +32,9 @@ case $machine_name in
|
||||
i*86)
|
||||
machine_name=i686
|
||||
;;
|
||||
ppc)
|
||||
machine_name=powerpc
|
||||
;;
|
||||
*)
|
||||
if test "$cpu_name" != "unknown"; then
|
||||
machine_name=$cpu_name
|
||||
@@ -37,6 +43,13 @@ case $machine_name in
|
||||
esac
|
||||
|
||||
sys_name=$(uname -s | tr 'A-Z ' 'a-z_')
|
||||
|
||||
case $sys_name in
|
||||
cygwin*)
|
||||
sys_name=cygwin
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
|
||||
[platform identifier (e.g., `i686-linux')]),
|
||||
system=$withval, system="${machine_name}-${sys_name}")
|
||||
@@ -44,9 +57,32 @@ AC_MSG_RESULT($system)
|
||||
AC_SUBST(system)
|
||||
AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier (`cpu-os')])
|
||||
|
||||
|
||||
# Windows-specific stuff.
|
||||
if test "$sys_name" = "cygwin"; then
|
||||
# We cannot delete open files.
|
||||
AC_DEFINE(CANNOT_DELETE_OPEN_FILES, 1, [Whether it is impossible to delete open files.])
|
||||
|
||||
# Shared libraries don't work, currently.
|
||||
AC_DISABLE_SHARED
|
||||
AC_ENABLE_STATIC
|
||||
fi
|
||||
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_RANLIB
|
||||
|
||||
|
||||
# We are going to use libtool.
|
||||
AC_DISABLE_STATIC
|
||||
AC_ENABLE_SHARED
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
|
||||
# Use 64-bit file system calls so that we can support files > 2 GiB.
|
||||
CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
|
||||
CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
|
||||
|
||||
|
||||
# Check for pubsetbuf.
|
||||
AC_MSG_CHECKING([for pubsetbuf])
|
||||
@@ -59,11 +95,13 @@ static char buf[1024];]],
|
||||
AC_MSG_RESULT(no))
|
||||
AC_LANG_POP(C++)
|
||||
|
||||
|
||||
# Check for <locale>
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_CHECK_HEADERS([locale])
|
||||
AC_LANG_POP(C++)
|
||||
|
||||
|
||||
AC_DEFUN([NEED_PROG],
|
||||
[
|
||||
AC_PATH_PROG($1, $2)
|
||||
@@ -73,15 +111,17 @@ fi
|
||||
])
|
||||
|
||||
NEED_PROG(curl, curl)
|
||||
NEED_PROG(bzip2, bzip2)
|
||||
NEED_PROG(bunzip2, bunzip2)
|
||||
NEED_PROG(shell, sh)
|
||||
NEED_PROG(patch, patch)
|
||||
AC_PATH_PROG(xmllint, xmllint, false)
|
||||
AC_PATH_PROG(xsltproc, xsltproc, false)
|
||||
AC_PATH_PROG(jing, jing, false) # needed because xmllint --relaxng seems broken
|
||||
AC_PATH_PROG(w3m, w3m, false)
|
||||
AC_PATH_PROG(flex, flex, false)
|
||||
AC_PATH_PROG(bison, bison, false)
|
||||
NEED_PROG(perl, perl)
|
||||
NEED_PROG(tar, tar)
|
||||
AC_PATH_PROG(dot, dot)
|
||||
|
||||
NEED_PROG(cat, cat)
|
||||
AC_ARG_WITH(coreutils-bin, AC_HELP_STRING([--with-coreutils-bin=PATH],
|
||||
@@ -89,10 +129,10 @@ AC_ARG_WITH(coreutils-bin, AC_HELP_STRING([--with-coreutils-bin=PATH],
|
||||
coreutils=$withval, coreutils=$(dirname $cat))
|
||||
AC_SUBST(coreutils)
|
||||
|
||||
AC_ARG_WITH(docbook-catalog, AC_HELP_STRING([--with-docbook-catalog=PATH],
|
||||
[path of the DocBook XML DTD]),
|
||||
docbookcatalog=$withval, docbookcatalog=/docbook-dtd-missing)
|
||||
AC_SUBST(docbookcatalog)
|
||||
AC_ARG_WITH(docbook-rng, AC_HELP_STRING([--with-docbook-rng=PATH],
|
||||
[path of the DocBook RelaxNG schema]),
|
||||
docbookrng=$withval, docbookrng=/docbook-rng-missing)
|
||||
AC_SUBST(docbookrng)
|
||||
|
||||
AC_ARG_WITH(docbook-xsl, AC_HELP_STRING([--with-docbook-xsl=PATH],
|
||||
[path of the DocBook XSL stylesheets]),
|
||||
@@ -140,14 +180,52 @@ AC_SUBST(aterm_lib)
|
||||
AC_SUBST(aterm_include)
|
||||
AC_SUBST(aterm_bin)
|
||||
|
||||
AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl=PATH],
|
||||
[prefix of the OpenSSL library]),
|
||||
openssl=$withval, openssl=)
|
||||
AM_CONDITIONAL(HAVE_OPENSSL, test -n "$openssl")
|
||||
if test -n "$openssl"; then
|
||||
LDFLAGS="-L$openssl/lib -lcrypto $LDFLAGS"
|
||||
CFLAGS="-I$openssl/include $CFLAGS"
|
||||
CXXFLAGS="-I$openssl/include $CXXFLAGS"
|
||||
AC_DEFINE(HAVE_OPENSSL, 1, [whether to use OpenSSL])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH],
|
||||
[prefix of bzip2]),
|
||||
bzip2=$withval, bzip2=)
|
||||
AM_CONDITIONAL(HAVE_BZIP2, test -n "$bzip2")
|
||||
if test -z "$bzip2"; then
|
||||
# Headers and libraries will be used from the temporary installation
|
||||
# in externals/inst-bzip2.
|
||||
bzip2_lib='-L${top_builddir}/externals/inst-bzip2/lib -lbz2'
|
||||
bzip2_include='-I${top_builddir}/externals/inst-bzip2/include'
|
||||
# The binary will be copied to $libexecdir.
|
||||
bzip2_bin='${libexecdir}'
|
||||
# But for testing, we have to use the temporary copy :-(
|
||||
bzip2_bin_test='${top_builddir}/externals/inst-bzip2/bin'
|
||||
else
|
||||
bzip2_lib="-L$bzip2/lib -lbz2"
|
||||
bzip2_include="-I$bzip2/include"
|
||||
bzip2_bin="$bzip2/bin"
|
||||
bzip2_bin_test="$bzip2/bin"
|
||||
fi
|
||||
AC_SUBST(bzip2_lib)
|
||||
AC_SUBST(bzip2_include)
|
||||
AC_SUBST(bzip2_bin)
|
||||
AC_SUBST(bzip2_bin_test)
|
||||
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_mutex_init)
|
||||
|
||||
|
||||
AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
|
||||
[do not initialise DB etc. in `make install']),
|
||||
init_state=$enableval, init_state=yes)
|
||||
AM_CONDITIONAL(INIT_STATE, test "$init_state" = "yes")
|
||||
|
||||
|
||||
# Setuid installations.
|
||||
AC_ARG_ENABLE(setuid, AC_HELP_STRING([--enable-setuid],
|
||||
[install Nix setuid]),
|
||||
setuid_hack=$enableval, setuid_hack=no)
|
||||
@@ -175,6 +253,13 @@ AC_SUBST(NIX_GROUP)
|
||||
AC_DEFINE_UNQUOTED(NIX_GROUP, ["$NIX_GROUP"], [Nix group])
|
||||
|
||||
|
||||
# This is needed if ATerm, Berkeley DB or bzip2 are static libraries,
|
||||
# and the Nix libraries are dynamic.
|
||||
if test "$(uname)" = "Darwin"; then
|
||||
LDFLAGS="-all_load $LDFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
AM_CONFIG_HEADER([config.h])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
externals/Makefile
|
||||
@@ -190,8 +275,8 @@ AC_CONFIG_FILES([Makefile
|
||||
src/libexpr/Makefile
|
||||
src/nix-instantiate/Makefile
|
||||
src/nix-env/Makefile
|
||||
src/log2xml/Makefile
|
||||
src/bsdiff-4.2/Makefile
|
||||
src/nix-log2xml/Makefile
|
||||
src/bsdiff-4.3/Makefile
|
||||
scripts/Makefile
|
||||
corepkgs/Makefile
|
||||
corepkgs/nar/Makefile
|
||||
|
||||
@@ -3,7 +3,7 @@ all-local: builder.pl
|
||||
install-exec-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||
$(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||
$(INSTALL_DATA) $(srcdir)/default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||
$(INSTALL_PROGRAM) builder.pl $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||
|
||||
include ../../substitute.mk
|
||||
|
||||
@@ -10,11 +10,15 @@ my $out = $ENV{"out"};
|
||||
mkdir "$out", 0755 || die "error creating $out";
|
||||
|
||||
|
||||
my $symlinks = 0;
|
||||
|
||||
|
||||
# For each activated package, create symlinks.
|
||||
|
||||
sub createLinks {
|
||||
my $srcDir = shift;
|
||||
my $dstDir = shift;
|
||||
my $ignoreCollisions = shift;
|
||||
|
||||
my @srcFiles = glob("$srcDir/*");
|
||||
|
||||
@@ -22,10 +26,12 @@ sub createLinks {
|
||||
my $baseName = $srcFile;
|
||||
$baseName =~ s/^.*\///g; # strip directory
|
||||
my $dstFile = "$dstDir/$baseName";
|
||||
|
||||
|
||||
# Urgh, hacky...
|
||||
if ($srcFile =~ /\/propagated-build-inputs$/ ||
|
||||
$srcFile =~ /\/nix-support$/ ||
|
||||
$srcFile =~ /\/perllocal.pod$/ ||
|
||||
$srcFile =~ /\/info\/dir$/ ||
|
||||
$srcFile =~ /\/log$/)
|
||||
{
|
||||
# Do nothing.
|
||||
@@ -36,7 +42,7 @@ sub createLinks {
|
||||
lstat $dstFile;
|
||||
|
||||
if (-d _) {
|
||||
createLinks($srcFile, $dstFile);
|
||||
createLinks($srcFile, $dstFile, $ignoreCollisions);
|
||||
}
|
||||
|
||||
elsif (-l _) {
|
||||
@@ -47,62 +53,82 @@ sub createLinks {
|
||||
unlink $dstFile or die "error unlinking `$dstFile': $!";
|
||||
mkdir $dstFile, 0755 ||
|
||||
die "error creating directory `$dstFile': $!";
|
||||
createLinks($target, $dstFile);
|
||||
createLinks($srcFile, $dstFile);
|
||||
createLinks($target, $dstFile, $ignoreCollisions);
|
||||
createLinks($srcFile, $dstFile, $ignoreCollisions);
|
||||
}
|
||||
|
||||
else {
|
||||
symlink($srcFile, $dstFile) ||
|
||||
die "error creating link `$dstFile': $!";
|
||||
$symlinks++;
|
||||
}
|
||||
}
|
||||
|
||||
elsif (-l $dstFile) {
|
||||
my $target = readlink $dstFile;
|
||||
die "collission between `$srcFile' and `$target'";
|
||||
if (!$ignoreCollisions) {
|
||||
my $target = readlink $dstFile;
|
||||
die "collission between `$srcFile' and `$target'";
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
# print "linking $dstFile to $srcFile\n";
|
||||
symlink($srcFile, $dstFile) ||
|
||||
die "error creating link `$dstFile': $!";
|
||||
$symlinks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my %done;
|
||||
my %postponed;
|
||||
|
||||
sub addPkg;
|
||||
sub addPkg {
|
||||
my $pkgDir = shift;
|
||||
my $ignoreCollisions = shift;
|
||||
|
||||
return if (defined $done{$pkgDir});
|
||||
$done{$pkgDir} = 1;
|
||||
|
||||
print "adding $pkgDir\n";
|
||||
createLinks("$pkgDir", "$out");
|
||||
# print "symlinking $pkgDir\n";
|
||||
createLinks("$pkgDir", "$out", $ignoreCollisions);
|
||||
|
||||
my $propagatedFN = "$pkgDir/nix-support/propagated-build-inputs";
|
||||
my $propagatedFN = "$pkgDir/nix-support/propagated-user-env-packages";
|
||||
if (-e $propagatedFN) {
|
||||
open PROP, "<$propagatedFN" or die;
|
||||
my $propagated = <PROP>;
|
||||
close PROP;
|
||||
my @propagated = split ' ', $propagated;
|
||||
foreach my $p (@propagated) {
|
||||
addPkg $p;
|
||||
$postponed{$p} = 1 unless defined $done{$p};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Symlink to the packages that have been installed explicitly by the user.
|
||||
my @args = split ' ', $ENV{"derivations"};
|
||||
|
||||
while (scalar @args > 0) {
|
||||
my $drvPath = shift @args;
|
||||
addPkg($drvPath);
|
||||
foreach my $pkgDir (sort @args) {
|
||||
addPkg($pkgDir, 0);
|
||||
}
|
||||
|
||||
|
||||
# Symlink to the packages that have been "propagated" by packages
|
||||
# installed by the user (i.e., package X declares that it want Y
|
||||
# installed as well). We do these later because they have a lower
|
||||
# priority in case of collisions.
|
||||
while (scalar(keys %postponed) > 0) {
|
||||
my @pkgDirs = keys %postponed;
|
||||
%postponed = ();
|
||||
foreach my $pkgDir (sort @pkgDirs) {
|
||||
addPkg($pkgDir, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print STDERR "created $symlinks symlinks in user environment\n";
|
||||
|
||||
|
||||
symlink($ENV{"manifest"}, "$out/manifest") or die "cannot create manifest";
|
||||
|
||||
@@ -3,7 +3,7 @@ all-local: unpack.sh
|
||||
install-exec-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||
$(INSTALL_DATA) unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||
$(INSTALL_DATA) $(srcdir)/unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||
$(INSTALL_PROGRAM) unpack.sh $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||
|
||||
include ../../substitute.mk
|
||||
|
||||
@@ -3,7 +3,7 @@ all-local: nar.sh
|
||||
install-exec-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||
$(INSTALL_DATA) nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||
$(INSTALL_DATA) $(srcdir)/nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||
$(INSTALL_PROGRAM) nar.sh $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||
|
||||
include ../../substitute.mk
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{system, path, hashAlgo}: derivation {
|
||||
{system, storePath, hashAlgo}:
|
||||
|
||||
derivation {
|
||||
name = "nar";
|
||||
builder = ./nar.sh;
|
||||
inherit system path hashAlgo;
|
||||
inherit system storePath hashAlgo;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#! @shell@ -e
|
||||
|
||||
echo "packing $path into $out..."
|
||||
echo "packing $storePath into $out..."
|
||||
@coreutils@/mkdir $out
|
||||
dst=$out/tmp.nar.bz2
|
||||
@bindir@/nix-store --dump "$path" > tmp
|
||||
@bindir@/nix-store --dump "$storePath" > tmp
|
||||
|
||||
@bzip2@ < tmp > $dst
|
||||
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
ENV = SGML_CATALOG_FILES=$(docbookcatalog)
|
||||
|
||||
XMLLINT = $(ENV) $(xmllint) $(xmlflags) --catalogs
|
||||
XSLTPROC = $(ENV) $(xsltproc) $(xmlflags) --catalogs \
|
||||
XMLLINT = $(xmllint) $(xmlflags)
|
||||
XSLTPROC = $(xsltproc) $(xmlflags) \
|
||||
--param section.autolabel 1 \
|
||||
--param section.label.includes.component.label 1 \
|
||||
--param html.stylesheet \'style.css\' \
|
||||
--param xref.with.number.and.title 1 \
|
||||
--param toc.section.depth 3
|
||||
--param toc.section.depth 3 \
|
||||
--param admon.style \'\' \
|
||||
--param callout.graphics.extension \'.gif\'
|
||||
|
||||
# Note: we use GIF for now, since the PNGs shipped with Docbook aren't
|
||||
# transparent.
|
||||
|
||||
man1_MANS = nix-env.1 nix-build.1 nix-store.1 nix-instantiate.1 \
|
||||
nix-collect-garbage.1 nix-push.1 nix-pull.1 \
|
||||
nix-prefetch-url.1 nix-channel.1
|
||||
nix-prefetch-url.1 nix-channel.1 \
|
||||
nix-pack-closure.1 nix-unpack-closure.1 \
|
||||
nix-install-package.1 nix-hash.1
|
||||
|
||||
FIGURES = figures/user-environments.png
|
||||
|
||||
@@ -20,11 +25,16 @@ MANUAL_SRCS = manual.xml introduction.xml installation.xml \
|
||||
$(man1_MANS:.1=.xml) \
|
||||
troubleshooting.xml bugs.xml opt-common.xml opt-common-syn.xml \
|
||||
env-common.xml quick-start.xml nix-lang-ref.xml glossary.xml \
|
||||
conf-file.xml \
|
||||
conf-file.xml release-notes.xml \
|
||||
style.css images
|
||||
|
||||
manual.is-valid: $(MANUAL_SRCS) version.txt
|
||||
$(XMLLINT) --xinclude $< | $(XMLLINT) --noout --nonet --valid -
|
||||
# $(XMLLINT) --xinclude $< | $(XMLLINT) --noout --nonet --relaxng $(docbookrng)/docbook.rng -
|
||||
if test "$(jing)" != "false"; then \
|
||||
$(XMLLINT) --xinclude $< | $(jing) $(docbookrng)/docbook.rng /dev/stdin; \
|
||||
else \
|
||||
echo "Not validating."; \
|
||||
fi
|
||||
touch $@
|
||||
|
||||
version.txt:
|
||||
@@ -37,7 +47,25 @@ manual.html: $(MANUAL_SRCS) manual.is-valid images
|
||||
$(XSLTPROC) --nonet --xinclude --output manual.html \
|
||||
$(docbookxsl)/html/docbook.xsl manual.xml
|
||||
|
||||
all-local: manual.html
|
||||
|
||||
NEWS_OPTS = \
|
||||
--stringparam generate.toc "article nop" \
|
||||
--stringparam section.autolabel.max.depth 0 \
|
||||
--stringparam header.rule 0
|
||||
|
||||
NEWS.html: release-notes.xml
|
||||
$(XSLTPROC) --nonet --xinclude --output $@ $(NEWS_OPTS) \
|
||||
$(docbookxsl)/html/docbook.xsl release-notes.xml
|
||||
|
||||
NEWS.txt: release-notes.xml
|
||||
$(XSLTPROC) --nonet --xinclude quote-literals.xsl release-notes.xml | \
|
||||
$(XSLTPROC) --nonet --output $@.tmp.html $(NEWS_OPTS) \
|
||||
$(docbookxsl)/html/docbook.xsl -
|
||||
LANG=en_US $(w3m) -dump $@.tmp.html > $@
|
||||
rm $@.tmp.html
|
||||
|
||||
|
||||
all-local: manual.html NEWS.html NEWS.txt
|
||||
|
||||
install-data-local: manual.html
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/manual
|
||||
@@ -49,12 +77,12 @@ install-data-local: manual.html
|
||||
|
||||
images:
|
||||
mkdir images
|
||||
cp $(docbookxsl)/images/*.png images
|
||||
# cp $(docbookxsl)/images/*.gif images
|
||||
mkdir images/callouts
|
||||
cp $(docbookxsl)/images/callouts/*.png images/callouts
|
||||
chmod +w -R images
|
||||
cp $(docbookxsl)/images/callouts/*.gif images/callouts
|
||||
chmod -R +w images
|
||||
|
||||
KEEP = manual.html manual.is-valid version.txt $(MANS)
|
||||
KEEP = manual.html manual.is-valid version.txt $(MANS) NEWS.html NEWS.txt
|
||||
|
||||
EXTRA_DIST = $(MANUAL_SRCS) $(FIGURES) $(KEEP)
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<appendix><title>Bugs / To-Do</title>
|
||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Bugs / To-Do</title>
|
||||
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
@@ -15,11 +19,12 @@ implemented; generations form a linear sequence.</para></listitem>
|
||||
is already possible to do build management using Nix (by writing
|
||||
builders that perform appropriate build steps), but the Nix expression
|
||||
language is not yet powerful enough to make this pleasant (?). The
|
||||
language should be extended with features from the <ulink
|
||||
url='http://www.cs.uu.nl/~eelco/maak/'>Maak build manager</ulink>.
|
||||
Another interesting idea is to write a <command>make</command>
|
||||
implementation that uses Nix as a back-end to support <ulink
|
||||
url='http://www.research.att.com/~bs/bs_faq.html#legacy'>legacy</ulink>
|
||||
language should be extended with features from the <link
|
||||
xlink:href='http://www.cs.uu.nl/~eelco/maak/'>Maak build
|
||||
manager</link>. Another interesting idea is to write a
|
||||
<command>make</command> implementation that uses Nix as a back-end to
|
||||
support <link
|
||||
xlink:href='http://www.research.att.com/~bs/bs_faq.html#legacy'>legacy</link>
|
||||
build files.</para></listitem>
|
||||
|
||||
<listitem><para>For security, <command>nix-push</command> manifests
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<chapter id='chap-build-farm'><title>Setting up a Build Farm</title>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id='chap-build-farm'>
|
||||
|
||||
<title>Setting up a Build Farm</title>
|
||||
|
||||
|
||||
<para>This chapter provides some sketchy information on how to set up
|
||||
a Nix-based build farm. Nix is particularly suited as a basis for a
|
||||
@@ -50,13 +55,13 @@ build farm, since:
|
||||
|
||||
<para>TODO</para>
|
||||
|
||||
<para>The sources of the Nix build farm are at <ulink
|
||||
url='https://svn.cs.uu.nl:12443/repos/trace/release/trunk' />.</para>
|
||||
<para>The sources of the Nix build farm are at <link
|
||||
xlink:href='https://svn.cs.uu.nl:12443/repos/trace/release/trunk'/>.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section id='sec-distributed-builds'><title>Setting up distributed builds</title>
|
||||
<section xml:id='sec-distributed-builds'><title>Setting up distributed builds</title>
|
||||
|
||||
<para>You can enable distributed builds by setting the environment
|
||||
variable <envar>NIX_BUILD_HOOK</envar> to point to a program that Nix
|
||||
@@ -70,7 +75,7 @@ the documentation of the <link
|
||||
linkend="envar-build-hook"><envar>NIX_BUILD_HOOK</envar>
|
||||
variable</link>.</para>
|
||||
|
||||
<example id='ex-remote-systems'><title>Remote machine configuration:
|
||||
<example xml:id='ex-remote-systems'><title>Remote machine configuration:
|
||||
<filename>remote-systems.conf</filename></title>
|
||||
<programlisting>
|
||||
nix@mcflurry.labs.cs.uu.nl powerpc-darwin /home/nix/.ssh/id_quarterpounder_auto 2
|
||||
@@ -79,8 +84,8 @@ nix@scratchy.labs.cs.uu.nl i686-linux /home/nix/.ssh/id_scratchy_auto
|
||||
</example>
|
||||
|
||||
<para>An example build hook can be found in the Nix build farm
|
||||
sources: <ulink
|
||||
url='https://svn.cs.uu.nl:12443/repos/trace/release/trunk/common/distributed/build-remote.pl'
|
||||
sources: <link
|
||||
xlink:href='https://svn.cs.uu.nl:12443/repos/trace/release/trunk/common/distributed/build-remote.pl'
|
||||
/>. It should be suitable for most purposes, with maybe some minor
|
||||
adjustments. It uses <command>ssh</command> and
|
||||
<command>rsync</command> to copy the build inputs and outputs and
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<sect1 id="sec-conf-file"><title>Nix configuration file</title>
|
||||
<section xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="sec-conf-file">
|
||||
|
||||
<title>Nix configuration file</title>
|
||||
|
||||
|
||||
<para>A number of persistent settings of Nix are stored in the file
|
||||
<filename><replaceable>prefix</replaceable>/etc/nix/nix.conf</filename>.
|
||||
@@ -7,7 +12,7 @@ This file is a list of <literal><replaceable>name</replaceable> =
|
||||
Comments start with a <literal>#</literal> character. An example
|
||||
configuration file is shown in <xref linkend="ex-nix-conf" />.</para>
|
||||
|
||||
<example id='ex-nix-conf'><title>Nix configuration file</title>
|
||||
<example xml:id='ex-nix-conf'><title>Nix configuration file</title>
|
||||
|
||||
<programlisting>
|
||||
gc-keep-outputs = true # Nice for developers
|
||||
@@ -20,7 +25,8 @@ env-keep-derivations = false
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry id="conf-gc-keep-outputs"><term><literal>gc-keep-outputs</literal></term>
|
||||
|
||||
<varlistentry xml:id="conf-gc-keep-outputs"><term><literal>gc-keep-outputs</literal></term>
|
||||
|
||||
<listitem><para>If <literal>true</literal>, the garbage collector
|
||||
will keep the outputs of non-garbage derivations. If
|
||||
@@ -35,8 +41,9 @@ env-keep-derivations = false
|
||||
this option to <literal>true</literal>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry id="conf-gc-keep-derivations"><term><literal>gc-keep-derivations</literal></term>
|
||||
<varlistentry xml:id="conf-gc-keep-derivations"><term><literal>gc-keep-derivations</literal></term>
|
||||
|
||||
<listitem><para>If <literal>true</literal> (default), the garbage
|
||||
collector will keep the derivations from which non-garbage store
|
||||
@@ -52,6 +59,28 @@ env-keep-derivations = false
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id="conf-gc-reserved-space"><term><literal>gc-reserved-space</literal></term>
|
||||
|
||||
<listitem><para>This option specifies how much space should be
|
||||
reserved in normal use so that the garbage collector can run
|
||||
succesfully. Since the garbage collector must perform Berkeley DB
|
||||
transactions, it needs some disk space for itself. However, when
|
||||
the disk is full, this space is not available, so the collector
|
||||
would not be able to run precisely when it is most needed.</para>
|
||||
|
||||
<para>For this reason, when Nix is run, it allocates a file
|
||||
<filename>/nix/var/nix/db/reserved</filename> of the size
|
||||
specified by this option. When the garbage collector is run, this
|
||||
file is deleted before the Berkeley DB environment is opened.
|
||||
This should give it enough room to proceed.</para>
|
||||
|
||||
<para>The default is <literal>1048576</literal> (1
|
||||
MiB).</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry><term><literal>env-keep-derivations</literal></term>
|
||||
|
||||
<listitem><para>If <literal>false</literal> (default), derivations
|
||||
@@ -75,8 +104,44 @@ env-keep-derivations = false
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id="conf-build-max-jobs"><term><literal>build-max-jobs</literal></term>
|
||||
|
||||
<listitem><para>This option defines the maximum number of jobs
|
||||
that Nix will try to build in parallel. The default is
|
||||
<literal>1</literal>. You should generally set it to the number
|
||||
of CPUs in your system (e.g., <literal>2</literal> on a Athlon 64
|
||||
X2). It can be overriden using the <option
|
||||
linkend='opt-max-jobs'>--max-jobs</option> (<option>-j</option>)
|
||||
command line switch.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry><term><literal>system</literal></term>
|
||||
|
||||
<listitem><para>This option specifies the canonical Nix system
|
||||
name of the current installation, such as
|
||||
<literal>i686-linux</literal> or
|
||||
<literal>powerpc-darwin</literal>. Nix can only build derivations
|
||||
whose <literal>system</literal> attribute equals the value
|
||||
specified here. In general, it never makes sense to modify this
|
||||
value from its default, since you can use it to ‘lie’ about the
|
||||
platform you are building on (e.g., perform a Mac OS build on a
|
||||
Linux machine; the result would obviously be wrong). It only
|
||||
makes sense if the Nix binaries can run on multiple platforms,
|
||||
e.g., ‘universal binaries’ that run on <literal>powerpc-darwin</literal> and
|
||||
<literal>i686-darwin</literal>.</para>
|
||||
|
||||
<para>It defaults to the canonical Nix system name detected by
|
||||
<filename>configure</filename> at build time.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<sect1 id="sec-common-env"><title>Common environment variables</title>
|
||||
<section xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="sec-common-env">
|
||||
|
||||
<title>Common environment variables</title>
|
||||
|
||||
|
||||
<para>Most Nix commands interpret the following environment variables:</para>
|
||||
|
||||
@@ -118,7 +123,7 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry id="envar-build-hook"><term><envar>NIX_BUILD_HOOK</envar></term>
|
||||
<varlistentry xml:id="envar-build-hook"><term><envar>NIX_BUILD_HOOK</envar></term>
|
||||
|
||||
<listitem>
|
||||
|
||||
@@ -271,4 +276,5 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</sect1>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<appendix><title>Glossary</title>
|
||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Glossary</title>
|
||||
|
||||
|
||||
<glosslist>
|
||||
|
||||
|
||||
<glossentry id="gloss-derivation"><glossterm>derivation</glossterm>
|
||||
<glossentry xml:id="gloss-derivation"><glossterm>derivation</glossterm>
|
||||
|
||||
<glossdef><para>A description of a build action. The result of a
|
||||
derivation is a store object. Derivations are typically specified
|
||||
@@ -46,7 +50,7 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-substitute"><glossterm>substitute</glossterm>
|
||||
<glossentry xml:id="gloss-substitute"><glossterm>substitute</glossterm>
|
||||
|
||||
<glossdef><para>A substitute is a command invocation stored in the
|
||||
Nix database that describes how to build a store object, bypassing
|
||||
@@ -79,7 +83,7 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-reference"><glossterm>reference</glossterm>
|
||||
<glossentry xml:id="gloss-reference"><glossterm>reference</glossterm>
|
||||
|
||||
<glossdef><para>A store path <varname>P</varname> is said to have a
|
||||
reference to a store path <varname>Q</varname> if the store object
|
||||
@@ -92,7 +96,7 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-closure"><glossterm>closure</glossterm>
|
||||
<glossentry xml:id="gloss-closure"><glossterm>closure</glossterm>
|
||||
|
||||
<glossdef><para>The closure of a store path is the set of store
|
||||
paths that are directly or indirectly “reachable” from that store
|
||||
@@ -108,14 +112,14 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-output-path"><glossterm>output path</glossterm>
|
||||
<glossentry xml:id="gloss-output-path"><glossterm>output path</glossterm>
|
||||
|
||||
<glossdef><para>A store path produced by a derivation.</para></glossdef>
|
||||
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-deriver"><glossterm>deriver</glossterm>
|
||||
<glossentry xml:id="gloss-deriver"><glossterm>deriver</glossterm>
|
||||
|
||||
<glossdef><para>The deriver of an <link
|
||||
linkend="gloss-output-path">output path</link> is the store
|
||||
@@ -124,7 +128,7 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-validity"><glossterm>validity</glossterm>
|
||||
<glossentry xml:id="gloss-validity"><glossterm>validity</glossterm>
|
||||
|
||||
<glossdef><para>A store path is considered
|
||||
<emphasis>valid</emphasis> if it exists in the file system, is
|
||||
@@ -134,7 +138,7 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-user-env"><glossterm>user environment</glossterm>
|
||||
<glossentry xml:id="gloss-user-env"><glossterm>user environment</glossterm>
|
||||
|
||||
<glossdef><para>An automatically generated store object that
|
||||
consists of a set of symlinks to “active” applications, i.e., other
|
||||
@@ -147,7 +151,7 @@
|
||||
</glossentry>
|
||||
|
||||
|
||||
<glossentry id="gloss-profile"><glossterm>profile</glossterm>
|
||||
<glossentry xml:id="gloss-profile"><glossterm>profile</glossterm>
|
||||
|
||||
<glossdef><para>A symlink to the current <link
|
||||
linkend="gloss-user-env">user environment</link> of a user, e.g.,
|
||||
|
||||
@@ -1,36 +1,43 @@
|
||||
<chapter id='chap-installation'><title>Installation</title>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-installation">
|
||||
|
||||
<title>Installation</title>
|
||||
|
||||
|
||||
<sect1><title>Obtaining Nix</title>
|
||||
<section><title>Obtaining Nix</title>
|
||||
|
||||
<para>The easiest way to obtain Nix is to download a <ulink
|
||||
url='http://www.cs.uu.nl/groups/ST/Trace/Nix'>source
|
||||
distribution</ulink>. RPMs for Red Hat, SuSE, and Fedore Core are
|
||||
also available.</para>
|
||||
<para>The easiest way to obtain Nix is to download a <link
|
||||
xlink:href="http://www.cs.uu.nl/groups/ST/Trace/Nix">source
|
||||
distribution</link>. RPMs for Red Hat, SuSE, and Fedora Core are also
|
||||
available.</para>
|
||||
|
||||
<para>Alternatively, the most recent sources of Nix can be obtained
|
||||
from its <ulink
|
||||
url='https://svn.cs.uu.nl:12443/repos/trace/nix/trunk'>Subversion
|
||||
repository</ulink>. For example, the following command will check out
|
||||
the latest revision into a directory called <filename>nix</filename>:</para>
|
||||
from its <link
|
||||
xlink:href="https://svn.cs.uu.nl:12443/repos/trace/nix/trunk">Subversion
|
||||
repository</link>. For example, the following command will check out
|
||||
the latest revision into a directory called
|
||||
<filename>nix</filename>:</para>
|
||||
|
||||
<screen>
|
||||
$ svn checkout https://svn.cs.uu.nl:12443/repos/trace/nix/trunk nix</screen>
|
||||
|
||||
<para>Likewise, specific releases can be obtained from the <ulink
|
||||
url='https://svn.cs.uu.nl:12443/repos/trace/nix/tags'>tags
|
||||
directory</ulink> of the repository. If you don't have Subversion,
|
||||
you can also download an automatically generated <ulink
|
||||
url='https://svn.cs.uu.nl:12443/dist/trace/'>compressed
|
||||
tar-file</ulink> of the head revision of the trunk.</para>
|
||||
<para>Likewise, specific releases can be obtained from the <link
|
||||
xlink:href="https://svn.cs.uu.nl:12443/repos/trace/nix/tags">tags
|
||||
directory</link> of the repository. If you don't have Subversion, you
|
||||
can also download an automatically generated <link
|
||||
xlink:href="https://svn.cs.uu.nl:12443/dist/trace/">compressed
|
||||
tar-file</link> of the head revision of the trunk.</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1><title>Prerequisites</title>
|
||||
<section><title>Prerequisites</title>
|
||||
|
||||
<para>The following prerequisites only apply when you build from
|
||||
source. Binary releases (e.g., RPMs) have no prerequisites.</para>
|
||||
<para><emphasis>The following prerequisites only apply when you build
|
||||
from source</emphasis>. Binary releases (e.g., RPMs) have no
|
||||
prerequisites.</para>
|
||||
|
||||
<para>A fairly recent version of GCC/G++ is required. Version 2.95
|
||||
and higher should work.</para>
|
||||
@@ -39,22 +46,23 @@ and higher should work.</para>
|
||||
<command>xmllint</command> and <command>xsltproc</command> programs,
|
||||
which are part of the <literal>libxml2</literal> and
|
||||
<literal>libxslt</literal> packages, respectively. You also need the
|
||||
<ulink url='http://docbook.sourceforge.net/projects/xsl/'>DocBook XSL
|
||||
stylesheets</ulink> and optionally the <ulink
|
||||
url='http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip'>
|
||||
DocBook XML 4.2 DTD</ulink>. Note that these are only required if you
|
||||
modify the manual sources or when you are building from the Subversion
|
||||
<link
|
||||
xlink:href="http://docbook.sourceforge.net/projects/xsl/">DocBook XSL
|
||||
stylesheets</link> and optionally the <link
|
||||
xlink:href="http://www.docbook.org/schemas/5x"> DocBook 5.0 RELAX NG
|
||||
schemas</link>. Note that these are only required if you modify the
|
||||
manual sources or when you are building from the Subversion
|
||||
repository.</para>
|
||||
|
||||
<para>To build the parser, very <emphasis>recent</emphasis> versions
|
||||
of Bison and Flex are required. (This is because Nix needs GLR
|
||||
support in Bison and reentrancy support in Flex.) For Bison, you need
|
||||
version 1.875c or higher (1.875 does <emphasis>not</emphasis> work),
|
||||
which can be obtained from the <ulink
|
||||
url='ftp://alpha.gnu.org/pub/gnu/bison'>GNU FTP server</ulink>. For
|
||||
Flex, you need version 2.5.31, which is available on <ulink
|
||||
url='http://lex.sourceforge.net/'>SourceForge</ulink>. Slightly older
|
||||
versions may also work, but ancient versions like the ubiquitous
|
||||
which can be obtained from the <link
|
||||
xlink:href="ftp://alpha.gnu.org/pub/gnu/bison">GNU FTP server</link>.
|
||||
For Flex, you need version 2.5.31, which is available on <link
|
||||
xlink:href="http://lex.sourceforge.net/">SourceForge</link>. Slightly
|
||||
older versions may also work, but ancient versions like the ubiquitous
|
||||
2.5.4a won't. Note that these are only required if you modify the
|
||||
parser or when you are building from the Subversion repository.</para>
|
||||
|
||||
@@ -67,12 +75,12 @@ these packages. Alternatively, if you already have them installed,
|
||||
you can use <command>configure</command>'s <option>--with-bdb</option>
|
||||
and <option>--with-aterm</option> options to point to their respective
|
||||
locations. Note that Berkeley DB <emphasis>must</emphasis> be version
|
||||
4.2; other versions may not have compatible database formats.</para>
|
||||
4.4; other versions may not have compatible database formats.</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1><title>Building Nix from source</title>
|
||||
<section><title>Building Nix from source</title>
|
||||
|
||||
<para>After unpacking or checking out the Nix sources, issue the
|
||||
following commands:
|
||||
@@ -97,30 +105,30 @@ $ autoreconf -i</screen>
|
||||
like. You must have write permission to the
|
||||
<replaceable>prefix</replaceable> path.</para>
|
||||
|
||||
<warning><para>It is advisable <emphasis>not</emphasis> to change the
|
||||
installation prefix from its default, since doing so will in all
|
||||
likelihood make it impossible to use derivations built on other
|
||||
systems.</para></warning>
|
||||
<warning><para>It is best <emphasis>not</emphasis> to change the
|
||||
installation prefix from its default, since doing so makes it
|
||||
impossible to use pre-built binaries from the standard Nixpkgs
|
||||
channels.</para></warning>
|
||||
|
||||
<para>If you want to rebuilt the documentation, pass the full path to
|
||||
the DocBook XML catalog file (<filename>docbook.cat</filename>) and to
|
||||
the DocBook XSL stylesheets using the
|
||||
<option>--with-docbook-catalog=<replaceable>path</replaceable></option>
|
||||
the DocBook RELAX NG schemas and to the DocBook XSL stylesheets using
|
||||
the
|
||||
<option>--with-docbook-rng=<replaceable>path</replaceable></option>
|
||||
and
|
||||
<option>--with-docbook-xsl=<replaceable>path</replaceable></option>
|
||||
options.</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1><title>Installing from RPMs</title>
|
||||
<section><title>Installing from RPMs</title>
|
||||
|
||||
<para>RPM packages of Nix can be downloaded from <ulink
|
||||
url='http://www.cs.uu.nl/groups/ST/Trace/Nix' />. These RPMs should
|
||||
work for most fairly recent releases of SuSE and Red Hat Linux. They
|
||||
have been known to work work on SuSE Linux 8.1 and 9.0, and Red Hat
|
||||
9.0. In fact, it should work on any RPM-based Linux distribution
|
||||
based on <literal>glibc</literal> 2.3 or later.</para>
|
||||
<para>RPM packages of Nix can be downloaded from <uri
|
||||
xlink:href="http://www.cs.uu.nl/groups/ST/Trace/Nix">http://www.cs.uu.nl/groups/ST/Trace/Nix</uri>.
|
||||
These RPMs should work for most fairly recent releases of SuSE and Red
|
||||
Hat Linux. They have been known to work work on SuSE Linux 8.1 and
|
||||
9.0, and Red Hat 9.0. In fact, it should work on any RPM-based Linux
|
||||
distribution based on <literal>glibc</literal> 2.3 or later.</para>
|
||||
|
||||
<para>Once downloaded, the RPMs can be installed or upgraded using
|
||||
<command>rpm -U</command>. For example,</para>
|
||||
@@ -137,28 +145,41 @@ auxiliary data:</para>
|
||||
$ rm -rf /nix/store
|
||||
$ rm -rf /nix/var</screen>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1><title>Permissions</title>
|
||||
<section><title>Upgrading Nix through Nix</title>
|
||||
|
||||
<para>You can install the latest stable version of Nix through Nix
|
||||
itself by subscribing to the channel <link
|
||||
xlink:href="http://nix.cs.uu.nl/dist/nix/channels-v3/nix-stable" /> ,
|
||||
or the latest unstable version by subscribing to the channel<link
|
||||
xlink:href="http://nix.cs.uu.nl/dist/nix/channels-v3/nix-unstable" />.
|
||||
You can also do a <link linkend="sec-one-click">one-click
|
||||
installation</link> by clicking on the package links at <link
|
||||
xlink:href="http://nix.cs.uu.nl/dist/nix/" />.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>Permissions</title>
|
||||
|
||||
<para>All Nix operations must be performed under the user ID that owns
|
||||
the Nix store and database
|
||||
(<filename><replaceable>prefix</replaceable>/store</filename> and
|
||||
<filename><replaceable>prefix</replaceable>/var/nix/db</filename>,
|
||||
respectively). When installed from the RPM packages, these
|
||||
directories are owned by <systemitem
|
||||
class='username'>root</systemitem>.</para>
|
||||
directories are owned by <systemitem class="username">root</systemitem>.</para>
|
||||
|
||||
<sect2><title>Setuid installation</title>
|
||||
<section><title>Setuid installation</title>
|
||||
|
||||
<para>As a somewhat <emphasis>ad hoc</emphasis> hack, you can also
|
||||
install the Nix binaries <quote>setuid</quote> so that a Nix store can
|
||||
be shared among several users. To do this, configure Nix with the
|
||||
<emphasis>--enable-setuid</emphasis> option. Nix will be installed as
|
||||
owned by a user and group specified by the
|
||||
<option>--with-nix-user=<parameter>user</parameter></option> and
|
||||
<option>--with-nix-group=<parameter>group</parameter></option>
|
||||
<option>--with-nix-user=</option><parameter>user</parameter> and
|
||||
<option>--with-nix-group=</option><parameter>group</parameter>
|
||||
options. E.g.,
|
||||
|
||||
<screen>
|
||||
@@ -184,12 +205,12 @@ on systems that have the <function>setresuid()</function> system call
|
||||
(such as Linux and FreeBSD), so on those systems the binaries are
|
||||
simply owned by the Nix user.</para></warning>
|
||||
|
||||
</sect2>
|
||||
</section>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1><title>Using Nix</title>
|
||||
<section><title>Using Nix</title>
|
||||
|
||||
<para>To use Nix, some environment variables should be set. In
|
||||
particular, <envar>PATH</envar> should contain the directories
|
||||
@@ -206,7 +227,7 @@ in your <filename>~/.bashrc</filename> (or similar), like this:</para>
|
||||
<screen>
|
||||
source <replaceable>prefix</replaceable>/etc/profile.d/nix.sh</screen>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<chapter><title>Introduction</title>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<!--
|
||||
<epigraph><para><quote>The number of Nix installations in the world
|
||||
has grown to 5, with more expected.</quote></para></epigraph>
|
||||
-->
|
||||
<title>Introduction</title>
|
||||
|
||||
<para>Nix is a system for the deployment of software. Software
|
||||
deployment is concerned with the creation, distribution, and
|
||||
@@ -130,21 +128,23 @@ collection. It also discusses some advanced topics, such as setting
|
||||
up a Nix-based build farm, and doing service deployment using
|
||||
Nix.</para>
|
||||
|
||||
<note><para>Some background information on Nix can be found in three
|
||||
papers. The ICSE 2004 paper <ulink
|
||||
url='http://www.cs.uu.nl/~eelco/pubs/immdsd-icse2004-final.pdf'><citetitle>Imposing
|
||||
a Memory Management Discipline on Software
|
||||
Deployment</citetitle></ulink> discusses the hashing mechanism used to
|
||||
ensure reliable dependency identification and non-interference between
|
||||
different versions and variants of packages. The LISA 2004 paper
|
||||
<ulink
|
||||
url='http://www.cs.uu.nl/~eelco/pubs/nspfssd-lisa2004-final.pdf'><citetitle>Nix:
|
||||
A Safe and Policy-Free System for Software
|
||||
Deployment</citetitle></ulink> gives a more general discussion of Nix
|
||||
from a system-administration perspective. The CBSE 2005 paper <ulink
|
||||
url='http://www.cs.uu.nl/~eelco/pubs/eupfcdm-cbse2005-final.pdf'><citetitle>Efficient
|
||||
<note><para>Some background information on Nix can be found in a
|
||||
number of papers. The ICSE 2004 paper <citetitle
|
||||
xlink:href='http://www.cs.uu.nl/~eelco/pubs/immdsd-icse2004-final.pdf'>Imposing
|
||||
a Memory Management Discipline on Software Deployment</citetitle>
|
||||
discusses the hashing mechanism used to ensure reliable dependency
|
||||
identification and non-interference between different versions and
|
||||
variants of packages. The LISA 2004 paper <citetitle
|
||||
xlink:href='http://www.cs.uu.nl/~eelco/pubs/nspfssd-lisa2004-final.pdf'>Nix:
|
||||
A Safe and Policy-Free System for Software Deployment</citetitle>
|
||||
gives a more general discussion of Nix from a system-administration
|
||||
perspective. The CBSE 2005 paper <citetitle
|
||||
xlink:href='http://www.cs.uu.nl/~eelco/pubs/eupfcdm-cbse2005-final.pdf'>Efficient
|
||||
Upgrading in a Purely Functional Component Deployment Model
|
||||
</citetitle></ulink> is about transparent patch deployment in
|
||||
Nix.</para></note>
|
||||
</citetitle> is about transparent patch deployment in Nix. Finally,
|
||||
the SCM-12 paper <citetitle
|
||||
xlink:href='http://www.cs.uu.nl/~eelco/pubs/servicecm-scm12-final.pdf'>
|
||||
Service Configuration Management</citetitle> shows how services (e.g.,
|
||||
web servers) can be deployed and managed through Nix.</para></note>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -1,83 +1,114 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE book
|
||||
PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.docbook.org/xml/4.3/docbook-xml-4.3.zip"
|
||||
[
|
||||
]>
|
||||
<book xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<book>
|
||||
<title>Nix User's Guide</title>
|
||||
<info>
|
||||
|
||||
<title>Nix User's Guide</title>
|
||||
|
||||
<subtitle>Draft (Version <xi:include href="version.txt"
|
||||
parse="text" />)</subtitle>
|
||||
|
||||
<subtitle>Draft (Version <xi:include
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="version.txt" parse="text" />)</subtitle>
|
||||
|
||||
<bookinfo>
|
||||
<author>
|
||||
<firstname>Eelco</firstname>
|
||||
<surname>Dolstra</surname>
|
||||
<personname>
|
||||
<firstname>Eelco</firstname>
|
||||
<surname>Dolstra</surname>
|
||||
</personname>
|
||||
</author>
|
||||
|
||||
<copyright>
|
||||
<year>2004</year>
|
||||
<year>2005</year>
|
||||
<year>2006</year>
|
||||
<holder>Eelco Dolstra</holder>
|
||||
</copyright>
|
||||
</bookinfo>
|
||||
|
||||
</info>
|
||||
|
||||
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="quick-start.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="installation.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="package-management.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="writing-nix-expressions.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="build-farm.xml" />
|
||||
<xi:include href="introduction.xml" />
|
||||
<xi:include href="quick-start.xml" />
|
||||
<xi:include href="installation.xml" />
|
||||
<xi:include href="package-management.xml" />
|
||||
<xi:include href="writing-nix-expressions.xml" />
|
||||
<xi:include href="build-farm.xml" />
|
||||
|
||||
|
||||
<appendix>
|
||||
<title>Command Reference</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="env-common.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="conf-file.xml" />
|
||||
<sect1 id="sec-nix-env">
|
||||
<title>nix-env</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-env.xml" />
|
||||
</sect1>
|
||||
<sect1 id="sec-nix-build">
|
||||
<title>nix-build</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-build.xml" />
|
||||
</sect1>
|
||||
<sect1>
|
||||
<title>nix-store</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-store.xml" />
|
||||
</sect1>
|
||||
<sect1 id="sec-nix-instantiate">
|
||||
<title>nix-instantiate</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-instantiate.xml" />
|
||||
</sect1>
|
||||
<sect1>
|
||||
<title>nix-collect-garbage</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-collect-garbage.xml" />
|
||||
</sect1>
|
||||
<sect1 id="sec-nix-channel">
|
||||
<title>nix-channel</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-channel.xml" />
|
||||
</sect1>
|
||||
<sect1>
|
||||
<title>nix-push</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-push.xml" />
|
||||
</sect1>
|
||||
<sect1>
|
||||
<title>nix-pull</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-pull.xml" />
|
||||
</sect1>
|
||||
<sect1>
|
||||
<title>nix-prefetch-url</title>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-prefetch-url.xml" />
|
||||
</sect1>
|
||||
<xi:include href="opt-common.xml" />
|
||||
<xi:include href="env-common.xml" />
|
||||
<xi:include href="conf-file.xml" />
|
||||
|
||||
<section>
|
||||
<title>Main commands</title>
|
||||
<section xml:id="sec-nix-env">
|
||||
<title>nix-env</title>
|
||||
<xi:include href="nix-env.xml" />
|
||||
</section>
|
||||
<section xml:id="sec-nix-instantiate">
|
||||
<title>nix-instantiate</title>
|
||||
<xi:include href="nix-instantiate.xml" />
|
||||
</section>
|
||||
<section>
|
||||
<title>nix-store</title>
|
||||
<xi:include href="nix-store.xml" />
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Utilities</title>
|
||||
<section xml:id="sec-nix-build">
|
||||
<title>nix-build</title>
|
||||
<xi:include href="nix-build.xml" />
|
||||
</section>
|
||||
<section xml:id="sec-nix-channel">
|
||||
<title>nix-channel</title>
|
||||
<xi:include href="nix-channel.xml" />
|
||||
</section>
|
||||
<section>
|
||||
<title>nix-collect-garbage</title>
|
||||
<xi:include href="nix-collect-garbage.xml" />
|
||||
</section>
|
||||
<section xml:id="sec-nix-hash">
|
||||
<title>nix-hash</title>
|
||||
<xi:include href="nix-hash.xml" />
|
||||
</section>
|
||||
<section xml:id="sec-nix-install-package">
|
||||
<title>nix-install-package</title>
|
||||
<xi:include href="nix-install-package.xml" />
|
||||
</section>
|
||||
<section>
|
||||
<title>nix-pack-closure</title>
|
||||
<xi:include href="nix-pack-closure.xml" />
|
||||
</section>
|
||||
<section>
|
||||
<title>nix-prefetch-url</title>
|
||||
<xi:include href="nix-prefetch-url.xml" />
|
||||
</section>
|
||||
<section>
|
||||
<title>nix-pull</title>
|
||||
<xi:include href="nix-pull.xml" />
|
||||
</section>
|
||||
<section xml:id="sec-nix-push">
|
||||
<title>nix-push</title>
|
||||
<xi:include href="nix-push.xml" />
|
||||
</section>
|
||||
<section>
|
||||
<title>nix-unpack-closure</title>
|
||||
<xi:include href="nix-unpack-closure.xml" />
|
||||
</section>
|
||||
</section>
|
||||
|
||||
</appendix>
|
||||
|
||||
<!-- &nix-lang-ref; -->
|
||||
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="troubleshooting.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bugs.xml" />
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glossary.xml" />
|
||||
<xi:include href="troubleshooting.xml" />
|
||||
<xi:include href="bugs.xml" />
|
||||
<xi:include href="glossary.xml" />
|
||||
|
||||
<appendix>
|
||||
<title>Nix Release Notes</title>
|
||||
<xi:include href="release-notes.xml"
|
||||
xpointer="xmlns(x=http://docbook.org/ns/docbook)xpointer(x:article/x:section)" />
|
||||
</appendix>
|
||||
|
||||
</book>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<refentry>
|
||||
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-build</refname>
|
||||
<refpurpose>build a Nix expression</refpurpose>
|
||||
@@ -8,8 +9,25 @@
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-build</command>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--attr</option></arg>
|
||||
<arg choice='plain'><option>-A</option></arg>
|
||||
</group>
|
||||
<replaceable>attrPath</replaceable>
|
||||
</arg>
|
||||
<arg><option>--add-drv-link</option></arg>
|
||||
<arg><option>--no-link</option></arg>
|
||||
<arg><option>--drv-link </option><replaceable>drvlink</replaceable></arg>
|
||||
<arg><option>--no-out-link</option></arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--out-link</option></arg>
|
||||
<arg choice='plain'><option>-o</option></arg>
|
||||
</group>
|
||||
<replaceable>outlink</replaceable>
|
||||
</arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
@@ -25,14 +43,17 @@ to multiple derivations, multiple sequentially numbered symlinks are
|
||||
created (<filename>result</filename>, <filename>result-2</filename>,
|
||||
and so on).</para>
|
||||
|
||||
<note><para><command>nix-build</command> is essentially a wrapper
|
||||
around <link
|
||||
<para>If no <replaceable>paths</replaceable> are specified, then
|
||||
<command>nix-build</command> will use <filename>default.nix</filename>
|
||||
in the current directory, if it exists.</para>
|
||||
|
||||
<para><command>nix-build</command> is essentially a wrapper around
|
||||
<link
|
||||
linkend="sec-nix-instantiate"><command>nix-instantiate</command></link>
|
||||
(to translate a high-level Nix expression to a low-level store
|
||||
derivation) and <link
|
||||
linkend="rsec-nix-store-realise"><command>nix-store
|
||||
--realise</command></link> (to build the store
|
||||
derivation).</para></note>
|
||||
--realise</command></link> (to build the store derivation).</para>
|
||||
|
||||
<warning><para>The result of the build is automatically registered as
|
||||
a root of the Nix garbage collector. This root disappears
|
||||
@@ -44,6 +65,12 @@ or renamed. So don’t rename the symlink.</para></warning>
|
||||
|
||||
<refsection><title>Options</title>
|
||||
|
||||
<para>See also <xref linkend="sec-common-options" />. All options not
|
||||
listed here are passed to <command>nix-store --realise</command>,
|
||||
except for <option>--arg</option> and <option>--attr</option> /
|
||||
<option>-A</option> which are passed to
|
||||
<command>nix-instantiate</command>.</para>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><option>--add-drv-link</option></term>
|
||||
@@ -57,7 +84,16 @@ or renamed. So don’t rename the symlink.</para></warning>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--no-link</option></term>
|
||||
<varlistentry><term><option>--drv-link</option> <replaceable>drvlink</replaceable></term>
|
||||
|
||||
<listitem><para>Change the name of the symlink to the derivation
|
||||
created when <option>--add-drv-link</option> is used from
|
||||
<filename>derivation</filename> to
|
||||
<replaceable>drvlink</replaceable>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--no-out-link</option></term>
|
||||
|
||||
<listitem><para>Do not create a symlink to the output path. Note
|
||||
that as a result the output does not become a root of the garbage
|
||||
@@ -66,9 +102,35 @@ or renamed. So don’t rename the symlink.</para></warning>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id='opt-out-link'><term><option>--out-link</option> /
|
||||
<option>-o</option> <replaceable>outlink</replaceable></term>
|
||||
|
||||
<listitem><para>Change the name of the symlink to the output path
|
||||
created unless <option>--no-out-link</option> is used from
|
||||
<filename>result</filename> to
|
||||
<replaceable>outlink</replaceable>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<screen>
|
||||
$ nix-build pkgs/top-level/all-packages.nix -A firefox
|
||||
store derivation is /nix/store/qybprl8sz2lc...-firefox-1.5.0.7.drv
|
||||
/nix/store/d18hyl92g30l...-firefox-1.5.0.7
|
||||
|
||||
$ ls -l result
|
||||
lrwxrwxrwx <replaceable>...</replaceable> result -> /nix/store/d18hyl92g30l...-firefox-1.5.0.7
|
||||
|
||||
$ ls ./result/bin/
|
||||
firefox firefox-config</screen>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<refentry>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-channel</refname>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<refentry>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-collect-garbage</refname>
|
||||
@@ -8,6 +9,8 @@
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-collect-garbage</command>
|
||||
<arg><option>--delete-old</option></arg>
|
||||
<arg><option>-d</option></arg>
|
||||
<group choice='opt'>
|
||||
<arg choice='plain'><option>--print-roots</option></arg>
|
||||
<arg choice='plain'><option>--print-live</option></arg>
|
||||
@@ -19,10 +22,28 @@
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The command <command>nix-collect-garbage</command> is an
|
||||
obsolete wrapper around <link
|
||||
linkend="rsec-nix-store-gc"><command>nix-store
|
||||
--gc</command></link>.</para>
|
||||
<para>The command <command>nix-collect-garbage</command> is mostly an
|
||||
alias of <link linkend="rsec-nix-store-gc"><command>nix-store
|
||||
--gc</command></link>, that is, it deletes all unreachable paths in
|
||||
the Nix store to clean up your system. However, it provides an
|
||||
additional option <option>-d</option> (<option>--delete-old</option>)
|
||||
that deletes all old generations of all profiles in
|
||||
<filename>/nix/var/nix/profiles</filename> by invoking
|
||||
<literal>nix-env --delete-generations old</literal> on all profiles.
|
||||
Of course, this makes rollbacks to previous configurations
|
||||
impossible.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
<refsection><title>Example</title>
|
||||
|
||||
<para>To delete from the Nix store everything that is not used by the
|
||||
current generations of each profile, do
|
||||
|
||||
<screen>
|
||||
$ nix-collect-garbage -d</screen>
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<refentry>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-env</refname>
|
||||
@@ -9,6 +10,14 @@
|
||||
<cmdsynopsis>
|
||||
<command>nix-env</command>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--attr</option></arg>
|
||||
<arg choice='plain'><option>-A</option></arg>
|
||||
</group>
|
||||
<replaceable>attrPath</replaceable>
|
||||
</arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--file</option></arg>
|
||||
@@ -23,7 +32,6 @@
|
||||
</group>
|
||||
<replaceable>path</replaceable>
|
||||
</arg>
|
||||
<arg><option>--preserve-installed</option></arg>
|
||||
<arg>
|
||||
<arg choice='plain'><option>--system-filter</option></arg>
|
||||
<replaceable>system</replaceable>
|
||||
@@ -101,21 +109,13 @@ linkend="sec-common-options" />.</para>
|
||||
<option>--rollback</option> operations, this flag will cause
|
||||
<command>nix-env</command> to print what
|
||||
<emphasis>would</emphasis> be done if this flag had not been
|
||||
specified, without actually doing it.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--preserve-installed</option></term>
|
||||
|
||||
<listitem><para>By default, when you install a derivation with the
|
||||
<option>--install</option> operation, it will replace previously
|
||||
installed versions with the same derivation name (regardless of
|
||||
the version number). This option causes those previously
|
||||
installed versions to be kept in the new generation of the
|
||||
profile. Note that this will generally cause conflicts in the
|
||||
creation of the user environment (since multiple versions of a
|
||||
package typically contain the same programs).</para></listitem>
|
||||
|
||||
specified, without actually doing it.</para>
|
||||
|
||||
<para><option>--dry-run</option> also prints out which paths will
|
||||
be <link linkend="gloss-substitute">substituted</link> (i.e.,
|
||||
downloaded) and which paths will be built from source (because no
|
||||
substitute is available).</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--system-filter</option> <replaceable>system</replaceable></term>
|
||||
@@ -172,7 +172,7 @@ linkend="sec-common-options" />.</para>
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection id="rsec-nix-env-install"><title>Operation <option>--install</option></title>
|
||||
<refsection xml:id="rsec-nix-env-install"><title>Operation <option>--install</option></title>
|
||||
|
||||
<refsection><title>Synopsis</title>
|
||||
|
||||
@@ -208,7 +208,24 @@ number of possible ways:
|
||||
installed. Currently installed derivations with a name equal to the
|
||||
name of a derivation being added are removed unless the option
|
||||
<option>--preserve-installed</option> is
|
||||
specified.</para></listitem>
|
||||
specified.</para>
|
||||
|
||||
<para>If there are multiple derivations matching a name in
|
||||
<replaceable>args</replaceable> that have the same name (e.g.,
|
||||
<literal>gcc-3.3.6</literal> and <literal>gcc-4.1.1</literal>), then
|
||||
only the highest version will be installed. You can force the
|
||||
installation of multiple derivations with the same name by being
|
||||
specific about the versions. For instance, <literal>nix-env -i
|
||||
gcc-3.3.6 gcc-4.1.1</literal> will install both version of GCC (and
|
||||
will probably cause a user environment conflict!).</para></listitem>
|
||||
|
||||
<listitem><para>If <link
|
||||
linkend='opt-attr'><option>--attr</option></link>
|
||||
(<option>-A</option>) is specified, the arguments are
|
||||
<emphasis>attribute paths</emphasis> that select attributes from the
|
||||
top-level Nix expression. This is faster than using derivation
|
||||
names and unambiguous. To find out the attribute paths of available
|
||||
packages, use <literal>nix-env -qaA '*'</literal>.</para></listitem>
|
||||
|
||||
<listitem><para>If <option>--from-profile</option>
|
||||
<replaceable>path</replaceable> is given,
|
||||
@@ -264,7 +281,7 @@ number of possible ways:
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
<refsection xml:id='refsec-nix-env-install-examples'><title>Examples</title>
|
||||
|
||||
<para>To install a specific version of <command>gcc</command> from the
|
||||
active Nix expression:
|
||||
@@ -285,6 +302,14 @@ installing `gcc-3.3.2'</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>To install using a specific attribute:
|
||||
|
||||
<screen>
|
||||
$ nix-env -i -A gcc40mips
|
||||
$ nix-env -i -A xorg.xorgserver</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>To install all derivations in the Nix expression <filename>foo.nix</filename>:
|
||||
|
||||
<screen>
|
||||
@@ -327,6 +352,25 @@ selecting the <literal>subversionWithJava</literal> attribute from the
|
||||
attribute set returned by calling the function defined in
|
||||
<filename>./foo.nix</filename>.</para>
|
||||
|
||||
<para>A dry-run tells you which paths will be downloaded or built from
|
||||
source:
|
||||
|
||||
<screen>
|
||||
$ nix-env -f pkgs/top-level/all-packages.nix -i f-spot --dry-run
|
||||
(dry run; not doing anything)
|
||||
installing `f-spot-0.0.10'
|
||||
the following derivations will be built:
|
||||
/nix/store/0g63jv9aagwbgci4nnzs2dkxqz84kdja-libgnomeprintui-2.12.1.tar.bz2.drv
|
||||
/nix/store/0gfarvxq6sannsdw8a1ir40j1ys2mqb4-ORBit2-2.14.2.tar.bz2.drv
|
||||
/nix/store/0i9gs5zc04668qiy60ga2rc16abkj7g8-sqlite-2.8.17.drv
|
||||
<replaceable>...</replaceable>
|
||||
the following paths will be substituted:
|
||||
/nix/store/8zbipvm4gp9jfqh9nnk1n3bary1a37gs-perl-XML-Parser-2.34
|
||||
/nix/store/b8a2bg7gnyvvvjjibp4axg9x1hzkw36c-mono-1.1.4
|
||||
<replaceable>...</replaceable></screen>
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
</refsection>
|
||||
@@ -348,6 +392,7 @@ attribute set returned by calling the function defined in
|
||||
<group choice='opt'>
|
||||
<arg choice='plain'><option>--lt</option></arg>
|
||||
<arg choice='plain'><option>--leq</option></arg>
|
||||
<arg choice='plain'><option>--eq</option></arg>
|
||||
<arg choice='plain'><option>--always</option></arg>
|
||||
</group>
|
||||
<arg choice='plain' rep='repeat'><replaceable>args</replaceable></arg>
|
||||
@@ -396,6 +441,17 @@ installed.</para>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--eq</option></term>
|
||||
|
||||
<listitem><para><emphasis>Only</emphasis> “upgrade” to derivations
|
||||
that have the same version. This may not seem very useful, but it
|
||||
actually is, e.g., when there is a new release of Nixpkgs and you
|
||||
want to replace installed applications with the same versions
|
||||
built against newer dependencies (to reduce the number of
|
||||
dependencies floating around on your system).</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--always</option></term>
|
||||
|
||||
<listitem><para>In addition to upgrading to newer versions, also
|
||||
@@ -528,17 +584,37 @@ $ nix-env -e '*' <lineannotation>(remove everything)</lineannotation></screen>
|
||||
<arg choice='plain'><option>--query</option></arg>
|
||||
<arg choice='plain'><option>-q</option></arg>
|
||||
</group>
|
||||
<arg><option>--xml</option></arg>
|
||||
<group choice='opt'>
|
||||
<arg choice='plain'><option>--installed</option></arg>
|
||||
<arg choice='plain'><option>--available</option></arg>
|
||||
<arg choice='plain'><option>-a</option></arg>
|
||||
</group>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--name</option></arg>
|
||||
<arg choice='plain'><option>--expr</option></arg>
|
||||
<arg choice='plain'><option>--status</option></arg>
|
||||
<arg choice='plain'><option>-s</option></arg>
|
||||
</group>
|
||||
<sbr />
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--status</option></arg>
|
||||
<arg choice='plain'><option>-s</option></arg>
|
||||
</group>
|
||||
</arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--attr</option></arg>
|
||||
<arg choice='plain'><option>-A</option></arg>
|
||||
</group>
|
||||
</arg>
|
||||
<arg><option>--no-name</option></arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--compare-versions</option></arg>
|
||||
<arg choice='plain'><option>-c</option></arg>
|
||||
</group>
|
||||
</arg>
|
||||
<arg><option>--system</option></arg>
|
||||
<arg><option>--drv-path</option></arg>
|
||||
<arg><option>--out-path</option></arg>
|
||||
<arg><option>--description</option></arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>names</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
</refsection>
|
||||
@@ -550,7 +626,10 @@ $ nix-env -e '*' <lineannotation>(remove everything)</lineannotation></screen>
|
||||
paths that are installed in the current generation of the active
|
||||
profile (<option>--installed</option>), or the derivations that are
|
||||
available for installation in the active Nix expression
|
||||
(<option>--available</option>).</para>
|
||||
(<option>--available</option>). It only prints information about
|
||||
derivations whose symbolic name matches one of
|
||||
<replaceable>names</replaceable>. The wildcard <literal>*</literal>
|
||||
shows all derivations.</para>
|
||||
|
||||
<para>The derivations are sorted by their <literal>name</literal>
|
||||
attributes.</para>
|
||||
@@ -599,6 +678,18 @@ user environment elements, etc. -->
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><option>--xml</option></term>
|
||||
|
||||
<listitem><para>Print the result in an XML representation suitable
|
||||
for automatic processing by other tools. The root element is
|
||||
called <literal>items</literal>, which contains a
|
||||
<literal>item</literal> element for each available or installed
|
||||
derivation. The fields discussed below are all stored in
|
||||
attributes of the <literal>item</literal>
|
||||
elements.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--status</option></term>
|
||||
<term><option>-s</option></term>
|
||||
|
||||
@@ -618,6 +709,17 @@ user environment elements, etc. -->
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--attr</option></term>
|
||||
<term><option>-a</option></term>
|
||||
|
||||
<listitem><para>Print the <emphasis>attribute path</emphasis> of
|
||||
the derivation, which can be used to unambiguously select it using
|
||||
the <link linkend="opt-attr"><option>--attr</option> option</link>
|
||||
available in commands that install derivations like
|
||||
<literal>nix-env --install</literal>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--no-name</option></term>
|
||||
|
||||
<listitem><para>Suppress printing of the <literal>name</literal>
|
||||
@@ -625,6 +727,51 @@ user environment elements, etc. -->
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--compare-versions</option> /
|
||||
<option>-c</option></term>
|
||||
|
||||
<listitem><para>Compare installed versions to available versions,
|
||||
or vice versa (if <option>--available</option> is given). This is
|
||||
useful for quickly seeing whether upgrades for installed
|
||||
components are available in a Nix expression. A column is added
|
||||
with the following meaning:
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><literal><</literal> <replaceable>version</replaceable></term>
|
||||
|
||||
<listitem><para>A newer version of the component is available
|
||||
or installed.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><literal>=</literal> <replaceable>version</replaceable></term>
|
||||
|
||||
<listitem><para>At most the same version of the component is
|
||||
available or installed.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><literal>></literal> <replaceable>version</replaceable></term>
|
||||
|
||||
<listitem><para>Only older versions of the component are
|
||||
available or installed.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><literal>- ?</literal></term>
|
||||
|
||||
<listitem><para>No version of the component is available or
|
||||
installed.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--system</option></term>
|
||||
|
||||
<listitem><para>Print the <literal>system</literal> attribute of
|
||||
@@ -646,6 +793,15 @@ user environment elements, etc. -->
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--description</option></term>
|
||||
|
||||
<listitem><para>Print a short (one-line) description of the
|
||||
derivation, if available. The description is taken from the
|
||||
<literal>meta.description</literal> attribute of the
|
||||
derivation.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsection>
|
||||
@@ -654,28 +810,47 @@ user environment elements, etc. -->
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<screen>
|
||||
$ nix-env -q <lineannotation>(show installed derivations)</lineannotation>
|
||||
MozillaFirebird-0.7
|
||||
$ nix-env -q '*' <lineannotation>(show installed derivations)</lineannotation>
|
||||
bison-1.875c
|
||||
docbook-xml-4.2
|
||||
...
|
||||
|
||||
$ nix-env -qa <lineannotation>(show available derivations)</lineannotation>
|
||||
GConf-2.4.0.1
|
||||
MPlayer-1.0pre3
|
||||
MozillaFirebird-0.7
|
||||
firefox-1.0.4
|
||||
MPlayer-1.0pre7
|
||||
ORBit2-2.8.3
|
||||
...
|
||||
|
||||
$ nix-env -qas <lineannotation>(show status of available derivations)</lineannotation>
|
||||
-P- GConf-2.4.0.1 <lineannotation>(not installed but present)</lineannotation>
|
||||
--S MPlayer-1.0pre3 <lineannotation>(not present, but there is a substitute for fast installation)</lineannotation>
|
||||
--S MozillaFirebird-0.7 <lineannotation>(i.e., this is not the installed Firebird, even though the version is the same!)</lineannotation>
|
||||
IP- bison-1.875c <lineannotation>(installed and by definition present)</lineannotation>
|
||||
$ nix-env -qa '*' <lineannotation>(show available derivations)</lineannotation>
|
||||
firefox-1.0.7
|
||||
GConf-2.4.0.1
|
||||
MPlayer-1.0pre7
|
||||
ORBit2-2.8.3
|
||||
...
|
||||
|
||||
$ nix-env -f ./foo.nix -qa <lineannotation>(show available derivations in the Nix expression <filename>foo.nix</filename>)</lineannotation>
|
||||
foo-1.2.3</screen>
|
||||
$ nix-env -qas '*' <lineannotation>(show status of available derivations)</lineannotation>
|
||||
-P- firefox-1.0.7 <lineannotation>(not installed but present)</lineannotation>
|
||||
--S GConf-2.4.0.1 <lineannotation>(not present, but there is a substitute for fast installation)</lineannotation>
|
||||
--S MPlayer-1.0pre3 <lineannotation>(i.e., this is not the installed MPlayer, even though the version is the same!)</lineannotation>
|
||||
IP- ORBit2-2.8.3 <lineannotation>(installed and by definition present)</lineannotation>
|
||||
...
|
||||
|
||||
<lineannotation>(show available derivations in the Nix expression <!-- !!! <filename>-->foo.nix<!-- </filename> -->)</lineannotation>
|
||||
$ nix-env -f ./foo.nix -qa '*'
|
||||
foo-1.2.3
|
||||
|
||||
$ nix-env -qc '*' <lineannotation>(compare installed versions to what’s available)</lineannotation>
|
||||
<replaceable>...</replaceable>
|
||||
acrobat-reader-7.0 - ? <lineannotation>(package is not available at all)</lineannotation>
|
||||
autoconf-2.59 = 2.59 <lineannotation>(same version)</lineannotation>
|
||||
firefox-1.0.4 < 1.0.7 <lineannotation>(a more recent version is available)</lineannotation>
|
||||
<replaceable>...</replaceable>
|
||||
|
||||
<lineannotation>(show info about a specific package, in XML)</lineannotation>
|
||||
$ nix-env -qa --xml --description firefox
|
||||
<![CDATA[<?xml version='1.0' encoding='utf-8'?>
|
||||
<items>
|
||||
<item attrPath="0.0.firefoxWrapper"
|
||||
description="Mozilla Firefox - the browser, reloaded (with various plugins)"
|
||||
name="firefox-1.5.0.7" system="i686-linux" />
|
||||
</items>]]></screen>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
154
doc/manual/nix-hash.xml
Normal file
154
doc/manual/nix-hash.xml
Normal file
@@ -0,0 +1,154 @@
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-hash</refname>
|
||||
<refpurpose>compute the cryptographic hash of a path</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-hash</command>
|
||||
<arg><option>--flat</option></arg>
|
||||
<arg><option>--base32</option></arg>
|
||||
<arg><option>--truncate</option></arg>
|
||||
<arg><option>--type</option> <replaceable>hashAlgo</replaceable></arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>path</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>nix-hash</command>
|
||||
<arg choice='plain'><option>--to-base16</option></arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>hash</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>nix-hash</command>
|
||||
<arg choice='plain'><option>--to-base32</option></arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>hash</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The command <command>nix-hash</command> computes the
|
||||
cryptographic hash of the contents of each
|
||||
<replaceable>path</replaceable> and prints it on standard output. By
|
||||
default, it computes an MD5 hash, but other hash algorithms are
|
||||
available as well. The hash is printed in hexadecimal.</para>
|
||||
|
||||
<para>The hash is computed over a <emphasis>serialisation</emphasis>
|
||||
of each path: a dump of the file system tree rooted at the path. This
|
||||
allows directories and symlinks to be hashed as well as regular files.
|
||||
The dump is in the <emphasis>NAR format</emphasis> produced by <link
|
||||
linkend="refsec-nix-store-dump"><command>nix-store</command>
|
||||
<option>--dump</option></link>. Thus, <literal>nix-hash
|
||||
<replaceable>path</replaceable></literal> yields the same
|
||||
cryptographic hash as <literal>nix-store --dump
|
||||
<replaceable>path</replaceable> | md5sum</literal>.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Options</title>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><option>--flat</option></term>
|
||||
|
||||
<listitem><para>Print the cryptographic hash of the contents of
|
||||
each regular file <replaceable>path</replaceable>. That is, do
|
||||
not compute the hash over the dump of
|
||||
<replaceable>path</replaceable>. The result is identical to that
|
||||
produced by the GNU commands <command>md5sum</command> and
|
||||
<command>sha1sum</command>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--base32</option></term>
|
||||
|
||||
<listitem><para>Print the hash in a base-32 representation rather
|
||||
than hexadecimal. This base-32 representation is more compact and
|
||||
can be used in Nix expressions (such as in calls to
|
||||
<function>fetchurl</function>).</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--truncate</option></term>
|
||||
|
||||
<listitem><para>Truncate hashes longer than 160 bits (such as
|
||||
SHA-256) to 160 bits.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--type</option> <replaceable>hashAlgo</replaceable></term>
|
||||
|
||||
<listitem><para>Specify a cryptographic hash, which can be one of
|
||||
<literal>md5</literal>, <literal>sha1</literal>, and
|
||||
<literal>sha256</literal>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--to-base16</option></term>
|
||||
|
||||
<listitem><para>Don’t hash anything, but convert the base-32 hash
|
||||
representation <replaceable>hash</replaceable> to
|
||||
hexadecimal.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--to-base32</option></term>
|
||||
|
||||
<listitem><para>Don’t hash anything, but convert the hexadecimal
|
||||
hash representation <replaceable>hash</replaceable> to
|
||||
base-32.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<para>Computing hashes:
|
||||
|
||||
<screen>
|
||||
$ mkdir test
|
||||
$ echo "hello" > test/world
|
||||
|
||||
$ nix-hash test/ <lineannotation>(MD5 hash; default)</lineannotation>
|
||||
8179d3caeff1869b5ba1744e5a245c04
|
||||
|
||||
$ nix-store --dump test/ | md5sum <lineannotation>(for comparison)</lineannotation>
|
||||
8179d3caeff1869b5ba1744e5a245c04 -
|
||||
|
||||
$ nix-hash --type sha1 test/
|
||||
e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6
|
||||
|
||||
$ nix-hash --type sha1 --base32 test/
|
||||
nvd61k9nalji1zl9rrdfmsmvyyjqpzg4
|
||||
|
||||
$ nix-hash --type sha256 --flat test/
|
||||
error: reading file `test/': Is a directory
|
||||
|
||||
$ nix-hash --type sha256 --flat test/world
|
||||
5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>Converting between hexadecimal and base-32:
|
||||
|
||||
<screen>
|
||||
$ nix-hash --type sha1 --to-base32 e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6
|
||||
nvd61k9nalji1zl9rrdfmsmvyyjqpzg4
|
||||
|
||||
$ nix-hash --type sha1 --to-base16 nvd61k9nalji1zl9rrdfmsmvyyjqpzg4
|
||||
e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6</screen>
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refentry>
|
||||
189
doc/manual/nix-install-package.xml
Normal file
189
doc/manual/nix-install-package.xml
Normal file
@@ -0,0 +1,189 @@
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-install-package</refname>
|
||||
<refpurpose>install a Nix Package file</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-install-package</command>
|
||||
<arg><option>--non-interactive</option></arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--profile</option></arg>
|
||||
<arg choice='plain'><option>-p</option></arg>
|
||||
</group>
|
||||
<replaceable>path</replaceable>
|
||||
</arg>
|
||||
<sbr />
|
||||
<group choice='req'>
|
||||
<arg choice='req'>
|
||||
<option>--url</option>
|
||||
<arg choice='plain'><replaceable>url</replaceable></arg>
|
||||
</arg>
|
||||
<arg choice='req'>
|
||||
<arg choice='plain'><replaceable>file</replaceable></arg>
|
||||
</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The command <command>nix-install-package</command> interactively
|
||||
installs a Nix Package file (<filename>*.nixpkg</filename>), which is
|
||||
a small file that contains a store path to be installed along with the
|
||||
URL of a <link linkend="sec-nix-push"><command>nix-push</command>
|
||||
manifest</link>. The Nix Package file is either
|
||||
<replaceable>file</replaceable>, or automatically downloaded from
|
||||
<replaceable>url</replaceable> if the <option>--url</option> switch is
|
||||
used.</para>
|
||||
|
||||
<para><command>nix-install-package</command> is used in <link
|
||||
linkend="sec-one-click">one-click installs</link> to download and
|
||||
install pre-built binary packages with all necessary dependencies.
|
||||
<command>nix-install-package</command> is intended to be associated
|
||||
with the MIME type <literal>application/nix-package</literal> in a web
|
||||
browser so that it is invoked automatically when you click on
|
||||
<filename>*.nixpkg</filename> files. When invoked, it restarts itself
|
||||
in a terminal window (since otherwise it would be invisible when run
|
||||
from a browser), asks the user to confirm whether to install the
|
||||
package, and if so downloads and installs the package into the user’s
|
||||
current profile.</para>
|
||||
|
||||
<para>To obtain a window, <command>nix-install-package</command> tries
|
||||
to restart itself with <command>xterm</command>,
|
||||
<command>konsole</command> and
|
||||
<command>gnome-terminal</command>.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Options</title>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><option>--non-interactive</option></term>
|
||||
|
||||
<listitem><para>Do not open a new terminal window and do not ask
|
||||
for confirmation.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--profile</option></term>
|
||||
<term><option>-p</option></term>
|
||||
|
||||
<listitem><para>Install the package into the specified profile
|
||||
rather than the user’s current profile.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<para>To install <filename>subversion-1.4.0.nixpkg</filename> into the
|
||||
user’s current profile, without any prompting:
|
||||
|
||||
<screen>
|
||||
$ nix-install-package --non-interactive subversion-1.4.0.nixpkg</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>To install the same package from some URL into a different
|
||||
profile:
|
||||
|
||||
<screen>
|
||||
$ nix-install-package --non-interactive -p /nix/var/nix/profiles/eelco \
|
||||
--url http://nix.cs.uu.nl/dist/nix/nixpkgs-0.10pre6622/pkgs/subversion-1.4.0-i686-linux.nixpkg</screen>
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Format of <literal>nixpkg</literal> files</title>
|
||||
|
||||
<para>A Nix Package file consists of a single line with the following
|
||||
format:
|
||||
|
||||
<screen>
|
||||
NIXPKG1 <replaceable>manifestURL</replaceable> <replaceable>name</replaceable> <replaceable>system</replaceable> <replaceable>drvPath</replaceable> <replaceable>outPath</replaceable></screen>
|
||||
|
||||
The elemens are as follows:
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry><term><literal>NIXPKG1</literal></term>
|
||||
|
||||
<listitem><para>The version of the Nix Package
|
||||
file.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><replaceable>manifestURL</replaceable></term>
|
||||
|
||||
<listitem><para>The manifest to be pulled by
|
||||
<command>nix-pull</command>. The manifest must contain
|
||||
<replaceable>outPath</replaceable>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><replaceable>name</replaceable></term>
|
||||
|
||||
<listitem><para>The symbolic name and version of the
|
||||
package.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><replaceable>system</replaceable></term>
|
||||
|
||||
<listitem><para>The platform identifier of the platform for which
|
||||
this binary package is intended.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><replaceable>drvPath</replaceable></term>
|
||||
|
||||
<listitem><para>The path in the Nix store of the derivation from
|
||||
which <replaceable>outPath</replaceable> was built. Not currently
|
||||
used.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><replaceable>outPath</replaceable></term>
|
||||
|
||||
<listitem><para>The path in the Nix store of the package. After
|
||||
<command>nix-install-package</command> has obtained the manifest
|
||||
from <replaceable>manifestURL</replaceable>, it performs a
|
||||
<literal>nix-env -i</literal> <replaceable>outPath</replaceable>
|
||||
to install the binary package.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
|
||||
<para>An example follows:
|
||||
|
||||
<screen>
|
||||
NIXPKG1 http://.../nixpkgs-0.10pre6622/MANIFEST subversion-1.4.0 i686-darwin \
|
||||
/nix/store/4kh60jkp...-subversion-1.4.0.drv \
|
||||
/nix/store/nkw7wpgb...-subversion-1.4.0</screen>
|
||||
|
||||
(The line breaks (<literal>\</literal>) are for presentation purposes
|
||||
and not part of the actual file.)
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refentry>
|
||||
@@ -1,4 +1,5 @@
|
||||
<refentry>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-instantiate</refname>
|
||||
@@ -9,12 +10,26 @@
|
||||
<cmdsynopsis>
|
||||
<command>nix-instantiate</command>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--attr</option></arg>
|
||||
<arg choice='plain'><option>-A</option></arg>
|
||||
</group>
|
||||
<replaceable>attrPath</replaceable>
|
||||
</arg>
|
||||
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
||||
<arg><option>--indirect</option></arg>
|
||||
<group choice='opt'>
|
||||
<arg choice='plain'><option>--parse-only</option></arg>
|
||||
<arg choice='plain'><option>--eval-only</option></arg>
|
||||
</group>
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>--parse-only</option></arg>
|
||||
<arg choice='plain'>
|
||||
<option>--eval-only</option>
|
||||
<arg><option>--strict</option></arg>
|
||||
</arg>
|
||||
</group>
|
||||
<arg><option>--xml</option></arg>
|
||||
</arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>files</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
@@ -30,6 +45,10 @@ evaluate to a derivation, a list of derivations, or a set of
|
||||
derivations. The paths of the resulting store derivations are printed
|
||||
on standard output.</para>
|
||||
|
||||
<para>If <replaceable>files</replaceable> is the character
|
||||
<literal>-</literal>, then a Nix expression will be read from standard
|
||||
input.</para>
|
||||
|
||||
<para>Most users and developers don’t need to use this command
|
||||
(<command>nix-env</command> and <command>nix-build</command> perform
|
||||
store derivation instantiation from Nix expressions automatically).
|
||||
@@ -72,6 +91,31 @@ common options.</para>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--xml</option></term>
|
||||
|
||||
<listitem><para>When used with <option>--parse-only</option> and
|
||||
<option>--eval-only</option>, print the resulting expression as an
|
||||
XML representation of the abstract syntax tree rather than as an
|
||||
ATerm. The schema is the same as that used by the <link
|
||||
linkend="builtin-toXML"><function>toXML</function>
|
||||
built-in</link>.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--strict</option></term>
|
||||
|
||||
<listitem><para>When used with <option>--eval-only</option>,
|
||||
recursively evaluate list elements and attributes. Normally, such
|
||||
sub-expressions are left unevaluated (since the Nix expression
|
||||
language is lazy).</para>
|
||||
|
||||
<warning><para>This option can cause non-termination, because lazy
|
||||
data structures can be infinitely large.</para></warning>
|
||||
|
||||
</listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsection>
|
||||
@@ -79,6 +123,9 @@ common options.</para>
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<para>Instantiating store derivations from a Nix expression, and
|
||||
building them using <command>nix-store</command>:
|
||||
|
||||
<screen>
|
||||
$ nix-instantiate test.nix <lineannotation>(instantiate)</lineannotation>
|
||||
/nix/store/cigxbmvy6dzix98dxxh9b6shg7ar5bvs-perl-BerkeleyDB-0.26.drv
|
||||
@@ -91,6 +138,54 @@ $ ls -l /nix/store/qhqk4n8ci095g3sdp93x7rgwyh9rdvgk-perl-BerkeleyDB-0.26
|
||||
dr-xr-xr-x 2 eelco users 4096 1970-01-01 01:00 lib
|
||||
...</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>Parsing and evaluating Nix expressions:
|
||||
|
||||
<screen>
|
||||
$ echo '"foo" + "bar"' | nix-instantiate --parse-only -
|
||||
OpPlus(Str("foo"),Str("bar"))
|
||||
|
||||
$ echo '"foo" + "bar"' | nix-instantiate --eval-only -
|
||||
Str("foobar")
|
||||
|
||||
$ echo '"foo" + "bar"' | nix-instantiate --eval-only --xml -
|
||||
<![CDATA[<?xml version='1.0' encoding='utf-8'?>
|
||||
<expr>
|
||||
<string value="foobar" />
|
||||
</expr>]]></screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>The difference between non-strict and strict evaluation:
|
||||
|
||||
<screen>
|
||||
$ echo 'rec { x = "foo"; y = x; }' | nix-instantiate --eval-only --xml -
|
||||
<replaceable>...</replaceable><![CDATA[
|
||||
<attr name="x">
|
||||
<string value="foo" />
|
||||
</attr>
|
||||
<attr name="y">
|
||||
<unevaluated />
|
||||
</attr>]]>
|
||||
<replaceable>...</replaceable></screen>
|
||||
|
||||
Note that <varname>y</varname> is left unevaluated (the XML
|
||||
representation doesn’t attempt to show non-normal forms).
|
||||
|
||||
<screen>
|
||||
$ echo 'rec { x = "foo"; y = x; }' | nix-instantiate --eval-only --xml --strict -
|
||||
<replaceable>...</replaceable><![CDATA[
|
||||
<attr name="x">
|
||||
<string value="foo" />
|
||||
</attr>
|
||||
<attr name="y">
|
||||
<string value="foo" />
|
||||
</attr>]]>
|
||||
<replaceable>...</replaceable></screen>
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
|
||||
64
doc/manual/nix-pack-closure.xml
Normal file
64
doc/manual/nix-pack-closure.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-pack-closure</refname>
|
||||
<refpurpose>pack the closure of a store path into a single file that
|
||||
can be unpacked with
|
||||
<command>nix-unpack-closure</command></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-pack-closure</command>
|
||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The command <command>nix-pack-closure</command> packs the
|
||||
contents of the store paths <replaceable>paths</replaceable> and
|
||||
<emphasis>all their dependencies</emphasis> into a single file, which
|
||||
is written to standard output. (That is, it
|
||||
<emphasis>serialises</emphasis> <replaceable>paths</replaceable>.)
|
||||
The output can then be unpacked into the Nix store of another machine
|
||||
using <command>nix-unpack-closure</command>.</para>
|
||||
|
||||
<para>Together, <command>nix-pack-closure</command> and
|
||||
<command>nix-unpack-closure</command> provide a quick and easy way to
|
||||
deploy a package to a different machine. However, as the output of
|
||||
<command>nix-pack-closure</command> tends to be rather large (since it
|
||||
contains all dependencies), it’s not very efficient.
|
||||
<command>nix-push</command> and <command>nix-pull</command> are more
|
||||
efficient, but are also a bit more cumbersome to use.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<para>To copy some instance of Subversion with all its dependencies to
|
||||
another machine:
|
||||
|
||||
<screen>
|
||||
$ nix-pack-closure /nix/store/hj232g1r...-subversion-1.3.0 > svn.closure
|
||||
|
||||
<lineannotation>Copy <!-- !!! <filename> -->svn.closure to the remote machine, then on the remote machine do:</lineannotation>
|
||||
$ nix-unpack-closure < svn.closure</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>Copy the program <command>azureus</command> with all its
|
||||
dependencies to the machine <literal>scratchy</literal>:
|
||||
|
||||
<screen>
|
||||
$ nix-pack-closure $(which azureus) | ssh scratchy nix-unpack-closure</screen>
|
||||
|
||||
</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refentry>
|
||||
@@ -1,43 +1,41 @@
|
||||
<refentry>
|
||||
<refnamediv>
|
||||
<refname>nix-pull</refname>
|
||||
<refpurpose>pull substitutes from a network cache</refpurpose>
|
||||
</refnamediv>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-pull</command>
|
||||
<arg choice='plain'><replaceable>url</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
<refnamediv>
|
||||
<refname>nix-pull</refname>
|
||||
<refpurpose>pull substitutes from a network cache</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsection>
|
||||
<title>Description</title>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-pull</command>
|
||||
<arg choice='plain'><replaceable>url</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<para>
|
||||
The command <command>nix-pull</command> obtains a list of
|
||||
pre-built store paths from the URL
|
||||
<replaceable>url</replaceable>, and for each of these store
|
||||
paths, registers a substitute derivation that downloads and
|
||||
unpacks it into the Nix store. This is used to speed up
|
||||
installations: if you attempt to install something that has
|
||||
already been built and stored into the network cache, Nix can
|
||||
transparently re-use the pre-built store paths.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The file at <replaceable>url</replaceable> must be compatible
|
||||
with the files created by <replaceable>nix-push</replaceable>.
|
||||
</para>
|
||||
<refsection><title>Description</title>
|
||||
|
||||
</refsection>
|
||||
<para>The command <command>nix-pull</command> obtains a list of
|
||||
pre-built store paths from the URL <replaceable>url</replaceable>, and
|
||||
for each of these store paths, registers a substitute derivation that
|
||||
downloads and unpacks it into the Nix store. This is used to speed up
|
||||
installations: if you attempt to install something that has already
|
||||
been built and stored into the network cache, Nix can transparently
|
||||
re-use the pre-built store paths.</para>
|
||||
|
||||
<refsection>
|
||||
<title>Examples</title>
|
||||
<para>The file at <replaceable>url</replaceable> must be compatible
|
||||
with the files created by <replaceable>nix-push</replaceable>.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection><title>Examples</title>
|
||||
|
||||
<screen>
|
||||
$ nix-pull http://nix.cs.uu.nl/dist/nix/nixpkgs-0.5pre753/MANIFEST</screen>
|
||||
|
||||
</refsection>
|
||||
|
||||
<screen>
|
||||
$ nix-pull http://catamaran.labs.cs.uu.nl/dist/nix/nixpkgs-0.5pre753/MANIFEST</screen>
|
||||
|
||||
</refsection>
|
||||
|
||||
</refentry>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<refentry>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-push</refname>
|
||||
@@ -62,14 +63,15 @@ machines using the <command>nix-pull</command> command.</para>
|
||||
specified by <replaceable>archivesPutURL</replaceable>. HTTP PUT
|
||||
requests are used to do this. However, before a file
|
||||
<varname>x</varname> is uploaded to
|
||||
<literal><replaceable>archivesPutURL</replaceable>/<varname>x</varname></literal>,
|
||||
<literal><replaceable>archivesPutURL</replaceable>/</literal><varname>x</varname>,
|
||||
<command>nix-push</command> first determines whether this upload is
|
||||
unnecessary by issuing a HTTP HEAD request on
|
||||
<literal><replaceable>archivesGetURL</replaceable>/<varname>x</varname></literal>.
|
||||
<literal><replaceable>archivesGetURL</replaceable>/</literal><varname>x</varname>.
|
||||
This allows a cache to be shared between many partially overlapping
|
||||
<command>nix-push</command> invocations. (We use two URLs because
|
||||
the upload URL typically refers to a CGI script, while the download
|
||||
URL just refers to a file system directory on the server.)</para></listitem>
|
||||
URL just refers to a file system directory on the
|
||||
server.)</para></listitem>
|
||||
|
||||
<listitem><para>The manifest is uploaded using an HTTP PUT request
|
||||
to <replaceable>manifestPutURL</replaceable>. The corresponding
|
||||
@@ -80,7 +82,9 @@ machines using the <command>nix-pull</command> command.</para>
|
||||
|
||||
</para>
|
||||
|
||||
<para>TODO: <option>--copy</option></para>
|
||||
<!--
|
||||
<para>TODO: <option>- -copy</option></para>
|
||||
-->
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<refentry>
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-store</refname>
|
||||
@@ -43,7 +44,7 @@ linkend="sec-common-options" /> for a list of common options.</para>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry id="opt-add-root"><term><option>--add-root</option> <replaceable>path</replaceable></term>
|
||||
<varlistentry xml:id="opt-add-root"><term><option>--add-root</option> <replaceable>path</replaceable></term>
|
||||
|
||||
<listitem><para>Causes the result of a realisation
|
||||
(<option>--realise</option> and <option>--force-realise</option>)
|
||||
@@ -108,8 +109,7 @@ lrwxrwxrwx 1 ... 2005-03-13 21:10 /home/eelco/bla/result -> /nix/store/1r1134
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection id='rsec-nix-store-realise'><title>Operation
|
||||
<option>--realise</option></title>
|
||||
<refsection xml:id='rsec-nix-store-realise'><title>Operation <option>--realise</option></title>
|
||||
|
||||
<refsection><title>Synopsis</title>
|
||||
|
||||
@@ -183,7 +183,7 @@ linkend="sec-nix-build"><command>nix-build</command></link> does.</para>
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection id='rsec-nix-store-gc'><title>Operation <option>--gc</option></title>
|
||||
<refsection xml:id='rsec-nix-store-gc'><title>Operation <option>--gc</option></title>
|
||||
|
||||
<refsection><title>Synopsis</title>
|
||||
|
||||
@@ -256,6 +256,11 @@ and <link
|
||||
linkend="conf-gc-keep-derivations"><literal>gc-keep-derivations</literal></link>
|
||||
variables in the Nix configuration file.</para>
|
||||
|
||||
<para>With <option>--delete</option>, the collector prints the total
|
||||
number of freed bytes when it finishes (or when it is interrupted).
|
||||
With <option>--print-dead</option>, it prints the number of bytes that
|
||||
would be freed.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
@@ -264,7 +269,10 @@ variables in the Nix configuration file.</para>
|
||||
<para>To delete all unreachable paths, just do:
|
||||
|
||||
<screen>
|
||||
$ nix-store --gc</screen>
|
||||
$ nix-store --gc
|
||||
deleting `/nix/store/kq82idx6g0nyzsp2s14gfsc38npai7lf-cairo-1.0.4.tar.gz.drv'
|
||||
<replaceable>...</replaceable>
|
||||
8825586 bytes freed (8.42 MiB)</screen>
|
||||
|
||||
</para>
|
||||
|
||||
@@ -277,7 +285,52 @@ $ nix-store --gc</screen>
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection><title>Operation <option>--query</option></title>
|
||||
<refsection><title>Operation <option>--delete</option></title>
|
||||
|
||||
<refsection><title>Synopsis</title>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>nix-store</command>
|
||||
<arg choice='plain'><option>--gc</option></arg>
|
||||
<arg><option>--ignore-liveness</option></arg>
|
||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
</refsection>
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The operation <option>--delete</option> deletes the store paths
|
||||
<replaceable>paths</replaceable> from the Nix store, but only if it is
|
||||
safe to do so; that is, when the path is not reachable from a root of
|
||||
the garbage collector. This means that you can only delete paths that
|
||||
would also be deleted by <literal>nix-store --gc</literal>. Thus,
|
||||
<literal>--delete</literal> is a more targeted version of
|
||||
<literal>--gc</literal>.</para>
|
||||
|
||||
<para>With the option <option>--ignore-liveness</option>, reachability
|
||||
from the roots is ignored. However, the path still won’t be deleted
|
||||
if there are other paths in the store that refer to it (i.e., depend
|
||||
on it).</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
<refsection><title>Example</title>
|
||||
|
||||
<screen>
|
||||
$ nix-store --delete /nix/store/zq0h41l75vlb4z45kzgjjmsjxvcv1qk7-mesa-6.4
|
||||
0 bytes freed (0.00 MiB)
|
||||
error: cannot delete path `/nix/store/zq0h41l75vlb4z45kzgjjmsjxvcv1qk7-mesa-6.4' since it is still alive</screen>
|
||||
|
||||
</refsection>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection xml:id='refsec-nix-store-query'><title>Operation <option>--query</option></title>
|
||||
|
||||
<refsection><title>Synopsis</title>
|
||||
|
||||
@@ -292,8 +345,8 @@ $ nix-store --gc</screen>
|
||||
<arg choice='plain'><option>--requisites</option></arg>
|
||||
<arg choice='plain'><option>-R</option></arg>
|
||||
<arg choice='plain'><option>--references</option></arg>
|
||||
<arg choice='plain'><option>--referers</option></arg>
|
||||
<arg choice='plain'><option>--referers-closure</option></arg>
|
||||
<arg choice='plain'><option>--referrers</option></arg>
|
||||
<arg choice='plain'><option>--referrers-closure</option></arg>
|
||||
<arg choice='plain'><option>--deriver</option></arg>
|
||||
<arg choice='plain'><option>--deriver</option></arg>
|
||||
<arg choice='plain'><option>--graph</option></arg>
|
||||
@@ -353,7 +406,7 @@ query is applied to the target of the symlink.</para>
|
||||
</refsection>
|
||||
|
||||
|
||||
<refsection id='nixref-queries'><title>Queries</title>
|
||||
<refsection xml:id='nixref-queries'><title>Queries</title>
|
||||
|
||||
<variablelist>
|
||||
|
||||
@@ -411,21 +464,21 @@ query is applied to the target of the symlink.</para>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--referers</option></term>
|
||||
<varlistentry><term><option>--referrers</option></term>
|
||||
|
||||
<listitem><para>Prints the set of <emphasis>referers</emphasis> of
|
||||
<listitem><para>Prints the set of <emphasis>referrers</emphasis> of
|
||||
the store paths <replaceable>paths</replaceable>, that is, the
|
||||
store paths currently existing in the Nix store that refer to one
|
||||
of <replaceable>paths</replaceable>. Note that contrary to the
|
||||
references, the set of referers is not constant; it can change as
|
||||
references, the set of referrers is not constant; it can change as
|
||||
store paths are added or removed.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term><option>--referers-closure</option></term>
|
||||
<varlistentry><term><option>--referrers-closure</option></term>
|
||||
|
||||
<listitem><para>Prints the closure of the set of store paths
|
||||
<replaceable>paths</replaceable> under the referers relation; that
|
||||
<replaceable>paths</replaceable> under the referrers relation; that
|
||||
is, all store paths that directly or indirectly refer to one of
|
||||
<replaceable>paths</replaceable>. These are all the path currently
|
||||
in the Nix store that are dependent on
|
||||
@@ -448,11 +501,11 @@ query is applied to the target of the symlink.</para>
|
||||
|
||||
<listitem><para>Prints the references graph of the store paths
|
||||
<replaceable>paths</replaceable> in the format of the
|
||||
<command>dot</command> tool of AT&T's <ulink
|
||||
url="http://www.graphviz.org/">Graphviz package</ulink>. This can
|
||||
be used to visualise dependency graphs. To obtain a build-time
|
||||
dependency graph, apply this to a store derivation. To obtain a
|
||||
runtime dependency graph, apply it to an output
|
||||
<command>dot</command> tool of AT&T's <link
|
||||
xlink:href="http://www.graphviz.org/">Graphviz package</link>.
|
||||
This can be used to visualise dependency graphs. To obtain a
|
||||
build-time dependency graph, apply this to a store derivation. To
|
||||
obtain a runtime dependency graph, apply it to an output
|
||||
path.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
@@ -536,7 +589,7 @@ $ nix-store -q --tree $(nix-store -qd $(which svn))
|
||||
<command>svn</command>:
|
||||
|
||||
<screen>
|
||||
$ nix-store -q --referers $(nix-store -q --binding openssl $(nix-store -qd $(which svn)))
|
||||
$ nix-store -q --referrers $(nix-store -q --binding openssl $(nix-store -qd $(which svn)))
|
||||
/nix/store/23ny9l9wixx21632y2wi4p585qhva1q8-sylpheed-1.0.0
|
||||
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
||||
/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3
|
||||
@@ -548,7 +601,7 @@ $ nix-store -q --referers $(nix-store -q --binding openssl $(nix-store -qd $(whi
|
||||
(C library) used by <command>svn</command>:
|
||||
|
||||
<screen>
|
||||
$ nix-store -q --referers-closure $(ldd $(which svn) | grep /libc.so | awk '{print $3}')
|
||||
$ nix-store -q --referrers-closure $(ldd $(which svn) | grep /libc.so | awk '{print $3}')
|
||||
/nix/store/034a6h4vpz9kds5r6kzb9lhh81mscw43-libgnomeprintui-2.8.2
|
||||
/nix/store/15l3yi0d45prm7a82pcrknxdh6nzmxza-gawk-3.1.4
|
||||
<replaceable>...</replaceable></screen>
|
||||
@@ -575,7 +628,7 @@ $ gv graph.ps</screen>
|
||||
<!--######################################################################-->
|
||||
|
||||
<!--
|
||||
<refsection id="rsec-nix-store-reg-val"><title>Operation <option>-XXX-register-validity</option></title>
|
||||
<refsection xml:id="rsec-nix-store-reg-val"><title>Operation <option>-XXX-register-validity</option></title>
|
||||
|
||||
<refsection><title>Synopsis</title>
|
||||
|
||||
@@ -669,8 +722,83 @@ in Nix itself.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection xml:id='refsec-nix-store-dump'><title>Operation <option>--dump</option></title>
|
||||
|
||||
<refsection>
|
||||
<title>Synopsis</title>
|
||||
<cmdsynopsis>
|
||||
<command>nix-store</command>
|
||||
<arg choice='plain'><option>--dump</option></arg>
|
||||
<arg choice='plain'><replaceable>path</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsection>
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The operation <option>--dump</option> produces a NAR (Nix
|
||||
ARchive) file containing the contents of the file system tree rooted
|
||||
at <replaceable>path</replaceable>. The archive is written to
|
||||
standard output.</para>
|
||||
|
||||
<para>A NAR archive is like a TAR or Zip archive, but it contains only
|
||||
the information that Nix considers important. For instance,
|
||||
timestamps are elided because all files in the Nix store have their
|
||||
timestamp set to 0 anyway. Likewise, all permissions are left out
|
||||
except for the execute bit, because all files in the Nix store have
|
||||
644 or 755 permission.</para>
|
||||
|
||||
<para>Also, a NAR archive is <emphasis>canonical</emphasis>, meaning
|
||||
that “equal” paths always produce the same NAR archive. For instance,
|
||||
directory entries are always sorted so that the actual on-disk order
|
||||
doesn’t influence the result. This means that the cryptographic hash
|
||||
of a NAR dump of a path is usable as a fingerprint of the contents of
|
||||
the path. Indeed, the hashes of store paths stored in Nix’s database
|
||||
(see <link linkend="refsec-nix-store-query"><literal>nix-store -q
|
||||
--hash</literal></link>) are SHA-256 hashes of the NAR dump of each
|
||||
store path.</para>
|
||||
|
||||
<para>NAR archives support filenames of unlimited length and 64-bit
|
||||
file sizes. They can contain regular files, directories, and symbolic
|
||||
links, but not other types of files (such as device nodes).</para>
|
||||
|
||||
<para>A Nix archive can be unpacked using <literal>nix-store
|
||||
--restore</literal>.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
<!--######################################################################-->
|
||||
|
||||
<refsection><title>Operation <option>--restore</option></title>
|
||||
|
||||
<refsection>
|
||||
<title>Synopsis</title>
|
||||
<cmdsynopsis>
|
||||
<command>nix-store</command>
|
||||
<arg choice='plain'><option>--restore</option></arg>
|
||||
<arg choice='plain'><replaceable>path</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsection>
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The operation <option>--restore</option> unpacks a NAR archive
|
||||
to <replaceable>path</replaceable>, which must not already exist. The
|
||||
archive is read from standard input.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
28
doc/manual/nix-unpack-closure.xml
Normal file
28
doc/manual/nix-unpack-closure.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<refnamediv>
|
||||
<refname>nix-unpack-closure</refname>
|
||||
<refpurpose>unpack the closure of a store path created by <command>nix-pack-closure</command> into the Nix store</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nix-unpack-closure</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsection><title>Description</title>
|
||||
|
||||
<para>The command <command>nix-unpack-closure</command> unpacks the
|
||||
closure of a set of store paths created by
|
||||
<command>nix-pack-closure</command> into the local Nix store. The
|
||||
closure is a single file read from standard input. See the
|
||||
description of <command>nix-pack-closure</command> for details and
|
||||
examples.</para>
|
||||
|
||||
</refsection>
|
||||
|
||||
|
||||
</refentry>
|
||||
@@ -20,5 +20,6 @@
|
||||
<arg><option>--fallback</option></arg>
|
||||
<arg><option>--readonly-mode</option></arg>
|
||||
<arg><option>--log-type</option> <replaceable>type</replaceable></arg>
|
||||
<sbr />
|
||||
|
||||
</nop>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<sect1 id="sec-common-options"><title>Common options</title>
|
||||
<section xmlns="http://docbook.org/ns/docbook" xml:id="sec-common-options">
|
||||
|
||||
<title>Common options</title>
|
||||
|
||||
|
||||
<para>Most Nix commands accept the following command-line options:</para>
|
||||
|
||||
@@ -86,12 +89,16 @@
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry id="opt-max-jobs"><term><option>--max-jobs</option></term>
|
||||
<varlistentry xml:id="opt-max-jobs"><term><option>--max-jobs</option></term>
|
||||
<term><option>-j</option></term>
|
||||
|
||||
<listitem><para>Sets the maximum number of build jobs that Nix will
|
||||
perform in parallel to the specified number. The default is 1. A
|
||||
higher value is useful on SMP systems or to exploit I/O latency.</para></listitem>
|
||||
perform in parallel to the specified number. The default is
|
||||
specified by the <link
|
||||
linkend='conf-build-max-jobs'><literal>build-max-jobs</literal></link>
|
||||
configuration setting, which itself defaults to
|
||||
<literal>1</literal>. A higher value is useful on SMP systems or to
|
||||
exploit I/O latency. </para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
@@ -155,7 +162,7 @@
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry id="opt-log-type"><term><option>--log-type</option>
|
||||
<varlistentry xml:id="opt-log-type"><term><option>--log-type</option>
|
||||
<replaceable>type</replaceable></term>
|
||||
|
||||
<listitem>
|
||||
@@ -187,9 +194,9 @@
|
||||
<varlistentry><term><literal>escapes</literal></term>
|
||||
|
||||
<listitem><para>Indicate nesting using escape codes that can be
|
||||
interpreted by the <command>log2xml</command> tool in the Nix
|
||||
source distribution. The resulting XML file can be fed into the
|
||||
<command>log2html.xsl</command> stylesheet to create an HTML
|
||||
interpreted by the <command>nix-log2xml</command> tool in the
|
||||
Nix source distribution. The resulting XML file can be fed into
|
||||
the <command>log2html.xsl</command> stylesheet to create an HTML
|
||||
file that can be browsed interactively, using Javascript to
|
||||
expand and collapse parts of the output.</para></listitem>
|
||||
|
||||
@@ -210,7 +217,73 @@
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry><term><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></term>
|
||||
|
||||
<listitem><para>This option is accepted by
|
||||
<command>nix-env</command>, <command>nix-instantiate</command> and
|
||||
<command>nix-build</command>. When evaluating Nix expressions, the
|
||||
expression evaluator will automatically try to call functions that
|
||||
it encounters. It can automatically call functions for which every
|
||||
argument has a <link linkend='ss-functions'>default value</link>
|
||||
(e.g., <literal>{<replaceable>argName</replaceable> ?
|
||||
<replaceable>defaultValue</replaceable>}:
|
||||
<replaceable>...</replaceable></literal>). With
|
||||
<option>--arg</option>, you can also call functions that have
|
||||
arguments without a default value (or override a default value).
|
||||
That is, if the evaluator encounters a function with an argument
|
||||
named <replaceable>name</replaceable>, it will call it with value
|
||||
<replaceable>value</replaceable>.</para>
|
||||
|
||||
<para>For instance, the file
|
||||
<literal>pkgs/top-level/all-packages.nix</literal> in Nixpkgs is
|
||||
actually a function:
|
||||
|
||||
<programlisting>
|
||||
{ # The system (e.g., `i686-linux') for which to build the packages.
|
||||
system ? __currentSystem
|
||||
<replaceable>...</replaceable>
|
||||
}: <replaceable>...</replaceable></programlisting>
|
||||
|
||||
So if you call this Nix expression (e.g., when you do
|
||||
<literal>nix-env -i <replaceable>pkgname</replaceable></literal>),
|
||||
the function will be called automatically using the value <link
|
||||
linkend='builtin-currentSystem'><literal>__currentSystem</literal></link>
|
||||
for the <literal>system</literal> argument. You can override this
|
||||
using <option>--arg</option>, e.g., <literal>nix-env -i
|
||||
<replaceable>pkgname</replaceable> --arg system
|
||||
\"i686-freebsd\"</literal>. (Note that since the argument is a Nix
|
||||
string literal, you have to escape the quotes.)</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id="opt-attr"><term><option>--attr</option> / <option>-A</option>
|
||||
<replaceable>attrPath</replaceable></term>
|
||||
|
||||
<listitem><para>In <command>nix-env</command>,
|
||||
<command>nix-instantiate</command> and <command>nix-build</command>,
|
||||
<option>--attr</option> allows you to select an attribute from the
|
||||
top-level Nix expression being evaluated. The <emphasis>attribute
|
||||
path</emphasis> <replaceable>attrPath</replaceable> is a sequence of
|
||||
attribute names separated by dots. For instance, given a top-level
|
||||
Nix expression <replaceable>e</replaceable>, the attribute path
|
||||
<literal>xorg.xorgserver</literal> would cause the expression
|
||||
<literal><replaceable>e</replaceable>.xorg.xorgserver</literal> to
|
||||
be used. See <link
|
||||
linkend='refsec-nix-env-install-examples'><command>nix-env
|
||||
--install</command></link> for some concrete examples.</para>
|
||||
|
||||
<para>In addition to attribute names, you can also specify array
|
||||
indices. For instance, the attribute path
|
||||
<literal>foo.3.bar</literal> selects the <literal>bar</literal>
|
||||
attribute of the fourth element of the array in the
|
||||
<literal>foo</literal> attribute of the top-level
|
||||
expression.</para></listitem>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<chapter id='chap-package-management'><title>Package Management</title>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id='chap-package-management'>
|
||||
|
||||
<title>Package Management</title>
|
||||
|
||||
|
||||
<para>This chapter discusses how to do package management with Nix,
|
||||
i.e., how to obtain, install, upgrade, and erase components. This is
|
||||
@@ -7,7 +12,7 @@ who want to <emphasis>create</emphasis> components should consult
|
||||
<xref linkend='chap-writing-nix-expressions' />.</para>
|
||||
|
||||
|
||||
<sect1><title>Basic package management</title>
|
||||
<section><title>Basic package management</title>
|
||||
|
||||
<para>The main command for package management is <link
|
||||
linkend="sec-nix-env"><command>nix-env</command></link>. You can use
|
||||
@@ -32,14 +37,14 @@ components ranging from basic development stuff such as GCC and Glibc,
|
||||
to end-user applications like Mozilla Firefox. (Nix is however not
|
||||
tied to the Nix Package collection; you could write your own Nix
|
||||
expressions based on it, or completely new ones.) You can download
|
||||
the latest version from <ulink
|
||||
url='http://catamaran.labs.cs.uu.nl/dist/nix' />.</para>
|
||||
the latest version from <link
|
||||
xlink:href='http://nix.cs.uu.nl/dist/nix' />.</para>
|
||||
|
||||
<para>Assuming that you have downloaded and unpacked a release of Nix
|
||||
Packages, you can view the set of available components in the release:
|
||||
|
||||
<screen>
|
||||
$ nix-env -qaf nixpkgs-<replaceable>version</replaceable>
|
||||
$ nix-env -qaf nixpkgs-<replaceable>version</replaceable> '*'
|
||||
ant-blackdown-1.4.2
|
||||
aterm-2.2
|
||||
bash-3.0
|
||||
@@ -50,14 +55,30 @@ bzip2-1.0.2
|
||||
...</screen>
|
||||
|
||||
where <literal>nixpkgs-<replaceable>version</replaceable></literal> is
|
||||
where you’ve unpacked the release.</para>
|
||||
where you’ve unpacked the release. The flag <option>-q</option>
|
||||
specifies a query operation; <option>-a</option> means that you want
|
||||
to show the “available” (i.e., installable) packages, as opposed to
|
||||
the installed packages; and <option>-f</option>
|
||||
<filename>nixpkgs-<replaceable>version</replaceable></filename>
|
||||
specifies the source of the packages. The argument
|
||||
<literal>'*'</literal> shows all installable packages. (The quotes are
|
||||
necessary to prevent shell expansion.) You can also select specific
|
||||
packages by name:
|
||||
|
||||
<screen>
|
||||
$ nix-env -qaf nixpkgs-<replaceable>version</replaceable> gcc
|
||||
gcc-3.4.6
|
||||
gcc-4.0.3
|
||||
gcc-4.1.1</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>It is also possible to see the <emphasis>status</emphasis> of
|
||||
available components, i.e., whether they are installed into the user
|
||||
environment and/or present in the system:
|
||||
|
||||
<screen>
|
||||
$ nix-env -qasf nixpkgs-<replaceable>version</replaceable>
|
||||
$ nix-env -qasf nixpkgs-<replaceable>version</replaceable> '*'
|
||||
...
|
||||
-PS bash-3.0
|
||||
--S binutils-2.15
|
||||
@@ -83,9 +104,9 @@ components contained in them. This is done using <literal>nix-env
|
||||
$ nix-env -f nixpkgs-<replaceable>version</replaceable> -i subversion</screen>
|
||||
|
||||
will install the component called <literal>subversion</literal> (which
|
||||
is, of course, the <ulink
|
||||
url='http://subversion.tigris.org/'>Subversion version management
|
||||
system</ulink>).</para>
|
||||
is, of course, the <link
|
||||
xlink:href='http://subversion.tigris.org/'>Subversion version
|
||||
management system</link>).</para>
|
||||
|
||||
<para>When you do this for the first time, Nix will start building
|
||||
Subversion and all its dependencies. This will take quite a while —
|
||||
@@ -96,18 +117,17 @@ available somewhere. This is done using the
|
||||
<command>nix-pull</command> command, which must be supplied with a URL
|
||||
containing a <emphasis>manifest</emphasis> describing what binaries
|
||||
are available. This URL should correspond to the Nix Packages release
|
||||
that you’re using. For instance, if you obtained a release from
|
||||
<ulink
|
||||
url='http://catamaran.labs.cs.uu.nl/dist/nix/nixpkgs-0.6pre1554/' />,
|
||||
then you should do:
|
||||
that you’re using. For instance, if you obtained a release from <link
|
||||
xlink:href='http://nix.cs.uu.nl/dist/nix/nixpkgs-0.6pre1554/' />, then
|
||||
you should do:
|
||||
|
||||
<screen>
|
||||
$ nix-pull http://catamaran.labs.cs.uu.nl/dist/nix/nixpkgs-0.6pre1554/MANIFEST</screen>
|
||||
$ nix-pull http://nix.cs.uu.nl/dist/nix/nixpkgs-0.6pre1554/MANIFEST</screen>
|
||||
|
||||
If you then issue the installation command, it should start
|
||||
downloading binaries from <systemitem
|
||||
class='fqdomainname'>catamaran.labs.cs.uu.nl</systemitem>, instead of
|
||||
building them from source. This might still take a while since all
|
||||
class='fqdomainname'>nix.cs.uu.nl</systemitem>, instead of building
|
||||
them from source. This might still take a while since all
|
||||
dependencies must be downloaded, but on a reasonably fast connection
|
||||
such as an DSL line it’s on the order of a few minutes.</para>
|
||||
|
||||
@@ -170,13 +190,13 @@ since <literal>nix-channel --update</literal> calls <literal>nix-env
|
||||
from the channel, replacing whatever default you had
|
||||
set.</para></footnote></para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1 id="sec-profiles"><title>Profiles</title>
|
||||
<section xml:id="sec-profiles"><title>Profiles</title>
|
||||
|
||||
<para>Profiles and user environments are Nix’s mechanism for
|
||||
implementing the ability to allow differens users to have different
|
||||
implementing the ability to allow different users to have different
|
||||
configurations, and to do atomic upgrades and rollbacks. To
|
||||
understand how they work, it’s useful to know a bit about how Nix
|
||||
works. In Nix, components are stored in unique locations in the
|
||||
@@ -196,7 +216,7 @@ the file system, so they don’t interfere with each other. <xref
|
||||
linkend='fig-user-environments' /> shows a part of a typical Nix
|
||||
store.</para>
|
||||
|
||||
<figure id='fig-user-environments'><title>User environments</title>
|
||||
<figure xml:id='fig-user-environments'><title>User environments</title>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref='figures/user-environments.png' format='PNG' />
|
||||
@@ -325,10 +345,10 @@ $ nix-env -p /nix/var/nix/profiles/other-profile -i subversion</screen>
|
||||
This will <emphasis>not</emphasis> change the
|
||||
<command>~/.nix-profile</command> symlink.</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1 id='sec-garbage-collection'><title>Garbage collection</title>
|
||||
<section xml:id='sec-garbage-collection'><title>Garbage collection</title>
|
||||
|
||||
<para><command>nix-env</command> operations such as upgrades
|
||||
(<option>-u</option>) and uninstall (<option>-e</option>) never
|
||||
@@ -378,8 +398,21 @@ $ nix-store --gc --print-dead</screen>
|
||||
Likewise, the option <option>--print-live</option> will show the paths
|
||||
that <emphasis>won’t</emphasis> be deleted.</para>
|
||||
|
||||
<para>There is also a convenient little utility
|
||||
<command>nix-collect-garbage</command>, which when invoked with the
|
||||
<option>-d</option> (<option>--delete-old</option>) switch deletes all
|
||||
old generations of all profiles in
|
||||
<filename>/nix/var/nix/profiles</filename>. So
|
||||
|
||||
<sect2 id="ssec-gc-roots"><title>Garbage collector roots</title>
|
||||
<screen>
|
||||
$ nix-collect-garbage -d</screen>
|
||||
|
||||
is a quick and easy way to clean up your system.</para>
|
||||
|
||||
|
||||
|
||||
|
||||
<section xml:id="ssec-gc-roots"><title>Garbage collector roots</title>
|
||||
|
||||
<para>The roots of the garbage collector are all store paths to which
|
||||
there are symlinks in the directory
|
||||
@@ -401,12 +434,12 @@ followed and searched for roots, but symlinks to non-store paths
|
||||
<emphasis>inside</emphasis> the paths reached in that way are not
|
||||
followed to prevent infinite recursion.</para>
|
||||
|
||||
</sect2>
|
||||
</section>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1 id="sec-channels"><title>Channels</title>
|
||||
<section xml:id="sec-channels"><title>Channels</title>
|
||||
|
||||
<para>If you want to stay up to date with a set of packages, it’s not
|
||||
very convenient to manually download the latest set of Nix expressions
|
||||
@@ -425,7 +458,7 @@ URL.</para>
|
||||
<command>nix-channel --add</command>, e.g.,
|
||||
|
||||
<screen>
|
||||
$ nix-channel --add http://catamaran.labs.cs.uu.nl/dist/nix/channels/nixpkgs-unstable</screen>
|
||||
$ nix-channel --add http://nix.cs.uu.nl/dist/nix/channels-v3/nixpkgs-unstable</screen>
|
||||
|
||||
subscribes you to a channel that always contains that latest version
|
||||
of the Nix Packages collection. (Instead of
|
||||
@@ -456,7 +489,44 @@ $ nix-env -u '*'</screen>
|
||||
to upgrade all components in your profile to the latest versions
|
||||
available in the subscribed channels.</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<section xml:id="sec-one-click"><title>One-click installs</title>
|
||||
|
||||
<para>Often, when you want to install a specific package (e.g., from
|
||||
the <link
|
||||
xlink:href="http://nix.cs.uu.nl/dist/nix/nixpkgs-unstable-latest/">Nix
|
||||
Packages collection</link> or from our <link
|
||||
xlink:href='http://nix.cs.uu.nl/dist/'>release server</link>),
|
||||
subscribing to a channel is a bit cumbersome. And channels don’t help
|
||||
you at all if you want to install an older version of a package than
|
||||
the one provided by the current contents of the channel, or a package
|
||||
that has been removed from the channel. That’s when
|
||||
<emphasis>one-click installs</emphasis> come in handy: you can just go
|
||||
to the web page that contains the package, click on it, and it will be
|
||||
installed with all the necessary dependencies.</para>
|
||||
|
||||
<para>For instance, you can go to <link
|
||||
xlink:href="http://nix.cs.uu.nl/dist/nix/nixpkgs-unstable-latest/" />
|
||||
— or to any older release of Nix Packages — and click on any link for
|
||||
the individual packages for your platform (say, <link
|
||||
xlink:href='http://nix.cs.uu.nl/dist/nix/nixpkgs-0.10pre6622/pkgs/subversion-1.4.0-i686-linux.nixpkg'><literal>subversion-1.4.0</literal>
|
||||
for <literal>i686-linux</literal></link>). The first time you do
|
||||
this, your browser will ask what to do with
|
||||
<literal>application/nix-package</literal> files. You should open
|
||||
them with <filename>/nix/bin/nix-install-package</filename>. This
|
||||
will open a window that asks you to confirm that you want to install
|
||||
the package. When you answer <literal>Y</literal>, the package and
|
||||
all its dependencies will be installed. This is a binary deployment
|
||||
mechanism — you get packages pre-compiled for the selected platform
|
||||
type.</para>
|
||||
|
||||
<para>You can also install <literal>application/nix-package</literal>
|
||||
files from the command line directly. See <xref
|
||||
linkend='sec-nix-install-package' /> for details.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<chapter><title>Quick Start</title>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Quick Start</title>
|
||||
|
||||
|
||||
<para>This chapter is for impatient people who don't like reading
|
||||
documentation. For more in-depth information you are kindly referred
|
||||
@@ -6,8 +10,8 @@ to the following chapters.</para>
|
||||
|
||||
<orderedlist>
|
||||
|
||||
<listitem><para>Download a source tarball or RPM from <ulink
|
||||
url='http://www.cs.uu.nl/groups/ST/Trace/Nix'/>. Build source
|
||||
<listitem><para>Download a source tarball or RPM from <link
|
||||
xlink:href='http://www.cs.uu.nl/groups/ST/Trace/Nix'/>. Build source
|
||||
distributions using the regular sequence:
|
||||
|
||||
<screen>
|
||||
@@ -27,7 +31,8 @@ file).</para></listitem>
|
||||
<listitem><para>Subscribe to the Nix Packages channel.
|
||||
|
||||
<screen>
|
||||
$ nix-channel --add http://catamaran.labs.cs.uu.nl/dist/nix/channels/nixpkgs-unstable</screen>
|
||||
$ nix-channel --add \
|
||||
http://nix.cs.uu.nl/dist/nix/channels-v3/nixpkgs-unstable</screen>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
@@ -45,7 +50,7 @@ available remotely.</para></listitem>
|
||||
available in the channel:
|
||||
|
||||
<screen>
|
||||
$ nix-env -qa
|
||||
$ nix-env -qa ’*’ <lineannotation>(mind the quotes!)</lineannotation>
|
||||
docbook-xml-4.2
|
||||
firefox-1.0pre-PR-0.10.1
|
||||
hello-2.1.1
|
||||
@@ -91,6 +96,16 @@ The latter command will upgrade each installed component for which
|
||||
there is a “newer” version (as determined by comparing the version
|
||||
numbers).</para></listitem>
|
||||
|
||||
<listitem><para>You can also install specific packages directly from
|
||||
your web browser. For instance, you can go to <link
|
||||
xlink:href="http://nix.cs.uu.nl/dist/nix/nixpkgs-unstable-latest/" />
|
||||
and click on any link for the individual packages for your platform.
|
||||
Associate <literal>application/nix-package</literal> with the program
|
||||
<filename>/nix/bin/nix-install-package</filename>. A window should
|
||||
appear asking you whether it’s okay to install the package. Say
|
||||
<literal>Y</literal>. The package and all its dependencies will be
|
||||
installed.</para></listitem>
|
||||
|
||||
<listitem><para>If you're unhappy with the result of a
|
||||
<command>nix-env</command> action (e.g., an upgraded component turned
|
||||
out not to work properly), you can go back:
|
||||
@@ -105,13 +120,15 @@ to get rid of unused packages, since uninstalls or upgrades don't
|
||||
actually delete them:
|
||||
|
||||
<screen>
|
||||
$ nix-env --delete-generations old
|
||||
$ nix-store --gc</screen>
|
||||
$ nix-collect-garbage -d</screen>
|
||||
|
||||
<!--
|
||||
The first command deletes old “generations” of your profile (making
|
||||
rollbacks impossible, but also making the components in those old
|
||||
generations available for garbage collection), while the second
|
||||
command actually deletes them.</para></listitem>
|
||||
command actually deletes them.-->
|
||||
|
||||
</para></listitem>
|
||||
|
||||
</orderedlist>
|
||||
|
||||
|
||||
44
doc/manual/quote-literals.xsl
Normal file
44
doc/manual/quote-literals.xsl
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:str="http://exslt.org/strings"
|
||||
extension-element-prefixes="str">
|
||||
|
||||
<xsl:output method="xml"/>
|
||||
|
||||
<xsl:template match="function|command|literal|varname|filename|option|quote">`<xsl:apply-templates/>'</xsl:template>
|
||||
|
||||
<xsl:template match="token"><xsl:text> </xsl:text><xsl:apply-templates /><xsl:text>
|
||||
</xsl:text></xsl:template>
|
||||
|
||||
<xsl:template match="screen|programlisting">
|
||||
<screen><xsl:apply-templates select="str:split(., '
')" /></screen>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="section[following::section]">
|
||||
<section>
|
||||
<xsl:apply-templates />
|
||||
<screen><xsl:text>
|
||||
</xsl:text></screen>
|
||||
</section>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*">
|
||||
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
|
||||
<xsl:copy-of select="namespace::*" />
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:attribute>
|
||||
</xsl:for-each>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()">
|
||||
<xsl:value-of select="translate(., '‘’“”—', concat("`'", '""-'))" />
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
896
doc/manual/release-notes.xml
Normal file
896
doc/manual/release-notes.xml
Normal file
@@ -0,0 +1,896 @@
|
||||
<article xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Nix Release Notes</title>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.10 (October 6, 2006)</title>
|
||||
|
||||
<note><para>This version of Nix uses Berkeley DB 4.4 instead of 4.3.
|
||||
The database is upgraded automatically, but you should be careful not
|
||||
to use old versions of Nix that still use Berkeley DB 4.3. In
|
||||
particular, if you use a Nix installed through Nix, you should run
|
||||
|
||||
<screen>
|
||||
$ nix-store --clear-substitutes</screen>
|
||||
|
||||
first.</para></note>
|
||||
|
||||
<warning><para>Also, the database schema has changed slighted to fix a
|
||||
performance issue (see below). When you run any Nix 0.10 command for
|
||||
the first time, the database will be upgraded automatically. This is
|
||||
irreversible.</para></warning>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
|
||||
<!-- Usability / features -->
|
||||
|
||||
|
||||
<listitem><para><command>nix-env</command> usability improvements:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>An option <option>--compare-versions</option>
|
||||
(or <option>-c</option>) has been added to <command>nix-env
|
||||
--query</command> to allow you to compare installed versions of
|
||||
packages to available versions, or vice versa. An easy way to
|
||||
see if you are up to date with what’s in your subscribed
|
||||
channels is <literal>nix-env -qc \*</literal>.</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-env --query</literal> now takes as
|
||||
arguments a list of package names about which to show
|
||||
information, just like <option>--install</option>, etc.: for
|
||||
example, <literal>nix-env -q gcc</literal>. Note that to show
|
||||
all derivations, you need to specify
|
||||
<literal>\*</literal>.</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-env -i
|
||||
<replaceable>pkgname</replaceable></literal> will now install
|
||||
the highest available version of
|
||||
<replaceable>pkgname</replaceable>, rather than installing all
|
||||
available versions (which would probably give collisions)
|
||||
(<literal>NIX-31</literal>).</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-env (-i|-u) --dry-run</literal> now
|
||||
shows exactly which missing paths will be built or
|
||||
substituted.</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-env -qa --description</literal>
|
||||
shows human-readable descriptions of packages, provided that
|
||||
they have a <literal>meta.description</literal> attribute (which
|
||||
most packages in Nixpkgs don’t have yet).</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>New language features:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Reference scanning (which happens after each
|
||||
build) is much faster and takes a constant amount of
|
||||
memory.</para></listitem>
|
||||
|
||||
<listitem><para>String interpolation. Expressions like
|
||||
|
||||
<programlisting>
|
||||
"--with-freetype2-library=" + freetype + "/lib"</programlisting>
|
||||
|
||||
can now be written as
|
||||
|
||||
<programlisting>
|
||||
"--with-freetype2-library=${freetype}/lib"</programlisting>
|
||||
|
||||
You can write arbitrary expressions within
|
||||
<literal>${<replaceable>...</replaceable>}</literal>, not just
|
||||
identifiers.</para></listitem>
|
||||
|
||||
<listitem><para>Multi-line string literals.</para></listitem>
|
||||
|
||||
<listitem><para>String concatenations can now involve
|
||||
derivations, as in the example <code>"--with-freetype2-library="
|
||||
+ freetype + "/lib"</code>. This was not previously possible
|
||||
because we need to register that a derivation that uses such a
|
||||
string is dependent on <literal>freetype</literal>. The
|
||||
evaluator now properly propagates this information.
|
||||
Consequently, the subpath operator (<literal>~</literal>) has
|
||||
been deprecated.</para></listitem>
|
||||
|
||||
<listitem><para>Default values of function arguments can now
|
||||
refer to other function arguments; that is, all arguments are in
|
||||
scope in the default values
|
||||
(<literal>NIX-45</literal>).</para></listitem>
|
||||
|
||||
<!--
|
||||
<listitem><para>TODO: domain checks (r5895).</para></listitem>
|
||||
-->
|
||||
|
||||
<listitem><para>Lots of new built-in primitives, such as
|
||||
functions for list manipulation and integer arithmetic. See the
|
||||
manual for a complete list. All primops are now available in
|
||||
the set <varname>builtins</varname>, allowing one to test for
|
||||
the availability of primop in a backwards-compatible
|
||||
way.</para></listitem>
|
||||
|
||||
<listitem><para>Real let-expressions: <literal>let x = ...;
|
||||
... z = ...; in ...</literal>.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>New commands <command>nix-pack-closure</command> and
|
||||
<command>nix-unpack-closure</command> than can be used to easily
|
||||
transfer a store path with all its dependencies to another machine.
|
||||
Very convenient whenever you have some package on your machine and
|
||||
you want to copy it somewhere else.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>XML support:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para><literal>nix-env -q --xml</literal> prints the
|
||||
installed or available packages in an XML representation for
|
||||
easy processing by other tools.</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-instantiate --eval-only
|
||||
--xml</literal> prints an XML representation of the resulting
|
||||
term. (The new flag <option>--strict</option> forces ‘deep’
|
||||
evaluation of the result, i.e., list elements and attributes are
|
||||
evaluated recursively.)</para></listitem>
|
||||
|
||||
<listitem><para>In Nix expressions, the primop
|
||||
<function>builtins.toXML</function> converts a term to an XML
|
||||
representation. This is primarily useful for passing structured
|
||||
information to builders.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>You can now unambigously specify which derivation to
|
||||
build or install in <command>nix-env</command>,
|
||||
<command>nix-instantiate</command> and <command>nix-build</command>
|
||||
using the <option>--attr</option> / <option>-A</option> flags, which
|
||||
takes an attribute name as argument. (Unlike symbolic package names
|
||||
such as <literal>subversion-1.4.0</literal>, attribute names in an
|
||||
attribute set are unique.) For instance, a quick way to perform a
|
||||
test build of a package in Nixpkgs is <literal>nix-build
|
||||
pkgs/top-level/all-packages.nix -A
|
||||
<replaceable>foo</replaceable></literal>. <literal>nix-env -q
|
||||
--attr</literal> shows the attribute names corresponding to each
|
||||
derivation.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>If the top-level Nix expression used by
|
||||
<command>nix-env</command>, <command>nix-instantiate</command> or
|
||||
<command>nix-build</command> evaluates to a function whose arguments
|
||||
all have default values, the function will be called automatically.
|
||||
Also, the new command-line switch <option>--arg
|
||||
<replaceable>name</replaceable>
|
||||
<replaceable>value</replaceable></option> can be used to specify
|
||||
function arguments on the command line.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para><literal>nix-install-package --url
|
||||
<replaceable>URL</replaceable></literal> allows a package to be
|
||||
installed directly from the given URL.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>Nix now works behind an HTTP proxy server; just set
|
||||
the standard environment variables <envar>http_proxy</envar>,
|
||||
<envar>https_proxy</envar>, <envar>ftp_proxy</envar> or
|
||||
<envar>all_proxy</envar> appropriately. Functions such as
|
||||
<function>fetchurl</function> in Nixpkgs also respect these
|
||||
variables.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para><literal>nix-build -o
|
||||
<replaceable>symlink</replaceable></literal> allows the symlink to
|
||||
the build result to be named something other than
|
||||
<literal>result</literal>.</para></listitem>
|
||||
|
||||
|
||||
<!-- Stability / performance / etc. -->
|
||||
|
||||
|
||||
<listitem><para>Platform support:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Support for 64-bit platforms, provided a <link
|
||||
xlink:href="http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=606">suitably
|
||||
patched ATerm library</link> is used. Also, files larger than 2
|
||||
GiB are now supported.</para></listitem>
|
||||
|
||||
<listitem><para>Added support for Cygwin (Windows,
|
||||
<literal>i686-cygwin</literal>), Mac OS X on Intel
|
||||
(<literal>i686-darwin</literal>) and Linux on PowerPC
|
||||
(<literal>powerpc-linux</literal>).</para></listitem>
|
||||
|
||||
<listitem><para>Users of SMP and multicore machines will
|
||||
appreciate that the number of builds to be performed in parallel
|
||||
can now be specified in the configuration file in the
|
||||
<literal>build-max-jobs</literal> setting.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>Garbage collector improvements:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Open files (such as running programs) are now
|
||||
used as roots of the garbage collector. This prevents programs
|
||||
that have been uninstalled from being garbage collected while
|
||||
they are still running. The script that detects these
|
||||
additional runtime roots
|
||||
(<filename>find-runtime-roots.pl</filename>) is inherently
|
||||
system-specific, but it should work on Linux and on all
|
||||
platforms that have the <command>lsof</command>
|
||||
utility.</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-store --gc</literal>
|
||||
(a.k.a. <command>nix-collect-garbage</command>) prints out the
|
||||
number of bytes freed on standard output. <literal>nix-store
|
||||
--gc --print-dead</literal> shows how many bytes would be freed
|
||||
by an actual garbage collection.</para></listitem>
|
||||
|
||||
<listitem><para><literal>nix-collect-garbage -d</literal>
|
||||
removes all old generations of <emphasis>all</emphasis> profiles
|
||||
before calling the actual garbage collector (<literal>nix-store
|
||||
--gc</literal>). This is an easy way to get rid of all old
|
||||
packages in the Nix store.</para></listitem>
|
||||
|
||||
<listitem><para><command>nix-store</command> now has an
|
||||
operation <option>--delete</option> to delete specific paths
|
||||
from the Nix store. It won’t delete reachable (non-garbage)
|
||||
paths unless <option>--ignore-liveness</option> is
|
||||
specified.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>Berkeley DB 4.4’s process registry feature is used
|
||||
to recover from crashed Nix processes.</para></listitem>
|
||||
|
||||
<!-- <listitem><para>TODO: shared stores.</para></listitem> -->
|
||||
|
||||
<listitem><para>A performance issue has been fixed with the
|
||||
<literal>referer</literal> table, which stores the inverse of the
|
||||
<literal>references</literal> table (i.e., it tells you what store
|
||||
paths refer to a given path). Maintaining this table could take a
|
||||
quadratic amount of time, as well as a quadratic amount of Berkeley
|
||||
DB log file space (in particular when running the garbage collector)
|
||||
(<literal>NIX-23</literal>).</para></listitem>
|
||||
|
||||
<listitem><para>Nix now catches the <literal>TERM</literal> and
|
||||
<literal>HUP</literal> signals in addition to the
|
||||
<literal>INT</literal> signal. So you can now do a <literal>killall
|
||||
nix-store</literal> without triggering a database
|
||||
recovery.</para></listitem>
|
||||
|
||||
<listitem><para><command>bsdiff</command> updated to version
|
||||
4.3.</para></listitem>
|
||||
|
||||
<listitem><para>Substantial performance improvements in expression
|
||||
evaluation and <literal>nix-env -qa</literal>, all thanks to <link
|
||||
xlink:href="http://valgrind.org/">Valgrind</link>. Memory use has
|
||||
been reduced by a factor 8 or so. Big speedup by memoisation of
|
||||
path hashing.</para></listitem>
|
||||
|
||||
<listitem><para>Lots of bug fixes, notably:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Make sure that the garbage collector can run
|
||||
succesfully when the disk is full
|
||||
(<literal>NIX-18</literal>).</para></listitem>
|
||||
|
||||
<listitem><para><command>nix-env</command> now locks the profile
|
||||
to prevent races between concurrent <command>nix-env</command>
|
||||
operations on the same profile
|
||||
(<literal>NIX-7</literal>).</para></listitem>
|
||||
|
||||
<listitem><para>Removed misleading messages from
|
||||
<literal>nix-env -i</literal> (e.g., <literal>installing
|
||||
`foo'</literal> followed by <literal>uninstalling
|
||||
`foo'</literal>) (<literal>NIX-17</literal>).</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>Nix source distributions are a lot smaller now since
|
||||
we no longer include a full copy of the Berkeley DB source
|
||||
distribution (but only the bits we need).</para></listitem>
|
||||
|
||||
<listitem><para>Header files are now installed so that external
|
||||
programs can use the Nix libraries.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.9.2 (September 21, 2005)</title>
|
||||
|
||||
<para>This bug fix release fixes two problems on Mac OS X:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>If Nix was linked against statically linked versions
|
||||
of the ATerm or Berkeley DB library, there would be dynamic link
|
||||
errors at runtime.</para></listitem>
|
||||
|
||||
<listitem><para><command>nix-pull</command> and
|
||||
<command>nix-push</command> intermittently failed due to race
|
||||
conditions involving pipes and child processes with error messages
|
||||
such as <literal>open2: open(GLOB(0x180b2e4), >&=9) failed: Bad
|
||||
file descriptor at /nix/bin/nix-pull line 77</literal> (issue
|
||||
<literal>NIX-14</literal>).</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.9.1 (September 20, 2005)</title>
|
||||
|
||||
<para>This bug fix release addresses a problem with the ATerm library
|
||||
when the <option>--with-aterm</option> flag in
|
||||
<command>configure</command> was <emphasis>not</emphasis> used.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.9 (September 16, 2005)</title>
|
||||
|
||||
<para>NOTE: this version of Nix uses Berkeley DB 4.3 instead of 4.2.
|
||||
The database is upgraded automatically, but you should be careful not
|
||||
to use old versions of Nix that still use Berkeley DB 4.2. In
|
||||
particular, if you use a Nix installed through Nix, you should run
|
||||
|
||||
<screen>
|
||||
$ nix-store --clear-substitutes</screen>
|
||||
|
||||
first.</para>
|
||||
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Unpacking of patch sequences is much faster now
|
||||
since we no longer do redundant unpacking and repacking of
|
||||
intermediate paths.</para></listitem>
|
||||
|
||||
<listitem><para>Nix now uses Berkeley DB 4.3.</para></listitem>
|
||||
|
||||
<listitem><para>The <function>derivation</function> primitive is
|
||||
lazier. Attributes of dependent derivations can mutually refer to
|
||||
each other (as long as there are no data dependencies on the
|
||||
<varname>outPath</varname> and <varname>drvPath</varname> attributes
|
||||
computed by <function>derivation</function>).</para>
|
||||
|
||||
<para>For example, the expression <literal>derivation
|
||||
attrs</literal> now evaluates to (essentially)
|
||||
|
||||
<programlisting>
|
||||
attrs // {
|
||||
type = "derivation";
|
||||
outPath = derivation! attrs;
|
||||
drvPath = derivation! attrs;
|
||||
}</programlisting>
|
||||
|
||||
where <function>derivation!</function> is a primop that does the
|
||||
actual derivation instantiation (i.e., it does what
|
||||
<function>derivation</function> used to do). The advantage is that
|
||||
it allows commands such as <command>nix-env -qa</command> and
|
||||
<command>nix-env -i</command> to be much faster since they no longer
|
||||
need to instantiate all derivations, just the
|
||||
<varname>name</varname> attribute.</para>
|
||||
|
||||
<para>Also, it allows derivations to cyclically reference each
|
||||
other, for example,
|
||||
|
||||
<programlisting>
|
||||
webServer = derivation {
|
||||
...
|
||||
hostName = "svn.cs.uu.nl";
|
||||
services = [svnService];
|
||||
};
|
||||
 
|
||||
svnService = derivation {
|
||||
...
|
||||
hostName = webServer.hostName;
|
||||
};</programlisting>
|
||||
|
||||
Previously, this would yield a black hole (infinite recursion).</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem><para><command>nix-build</command> now defaults to using
|
||||
<filename>./default.nix</filename> if no Nix expression is
|
||||
specified.</para></listitem>
|
||||
|
||||
<listitem><para><command>nix-instantiate</command>, when applied to
|
||||
a Nix expression that evaluates to a function, will call the
|
||||
function automatically if all its arguments have
|
||||
defaults.</para></listitem>
|
||||
|
||||
<listitem><para>Nix now uses libtool to build dynamic libraries.
|
||||
This reduces the size of executables.</para></listitem>
|
||||
|
||||
<listitem><para>A new list concatenation operator
|
||||
<literal>++</literal>. For example, <literal>[1 2 3] ++ [4 5
|
||||
6]</literal> evaluates to <literal>[1 2 3 4 5
|
||||
6]</literal>.</para></listitem>
|
||||
|
||||
<listitem><para>Some currently undocumented primops to support
|
||||
low-level build management using Nix (i.e., using Nix as a Make
|
||||
replacement). See the commit messages for <literal>r3578</literal>
|
||||
and <literal>r3580</literal>.</para></listitem>
|
||||
|
||||
<listitem><para>Various bug fixes and performance
|
||||
improvements.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.8.1 (April 13, 2005)</title>
|
||||
|
||||
<para>This is a bug fix release.</para>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Patch downloading was broken.</para></listitem>
|
||||
|
||||
<listitem><para>The garbage collector would not delete paths that
|
||||
had references from invalid (but substitutable)
|
||||
paths.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.8 (April 11, 2005)</title>
|
||||
|
||||
<para>NOTE: the hashing scheme in Nix 0.8 changed (as detailed below).
|
||||
As a result, <command>nix-pull</command> manifests and channels built
|
||||
for Nix 0.7 and below will now work anymore. However, the Nix
|
||||
expression language has not changed, so you can still build from
|
||||
source. Also, existing user environments continue to work. Nix 0.8
|
||||
will automatically upgrade the database schema of previous
|
||||
installations when it is first run.</para>
|
||||
|
||||
<para>If you get the error message
|
||||
|
||||
<screen>
|
||||
you have an old-style manifest `/nix/var/nix/manifests/[...]'; please
|
||||
delete it</screen>
|
||||
|
||||
you should delete previously downloaded manifests:
|
||||
|
||||
<screen>
|
||||
$ rm /nix/var/nix/manifests/*</screen>
|
||||
|
||||
If <command>nix-channel</command> gives the error message
|
||||
|
||||
<screen>
|
||||
manifest `http://catamaran.labs.cs.uu.nl/dist/nix/channels/[channel]/MANIFEST'
|
||||
is too old (i.e., for Nix <= 0.7)</screen>
|
||||
|
||||
then you should unsubscribe from the offending channel
|
||||
(<command>nix-channel --remove
|
||||
<replaceable>URL</replaceable></command>; leave out
|
||||
<literal>/MANIFEST</literal>), and subscribe to the same URL, with
|
||||
<literal>channels</literal> replaced by <literal>channels-v3</literal>
|
||||
(e.g., <link
|
||||
xlink:href='http://catamaran.labs.cs.uu.nl/dist/nix/channels-v3/nixpkgs-unstable'
|
||||
/>).</para>
|
||||
|
||||
<para>Nix 0.8 has the following improvements:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>The cryptographic hashes used in store paths are now
|
||||
160 bits long, but encoded in base-32 so that they are still only 32
|
||||
characters long (e.g.,
|
||||
<filename>/nix/store/csw87wag8bqlqk7ipllbwypb14xainap-atk-1.9.0</filename>).
|
||||
(This is actually a 160 bit truncation of a SHA-256
|
||||
hash.)</para></listitem>
|
||||
|
||||
<listitem><para>Big cleanups and simplifications of the basic store
|
||||
semantics. The notion of “closure store expressions” is gone (and
|
||||
so is the notion of “successors”); the file system references of a
|
||||
store path are now just stored in the database.</para>
|
||||
|
||||
<para>For instance, given any store path, you can query its closure:
|
||||
|
||||
<screen>
|
||||
$ nix-store -qR $(which firefox)
|
||||
... lots of paths ...</screen>
|
||||
|
||||
Also, Nix now remembers for each store path the derivation that
|
||||
built it (the “deriver”):
|
||||
|
||||
<screen>
|
||||
$ nix-store -qR $(which firefox)
|
||||
/nix/store/4b0jx7vq80l9aqcnkszxhymsf1ffa5jd-firefox-1.0.1.drv</screen>
|
||||
|
||||
So to see the build-time dependencies, you can do
|
||||
|
||||
<screen>
|
||||
$ nix-store -qR $(nix-store -qd $(which firefox))</screen>
|
||||
|
||||
or, in a nicer format:
|
||||
|
||||
<screen>
|
||||
$ nix-store -q --tree $(nix-store -qd $(which firefox))</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>File system references are also stored in reverse. For
|
||||
instance, you can query all paths that directly or indirectly use a
|
||||
certain Glibc:
|
||||
|
||||
<screen>
|
||||
$ nix-store -q --referrers-closure \
|
||||
/nix/store/8lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4</screen>
|
||||
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem><para>The concept of fixed-output derivations has been
|
||||
formalised. Previously, functions such as
|
||||
<function>fetchurl</function> in Nixpkgs used a hack (namely,
|
||||
explicitly specifying a store path hash) to prevent changes to, say,
|
||||
the URL of the file from propagating upwards through the dependency
|
||||
graph, causing rebuilds of everything. This can now be done cleanly
|
||||
by specifying the <varname>outputHash</varname> and
|
||||
<varname>outputHashAlgo</varname> attributes. Nix itself checks
|
||||
that the content of the output has the specified hash. (This is
|
||||
important for maintaining certain invariants necessary for future
|
||||
work on secure shared stores.)</para></listitem>
|
||||
|
||||
<listitem><para>One-click installation :-) It is now possible to
|
||||
install any top-level component in Nixpkgs directly, through the web
|
||||
— see, e.g., <link
|
||||
xlink:href='http://catamaran.labs.cs.uu.nl/dist/nixpkgs-0.8/' />.
|
||||
All you have to do is associate
|
||||
<filename>/nix/bin/nix-install-package</filename> with the MIME type
|
||||
<literal>application/nix-package</literal> (or the extension
|
||||
<filename>.nixpkg</filename>), and clicking on a package link will
|
||||
cause it to be installed, with all appropriate dependencies. If you
|
||||
just want to install some specific application, this is easier than
|
||||
subscribing to a channel.</para></listitem>
|
||||
|
||||
<listitem><para><command>nix-store -r
|
||||
<replaceable>PATHS</replaceable></command> now builds all the
|
||||
derivations PATHS in parallel. Previously it did them sequentially
|
||||
(though exploiting possible parallelism between subderivations).
|
||||
This is nice for build farms.</para></listitem>
|
||||
|
||||
<listitem><para><command>nix-channel</command> has new operations
|
||||
<option>--list</option> and
|
||||
<option>--remove</option>.</para></listitem>
|
||||
|
||||
<listitem><para>New ways of installing components into user
|
||||
environments:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Copy from another user environment:
|
||||
|
||||
<screen>
|
||||
$ nix-env -i --from-profile .../other-profile firefox</screen>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>Install a store derivation directly (bypassing the
|
||||
Nix expression language entirely):
|
||||
|
||||
<screen>
|
||||
$ nix-env -i /nix/store/z58v41v21xd3...-aterm-2.3.1.drv</screen>
|
||||
|
||||
(This is used to implement <command>nix-install-package</command>,
|
||||
which is therefore immune to evolution in the Nix expression
|
||||
language.)</para></listitem>
|
||||
|
||||
<listitem><para>Install an already built store path directly:
|
||||
|
||||
<screen>
|
||||
$ nix-env -i /nix/store/hsyj5pbn0d9i...-aterm-2.3.1</screen>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>Install the result of a Nix expression specified
|
||||
as a command-line argument:
|
||||
|
||||
<screen>
|
||||
$ nix-env -f .../i686-linux.nix -i -E 'x: x.firefoxWrapper'</screen>
|
||||
|
||||
The difference with the normal installation mode is that
|
||||
<option>-E</option> does not use the <varname>name</varname>
|
||||
attributes of derivations. Therefore, this can be used to
|
||||
disambiguate multiple derivations with the same
|
||||
name.</para></listitem>
|
||||
|
||||
</itemizedlist></para></listitem>
|
||||
|
||||
<listitem><para>A hash of the contents of a store path is now stored
|
||||
in the database after a succesful build. This allows you to check
|
||||
whether store paths have been tampered with: <command>nix-store
|
||||
--verify --check-contents</command>.</para></listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
<para>Implemented a concurrent garbage collector. It is now
|
||||
always safe to run the garbage collector, even if other Nix
|
||||
operations are happening simultaneously.</para>
|
||||
|
||||
<para>However, there can still be GC races if you use
|
||||
<command>nix-instantiate</command> and <command>nix-store
|
||||
--realise</command> directly to build things. To prevent races,
|
||||
use the <option>--add-root</option> flag of those commands.</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem><para>The garbage collector now finally deletes paths in
|
||||
the right order (i.e., topologically sorted under the “references”
|
||||
relation), thus making it safe to interrupt the collector without
|
||||
risking a store that violates the closure
|
||||
invariant.</para></listitem>
|
||||
|
||||
<listitem><para>Likewise, the substitute mechanism now downloads
|
||||
files in the right order, thus preserving the closure invariant at
|
||||
all times.</para></listitem>
|
||||
|
||||
<listitem><para>The result of <command>nix-build</command> is now
|
||||
registered as a root of the garbage collector. If the
|
||||
<filename>./result</filename> link is deleted, the GC root
|
||||
disappears automatically.</para></listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
<para>The behaviour of the garbage collector can be changed
|
||||
globally by setting options in
|
||||
<filename>/nix/etc/nix/nix.conf</filename>.
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para><literal>gc-keep-derivations</literal> specifies
|
||||
whether deriver links should be followed when searching for live
|
||||
paths.</para></listitem>
|
||||
|
||||
<listitem><para><literal>gc-keep-outputs</literal> specifies
|
||||
whether outputs of derivations should be followed when searching
|
||||
for live paths.</para></listitem>
|
||||
|
||||
<listitem><para><literal>env-keep-derivations</literal>
|
||||
specifies whether user environments should store the paths of
|
||||
derivations when they are added (thus keeping the derivations
|
||||
alive).</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>New <command>nix-env</command> query flags
|
||||
<option>--drv-path</option> and
|
||||
<option>--out-path</option>.</para></listitem>
|
||||
|
||||
<listitem><para><command>fetchurl</command> allows SHA-1 and SHA-256
|
||||
in addition to MD5. Just specify the attribute
|
||||
<varname>sha1</varname> or <varname>sha256</varname> instead of
|
||||
<varname>md5</varname>.</para></listitem>
|
||||
|
||||
<listitem><para>Manual updates.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.7 (January 12, 2005)</title>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Binary patching. When upgrading components using
|
||||
pre-built binaries (through nix-pull / nix-channel), Nix can
|
||||
automatically download and apply binary patches to already installed
|
||||
components instead of full downloads. Patching is “smart”: if there
|
||||
is a <emphasis>sequence</emphasis> of patches to an installed
|
||||
component, Nix will use it. Patches are currently generated
|
||||
automatically between Nixpkgs (pre-)releases.</para></listitem>
|
||||
|
||||
<listitem><para>Simplifications to the substitute
|
||||
mechanism.</para></listitem>
|
||||
|
||||
<listitem><para>Nix-pull now stores downloaded manifests in
|
||||
<filename>/nix/var/nix/manifests</filename>.</para></listitem>
|
||||
|
||||
<listitem><para>Metadata on files in the Nix store is canonicalised
|
||||
after builds: the last-modified timestamp is set to 0 (00:00:00
|
||||
1/1/1970), the mode is set to 0444 or 0555 (readable and possibly
|
||||
executable by all; setuid/setgid bits are dropped), and the group is
|
||||
set to the default. This ensures that the result of a build and an
|
||||
installation through a substitute is the same; and that timestamp
|
||||
dependencies are revealed.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.6 (November 14, 2004)</title>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<para>Rewrite of the normalisation engine.
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Multiple builds can now be performed in parallel
|
||||
(option <option>-j</option>).</para></listitem>
|
||||
|
||||
<listitem><para>Distributed builds. Nix can now call a shell
|
||||
script to forward builds to Nix installations on remote
|
||||
machines, which may or may not be of the same platform
|
||||
type.</para></listitem>
|
||||
|
||||
<listitem><para>Option <option>--fallback</option> allows
|
||||
recovery from broken substitutes.</para></listitem>
|
||||
|
||||
<listitem><para>Option <option>--keep-going</option> causes
|
||||
building of other (unaffected) derivations to continue if one
|
||||
failed.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem><para>Improvements to the garbage collector (i.e., it
|
||||
should actually work now).</para></listitem>
|
||||
|
||||
<listitem><para>Setuid Nix installations allow a Nix store to be
|
||||
shared among multiple users.</para></listitem>
|
||||
|
||||
<listitem><para>Substitute registration is much faster
|
||||
now.</para></listitem>
|
||||
|
||||
<listitem><para>A utility <command>nix-build</command> to build a
|
||||
Nix expression and create a symlink to the result int the current
|
||||
directory; useful for testing Nix derivations.</para></listitem>
|
||||
|
||||
<listitem><para>Manual updates.</para></listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
<para><command>nix-env</command> changes:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Derivations for other platforms are filtered out
|
||||
(which can be overriden using
|
||||
<option>--system-filter</option>).</para></listitem>
|
||||
|
||||
<listitem><para><option>--install</option> by default now
|
||||
uninstall previous derivations with the same
|
||||
name.</para></listitem>
|
||||
|
||||
<listitem><para><option>--upgrade</option> allows upgrading to a
|
||||
specific version.</para></listitem>
|
||||
|
||||
<listitem><para>New operation
|
||||
<option>--delete-generations</option> to remove profile
|
||||
generations (necessary for effective garbage
|
||||
collection).</para></listitem>
|
||||
|
||||
<listitem><para>Nicer output (sorted,
|
||||
columnised).</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem><para>More sensible verbosity levels all around (builder
|
||||
output is now shown always, unless <option>-Q</option> is
|
||||
given).</para></listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
<para>Nix expression language changes:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>New language construct: <literal>with
|
||||
<replaceable>E1</replaceable>;
|
||||
<replaceable>E2</replaceable></literal> brings all attributes
|
||||
defined in the attribute set <replaceable>E1</replaceable> in
|
||||
scope in <replaceable>E2</replaceable>.</para></listitem>
|
||||
|
||||
<listitem><para>Added a <function>map</function>
|
||||
function.</para></listitem>
|
||||
|
||||
<listitem><para>Various new operators (e.g., string
|
||||
concatenation).</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
|
||||
<listitem><para>Expression evaluation is much
|
||||
faster.</para></listitem>
|
||||
|
||||
<listitem><para>An Emacs mode for editing Nix expressions (with
|
||||
syntax highlighting and indentation) has been
|
||||
added.</para></listitem>
|
||||
|
||||
<listitem><para>Many bug fixes.</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
|
||||
<section><title>Release 0.5 and earlier</title>
|
||||
|
||||
<para>Please refer to the Subversion commit log messages.</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
@@ -10,7 +10,6 @@ body
|
||||
{
|
||||
font-family: sans-serif;
|
||||
background: white;
|
||||
|
||||
margin: 2em 1em 2em 1em;
|
||||
}
|
||||
|
||||
@@ -34,16 +33,28 @@ h2 /* chapters, appendices, subtitle */
|
||||
div.chapter > div.titlepage h2, div.appendix > div.titlepage h2
|
||||
{
|
||||
margin-top: 1.5em;
|
||||
/* border-top: solid #005aa0; */
|
||||
}
|
||||
|
||||
div.sect1 h2 /* sections */
|
||||
div.section > div.titlepage h2 /* sections */
|
||||
{
|
||||
font-size: 150%;
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
h3 /* subsections */
|
||||
{
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
div.appendix h3
|
||||
{
|
||||
font-size: 150%;
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */
|
||||
{
|
||||
margin-top: 1.4em;
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
@@ -52,30 +63,23 @@ div.refsection h3
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
h3 /* subsections */
|
||||
{
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
Program listings:
|
||||
Examples:
|
||||
***************************************************************************/
|
||||
|
||||
div.example
|
||||
{
|
||||
border: 1px solid #6185a0;
|
||||
padding: 6px 6px;
|
||||
margin-left: 3em;
|
||||
margin-right: 3em;
|
||||
background: #eeeeee;
|
||||
margin-left: 1.5em;
|
||||
margin-right: 1.5em;
|
||||
background: #f4f4f8;
|
||||
}
|
||||
|
||||
pre.programlisting
|
||||
div.example p.title
|
||||
{
|
||||
color: #600000;
|
||||
font-family: monospace;
|
||||
margin-top: 0em;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,41 +87,63 @@ pre.programlisting
|
||||
Screen dumps:
|
||||
***************************************************************************/
|
||||
|
||||
pre.screen
|
||||
pre.screen, pre.programlisting
|
||||
{
|
||||
border: 1px solid #6185a0;
|
||||
padding: 6px 6px;
|
||||
margin-left: 3em;
|
||||
margin-right: 3em;
|
||||
padding: 3px 3px;
|
||||
margin-left: 1.5em;
|
||||
margin-right: 1.5em;
|
||||
color: #600000;
|
||||
background: #eeeeee;
|
||||
background: #f4f4f8;
|
||||
font-family: monospace;
|
||||
/* font-size: 90%; */
|
||||
}
|
||||
|
||||
div.example pre.programlisting
|
||||
{
|
||||
border: 0px;
|
||||
padding: 0 0;
|
||||
margin: 0 0 0 0;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
Notes, warnings etc:
|
||||
***************************************************************************/
|
||||
|
||||
.note,.warning
|
||||
.note, .warning
|
||||
{
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
border: 1px solid #6185a0;
|
||||
padding: 0px 1em;
|
||||
padding: 3px 3px;
|
||||
margin-left: 1.5em;
|
||||
margin-right: 1.5em;
|
||||
margin-bottom: 1em;
|
||||
padding: 0.3em 0.3em 0.3em 0.3em;
|
||||
background: #fffff5;
|
||||
}
|
||||
|
||||
div.note,div.warning
|
||||
div.note, div.warning
|
||||
{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.warning h3
|
||||
div.note h3, div.warning h3
|
||||
{
|
||||
color: red;
|
||||
font-size: 100%;
|
||||
// margin: 0 0 0 0;
|
||||
padding-right: 0.5em;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.note p, div.warning p
|
||||
{
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
div.note h3 + p, div.warning h3 + p
|
||||
{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.note h3
|
||||
@@ -167,9 +193,19 @@ tt, code
|
||||
|
||||
}
|
||||
|
||||
div.variablelist dd
|
||||
div.variablelist dd p, div.glosslist dd p
|
||||
{
|
||||
margin-bottom: 1em;
|
||||
margin-top: 0em;
|
||||
}
|
||||
|
||||
div.variablelist dd, div.glosslist dd
|
||||
{
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
div.glosslist dt
|
||||
{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.default
|
||||
@@ -232,3 +268,16 @@ table.productionset table.productionset
|
||||
{
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
strong.command
|
||||
{
|
||||
// font-family: monospace;
|
||||
// font-style: italic;
|
||||
// font-weight: normal;
|
||||
color: #400000;
|
||||
}
|
||||
|
||||
div.calloutlist td
|
||||
{
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<appendix><title>Troubleshooting</title>
|
||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Troubleshooting</title>
|
||||
|
||||
|
||||
<para>This section provides solutions for some common problems.</para>
|
||||
|
||||
|
||||
<sect1><title>Berkeley DB: <quote>Cannot allocate memory</quote></title>
|
||||
<section><title>Berkeley DB: <quote>Cannot allocate memory</quote></title>
|
||||
|
||||
<para>Symptom: Nix operations (in particular the
|
||||
<command>nix-store</command> operations <option>--gc</option>,
|
||||
@@ -26,10 +30,10 @@ $ rm __db.00*</screen>
|
||||
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<sect1><title>Collisions in <command>nix-env</command></title>
|
||||
<section><title>Collisions in <command>nix-env</command></title>
|
||||
|
||||
<para>Symptom: when installing or upgrading, you get an error message such as
|
||||
|
||||
@@ -55,7 +59,7 @@ so it just gives up.</para>
|
||||
|
||||
<para>Solution: remove one of the offending packages from the user
|
||||
environment (if already installed) using <command>nix-env
|
||||
-u</command>, or specify exactly which version should be installed
|
||||
-e</command>, or specify exactly which version should be installed
|
||||
(e.g., <literal>nix-env -i docbook-xml-4.2</literal>).</para>
|
||||
|
||||
<para>Alternatively, you can modify the user environment builder
|
||||
@@ -65,7 +69,47 @@ to implement some conflict resolution policy. E.g., the script could
|
||||
be modified to rename conflicting file names, or to pick one over the
|
||||
other.</para>
|
||||
|
||||
</sect1>
|
||||
</section>
|
||||
|
||||
|
||||
<section><title><quote>Too many links</quote> error in the Nix
|
||||
store</title>
|
||||
|
||||
|
||||
<para>Symptom: when building something, you get an error message such as
|
||||
|
||||
<screen>
|
||||
...
|
||||
<literal>mkdir: cannot create directory `/nix/store/<replaceable>name</replaceable>': Too many links</literal></screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>This is usually because you have more than 32,000 subdirectories
|
||||
in <filename>/nix/store</filename>, as can be seen using <command>ls
|
||||
-l</command>:
|
||||
|
||||
<screen>
|
||||
$ ls -l /nix/store
|
||||
drwxrwxrwt 32000 nix nix 4620288 Sep 8 15:08 store</screen>
|
||||
|
||||
The <literal>ext2</literal> file system is limited to a inode link
|
||||
count of 32,000 (each subdirectory increasing the count by one).
|
||||
Furthermore, the <literal>st_nlink</literal> field of the
|
||||
<function>stat</function> system call is a 16-bit value.</para>
|
||||
|
||||
<para>This only happens on very large Nix installations (such as build
|
||||
machines).</para>
|
||||
|
||||
<para>Quick solution: run the garbage collector.</para>
|
||||
|
||||
<para>Real solution: put the Nix store on a file system that supports
|
||||
more than 32,000 subdirectories per directory, such as ReiserFS.
|
||||
(This doesn’t solve the <literal>st_nlink</literal> limit, but
|
||||
ReiserFS lies to the kernel by reporting a link count of 1 if it
|
||||
exceeds the limit.)</para>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</appendix>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
65
externals/Makefile.am
vendored
65
externals/Makefile.am
vendored
@@ -1,16 +1,17 @@
|
||||
# Berkeley DB
|
||||
|
||||
DB = db-4.3.28.NC
|
||||
DB = db-4.4.20.NC
|
||||
|
||||
$(DB).tar.gz:
|
||||
@echo "Nix requires Berkeley DB to build."
|
||||
@echo "Please download version 4.3.28 from"
|
||||
@echo " http://downloads.sleepycat.com/db-4.3.28.NC.tar.gz"
|
||||
@echo "Please download version 4.4.20 from"
|
||||
@echo " http://downloads.sleepycat.com/db-4.4.20.NC.tar.gz"
|
||||
@echo "and place it in the externals/ directory."
|
||||
false
|
||||
|
||||
$(DB): $(DB).tar.gz
|
||||
gunzip < $(DB).tar.gz | tar xvf -
|
||||
gunzip < $(srcdir)/$(DB).tar.gz | tar xvf -
|
||||
(cd $(DB) && $(patch) -p1) < $(srcdir)/bdb-cygwin.patch
|
||||
|
||||
have-db:
|
||||
$(MAKE) $(DB)
|
||||
@@ -27,24 +28,26 @@ build-db: have-db
|
||||
--enable-cxx --disable-shared --disable-cryptography \
|
||||
--disable-replication --disable-verify && \
|
||||
$(MAKE) && \
|
||||
$(MAKE) install)
|
||||
$(MAKE) install_include install_lib)
|
||||
touch build-db
|
||||
endif
|
||||
|
||||
|
||||
# CWI ATerm
|
||||
|
||||
ATERM = aterm-2.3.1
|
||||
ATERM = aterm-2.4.2
|
||||
|
||||
$(ATERM).tar.gz:
|
||||
@echo "Nix requires the CWI ATerm library to build."
|
||||
@echo "Please download version 2.3.1 from"
|
||||
@echo " http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.3.1.tar.gz"
|
||||
@echo "Please download version 2.4.2 from"
|
||||
@echo " http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.4.2.tar.gz"
|
||||
@echo "and place it in the externals/ directory."
|
||||
false
|
||||
|
||||
$(ATERM): $(ATERM).tar.gz
|
||||
gunzip < $(ATERM).tar.gz | tar xvf -
|
||||
gunzip < $(srcdir)/$(ATERM).tar.gz | tar xvf -
|
||||
(cd $(ATERM) && $(patch) -p1) < $(srcdir)/aterm-aliasing.patch
|
||||
# (cd $(ATERM) && $(patch) -p1) < $(srcdir)/aterm-64-bit.patch
|
||||
|
||||
have-aterm:
|
||||
$(MAKE) $(ATERM)
|
||||
@@ -56,17 +59,53 @@ else
|
||||
build-aterm: have-aterm
|
||||
(pfx=`pwd` && \
|
||||
cd $(ATERM) && \
|
||||
CC="$(CC)" ./configure --prefix=$$pfx/inst-aterm && \
|
||||
CC="$(CC)" ./configure --prefix=$$pfx/inst-aterm \
|
||||
--disable-shared --enable-static && \
|
||||
$(MAKE) && \
|
||||
$(MAKE) install)
|
||||
touch build-aterm
|
||||
endif
|
||||
|
||||
|
||||
all: build-db build-aterm
|
||||
# bzip2
|
||||
|
||||
EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz
|
||||
BZIP2 = bzip2-1.0.3
|
||||
|
||||
$(BZIP2).tar.gz:
|
||||
@echo "Nix requires bzip2 to build."
|
||||
@echo "Please download version 1.0.3 from"
|
||||
@echo " http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz"
|
||||
@echo "and place it in the externals/ directory."
|
||||
false
|
||||
|
||||
$(BZIP2): $(BZIP2).tar.gz
|
||||
gunzip < $(srcdir)/$(BZIP2).tar.gz | tar xvf -
|
||||
|
||||
have-bzip2:
|
||||
$(MAKE) $(BZIP2)
|
||||
touch have-bzip2
|
||||
|
||||
if HAVE_BZIP2
|
||||
build-bzip2:
|
||||
else
|
||||
build-bzip2: have-bzip2
|
||||
(pfx=`pwd` && \
|
||||
cd $(BZIP2) && \
|
||||
$(MAKE) && \
|
||||
$(MAKE) install PREFIX=$$pfx/inst-bzip2)
|
||||
touch build-bzip2
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)${bzip2_bin}
|
||||
$(INSTALL_PROGRAM) $(bzip2_bin_test)/bzip2 $(bzip2_bin_test)/bunzip2 $(DESTDIR)${bzip2_bin}
|
||||
endif
|
||||
|
||||
|
||||
all: build-db build-aterm build-bzip2
|
||||
|
||||
EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz $(BZIP2).tar.gz \
|
||||
bdb-cygwin.patch aterm-aliasing.patch aterm-64-bit.patch
|
||||
|
||||
ext-clean:
|
||||
$(RM) -f have-db build-db have-aterm build-aterm
|
||||
$(RM) -rf $(DB) $(ATERM)
|
||||
$(RM) -rf $(DB) $(ATERM) $(BZIP2)
|
||||
|
||||
661
externals/aterm-64-bit.patch
vendored
Normal file
661
externals/aterm-64-bit.patch
vendored
Normal file
@@ -0,0 +1,661 @@
|
||||
diff -rc aterm-2.4.2-orig/aterm/bafio.c aterm-2.4.2/aterm/bafio.c
|
||||
*** aterm-2.4.2-orig/aterm/bafio.c 2004-02-02 12:24:34.000000000 +0100
|
||||
--- aterm-2.4.2/aterm/bafio.c 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 222,227 ****
|
||||
--- 222,229 ----
|
||||
}
|
||||
}
|
||||
|
||||
+ if (val) return -1;
|
||||
+
|
||||
/* Ok */
|
||||
return 0;
|
||||
}
|
||||
***************
|
||||
*** 544,551 ****
|
||||
* terms have been sorted by symbol.
|
||||
*/
|
||||
|
||||
! void gather_top_symbols(sym_entry *cur_entry, int cur_arg,
|
||||
! int total_top_symbols)
|
||||
{
|
||||
int index;
|
||||
unsigned int hnr;
|
||||
--- 546,553 ----
|
||||
* terms have been sorted by symbol.
|
||||
*/
|
||||
|
||||
! static void gather_top_symbols(sym_entry *cur_entry, int cur_arg,
|
||||
! int total_top_symbols)
|
||||
{
|
||||
int index;
|
||||
unsigned int hnr;
|
||||
***************
|
||||
*** 899,905 ****
|
||||
} else {
|
||||
switch(ATgetType(t)) {
|
||||
case AT_INT:
|
||||
! if(writeBits(ATgetInt((ATermInt)t), HEADER_BITS, writer) < 0) {
|
||||
return ATfalse;
|
||||
}
|
||||
#if 0
|
||||
--- 901,908 ----
|
||||
} else {
|
||||
switch(ATgetType(t)) {
|
||||
case AT_INT:
|
||||
! /* If ATerm integers are > 32 bits, then this can fail. */
|
||||
! if(writeBits(ATgetInt((ATermInt)t), INT_SIZE_IN_BAF, writer) < 0) {
|
||||
return ATfalse;
|
||||
}
|
||||
#if 0
|
||||
***************
|
||||
*** 1033,1039 ****
|
||||
/*}}} */
|
||||
/*{{{ ATbool write_baf(ATerm t, byte_writer *writer) */
|
||||
|
||||
! ATbool
|
||||
write_baf(ATerm t, byte_writer *writer)
|
||||
{
|
||||
int nr_unique_terms = 0;
|
||||
--- 1036,1042 ----
|
||||
/*}}} */
|
||||
/*{{{ ATbool write_baf(ATerm t, byte_writer *writer) */
|
||||
|
||||
! static ATbool
|
||||
write_baf(ATerm t, byte_writer *writer)
|
||||
{
|
||||
int nr_unique_terms = 0;
|
||||
***************
|
||||
*** 1233,1239 ****
|
||||
* Read a single symbol from file.
|
||||
*/
|
||||
|
||||
! Symbol read_symbol(byte_reader *reader)
|
||||
{
|
||||
unsigned int arity, quoted;
|
||||
int len;
|
||||
--- 1236,1242 ----
|
||||
* Read a single symbol from file.
|
||||
*/
|
||||
|
||||
! static Symbol read_symbol(byte_reader *reader)
|
||||
{
|
||||
unsigned int arity, quoted;
|
||||
int len;
|
||||
***************
|
||||
*** 1260,1266 ****
|
||||
* Read all symbols from file.
|
||||
*/
|
||||
|
||||
! ATbool read_all_symbols(byte_reader *reader)
|
||||
{
|
||||
unsigned int val;
|
||||
int i, j, k, arity;
|
||||
--- 1263,1269 ----
|
||||
* Read all symbols from file.
|
||||
*/
|
||||
|
||||
! static ATbool read_all_symbols(byte_reader *reader)
|
||||
{
|
||||
unsigned int val;
|
||||
int i, j, k, arity;
|
||||
***************
|
||||
*** 1280,1293 ****
|
||||
/*}}} */
|
||||
/*{{{ Read term count and allocate space */
|
||||
|
||||
! if(readInt(&val, reader) < 0)
|
||||
return ATfalse;
|
||||
read_symbols[i].nr_terms = val;
|
||||
read_symbols[i].term_width = bit_width(val);
|
||||
! if(val == 0)
|
||||
! read_symbols[i].terms = NULL;
|
||||
! else
|
||||
! read_symbols[i].terms = (ATerm *)calloc(val, sizeof(ATerm));
|
||||
if(!read_symbols[i].terms)
|
||||
ATerror("read_symbols: could not allocate space for %d terms.\n", val);
|
||||
ATprotectArray(read_symbols[i].terms, val);
|
||||
--- 1283,1293 ----
|
||||
/*}}} */
|
||||
/*{{{ Read term count and allocate space */
|
||||
|
||||
! if(readInt(&val, reader) < 0 || val == 0)
|
||||
return ATfalse;
|
||||
read_symbols[i].nr_terms = val;
|
||||
read_symbols[i].term_width = bit_width(val);
|
||||
! read_symbols[i].terms = (ATerm *)calloc(val, sizeof(ATerm));
|
||||
if(!read_symbols[i].terms)
|
||||
ATerror("read_symbols: could not allocate space for %d terms.\n", val);
|
||||
ATprotectArray(read_symbols[i].terms, val);
|
||||
***************
|
||||
*** 1351,1357 ****
|
||||
/*}}} */
|
||||
/*{{{ ATerm read_term(sym_read_entry *sym, byte_reader *reader) */
|
||||
|
||||
! ATerm read_term(sym_read_entry *sym, byte_reader *reader)
|
||||
{
|
||||
unsigned int val;
|
||||
int i, arity = sym->arity;
|
||||
--- 1351,1357 ----
|
||||
/*}}} */
|
||||
/*{{{ ATerm read_term(sym_read_entry *sym, byte_reader *reader) */
|
||||
|
||||
! static ATerm read_term(sym_read_entry *sym, byte_reader *reader)
|
||||
{
|
||||
unsigned int val;
|
||||
int i, arity = sym->arity;
|
||||
***************
|
||||
*** 1365,1370 ****
|
||||
--- 1365,1371 ----
|
||||
ATprotectArray(args, arity);
|
||||
if(!args)
|
||||
ATerror("could not allocate space for %d arguments.\n", arity);
|
||||
+ /* !!! leaks memory on the "return NULL" paths */
|
||||
}
|
||||
|
||||
/*ATfprintf(stderr, "reading term over symbol %y\n", sym->sym);*/
|
||||
***************
|
||||
*** 1372,1377 ****
|
||||
--- 1373,1380 ----
|
||||
/*ATfprintf(stderr, " reading argument %d (%d)", i, sym->sym_width[i]);*/
|
||||
if(readBits(&val, sym->sym_width[i], reader) < 0)
|
||||
return NULL;
|
||||
+ if(val >= sym->nr_topsyms[i])
|
||||
+ return NULL;
|
||||
arg_sym = &read_symbols[sym->topsyms[i][val]];
|
||||
/* ATfprintf(stderr, "argument %d, symbol index = %d, symbol = %y\n",
|
||||
i, val, arg_sym->sym);*/
|
||||
***************
|
||||
*** 1381,1386 ****
|
||||
--- 1384,1391 ----
|
||||
if(readBits(&val, arg_sym->term_width, reader) < 0)
|
||||
return NULL;
|
||||
/* ATfprintf(stderr, "arg term index = %d\n", val);*/
|
||||
+ if(val >= arg_sym->nr_terms)
|
||||
+ return NULL;
|
||||
if(!arg_sym->terms[val]) {
|
||||
arg_sym->terms[val] = read_term(arg_sym, reader);
|
||||
if(!arg_sym->terms[val])
|
||||
***************
|
||||
*** 1396,1402 ****
|
||||
case AS_INT:
|
||||
/*{{{ Read an integer */
|
||||
|
||||
! if(readBits(&val, HEADER_BITS, reader) < 0)
|
||||
return NULL;
|
||||
|
||||
result = (ATerm)ATmakeInt((int)val);
|
||||
--- 1401,1407 ----
|
||||
case AS_INT:
|
||||
/*{{{ Read an integer */
|
||||
|
||||
! if(readBits(&val, INT_SIZE_IN_BAF, reader) < 0)
|
||||
return NULL;
|
||||
|
||||
result = (ATerm)ATmakeInt((int)val);
|
||||
***************
|
||||
*** 1494,1502 ****
|
||||
for(i=0; i<nr_unique_symbols; i++) {
|
||||
sym_read_entry *entry = &read_symbols[i];
|
||||
|
||||
! ATunprotectArray(entry->terms);
|
||||
! if(entry->terms)
|
||||
free(entry->terms);
|
||||
if(entry->nr_topsyms)
|
||||
free(entry->nr_topsyms);
|
||||
if(entry->sym_width)
|
||||
--- 1499,1508 ----
|
||||
for(i=0; i<nr_unique_symbols; i++) {
|
||||
sym_read_entry *entry = &read_symbols[i];
|
||||
|
||||
! if(entry->terms) {
|
||||
! ATunprotectArray(entry->terms);
|
||||
free(entry->terms);
|
||||
+ }
|
||||
if(entry->nr_topsyms)
|
||||
free(entry->nr_topsyms);
|
||||
if(entry->sym_width)
|
||||
Only in aterm-2.4.2/aterm: config.h.in
|
||||
diff -rc aterm-2.4.2-orig/aterm/encoding.h aterm-2.4.2/aterm/encoding.h
|
||||
*** aterm-2.4.2-orig/aterm/encoding.h 2004-06-01 10:29:02.000000000 +0200
|
||||
--- aterm-2.4.2/aterm/encoding.h 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 10,15 ****
|
||||
--- 10,17 ----
|
||||
{
|
||||
#endif/* __cplusplus */
|
||||
|
||||
+ #include "config.h"
|
||||
+
|
||||
/*
|
||||
|--------------------------------|
|
||||
|info|type |arity|quoted|mark|age|
|
||||
***************
|
||||
*** 31,37 ****
|
||||
#define SHIFT_REMOVE_MARK_AGE 3
|
||||
#define MASK_AGE_MARK (MASK_AGE|MASK_MARK)
|
||||
|
||||
! #if AT_64BIT
|
||||
#define SHIFT_LENGTH 34
|
||||
#define HEADER_BITS 64
|
||||
typedef unsigned long header_type;
|
||||
--- 33,39 ----
|
||||
#define SHIFT_REMOVE_MARK_AGE 3
|
||||
#define MASK_AGE_MARK (MASK_AGE|MASK_MARK)
|
||||
|
||||
! #ifdef AT_64BIT
|
||||
#define SHIFT_LENGTH 34
|
||||
#define HEADER_BITS 64
|
||||
typedef unsigned long header_type;
|
||||
***************
|
||||
*** 137,142 ****
|
||||
--- 139,150 ----
|
||||
#define AT_TABLE_SIZE(table_class) (1<<(table_class))
|
||||
#define AT_TABLE_MASK(table_class) (AT_TABLE_SIZE(table_class)-1)
|
||||
|
||||
+
|
||||
+ /* Integers in BAF are always exactly 32 bits. The size must be fixed so that
|
||||
+ * BAF terms can be exchanged between platforms. */
|
||||
+ #define INT_SIZE_IN_BAF 32
|
||||
+
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif/* __cplusplus */
|
||||
diff -rc aterm-2.4.2-orig/aterm/gc.c aterm-2.4.2/aterm/gc.c
|
||||
*** aterm-2.4.2-orig/aterm/gc.c 2004-06-01 10:29:02.000000000 +0200
|
||||
--- aterm-2.4.2/aterm/gc.c 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 154,166 ****
|
||||
}
|
||||
|
||||
#ifdef AT_64BIT
|
||||
! odd_term = *((ATerm *)((MachineWord)cur)+4);
|
||||
real_term = AT_isInsideValidTerm(odd_term);
|
||||
if (real_term != NULL) {
|
||||
AT_markTerm(odd_term);
|
||||
}
|
||||
|
||||
! odd_sym = *((AFun *)((MachineWord)cur)+4);
|
||||
if (AT_isValidSymbol(odd_sym)) {
|
||||
/*fprintf(stderr,"mark_memory: AT_markSymbol(%d)\n",odd_sym);*/
|
||||
AT_markSymbol(odd_sym);
|
||||
--- 154,166 ----
|
||||
}
|
||||
|
||||
#ifdef AT_64BIT
|
||||
! odd_term = *((ATerm *)(((MachineWord)cur)+4));
|
||||
real_term = AT_isInsideValidTerm(odd_term);
|
||||
if (real_term != NULL) {
|
||||
AT_markTerm(odd_term);
|
||||
}
|
||||
|
||||
! odd_sym = *((AFun *)(((MachineWord)cur)+4));
|
||||
if (AT_isValidSymbol(odd_sym)) {
|
||||
/*fprintf(stderr,"mark_memory: AT_markSymbol(%d)\n",odd_sym);*/
|
||||
AT_markSymbol(odd_sym);
|
||||
***************
|
||||
*** 198,210 ****
|
||||
}
|
||||
|
||||
#ifdef AT_64BIT
|
||||
! odd_term = *((ATerm *)((MachineWord)cur)+4);
|
||||
real_term = AT_isInsideValidTerm(odd_term);
|
||||
if (real_term != NULL) {
|
||||
AT_markTerm_young(odd_term);
|
||||
}
|
||||
|
||||
! odd_sym = *((AFun *)((MachineWord)cur)+4);
|
||||
if (AT_isValidSymbol(odd_sym)) {
|
||||
/*fprintf(stderr,"mark_memory_young: AT_markSymbol_young(%d)\n",odd_sym);*/
|
||||
AT_markSymbol_young(odd_sym);
|
||||
--- 198,210 ----
|
||||
}
|
||||
|
||||
#ifdef AT_64BIT
|
||||
! odd_term = *((ATerm *)(((MachineWord)cur)+4));
|
||||
real_term = AT_isInsideValidTerm(odd_term);
|
||||
if (real_term != NULL) {
|
||||
AT_markTerm_young(odd_term);
|
||||
}
|
||||
|
||||
! odd_sym = *((AFun *)(((MachineWord)cur)+4));
|
||||
if (AT_isValidSymbol(odd_sym)) {
|
||||
/*fprintf(stderr,"mark_memory_young: AT_markSymbol_young(%d)\n",odd_sym);*/
|
||||
AT_markSymbol_young(odd_sym);
|
||||
***************
|
||||
*** 225,235 ****
|
||||
ATerm *start, *stop;
|
||||
ProtEntry *prot;
|
||||
|
||||
- #ifdef AT_64BIT
|
||||
- ATerm oddTerm;
|
||||
- AFun oddSym;
|
||||
- #endif
|
||||
-
|
||||
#ifdef WIN32
|
||||
|
||||
unsigned int r_eax, r_ebx, r_ecx, r_edx, \
|
||||
--- 225,230 ----
|
||||
***************
|
||||
*** 287,293 ****
|
||||
/* Traverse possible register variables */
|
||||
sigsetjmp(env,0);
|
||||
|
||||
! start = (ATerm *)env;
|
||||
stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
|
||||
mark_memory(start, stop);
|
||||
#endif
|
||||
--- 282,288 ----
|
||||
/* Traverse possible register variables */
|
||||
sigsetjmp(env,0);
|
||||
|
||||
! start = (ATerm *)env; /* !!! illegal aliasing */
|
||||
stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
|
||||
mark_memory(start, stop);
|
||||
#endif
|
||||
***************
|
||||
*** 338,348 ****
|
||||
ATerm *start, *stop;
|
||||
ProtEntry *prot;
|
||||
|
||||
- #ifdef AT_64BIT
|
||||
- ATerm oddTerm;
|
||||
- AFun oddSym;
|
||||
- #endif
|
||||
-
|
||||
#ifdef WIN32
|
||||
|
||||
unsigned int r_eax, r_ebx, r_ecx, r_edx, \
|
||||
--- 333,338 ----
|
||||
***************
|
||||
*** 400,406 ****
|
||||
/* Traverse possible register variables */
|
||||
sigsetjmp(env,0);
|
||||
|
||||
! start = (ATerm *)env;
|
||||
stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
|
||||
mark_memory_young(start, stop);
|
||||
#endif
|
||||
--- 390,396 ----
|
||||
/* Traverse possible register variables */
|
||||
sigsetjmp(env,0);
|
||||
|
||||
! start = (ATerm *)env; /* !!! illegal aliasing */
|
||||
stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
|
||||
mark_memory_young(start, stop);
|
||||
#endif
|
||||
***************
|
||||
*** 1047,1053 ****
|
||||
/*fprintf(stderr,"minor_sweep_phase_young: ensure empty freelist[%d]\n",size);*/
|
||||
for(data = at_freelist[size] ; data ; data=data->next) {
|
||||
if(!EQUAL_HEADER(data->header,FREE_HEADER)) {
|
||||
! fprintf(stderr,"data = %x header = %x\n",(unsigned int)data,data->header);
|
||||
}
|
||||
assert(EQUAL_HEADER(data->header,FREE_HEADER));
|
||||
assert(ATgetType(data) == AT_FREE);
|
||||
--- 1037,1043 ----
|
||||
/*fprintf(stderr,"minor_sweep_phase_young: ensure empty freelist[%d]\n",size);*/
|
||||
for(data = at_freelist[size] ; data ; data=data->next) {
|
||||
if(!EQUAL_HEADER(data->header,FREE_HEADER)) {
|
||||
! fprintf(stderr,"data = %p header = %x\n",data,(unsigned int) data->header);
|
||||
}
|
||||
assert(EQUAL_HEADER(data->header,FREE_HEADER));
|
||||
assert(ATgetType(data) == AT_FREE);
|
||||
diff -rc aterm-2.4.2-orig/aterm/Makefile.am aterm-2.4.2/aterm/Makefile.am
|
||||
*** aterm-2.4.2-orig/aterm/Makefile.am 2005-08-03 11:45:19.000000000 +0200
|
||||
--- aterm-2.4.2/aterm/Makefile.am 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 37,43 ****
|
||||
aterm2.h \
|
||||
atypes.h \
|
||||
deprecated.h \
|
||||
! encoding.h
|
||||
|
||||
PRIVATE_INCL = \
|
||||
_afun.h \
|
||||
--- 37,44 ----
|
||||
aterm2.h \
|
||||
atypes.h \
|
||||
deprecated.h \
|
||||
! encoding.h \
|
||||
! config.h
|
||||
|
||||
PRIVATE_INCL = \
|
||||
_afun.h \
|
||||
diff -rc aterm-2.4.2-orig/aterm/md5.h aterm-2.4.2/aterm/md5.h
|
||||
*** aterm-2.4.2-orig/aterm/md5.h 2003-09-02 15:32:46.000000000 +0200
|
||||
--- aterm-2.4.2/aterm/md5.h 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 24,29 ****
|
||||
--- 24,31 ----
|
||||
documentation and/or software.
|
||||
*/
|
||||
|
||||
+ #include <stdint.h>
|
||||
+
|
||||
/* GLOBAL.H - RSAREF types and constants
|
||||
*/
|
||||
|
||||
***************
|
||||
*** 46,55 ****
|
||||
typedef unsigned char *POINTER;
|
||||
|
||||
/* UINT2 defines a two byte word */
|
||||
! typedef unsigned short int UINT2;
|
||||
|
||||
/* UINT4 defines a four byte word */
|
||||
! typedef unsigned long int UINT4;
|
||||
|
||||
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
|
||||
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
|
||||
--- 48,57 ----
|
||||
typedef unsigned char *POINTER;
|
||||
|
||||
/* UINT2 defines a two byte word */
|
||||
! typedef uint16_t UINT2;
|
||||
|
||||
/* UINT4 defines a four byte word */
|
||||
! typedef uint32_t UINT4;
|
||||
|
||||
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
|
||||
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
|
||||
diff -rc aterm-2.4.2-orig/aterm/memory.c aterm-2.4.2/aterm/memory.c
|
||||
*** aterm-2.4.2-orig/aterm/memory.c 2005-10-11 13:19:25.000000000 +0200
|
||||
--- aterm-2.4.2/aterm/memory.c 2006-09-22 13:39:16.000000000 +0200
|
||||
***************
|
||||
*** 96,102 ****
|
||||
#define HASHNUMBER4(t) hash_number(t,4)
|
||||
#define HASHINT(val) (tmp[0]=(MachineWord)(AT_INT<<SHIFT_TYPE),\
|
||||
tmp[1]=(MachineWord)0,\
|
||||
! tmp[2]=(MachineWord)val,\
|
||||
hash_number(tmp,3))
|
||||
|
||||
#else
|
||||
--- 96,102 ----
|
||||
#define HASHNUMBER4(t) hash_number(t,4)
|
||||
#define HASHINT(val) (tmp[0]=(MachineWord)(AT_INT<<SHIFT_TYPE),\
|
||||
tmp[1]=(MachineWord)0,\
|
||||
! tmp[2]=(MachineWord)((unsigned int) val),\
|
||||
hash_number(tmp,3))
|
||||
|
||||
#else
|
||||
***************
|
||||
*** 127,133 ****
|
||||
((MachineWord*)t)[2]),((MachineWord*)t)[3]))
|
||||
|
||||
#define HASHINT(val) \
|
||||
! FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), val))
|
||||
|
||||
|
||||
#endif /* HASHPEM */
|
||||
--- 127,133 ----
|
||||
((MachineWord*)t)[2]),((MachineWord*)t)[3]))
|
||||
|
||||
#define HASHINT(val) \
|
||||
! FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), (unsigned int) val))
|
||||
|
||||
|
||||
#endif /* HASHPEM */
|
||||
***************
|
||||
*** 708,714 ****
|
||||
at_blocks[size] = newblock;
|
||||
top_at_blocks[size] = newblock->data;
|
||||
assert(at_blocks[size] != NULL);
|
||||
! assert(((int)top_at_blocks[size] % MAX(sizeof(double), sizeof(void *))) == 0);
|
||||
|
||||
/* [pem: Feb 14 02] TODO: fast allocation */
|
||||
assert(at_freelist[size] == NULL);
|
||||
--- 708,714 ----
|
||||
at_blocks[size] = newblock;
|
||||
top_at_blocks[size] = newblock->data;
|
||||
assert(at_blocks[size] != NULL);
|
||||
! assert(((long)top_at_blocks[size] % MAX(sizeof(double), sizeof(void *))) == 0);
|
||||
|
||||
/* [pem: Feb 14 02] TODO: fast allocation */
|
||||
assert(at_freelist[size] == NULL);
|
||||
***************
|
||||
*** 1009,1018 ****
|
||||
do {
|
||||
if(!cur) {
|
||||
/*printf("freeterm = %d\n",t);*/
|
||||
! fprintf(stderr,"### cannot find term %x in hashtable at pos %d header = %x\n", (unsigned int)t, hnr, t->header);
|
||||
!
|
||||
! ATabort("### cannot find term %n at %p in hashtable at pos %d"
|
||||
! ", header = %d\n", t, t, hnr, t->header);
|
||||
}
|
||||
if (cur == t) {
|
||||
if(prev)
|
||||
--- 1009,1016 ----
|
||||
do {
|
||||
if(!cur) {
|
||||
/*printf("freeterm = %d\n",t);*/
|
||||
! ATabort("### cannot find term %p in hashtable at pos %d"
|
||||
! ", header = %x\n", t, hnr, t->header);
|
||||
}
|
||||
if (cur == t) {
|
||||
if(prev)
|
||||
***************
|
||||
*** 1728,1733 ****
|
||||
--- 1726,1733 ----
|
||||
hashtable[hnr] = cur;
|
||||
}
|
||||
|
||||
+ assert((hnr & table_mask) == (hash_number(cur, TERM_SIZE_INT) & table_mask));
|
||||
+
|
||||
return (ATermInt)cur;
|
||||
}
|
||||
|
||||
diff -rc aterm-2.4.2-orig/aterm.m4 aterm-2.4.2/aterm.m4
|
||||
*** aterm-2.4.2-orig/aterm.m4 2005-08-03 11:45:19.000000000 +0200
|
||||
--- aterm-2.4.2/aterm.m4 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 8,15 ****
|
||||
[AS_HELP_STRING([--with-sharing],[create libraries that do term sharing @<:@yes@:>@])],
|
||||
[if test "$withval" = "no"; then
|
||||
AC_MSG_RESULT([no])
|
||||
! AC_DEFINE([NO_SHARING])
|
||||
! AC_DEFINE([WITH_STATS])
|
||||
else
|
||||
if test "$withval" != "yes"; then
|
||||
AC_MSG_RESULT([unknown value specified for --with-sharing.])
|
||||
--- 8,15 ----
|
||||
[AS_HELP_STRING([--with-sharing],[create libraries that do term sharing @<:@yes@:>@])],
|
||||
[if test "$withval" = "no"; then
|
||||
AC_MSG_RESULT([no])
|
||||
! AC_DEFINE([NO_SHARING], [], [Whether terms are shared.])
|
||||
! AC_DEFINE([WITH_STATS], [], [Whether to keep statistics.])
|
||||
else
|
||||
if test "$withval" != "yes"; then
|
||||
AC_MSG_RESULT([unknown value specified for --with-sharing.])
|
||||
***************
|
||||
*** 73,78 ****
|
||||
--- 73,102 ----
|
||||
AC_SUBST([OPTIMIZECFLAGS])
|
||||
])
|
||||
|
||||
+ # ATERM_64_BIT
|
||||
+ # ------------
|
||||
+ # Enable 64-bit mode if pointers are 8 bytes large.
|
||||
+ AC_DEFUN([ATERM_64_BIT], [
|
||||
+ AC_CHECK_SIZEOF(void *)
|
||||
+ AC_CHECK_SIZEOF(int)
|
||||
+ AC_CHECK_SIZEOF(long)
|
||||
+
|
||||
+ AC_MSG_CHECKING([what kind of platform this is])
|
||||
+
|
||||
+ AC_SUBST([AT_64BIT], [0])
|
||||
+ if test "$ac_cv_sizeof_void_p" = "8" -a "$ac_cv_sizeof_int" = "4" -a "$ac_cv_sizeof_long" = "8"; then
|
||||
+ AC_MSG_RESULT([LP64])
|
||||
+ AC_SUBST([AT_64BIT], [1])
|
||||
+ elif test "$ac_cv_sizeof_void_p" = "8" -a "$ac_cv_sizeof_int" = "8" -a "$ac_cv_sizeof_long" = "8"; then
|
||||
+ AC_MSG_RESULT([ILP64 - warning, untested])
|
||||
+ AC_SUBST([AT_64BIT], [1])
|
||||
+ elif test "$ac_cv_sizeof_void_p" = "4" -a "$ac_cv_sizeof_int" = "4" -a "$ac_cv_sizeof_long" = "4"; then
|
||||
+ AC_MSG_RESULT([32 bits])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([something weird - warning, untested])
|
||||
+ fi
|
||||
+ ])
|
||||
+
|
||||
# XT_SVN_REVISION
|
||||
# ---------------
|
||||
AC_DEFUN([XT_SVN_REVISION],
|
||||
diff -rc aterm-2.4.2-orig/configure.ac aterm-2.4.2/configure.ac
|
||||
*** aterm-2.4.2-orig/configure.ac 2005-08-03 11:45:19.000000000 +0200
|
||||
--- aterm-2.4.2/configure.ac 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 30,35 ****
|
||||
--- 30,38 ----
|
||||
# Add a configuration option to allow users to control sharing.
|
||||
ATERM_WITH_SHARING
|
||||
|
||||
+ # Enable 64-bit mode if pointers are 8 bytes large.
|
||||
+ ATERM_64_BIT
|
||||
+
|
||||
CURDATE=`date`
|
||||
AC_SUBST([CURDATE])
|
||||
|
||||
***************
|
||||
*** 45,49 ****
|
||||
--- 48,53 ----
|
||||
doc/spec/Makefile
|
||||
aterm.spec
|
||||
aterm.pc
|
||||
+ aterm/config.h
|
||||
])
|
||||
AC_OUTPUT
|
||||
diff -rc aterm-2.4.2-orig/utils/dicttoc.c aterm-2.4.2/utils/dicttoc.c
|
||||
*** aterm-2.4.2-orig/utils/dicttoc.c 2003-10-07 13:57:40.000000000 +0200
|
||||
--- aterm-2.4.2/utils/dicttoc.c 2006-09-22 13:39:07.000000000 +0200
|
||||
***************
|
||||
*** 69,74 ****
|
||||
--- 69,75 ----
|
||||
fprintf(file, "#ifndef __%s_H\n", code_prefix);
|
||||
fprintf(file, "#define __%s_H\n\n", code_prefix);
|
||||
fprintf(file, "#include <aterm2.h>\n\n");
|
||||
+ fprintf(file, "#include <assert.h>\n\n");
|
||||
|
||||
while (!ATisEmpty(afuns)) {
|
||||
ATerm afun, alias, pair = ATgetFirst(afuns);
|
||||
***************
|
||||
*** 244,251 ****
|
||||
ATfprintf(file, "{\n");
|
||||
ATfprintf(file, " ATermList afuns, terms;\n\n");
|
||||
|
||||
! ATfprintf(file, " _%s = ATreadFromBinaryString(_%s_baf, _%s_LEN);\n\n",
|
||||
code_prefix, code_prefix, code_prefix);
|
||||
ATfprintf(file, " ATprotect(&_%s);\n\n", code_prefix);
|
||||
|
||||
ATfprintf(file, " afuns = (ATermList)ATelementAt((ATermList)_%s, 0);\n\n", code_prefix);
|
||||
--- 245,253 ----
|
||||
ATfprintf(file, "{\n");
|
||||
ATfprintf(file, " ATermList afuns, terms;\n\n");
|
||||
|
||||
! ATfprintf(file, " _%s = ATreadFromBinaryString(_%s_baf, _%s_LEN);\n",
|
||||
code_prefix, code_prefix, code_prefix);
|
||||
+ ATfprintf(file, " assert(_%s);\n\n", code_prefix);
|
||||
ATfprintf(file, " ATprotect(&_%s);\n\n", code_prefix);
|
||||
|
||||
ATfprintf(file, " afuns = (ATermList)ATelementAt((ATermList)_%s, 0);\n\n", code_prefix);
|
||||
224
externals/aterm-aliasing.patch
vendored
Normal file
224
externals/aterm-aliasing.patch
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
diff -rc aterm-1142707243.10633/aterm/aterm.c aterm/aterm/aterm.c
|
||||
*** aterm-1142707243.10633/aterm/aterm.c 2006-02-08 11:35:28.000000000 +0100
|
||||
--- aterm/aterm/aterm.c 2006-04-25 17:10:52.000000000 +0200
|
||||
***************
|
||||
*** 193,198 ****
|
||||
--- 193,199 ----
|
||||
/* that have char == 2 bytes, and sizeof(header_type) == 2 */
|
||||
assert(sizeof(header_type) == sizeof(ATerm *));
|
||||
assert(sizeof(header_type) >= 4);
|
||||
+ assert(sizeof(ATerm) == sizeof(MachineWord));
|
||||
|
||||
/*}}} */
|
||||
/*{{{ Initialize buffer */
|
||||
diff -rc aterm-1142707243.10633/aterm/memory.c aterm/aterm/memory.c
|
||||
*** aterm-1142707243.10633/aterm/memory.c 2006-03-09 15:02:56.000000000 +0100
|
||||
--- aterm/aterm/memory.c 2006-04-25 18:22:00.000000000 +0200
|
||||
***************
|
||||
*** 119,130 ****
|
||||
hash_number(tmp,3))
|
||||
*/
|
||||
|
||||
#define HASHNUMBER3(t)\
|
||||
! FINISH(COMBINE(START(((MachineWord*)t)[0]), ((MachineWord*)t)[2]))
|
||||
|
||||
#define HASHNUMBER4(t)\
|
||||
! FINISH(COMBINE(COMBINE(START(((MachineWord*)t)[0]), \
|
||||
! ((MachineWord*)t)[2]),((MachineWord*)t)[3]))
|
||||
|
||||
#define HASHINT(val) \
|
||||
FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), val))
|
||||
--- 119,171 ----
|
||||
hash_number(tmp,3))
|
||||
*/
|
||||
|
||||
+ /* The ATerm library use some heavy aliasing. For instance, the
|
||||
+ various ATermXXX structures are referenced through MachineWord
|
||||
+ arrays. This is not generally allowed by the C standard --- see
|
||||
+ C99, section 6.5, clause 7. In particular, this means that you
|
||||
+ cannot assign something through an ATermXXX pointer, e.g.,
|
||||
+
|
||||
+ protoAppl->header = header;
|
||||
+
|
||||
+ and then read it through a MachineWord*, e.g.,
|
||||
+
|
||||
+ hnr = hash_number((ATerm) protoAppl, 2);
|
||||
+
|
||||
+ (hash_number walks over the term by casting it to a MachineWord*).
|
||||
+
|
||||
+ However, the same clause of the C standard also specifies that you
|
||||
+ *can* read the memory location through a union type that contains
|
||||
+ both the original type (e.g. ATermAppl) and the type used to read
|
||||
+ the memory location (e.g. MachineWord). That's what we do
|
||||
+ below: we have a union of all the types that occur in the various
|
||||
+ ATerm types. We then read the "w" element of the union. The
|
||||
+ compiler is not allowed to assume absence of aliasing with the
|
||||
+ other types in the union.
|
||||
+
|
||||
+ A better solution would be to hash the term through a character
|
||||
+ pointer (since *any* memory location can be legally read as a
|
||||
+ character), but I'm too lazy right now. Performance might also
|
||||
+ suffer if we do that. */
|
||||
+
|
||||
+ typedef union
|
||||
+ {
|
||||
+ MachineWord w;
|
||||
+ header_type header;
|
||||
+ ATerm term;
|
||||
+ ATermList list;
|
||||
+ int i;
|
||||
+ double d;
|
||||
+ void* p;
|
||||
+ } Aliaser;
|
||||
+
|
||||
+ #define GET_WORD(t, n) (((Aliaser*) (((MachineWord*) t) + n))->w)
|
||||
+
|
||||
#define HASHNUMBER3(t)\
|
||||
! FINISH(COMBINE(START(GET_WORD(t, 0)), GET_WORD(t, 2)))
|
||||
|
||||
#define HASHNUMBER4(t)\
|
||||
! FINISH(COMBINE(COMBINE(START(GET_WORD(t, 0)), \
|
||||
! GET_WORD(t, 2)), GET_WORD(t, 3)))
|
||||
|
||||
#define HASHINT(val) \
|
||||
FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), val))
|
||||
***************
|
||||
*** 132,144 ****
|
||||
|
||||
#endif /* HASHPEM */
|
||||
|
||||
! #define PROTO_APPL_ARGS ((ATerm *) (protoTerm + ARG_OFFSET))
|
||||
|
||||
#define SET_PROTO_APPL_ARG(i, a) \
|
||||
! (PROTO_APPL_ARGS[(i)] = (a))
|
||||
|
||||
#define GET_PROTO_APPL_ARG(i) \
|
||||
! (PROTO_APPL_ARGS[(i)])
|
||||
|
||||
#define CHECK_TERM(t) \
|
||||
assert((t) != NULL \
|
||||
--- 173,185 ----
|
||||
|
||||
#endif /* HASHPEM */
|
||||
|
||||
! #define PROTO_APPL_ARGS (protoTerm + ARG_OFFSET)
|
||||
|
||||
#define SET_PROTO_APPL_ARG(i, a) \
|
||||
! (PROTO_APPL_ARGS[(i)] = (MachineWord) (a))
|
||||
|
||||
#define GET_PROTO_APPL_ARG(i) \
|
||||
! ((ATerm) PROTO_APPL_ARGS[(i)])
|
||||
|
||||
#define CHECK_TERM(t) \
|
||||
assert((t) != NULL \
|
||||
***************
|
||||
*** 323,336 ****
|
||||
#else
|
||||
static HashNumber hash_number(ATerm t, int size)
|
||||
{
|
||||
- MachineWord *words = (MachineWord *) t;
|
||||
int i;
|
||||
HashNumber hnr;
|
||||
|
||||
! hnr = START(HIDE_AGE_MARK(words[0]));
|
||||
|
||||
for (i=2; i<size; i++) {
|
||||
! hnr = COMBINE(hnr, words[i]);
|
||||
}
|
||||
|
||||
return FINISH(hnr);
|
||||
--- 364,376 ----
|
||||
#else
|
||||
static HashNumber hash_number(ATerm t, int size)
|
||||
{
|
||||
int i;
|
||||
HashNumber hnr;
|
||||
|
||||
! hnr = START(HIDE_AGE_MARK(GET_WORD(t, 0)));
|
||||
|
||||
for (i=2; i<size; i++) {
|
||||
! hnr = COMBINE(hnr, GET_WORD(t, i));
|
||||
}
|
||||
|
||||
return FINISH(hnr);
|
||||
***************
|
||||
*** 338,351 ****
|
||||
|
||||
static HashNumber hash_number_anno(ATerm t, int size, ATerm anno)
|
||||
{
|
||||
- MachineWord *words = (MachineWord *) t;
|
||||
int i;
|
||||
HashNumber hnr;
|
||||
|
||||
! hnr = START(HIDE_AGE_MARK(words[0]));
|
||||
|
||||
for (i=2; i<size; i++) {
|
||||
! hnr = COMBINE(hnr, words[i]);
|
||||
}
|
||||
hnr = COMBINE(hnr, (MachineWord)anno);
|
||||
|
||||
--- 378,390 ----
|
||||
|
||||
static HashNumber hash_number_anno(ATerm t, int size, ATerm anno)
|
||||
{
|
||||
int i;
|
||||
HashNumber hnr;
|
||||
|
||||
! hnr = START(HIDE_AGE_MARK(GET_WORD(t, 0)));
|
||||
|
||||
for (i=2; i<size; i++) {
|
||||
! hnr = COMBINE(hnr, GET_WORD(t, i));
|
||||
}
|
||||
hnr = COMBINE(hnr, (MachineWord)anno);
|
||||
|
||||
***************
|
||||
*** 1639,1645 ****
|
||||
protoAppl->header = header;
|
||||
CHECK_HEADER(protoAppl->header);
|
||||
|
||||
! if (args != PROTO_APPL_ARGS) {
|
||||
for (i=0; i<arity; i++) {
|
||||
CHECK_TERM(args[i]);
|
||||
SET_PROTO_APPL_ARG(i, args[i]);
|
||||
--- 1678,1684 ----
|
||||
protoAppl->header = header;
|
||||
CHECK_HEADER(protoAppl->header);
|
||||
|
||||
! if (args != (ATerm *) PROTO_APPL_ARGS) {
|
||||
for (i=0; i<arity; i++) {
|
||||
CHECK_TERM(args[i]);
|
||||
SET_PROTO_APPL_ARG(i, args[i]);
|
||||
***************
|
||||
*** 1680,1686 ****
|
||||
hashtable[hnr] = cur;
|
||||
}
|
||||
|
||||
! if (args != PROTO_APPL_ARGS) {
|
||||
for (i=0; i<arity; i++) {
|
||||
protected_buffer[i] = NULL;
|
||||
}
|
||||
--- 1719,1725 ----
|
||||
hashtable[hnr] = cur;
|
||||
}
|
||||
|
||||
! if (args != (ATerm *) PROTO_APPL_ARGS) {
|
||||
for (i=0; i<arity; i++) {
|
||||
protected_buffer[i] = NULL;
|
||||
}
|
||||
***************
|
||||
*** 2144,2150 ****
|
||||
}
|
||||
SET_PROTO_APPL_ARG(n, arg);
|
||||
|
||||
! result = ATmakeApplArray(sym, PROTO_APPL_ARGS);
|
||||
annos = AT_getAnnotations((ATerm)appl);
|
||||
if (annos != NULL) {
|
||||
result = (ATermAppl)AT_setAnnotations((ATerm)result, annos);
|
||||
--- 2183,2189 ----
|
||||
}
|
||||
SET_PROTO_APPL_ARG(n, arg);
|
||||
|
||||
! result = ATmakeApplArray(sym, (ATerm *) PROTO_APPL_ARGS);
|
||||
annos = AT_getAnnotations((ATerm)appl);
|
||||
if (annos != NULL) {
|
||||
result = (ATermAppl)AT_setAnnotations((ATerm)result, annos);
|
||||
21
externals/bdb-cygwin.patch
vendored
Normal file
21
externals/bdb-cygwin.patch
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
diff -rc db-4.4.20.NC-old/os/os_flock.c db-4.4.20.NC/os/os_flock.c
|
||||
*** db-4.4.20.NC-old/os/os_flock.c Mon Jun 20 16:59:01 2005
|
||||
--- db-4.4.20.NC/os/os_flock.c Wed Jun 7 17:01:49 2006
|
||||
***************
|
||||
*** 36,41 ****
|
||||
--- 36,50 ----
|
||||
|
||||
DB_ASSERT(F_ISSET(fhp, DB_FH_OPENED) && fhp->fd != -1);
|
||||
|
||||
+ #ifdef __CYGWIN__
|
||||
+ /*
|
||||
+ * Windows file locking interferes with read/write operations, so we
|
||||
+ * map the ranges to an area past the end of the file.
|
||||
+ */
|
||||
+ DB_ASSERT(offset < (off_t) 1 << 62);
|
||||
+ offset += (off_t) 1 << 62;
|
||||
+ #endif
|
||||
+
|
||||
#ifdef HAVE_FCNTL
|
||||
fl.l_start = offset;
|
||||
fl.l_len = 1;
|
||||
@@ -19,11 +19,7 @@ rec {
|
||||
./version.c
|
||||
];
|
||||
|
||||
compile = fn: compileC {
|
||||
main = fn;
|
||||
localIncludes = "auto";
|
||||
forSharedLib = sharedLib;
|
||||
};
|
||||
compile = main: compileC {inherit main sharedLib;};
|
||||
|
||||
libATerm = makeLibrary {
|
||||
libraryName = "ATerm";
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
with (import ../../../lib);
|
||||
|
||||
let {
|
||||
|
||||
inherit (import ../../../lib) compileC link;
|
||||
|
||||
inherit (import ../aterm {}) libATerm;
|
||||
|
||||
compile = fn: compileC {
|
||||
main = fn;
|
||||
localIncludes = "auto";
|
||||
cFlags = "-I../aterm";
|
||||
compileTest = main: link {
|
||||
objects = [(compileC {inherit main; localIncludePath = [ ../aterm ];})];
|
||||
libraries = libATerm;
|
||||
};
|
||||
|
||||
fib = link {objects = compile ./fib.c; libraries = libATerm;};
|
||||
|
||||
primes = link {objects = compile ./primes.c; libraries = libATerm;};
|
||||
|
||||
body = [fib primes];
|
||||
body = [
|
||||
(compileTest ./fib.c)
|
||||
(compileTest ./primes.c)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
let {
|
||||
with import ../../lib;
|
||||
|
||||
inherit (import ../../lib) compileC findIncludes link;
|
||||
let {
|
||||
|
||||
hello = link {programName = "hello"; objects = compileC {
|
||||
main = ./foo/hello.c;
|
||||
localIncludes = "auto";
|
||||
};};
|
||||
|
||||
# body = findIncludes {main = ./foo/hello.c;};
|
||||
|
||||
body = [hello];
|
||||
}
|
||||
|
||||
@@ -8,46 +8,55 @@ rec {
|
||||
stdenv = pkgs.stdenv;
|
||||
|
||||
|
||||
compileC = {main, localIncludes ? [], cFlags ? "", forSharedLib ? false}:
|
||||
compileC =
|
||||
{ main
|
||||
, localIncludes ? "auto"
|
||||
, localIncludePath ? []
|
||||
, cFlags ? ""
|
||||
, sharedLib ? false
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "compile-c";
|
||||
builder = ./compile-c.sh;
|
||||
|
||||
localIncludes =
|
||||
if localIncludes == "auto" then
|
||||
import (findIncludes {
|
||||
main = toString main;
|
||||
hack = __currentTime;
|
||||
inherit cFlags;
|
||||
})
|
||||
dependencyClosure {
|
||||
scanner = main:
|
||||
import (findIncludes {
|
||||
inherit main;
|
||||
});
|
||||
searchPath = localIncludePath;
|
||||
startSet = [main];
|
||||
}
|
||||
else
|
||||
localIncludes;
|
||||
|
||||
inherit main;
|
||||
|
||||
cFlags = [
|
||||
cFlags
|
||||
(if forSharedLib then ["-fpic"] else [])
|
||||
(if sharedLib then ["-fpic"] else [])
|
||||
(map (p: "-I" + (relativise (dirOf main) p)) localIncludePath)
|
||||
];
|
||||
};
|
||||
|
||||
/*
|
||||
runCommand = {command}: {
|
||||
name = "run-command";
|
||||
builder = ./run-command.sh;
|
||||
inherit command;
|
||||
};
|
||||
*/
|
||||
|
||||
findIncludes = {main, hack, cFlags ? ""}: stdenv.mkDerivation {
|
||||
name = "find-includes";
|
||||
builder = ./find-includes.sh;
|
||||
inherit main hack cFlags;
|
||||
};
|
||||
|
||||
findIncludes = {main}: stdenv.mkDerivation {
|
||||
name = "find-includes";
|
||||
realBuilder = pkgs.perl ~ "bin/perl";
|
||||
args = [ ./find-includes.pl ];
|
||||
inherit main;
|
||||
};
|
||||
|
||||
|
||||
link = {objects, programName ? "program", libraries ? []}: stdenv.mkDerivation {
|
||||
name = "link";
|
||||
builder = ./link.sh;
|
||||
inherit objects programName libraries;
|
||||
};
|
||||
|
||||
|
||||
makeLibrary = {objects, libraryName ? [], sharedLib ? false}:
|
||||
# assert sharedLib -> fold (obj: x: assert obj.sharedLib && x) false objects
|
||||
stdenv.mkDerivation {
|
||||
@@ -56,4 +65,5 @@ rec {
|
||||
inherit objects libraryName sharedLib;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
21
make/lib/find-includes.pl
Normal file
21
make/lib/find-includes.pl
Normal file
@@ -0,0 +1,21 @@
|
||||
use strict;
|
||||
|
||||
my $root = $ENV{"main"};
|
||||
my $out = $ENV{"out"};
|
||||
|
||||
open OUT, ">$out" or die "$!";
|
||||
print OUT "[\n";
|
||||
|
||||
open IN, "<$root" or die "$!";
|
||||
while (<IN>) {
|
||||
if (/^\#include\s+\"(.*)\"/) {
|
||||
print OUT "\"$1\"\n";
|
||||
}
|
||||
if (/^\#include\s+\<(.*)\>/) {
|
||||
print OUT "\"$1\"\n";
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
|
||||
print OUT "]\n";
|
||||
close OUT;
|
||||
@@ -1,20 +0,0 @@
|
||||
. $stdenv/setup
|
||||
|
||||
echo "finding includes of \`$(basename $main)'..."
|
||||
|
||||
makefile=$NIX_BUILD_TOP/makefile
|
||||
|
||||
mainDir=$(dirname $main)
|
||||
(cd $mainDir && gcc $cFlags -MM $(basename $main) -MF $makefile) || false
|
||||
|
||||
echo "[" >$out
|
||||
|
||||
while read line; do
|
||||
line=$(echo "$line" | sed 's/.*://')
|
||||
for i in $line; do
|
||||
fullPath=$(readlink -f $mainDir/$i)
|
||||
echo " [ $fullPath \"$i\" ]" >>$out
|
||||
done
|
||||
done < $makefile
|
||||
|
||||
echo "]" >>$out
|
||||
@@ -2,4 +2,4 @@ EXTRA_DIST = nix-mode.el
|
||||
|
||||
install-data-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/emacs/site-lisp
|
||||
$(INSTALL_DATA) nix-mode.el $(DESTDIR)$(datadir)/emacs/site-lisp
|
||||
$(INSTALL_DATA) $(srcdir)/nix-mode.el $(DESTDIR)$(datadir)/emacs/site-lisp
|
||||
|
||||
@@ -66,8 +66,8 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
||||
|
||||
|
||||
(defvar nix-keywords
|
||||
'("\\<if\\>" "\\<then\\>" "\\<else\\>" "\\<assert\\>"
|
||||
"\\<let\\>" "\\<rec\\>" "\\<inherit\\>"
|
||||
'("\\<if\\>" "\\<then\\>" "\\<else\\>" "\\<assert\\>" "\\<with\\>"
|
||||
"\\<let\\>" "\\<in\\>" "\\<rec\\>" "\\<inherit\\>"
|
||||
("\\<true\\>" . font-lock-builtin-face)
|
||||
("\\<false\\>" . font-lock-builtin-face)
|
||||
("\\<null\\>" . font-lock-builtin-face)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# build time (e.g., the C compiler, or source tarballs downloaded from
|
||||
# the network). To prevent it from doing so, set this option to
|
||||
# `true'.
|
||||
gc-keep-outputs = false
|
||||
#gc-keep-outputs = false
|
||||
|
||||
|
||||
### Option `gc-keep-derivations'
|
||||
@@ -26,7 +26,26 @@ gc-keep-outputs = false
|
||||
# store path was built), so by default this option is on. Turn it off
|
||||
# to safe a bit of disk space (or a lot if `gc-keep-outputs' is also
|
||||
# turned on).
|
||||
gc-keep-derivations = true
|
||||
#gc-keep-derivations = true
|
||||
|
||||
|
||||
### Option `gc-reserved-space'
|
||||
#
|
||||
# This option specifies how much space should be reserved in normal
|
||||
# use so that the garbage collector can run succesfully. Since the
|
||||
# garbage collector must perform Berkeley DB transactions, it needs
|
||||
# some disk space for itself. However, when the disk is full, this
|
||||
# space is not available, so the collector would not be able to run
|
||||
# precisely when it is most needed.
|
||||
#
|
||||
# For this reason, when Nix is run, it allocates a file
|
||||
# /nix/var/nix/db/reserved of the size specified by this option. When
|
||||
# the garbage collector is run, this file is deleted before the
|
||||
# Berkeley DB environment is opened. This should give it enough room
|
||||
# to proceed.
|
||||
#
|
||||
# The default is "1048576" (1 MiB).
|
||||
#gc-reserved-space = 1048576
|
||||
|
||||
|
||||
### Option `env-keep-derivations'
|
||||
@@ -46,4 +65,65 @@ gc-keep-derivations = true
|
||||
# this one is `sticky': it applies to any user environment created
|
||||
# while this option was enabled, while `gc-keep-derivations' only
|
||||
# applies at the moment the garbage collector is run.
|
||||
env-keep-derivations = false
|
||||
#env-keep-derivations = false
|
||||
|
||||
|
||||
### Option `build-max-jobs'
|
||||
#
|
||||
# This option defines the maximum number of jobs that Nix will try to
|
||||
# build in parallel. The default is 1. You should generally set it
|
||||
# to the number of CPUs in your system (e.g., 2 on a Athlon 64 X2).
|
||||
# It can be overriden using the `--max-jobs' / `-j' command line
|
||||
# switch.
|
||||
#build-max-jobs = 1
|
||||
|
||||
|
||||
### Option `build-allow-root'
|
||||
#
|
||||
# This option controls Nix's behaviour when it is invoked under the
|
||||
# `root' user (or setuid-root). If `true' (default), builds are
|
||||
# performed under the `root' user. If `false', builds are performed
|
||||
# under one of the users listed in the `build-users' option (see
|
||||
# below).
|
||||
#build-allow-root = true
|
||||
|
||||
|
||||
### Option `build-users'
|
||||
#
|
||||
# This option is only applicable if `build-allow-root' is `false' and
|
||||
# Nix is invoked under the `root' user (or setuid-root). It contains
|
||||
# a list of user names under which Nix can execute builds. Builds
|
||||
# cannot be performed by root since that would allow users to take
|
||||
# over the system by supplying specially crafted builders; and they
|
||||
# cannot be performed by the calling user since that would allow
|
||||
# him/her to influence the build result.
|
||||
#
|
||||
# Thus this list should contain a number of `special' user accounts
|
||||
# created specifically for Nix, e.g., `nix-builder-1',
|
||||
# `nix-builder-2', and so on. The more users the better, since at
|
||||
# most a number of builds equal to the number of build users can be
|
||||
# started.
|
||||
#
|
||||
# Example:
|
||||
# build-users = nix-builder-1 nix-builder-2 nix-builder-3
|
||||
#build-users =
|
||||
|
||||
|
||||
### Option `system'
|
||||
#
|
||||
# This option specifies the canonical Nix system name of the current
|
||||
# installation, such as `i686-linux' or `powerpc-darwin'. Nix can
|
||||
# only build derivations whose `system' attribute equals the value
|
||||
# specified here. In general, it never makes sense to modify this
|
||||
# value from its default, since you can use it to `lie' about the
|
||||
# platform you are building on (e.g., perform a Mac OS build on a
|
||||
# Linux machine; the result would obviously be wrong). It only makes
|
||||
# sense if the Nix binaries can run on multiple platforms, e.g.,
|
||||
# `universal binaries' that run on `powerpc-darwin' and `i686-darwin'.
|
||||
#
|
||||
# It defaults to the canonical Nix system name detected by `configure'
|
||||
# at build time.
|
||||
#
|
||||
# Example:
|
||||
# system = i686-darwin
|
||||
#system =
|
||||
|
||||
@@ -19,6 +19,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
%define _prefix /nix
|
||||
Prefix: %{_prefix}
|
||||
Requires: /usr/bin/perl
|
||||
Requires: curl
|
||||
|
||||
# Hack to make that shitty RPM scanning hack shut up.
|
||||
Provides: perl(readmanifest)
|
||||
@@ -48,6 +49,7 @@ make check
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
rm $RPM_BUILD_ROOT/%{_prefix}/etc/nix/nix.conf
|
||||
strip $RPM_BUILD_ROOT/%{_prefix}/bin/* || true
|
||||
|
||||
%clean
|
||||
@@ -66,7 +68,9 @@ fi
|
||||
%files
|
||||
#%defattr(-,root,root)
|
||||
%{_prefix}/bin
|
||||
%{_prefix}/lib
|
||||
%{_prefix}/libexec
|
||||
%{_prefix}/include
|
||||
%{_prefix}/var
|
||||
%{_prefix}/share
|
||||
%{_prefix}/man
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
bin_SCRIPTS = nix-collect-garbage \
|
||||
nix-pull nix-push nix-prefetch-url \
|
||||
nix-install-package nix-channel nix-build
|
||||
nix-install-package nix-channel nix-build \
|
||||
nix-pack-closure nix-unpack-closure
|
||||
|
||||
noinst_SCRIPTS = nix-profile.sh generate-patches.pl
|
||||
noinst_SCRIPTS = nix-profile.sh generate-patches.pl find-runtime-roots.pl
|
||||
|
||||
nix-pull nix-push: readmanifest.pm download-using-manifests.pl
|
||||
nix-pull nix-push: readmanifest.pm readconfig.pm download-using-manifests.pl
|
||||
|
||||
install-exec-local: readmanifest.pm download-using-manifests.pl
|
||||
install-exec-local: readmanifest.pm download-using-manifests.pl find-runtime-roots.pl
|
||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/profile.d
|
||||
$(INSTALL_PROGRAM) nix-profile.sh $(DESTDIR)$(sysconfdir)/profile.d/nix.sh
|
||||
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_DATA) readmanifest.pm $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_DATA) readconfig.pm $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) find-runtime-roots.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
||||
|
||||
include ../substitute.mk
|
||||
@@ -21,6 +24,9 @@ EXTRA_DIST = nix-collect-garbage.in \
|
||||
nix-prefetch-url.in nix-install-package.in \
|
||||
nix-channel.in \
|
||||
readmanifest.pm.in \
|
||||
readconfig.pm.in \
|
||||
nix-build.in \
|
||||
download-using-manifests.pl.in \
|
||||
generate-patches.pl.in
|
||||
generate-patches.pl.in \
|
||||
nix-pack-closure.in nix-unpack-closure.in \
|
||||
find-runtime-roots.pl.in
|
||||
|
||||
@@ -2,19 +2,33 @@
|
||||
|
||||
use strict;
|
||||
use readmanifest;
|
||||
use POSIX qw(strftime);
|
||||
use File::Temp qw(tempdir);
|
||||
|
||||
my $manifestDir = "@localstatedir@/nix/manifests";
|
||||
my $logFile = "@localstatedir@/log/nix/downloads";
|
||||
|
||||
open LOGFILE, ">>$logFile" or die "cannot open log file $logFile";
|
||||
|
||||
delete $ENV{"NIX_ROOT"};
|
||||
|
||||
# Create a temporary directory.
|
||||
my $tmpDir = tempdir("nix-download.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
chdir $tmpDir or die "cannot change to `$tmpDir': $!";
|
||||
|
||||
my $tmpNar = "$tmpDir/nar";
|
||||
my $tmpNar2 = "$tmpDir/nar2";
|
||||
|
||||
END { unlink $tmpNar; unlink $tmpNar2; rmdir $tmpDir; }
|
||||
|
||||
|
||||
# Check the arguments.
|
||||
die unless scalar @ARGV == 1;
|
||||
my $targetPath = $ARGV[0];
|
||||
|
||||
my $date = `date` or die;
|
||||
chomp $date;
|
||||
my $date = strftime ("%F %H:%M:%S UTC", gmtime (time));
|
||||
print LOGFILE "$$ get $targetPath $date\n";
|
||||
|
||||
print "\n*** Trying to download/patch `$targetPath'\n";
|
||||
@@ -76,8 +90,7 @@ addToQueue $targetPath;
|
||||
|
||||
sub isValidPath {
|
||||
my $p = shift;
|
||||
system "@bindir@/nix-store --check-validity '$p' 2> /dev/null";
|
||||
return $? == 0;
|
||||
return system("@bindir@/nix-store --check-validity '$p' 2> /dev/null") == 0;
|
||||
}
|
||||
|
||||
sub parseHash {
|
||||
@@ -217,8 +230,8 @@ while (scalar @path > 0) {
|
||||
# as a base to one or more patches. So turn the base path
|
||||
# into a NAR archive, to which we can apply the patch.
|
||||
print " packing base path...\n";
|
||||
system "@bindir@/nix-store --dump $v > /tmp/nar";
|
||||
die "cannot dump `$v'" if ($? != 0);
|
||||
system("@bindir@/nix-store --dump $v > $tmpNar") == 0
|
||||
or die "cannot dump `$v'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,18 +248,18 @@ while (scalar @path > 0) {
|
||||
# Apply the patch to the NAR archive produced in step 1 (for
|
||||
# the already present path) or a later step (for patch sequences).
|
||||
print " applying patch...\n";
|
||||
system "@libexecdir@/bspatch /tmp/nar /tmp/nar2 $patchPath";
|
||||
die "cannot apply patch `$patchPath' to /tmp/nar" if ($? != 0);
|
||||
system("@libexecdir@/bspatch $tmpNar $tmpNar2 $patchPath") == 0
|
||||
or die "cannot apply patch `$patchPath' to $tmpNar";
|
||||
|
||||
if ($curStep < $maxStep) {
|
||||
# The archive will be used as the base of the next patch.
|
||||
rename "/tmp/nar2", "/tmp/nar" or die "cannot rename NAR archive: $!";
|
||||
rename "$tmpNar2", "$tmpNar" or die "cannot rename NAR archive: $!";
|
||||
} else {
|
||||
# This was the last patch. Unpack the final NAR archive
|
||||
# into the target path.
|
||||
print " unpacking patched archive...\n";
|
||||
system "@bindir@/nix-store --restore $v < /tmp/nar2";
|
||||
die "cannot unpack /tmp/nar2 into `$v'" if ($? != 0);
|
||||
system("@bindir@/nix-store --restore $v < $tmpNar2") == 0
|
||||
or die "cannot unpack $tmpNar2 into `$v'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,12 +275,13 @@ while (scalar @path > 0) {
|
||||
|
||||
if ($curStep < $maxStep) {
|
||||
# The archive will be used a base to a patch.
|
||||
system "@bunzip2@ < '$narFilePath' > /tmp/nar";
|
||||
system("@bunzip2@ < '$narFilePath' > $tmpNar") == 0
|
||||
or die "cannot unpack `$narFilePath' into `$v'";
|
||||
} else {
|
||||
# Unpack the archive into the target path.
|
||||
print " unpacking archive...\n";
|
||||
system "@bunzip2@ < '$narFilePath' | @bindir@/nix-store --restore '$v'";
|
||||
die "cannot unpack `$narFilePath' into `$v'" if ($? != 0);
|
||||
system("@bunzip2@ < '$narFilePath' | @bindir@/nix-store --restore '$v'") == 0
|
||||
or die "cannot unpack `$narFilePath' into `$v'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
58
scripts/find-runtime-roots.pl.in
Normal file
58
scripts/find-runtime-roots.pl.in
Normal file
@@ -0,0 +1,58 @@
|
||||
#! @perl@ -w
|
||||
|
||||
use strict;
|
||||
|
||||
my $procDir = "/proc";
|
||||
|
||||
|
||||
sub readProc {
|
||||
return unless -d $procDir;
|
||||
|
||||
opendir DIR, $procDir or return;
|
||||
|
||||
foreach my $name (readdir DIR) {
|
||||
next unless $name =~ /^\d+$/;
|
||||
|
||||
my $process = "$procDir/$name";
|
||||
|
||||
#print STDERR "=== $process\n";
|
||||
|
||||
my $target;
|
||||
print "$target\n" if $target = readlink "$process/exe";
|
||||
print "$target\n" if $target = readlink "$process/cwd";
|
||||
|
||||
if (opendir FDS, "$process/fd") {
|
||||
foreach my $name (readdir FDS) {
|
||||
$target = readlink "$process/fd/$name";
|
||||
print "$target\n" if $target && substr($target, 0, 1) eq "/";
|
||||
}
|
||||
closedir FDS;
|
||||
}
|
||||
|
||||
if (open MAP, "<$process/maps") {
|
||||
while (<MAP>) {
|
||||
next unless /^ \s* \S+ \s+ \S+ \s+ \S+ \s+ \S+ \s+ \S+ \s+ (\/\S+) \s* $/x;
|
||||
print "$1\n";
|
||||
}
|
||||
close MAP;
|
||||
}
|
||||
}
|
||||
|
||||
closedir DIR;
|
||||
}
|
||||
|
||||
|
||||
sub lsof {
|
||||
return unless open LSOF, "lsof -n -w -F n 2> /dev/null |";
|
||||
|
||||
while (<LSOF>) {
|
||||
next unless /^n (\/ .*)$/x;
|
||||
print $1, "\n";
|
||||
}
|
||||
|
||||
close LSOF;
|
||||
}
|
||||
|
||||
|
||||
readProc;
|
||||
lsof;
|
||||
@@ -1,7 +1,7 @@
|
||||
#! @perl@ -w -I@libexecdir@/nix
|
||||
|
||||
use strict;
|
||||
use POSIX qw(tmpnam);
|
||||
use File::Temp qw(tempdir);
|
||||
use readmanifest;
|
||||
|
||||
die unless scalar @ARGV == 5;
|
||||
@@ -14,13 +14,12 @@ my $patchesURL = $ARGV[2];
|
||||
my $srcDir = $ARGV[3];
|
||||
my $dstDir = $ARGV[4];
|
||||
|
||||
my $tmpdir;
|
||||
do { $tmpdir = tmpnam(); }
|
||||
until mkdir $tmpdir, 0777;
|
||||
my $tmpDir = tempdir("nix-generate-patches.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
print "TEMP = $tmpdir\n";
|
||||
print "TEMP = $tmpDir\n";
|
||||
|
||||
#END { rmdir $tmpdir; }
|
||||
#END { rmdir $tmpDir; }
|
||||
|
||||
my %srcNarFiles;
|
||||
my %srcPatches;
|
||||
@@ -140,19 +139,19 @@ sub computeUses {
|
||||
|
||||
# print " DERIVER $deriver\n";
|
||||
|
||||
# Optimisation: build the referers graph from the references
|
||||
# Optimisation: build the referrers graph from the references
|
||||
# graph.
|
||||
my %referers;
|
||||
my %referrers;
|
||||
foreach my $q (keys %{$narFiles}) {
|
||||
my @refs = split " ", @{$$narFiles{$q}}[0]->{references};
|
||||
foreach my $r (@refs) {
|
||||
$referers{$r} = [] unless defined $referers{$r};
|
||||
push @{$referers{$r}}, $q;
|
||||
$referrers{$r} = [] unless defined $referrers{$r};
|
||||
push @{$referrers{$r}}, $q;
|
||||
}
|
||||
}
|
||||
|
||||
# Determine the shortest path from $deriver to all other reachable
|
||||
# paths in the `referers' graph.
|
||||
# paths in the `referrers' graph.
|
||||
|
||||
my %dist;
|
||||
$dist{$deriver} = 0;
|
||||
@@ -164,7 +163,7 @@ sub computeUses {
|
||||
my $p = $queue[$pos];
|
||||
$pos++;
|
||||
|
||||
foreach my $q (@{$referers{$p}}) {
|
||||
foreach my $q (@{$referrers{$p}}) {
|
||||
if (!defined $dist{$q}) {
|
||||
$dist{$q} = $dist{$p} + 1;
|
||||
# print " $q $dist{$q}\n";
|
||||
@@ -277,26 +276,38 @@ foreach my $p (keys %dstOutPaths) {
|
||||
|
||||
my $srcNarBz2 = getNarBz2 \%srcNarFiles, $closest;
|
||||
my $dstNarBz2 = getNarBz2 \%dstNarFiles, $p;
|
||||
|
||||
system("@bunzip2@ < $srcNarBz2 > $tmpdir/A") == 0
|
||||
|
||||
my $maxNarSize = 150 * 1024 * 1024;
|
||||
|
||||
system("@bunzip2@ < $srcNarBz2 > $tmpDir/A") == 0
|
||||
or die "cannot unpack $srcNarBz2";
|
||||
|
||||
system("@bunzip2@ < $dstNarBz2 > $tmpdir/B") == 0
|
||||
if ((stat "$tmpDir/A")[7] >= $maxNarSize) {
|
||||
print " skipping, source is too large\n";
|
||||
next;
|
||||
}
|
||||
|
||||
system("@bunzip2@ < $dstNarBz2 > $tmpDir/B") == 0
|
||||
or die "cannot unpack $dstNarBz2";
|
||||
|
||||
system("@libexecdir@/bsdiff $tmpdir/A $tmpdir/B $tmpdir/DIFF") == 0
|
||||
if ((stat "$tmpDir/B")[7] >= $maxNarSize) {
|
||||
print " skipping, destination is too large\n";
|
||||
next;
|
||||
}
|
||||
|
||||
system("@libexecdir@/bsdiff $tmpDir/A $tmpDir/B $tmpDir/DIFF") == 0
|
||||
or die "cannot compute binary diff";
|
||||
|
||||
my $baseHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpdir/A` or die;
|
||||
my $baseHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpDir/A` or die;
|
||||
chomp $baseHash;
|
||||
|
||||
my $narHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpdir/B` or die;
|
||||
my $narHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpDir/B` or die;
|
||||
chomp $narHash;
|
||||
|
||||
my $narDiffHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpdir/DIFF` or die;
|
||||
my $narDiffHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpDir/DIFF` or die;
|
||||
chomp $narDiffHash;
|
||||
|
||||
my $narDiffSize = (stat "$tmpdir/DIFF")[7];
|
||||
my $narDiffSize = (stat "$tmpDir/DIFF")[7];
|
||||
my $dstNarBz2Size = (stat $dstNarBz2)[7];
|
||||
|
||||
if ($narDiffSize >= $dstNarBz2Size) {
|
||||
@@ -315,7 +326,7 @@ foreach my $p (keys %dstOutPaths) {
|
||||
|
||||
else {
|
||||
|
||||
system("cp '$tmpdir/DIFF' '$patchesDir/$finalName.tmp'") == 0
|
||||
system("cp '$tmpDir/DIFF' '$patchesDir/$finalName.tmp'") == 0
|
||||
or die "cannot copy diff";
|
||||
|
||||
rename("$patchesDir/$finalName.tmp", "$patchesDir/$finalName")
|
||||
|
||||
2
scripts/maintenance/gc-commands
Normal file
2
scripts/maintenance/gc-commands
Normal file
@@ -0,0 +1,2 @@
|
||||
./gc-releases.pl /data/webserver/dist/*/*/MANIFEST > dead
|
||||
cat dead | xargs mv --target-directory=/data/webserver/trash/
|
||||
@@ -1,28 +1,8 @@
|
||||
#! /usr/bin/perl -w
|
||||
#! /usr/bin/perl -w -I. -I..
|
||||
|
||||
use strict;
|
||||
use readmanifest;
|
||||
|
||||
|
||||
# Read the archive directories.
|
||||
my @archives = ();
|
||||
my %archives;
|
||||
|
||||
sub readDir {
|
||||
my $dir = shift;
|
||||
opendir(DIR, "$dir") or die "cannot open `$dir': $!";
|
||||
my @as = readdir DIR;
|
||||
foreach my $archive (@as) {
|
||||
push @archives, $archive;
|
||||
$archives{$archive} = "$dir/$archive";
|
||||
}
|
||||
closedir DIR;
|
||||
}
|
||||
|
||||
readDir "/mnt/scratchy/eelco/public_html/nix-cache";
|
||||
readDir "/mnt/scratchy/eelco/public_html/patches";
|
||||
|
||||
print STDERR scalar @archives, "\n";
|
||||
use readcache;
|
||||
|
||||
|
||||
# Read the manifests.
|
||||
@@ -48,8 +28,8 @@ foreach my $narFile (keys %narFiles) {
|
||||
die unless defined $basename;
|
||||
# print $basename, "\n";
|
||||
$usedFiles{$basename} = 1;
|
||||
die "missing archive `$basename'"
|
||||
unless defined $archives{$basename};
|
||||
print STDERR "missing archive `$basename'\n"
|
||||
unless defined $readcache::archives{$basename};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,15 +41,15 @@ foreach my $patch (keys %patches) {
|
||||
# print $basename, "\n";
|
||||
$usedFiles{$basename} = 1;
|
||||
die "missing archive `$basename'"
|
||||
unless defined $archives{$basename};
|
||||
unless defined $readcache::archives{$basename};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Print out the dead archives.
|
||||
foreach my $archive (@archives) {
|
||||
foreach my $archive (keys %readcache::archives) {
|
||||
next if $archive eq "." || $archive eq "..";
|
||||
if (!defined $usedFiles{$archive}) {
|
||||
print $archives{$archive}, "\n";
|
||||
print $readcache::archives{$archive}, "\n";
|
||||
}
|
||||
}
|
||||
21
scripts/maintenance/readcache.pm
Normal file
21
scripts/maintenance/readcache.pm
Normal file
@@ -0,0 +1,21 @@
|
||||
package readcache;
|
||||
use strict;
|
||||
|
||||
# Read the archive directories.
|
||||
our %archives;
|
||||
|
||||
sub readDir {
|
||||
my $dir = shift;
|
||||
opendir(DIR, "$dir") or die "cannot open `$dir': $!";
|
||||
my @as = readdir DIR;
|
||||
foreach my $archive (@as) {
|
||||
$archives{$archive} = "$dir/$archive";
|
||||
}
|
||||
closedir DIR;
|
||||
}
|
||||
|
||||
readDir "/data/webserver/dist/nix-cache";
|
||||
readDir "/data/webserver/dist/test";
|
||||
readDir "/data/webserver/dist/patches";
|
||||
|
||||
print STDERR scalar (keys %archives), "\n";
|
||||
77
scripts/maintenance/shrink-manifest.pl
Executable file
77
scripts/maintenance/shrink-manifest.pl
Executable file
@@ -0,0 +1,77 @@
|
||||
#! /usr/bin/perl -w -I. -I..
|
||||
|
||||
use strict;
|
||||
use readmanifest;
|
||||
use readcache;
|
||||
|
||||
|
||||
my %allNarFiles;
|
||||
my %allPatches;
|
||||
my %allSuccessors;
|
||||
|
||||
foreach my $manifest (glob "/data/webserver/dist/*/*/MANIFEST") {
|
||||
print STDERR "loading $manifest\n";
|
||||
readManifest($manifest, \%allNarFiles, \%allPatches, \%allSuccessors, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach my $manifest (@ARGV) {
|
||||
|
||||
print STDERR "shrinking manifest $manifest...\n";
|
||||
|
||||
my %narFiles;
|
||||
my %patches;
|
||||
my %successors;
|
||||
|
||||
if (readManifest($manifest, \%narFiles, \%patches, \%successors, 1) < 3) {
|
||||
print STDERR "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my %done;
|
||||
|
||||
sub traverse {
|
||||
my $p = shift;
|
||||
my $prefix = shift;
|
||||
print "$prefix$p\n";
|
||||
|
||||
my $reachesNAR = 0;
|
||||
|
||||
foreach my $patch (@{$patches{$p}}) {
|
||||
next if defined $done{$patch->{url}};
|
||||
$done{$patch->{url}} = 1;
|
||||
$reachesNAR = 1 if traverse ($patch->{basePath}, $prefix . " ");
|
||||
}
|
||||
|
||||
$reachesNAR = 1 if defined $allNarFiles{$p};
|
||||
|
||||
print " $prefix$reachesNAR\n";
|
||||
return $reachesNAR;
|
||||
}
|
||||
|
||||
# foreach my $p (keys %narFiles) {
|
||||
# traverse ($p, "");
|
||||
# }
|
||||
|
||||
my %newPatches;
|
||||
|
||||
foreach my $p (keys %patches) {
|
||||
my $patchList = $patches{$p};
|
||||
my @newList;
|
||||
foreach my $patch (@{$patchList}) {
|
||||
if (! defined $allNarFiles{$patch->{basePath}} ||
|
||||
! defined $allNarFiles{$p} )
|
||||
{
|
||||
# print "REMOVING PATCH ", $patch->{basePath}, " -> ", $p, "\n";
|
||||
} else {
|
||||
# print "KEEPING PATCH ", $patch->{basePath}, " -> ", $p, "\n";
|
||||
push @newList, $patch;
|
||||
}
|
||||
}
|
||||
$newPatches{$p} = \@newList;
|
||||
}
|
||||
|
||||
writeManifest ($manifest, \%narFiles, \%newPatches);
|
||||
}
|
||||
|
||||
@@ -1,59 +1,132 @@
|
||||
#! @shell@ -e
|
||||
#! @perl@ -w -I@libexecdir@/nix
|
||||
|
||||
nixExpr=$1
|
||||
|
||||
if test -z "$nixExpr"; then
|
||||
echo "syntax: $0 NIX-EXPR..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extraArgs=
|
||||
addDrvLink=0
|
||||
addOutLink=1
|
||||
use strict;
|
||||
|
||||
|
||||
trap 'rm -f ./.nix-build-tmp-*' EXIT
|
||||
my $addDrvLink = 0;
|
||||
my $addOutLink = 1;
|
||||
|
||||
my $outLink;
|
||||
my $drvLink;
|
||||
|
||||
my @instArgs = ();
|
||||
my @buildArgs = ();
|
||||
my @exprs = ();
|
||||
|
||||
|
||||
# Process the arguments.
|
||||
for i in "$@"; do
|
||||
case "$i" in
|
||||
END {
|
||||
foreach my $fn (glob ".nix-build-tmp-*") {
|
||||
unlink $fn;
|
||||
}
|
||||
}
|
||||
|
||||
sub intHandler {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$SIG{'INT'} = 'intHandler';
|
||||
|
||||
|
||||
for (my $n = 0; $n < scalar @ARGV; $n++) {
|
||||
my $arg = $ARGV[$n];
|
||||
|
||||
if ($arg eq "--help") {
|
||||
print STDERR <<EOF;
|
||||
Usage: nix-build [OPTION]... [FILE]...
|
||||
|
||||
`nix-build' builds the given Nix expressions (which
|
||||
default to ./default.nix if none are given). A symlink called
|
||||
`result' is placed in the current directory.
|
||||
|
||||
Flags:
|
||||
--add-drv-link: create a symlink `derivation' to the store derivation
|
||||
--drv-link NAME: create symlink NAME instead of `derivation'
|
||||
--no-out-link: do not create the `result' symlink
|
||||
--out-link / -o NAME: create symlink NAME instead of `result'
|
||||
--attr ATTR: select a specific attribution from the Nix expression
|
||||
|
||||
Any additional flags are passed to `nix-store'.
|
||||
EOF
|
||||
exit 0;
|
||||
# '` hack
|
||||
}
|
||||
|
||||
elsif ($arg eq "--add-drv-link") {
|
||||
$addDrvLink = 1;
|
||||
}
|
||||
|
||||
elsif ($arg eq "--no-out-link" or $arg eq "--no-link") {
|
||||
$addOutLink = 1;
|
||||
}
|
||||
|
||||
elsif ($arg eq "--drv-link") {
|
||||
$n++;
|
||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
||||
$drvLink = $ARGV[$n];
|
||||
}
|
||||
|
||||
elsif ($arg eq "--out-link" or $arg eq "-o") {
|
||||
$n++;
|
||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
||||
$outLink = $ARGV[$n];
|
||||
}
|
||||
|
||||
elsif ($arg eq "--attr" or $arg eq "-A") {
|
||||
$n++;
|
||||
die "$0: `--attr' requires an argument\n" unless $n < scalar @ARGV;
|
||||
push @instArgs, ("--attr", $ARGV[$n]);
|
||||
}
|
||||
|
||||
elsif ($arg eq "--arg") {
|
||||
die "$0: `--arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
|
||||
push @instArgs, ("--arg", $ARGV[$n + 1], $ARGV[$n + 2]);
|
||||
$n += 2;
|
||||
}
|
||||
|
||||
elsif (substr($arg, 0, 1) eq "-") {
|
||||
push @buildArgs, $arg;
|
||||
}
|
||||
|
||||
else {
|
||||
push @exprs, $arg;
|
||||
}
|
||||
}
|
||||
|
||||
@exprs = ("./default.nix") if scalar @exprs == 0;
|
||||
|
||||
|
||||
if (!defined $drvLink) {
|
||||
$drvLink = "derivation";
|
||||
$drvLink = ".nix-build-tmp-" . $drvLink if !$addDrvLink;
|
||||
}
|
||||
|
||||
if (!defined $outLink) {
|
||||
$outLink = "result";
|
||||
$outLink = ".nix-build-tmp-" . $outLink if !$addOutLink;
|
||||
}
|
||||
|
||||
|
||||
foreach my $expr (@exprs) {
|
||||
|
||||
# Instantiate.
|
||||
my @drvPaths;
|
||||
# !!! would prefer the perl 5.8.0 pipe open feature here.
|
||||
my $pid = open(DRVPATHS, "-|") || exec "@bindir@/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
|
||||
while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
|
||||
close DRVPATHS or exit 1;
|
||||
|
||||
foreach my $drvPath (@drvPaths) {
|
||||
my $target = readlink $drvPath;
|
||||
print STDERR "store derivation is $target\n";
|
||||
}
|
||||
|
||||
# Build.
|
||||
my $outPaths = `@bindir@/nix-store --add-root "$outLink" --indirect -rv @buildArgs @drvPaths`;
|
||||
my @outPaths = split ' ', $outPaths;
|
||||
|
||||
--add-drv-link)
|
||||
addDrvLink=1
|
||||
;;
|
||||
|
||||
--no-link)
|
||||
addOutLink=0
|
||||
;;
|
||||
|
||||
-*)
|
||||
extraArgs="$extraArgs $i"
|
||||
;;
|
||||
|
||||
*)
|
||||
# Instantiate the Nix expression.
|
||||
prefix=
|
||||
if test "$addDrvLink" = 0; then prefix=.nix-build-tmp-; fi
|
||||
storeExprs=$(@bindir@/nix-instantiate \
|
||||
--add-root ./${prefix}derivation --indirect \
|
||||
"$i")
|
||||
|
||||
for j in $storeExprs; do
|
||||
echo "store expression is $(readlink "$j")" >&2
|
||||
done
|
||||
foreach my $outPath (@outPaths) {
|
||||
my $target = readlink $outPath;
|
||||
print "$target\n";
|
||||
}
|
||||
|
||||
# Build the resulting store derivation.
|
||||
prefix=
|
||||
if test "$addOutLink" = 0; then prefix=.nix-build-tmp-; fi
|
||||
outPaths=$(@bindir@/nix-store \
|
||||
--add-root ./${prefix}result --indirect \
|
||||
-rv $extraArgs $storeExprs)
|
||||
|
||||
for j in $outPaths; do
|
||||
echo "$(readlink "$j")"
|
||||
done
|
||||
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ use strict;
|
||||
|
||||
my $rootsDir = "@localstatedir@/nix/gcroots/channels";
|
||||
|
||||
my $stateDir = $ENV{"NIX_STATE_DIR"};
|
||||
$stateDir = "@localstatedir@/nix" unless defined $stateDir;
|
||||
|
||||
|
||||
# Figure out the name of the `.nix-channels' file to use.
|
||||
my $home = $ENV{"HOME"};
|
||||
@@ -20,6 +23,7 @@ sub readChannels {
|
||||
open CHANNELS, "<$channelsList" or die "cannot open `$channelsList': $!";
|
||||
while (<CHANNELS>) {
|
||||
chomp;
|
||||
next if /^\s*\#/;
|
||||
push @channels, $_;
|
||||
}
|
||||
close CHANNELS;
|
||||
@@ -67,14 +71,19 @@ sub update {
|
||||
readChannels;
|
||||
|
||||
# Get rid of all the old substitutes.
|
||||
system "@bindir@/nix-store --clear-substitutes";
|
||||
die "cannot clear substitutes" if ($? != 0);
|
||||
system("@bindir@/nix-store", "--clear-substitutes") == 0
|
||||
or die "cannot clear substitutes";
|
||||
|
||||
# Remove all the old manifests.
|
||||
for my $manifest (glob "$stateDir/manifests/*.nixmanifest") {
|
||||
unlink $manifest or die "cannot remove `$manifest': $!";
|
||||
}
|
||||
|
||||
# Pull cache manifests.
|
||||
foreach my $url (@channels) {
|
||||
print "pulling cache manifest from `$url'\n";
|
||||
system "@bindir@/nix-pull '$url'/MANIFEST";
|
||||
die "cannot pull cache manifest from `$url'" if ($? != 0);
|
||||
system("@bindir@/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
|
||||
or die "cannot pull cache manifest from `$url'";
|
||||
}
|
||||
|
||||
# Create a Nix expression that fetches and unpacks the channel Nix
|
||||
@@ -107,15 +116,15 @@ sub update {
|
||||
chomp $storeExpr;
|
||||
|
||||
# Build the resulting derivation.
|
||||
my $outPath = `nix-store --add-root '$rootFile' -r '$storeExpr'`
|
||||
my $outPath = `@bindir@/nix-store --add-root '$rootFile' -r '$storeExpr'`
|
||||
or die "cannot realise store expression";
|
||||
chomp $outPath;
|
||||
|
||||
unlink "$rootFile.tmp";
|
||||
|
||||
# Make it the default Nix expression for `nix-env'.
|
||||
system "@bindir@/nix-env --import '$outPath'";
|
||||
die "cannot pull set default Nix expression to `$outPath'" if ($? != 0);
|
||||
system("@bindir@/nix-env", "--import", "$outPath") == 0
|
||||
or die "cannot pull set default Nix expression to `$outPath'";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,42 @@
|
||||
#! @shell@ -e
|
||||
exec @bindir@/nix-store --gc "$@"
|
||||
#! @perl@ -w
|
||||
|
||||
use strict;
|
||||
|
||||
my $profilesDir = "@localstatedir@/nix/profiles";
|
||||
|
||||
|
||||
# Process the command line arguments.
|
||||
my @args = ();
|
||||
my $removeOld = 0;
|
||||
|
||||
for my $arg (@ARGV) {
|
||||
if ($arg eq "--delete-old" || $arg eq "-d") {
|
||||
$removeOld = 1;
|
||||
} else {
|
||||
push @args, $arg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# If `-d' was specified, remove all old generations of all profiles.
|
||||
# Of course, this makes rollbacks to before this point in time
|
||||
# impossible.
|
||||
if ($removeOld) {
|
||||
|
||||
opendir DIR, $profilesDir or die;
|
||||
|
||||
foreach my $name (sort (readdir DIR)) {
|
||||
$name = $profilesDir . "/" . $name;
|
||||
if (-l $name && (readlink($name) =~ /link/)) {
|
||||
print STDERR "removing old generations of profile $name\n";
|
||||
system("@bindir@/nix-env", "-p", $name, "--delete-generations", "old");
|
||||
}
|
||||
}
|
||||
|
||||
closedir DIR or die;
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Run the actual garbage collector.
|
||||
exec "@bindir@/nix-store", "--gc", @args;
|
||||
|
||||
@@ -1,28 +1,107 @@
|
||||
#! @perl@ -w
|
||||
|
||||
use strict;
|
||||
use POSIX qw(tmpnam);
|
||||
use File::Temp qw(tempdir);
|
||||
|
||||
my $pkgFile = $ARGV[0];
|
||||
die unless defined $pkgFile;
|
||||
|
||||
sub usageError {
|
||||
print STDERR <<EOF;
|
||||
Usage: nix-install-package (FILE | --url URL)
|
||||
|
||||
Install a Nix Package (.nixpkg) either directly from FILE or by
|
||||
downloading it from URL.
|
||||
|
||||
Flags:
|
||||
--profile / -p LINK: install into the specified profile
|
||||
--non-interactive: don't run inside a new terminal XXX
|
||||
EOF
|
||||
; # '
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
# Parse the command line arguments.
|
||||
my @args = @ARGV;
|
||||
usageError if scalar @args == 0;
|
||||
|
||||
my $source;
|
||||
my $fromURL = 0;
|
||||
my @extraNixEnvArgs = ();
|
||||
my $interactive = 1;
|
||||
|
||||
while (scalar @args) {
|
||||
my $arg = shift @args;
|
||||
if ($arg eq "--help") {
|
||||
usageError;
|
||||
}
|
||||
elsif ($arg eq "--url") {
|
||||
$fromURL = 1;
|
||||
}
|
||||
elsif ($arg eq "--profile" || $arg eq "-p") {
|
||||
my $profile = shift @args;
|
||||
usageError if !defined $profile;
|
||||
push @extraNixEnvArgs, "-p", $profile;
|
||||
}
|
||||
elsif ($arg eq "--non-interactive") {
|
||||
$interactive = 0;
|
||||
}
|
||||
else {
|
||||
$source = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
usageError unless defined $source;
|
||||
|
||||
|
||||
# Re-execute in a terminal, if necessary, so that if we're executed
|
||||
# from a web browser, the user gets to see us.
|
||||
if (!defined $ENV{"NIX_HAVE_TERMINAL"}) {
|
||||
if ($interactive && !defined $ENV{"NIX_HAVE_TERMINAL"}) {
|
||||
$ENV{"NIX_HAVE_TERMINAL"} = "1";
|
||||
$ENV{"LD_LIBRARY_PATH"} = "";
|
||||
exec("xterm", "-e", "@shell@", "-c", "@bindir@/nix-install-package '$pkgFile' || read");
|
||||
foreach my $term ("xterm", "konsole", "gnome-terminal", "xterm") {
|
||||
exec($term, "-e", "@bindir@/nix-install-package", @ARGV);
|
||||
}
|
||||
die "cannot execute `xterm'";
|
||||
}
|
||||
|
||||
|
||||
my $tmpDir = tempdir("nix-install-package.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
|
||||
sub barf {
|
||||
my $msg = shift;
|
||||
print "$msg\n";
|
||||
<STDIN> if $interactive;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
# Download the package description, if necessary.
|
||||
my $pkgFile = $source;
|
||||
if ($fromURL) {
|
||||
$pkgFile = "$tmpDir/tmp.nixpkg";
|
||||
system("@curl@", "--silent", $source, "-o", $pkgFile) == 0
|
||||
or barf "curl failed: $?";
|
||||
}
|
||||
|
||||
|
||||
# Read and parse the package file.
|
||||
open PKGFILE, "<$pkgFile" or die "cannot open `$pkgFile': $!";
|
||||
open PKGFILE, "<$pkgFile" or barf "cannot open `$pkgFile': $!";
|
||||
my $contents = <PKGFILE>;
|
||||
close PKGFILE;
|
||||
|
||||
$contents =~ /^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/ or die "invalid package contents";
|
||||
my $urlRE = "(?: [a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+ )";
|
||||
my $nameRE = "(?: [A-Za-z0-9\+\-\.\_\?\=]+ )"; # see checkStoreName()
|
||||
my $systemRE = "(?: [A-Za-z0-9\+\-\_]+ )";
|
||||
my $pathRE = "(?: \/ [\/A-Za-z0-9\+\-\.\_\?\=]* )";
|
||||
|
||||
# Note: $pathRE doesn't check that whether we're looking at a valid
|
||||
# store path. We'll let nix-env do that.
|
||||
|
||||
$contents =~
|
||||
/ ^ \s* (\S+) \s+ ($urlRE) \s+ ($nameRE) \s+ ($systemRE) \s+ ($pathRE) \s+ ($pathRE) /x
|
||||
or barf "invalid package contents";
|
||||
my $version = $1;
|
||||
my $manifestURL = $2;
|
||||
my $drvName = $3;
|
||||
@@ -30,22 +109,29 @@ my $system = $4;
|
||||
my $drvPath = $5;
|
||||
my $outPath = $6;
|
||||
|
||||
die "invalid package version `$version'" unless $version eq "NIXPKG1";
|
||||
barf "invalid package version `$version'" unless $version eq "NIXPKG1";
|
||||
|
||||
|
||||
# Ask confirmation.
|
||||
print "Do you want to install `$drvName' (Y/N)? ";
|
||||
my $reply = <STDIN>;
|
||||
chomp $reply;
|
||||
exit if $reply ne "y" && $reply ne "Y";
|
||||
if ($interactive) {
|
||||
# Ask confirmation.
|
||||
print "Do you want to install `$drvName' (Y/N)? ";
|
||||
my $reply = <STDIN>;
|
||||
chomp $reply;
|
||||
exit if $reply ne "y" && $reply ne "Y";
|
||||
}
|
||||
|
||||
|
||||
print "\nPulling manifests...\n";
|
||||
system "@bindir@/nix-pull '$manifestURL'";
|
||||
die if $? != 0;
|
||||
system("@bindir@/nix-pull", $manifestURL) == 0
|
||||
or barf "nix-pull failed: $?";
|
||||
|
||||
|
||||
print "\nInstalling package...\n";
|
||||
system "@bindir@/nix-env -i '$outPath'";
|
||||
die if $? != 0;
|
||||
system("@bindir@/nix-env", "--install", $outPath, "--force-name", $drvName, @extraNixEnvArgs) == 0
|
||||
or barf "nix-env failed: $?";
|
||||
|
||||
print "\nInstallation succeeded! Press Enter to continue.\n";
|
||||
<STDIN>;
|
||||
|
||||
if ($interactive) {
|
||||
print "\nInstallation succeeded! Press Enter to continue.\n";
|
||||
<STDIN>;
|
||||
}
|
||||
|
||||
65
scripts/nix-pack-closure.in
Normal file
65
scripts/nix-pack-closure.in
Normal file
@@ -0,0 +1,65 @@
|
||||
#! @perl@ -w
|
||||
|
||||
# This tool computes the closure of a path (using "nix-store --query
|
||||
# --requisites") and puts the contents of each path in the closure in
|
||||
# a big NAR archive that can be installed on another Nix installation
|
||||
# using "nix-unpack-closure".
|
||||
|
||||
# TODO: make this program "streamy", i.e., don't use a temporary
|
||||
# directory.
|
||||
|
||||
use strict;
|
||||
use File::Temp qw(tempdir);
|
||||
|
||||
my $binDir = $ENV{"NIX_BIN_DIR"};
|
||||
$binDir = "@bindir@" unless defined $binDir;
|
||||
|
||||
my $tmpDir = tempdir("nix-pack-closure.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
mkdir "$tmpDir/contents", 0777 or die;
|
||||
mkdir "$tmpDir/references", 0777 or die;
|
||||
mkdir "$tmpDir/derivers", 0777 or die;
|
||||
|
||||
|
||||
|
||||
my %storePaths;
|
||||
|
||||
|
||||
while (@ARGV) {
|
||||
my $storePath = shift @ARGV;
|
||||
|
||||
# Get the closure of this path.
|
||||
my $pid = open(READ,
|
||||
"$binDir/nix-store --query --requisites '$storePath'|") or die;
|
||||
|
||||
while (<READ>) {
|
||||
chomp;
|
||||
die "bad: $_" unless /^\//;
|
||||
$storePaths{$_} = "";
|
||||
}
|
||||
|
||||
close READ or die "nix-store failed: $?";
|
||||
}
|
||||
|
||||
|
||||
foreach my $storePath (sort(keys %storePaths)) {
|
||||
print STDERR "packing `$storePath'...\n";
|
||||
|
||||
$storePath =~ /\/([^\/]+)$/;
|
||||
my $name = $1;
|
||||
|
||||
system("$binDir/nix-store --dump '$storePath' > $tmpDir/contents/$name") == 0
|
||||
or die "nix-store --dump failed on `$storePath': $?";
|
||||
|
||||
system("$binDir/nix-store --query --references '$storePath' > $tmpDir/references/$name") == 0
|
||||
or die "nix-store --query --references failed on `$storePath': $?";
|
||||
|
||||
system("$binDir/nix-store --query --deriver '$storePath' > $tmpDir/derivers/$name") == 0
|
||||
or die "nix-store --query --deriver failed on `$storePath': $?";
|
||||
}
|
||||
|
||||
|
||||
# Write a NAR archive of everything to standard output.
|
||||
system("nix-store --dump '$tmpDir'") == 0
|
||||
or die "nix-store --dump failed";
|
||||
@@ -3,6 +3,12 @@
|
||||
url=$1
|
||||
expHash=$2
|
||||
|
||||
# to prevent doing more than 1 chroot
|
||||
unset NIX_ROOT
|
||||
|
||||
# needed to make it work on NixOS
|
||||
export PATH=$PATH:@coreutils@
|
||||
|
||||
hashType=$NIX_HASH_ALGO
|
||||
if test -z "$hashType"; then
|
||||
hashType=md5
|
||||
|
||||
@@ -2,9 +2,9 @@ if test -n "$HOME"; then
|
||||
NIX_LINK="$HOME/.nix-profile"
|
||||
|
||||
if ! test -L "$NIX_LINK"; then
|
||||
echo "creating $NIX_LINK"
|
||||
echo "creating $NIX_LINK" >&2
|
||||
_NIX_DEF_LINK=@localstatedir@/nix/profiles/default
|
||||
ln -s "$_NIX_DEF_LINK" "$NIX_LINK"
|
||||
@coreutils@/ln -s "$_NIX_DEF_LINK" "$NIX_LINK"
|
||||
fi
|
||||
|
||||
export PATH=$NIX_LINK/bin:@prefix@/bin:$PATH
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
#! @perl@ -w -I@libexecdir@/nix
|
||||
|
||||
use strict;
|
||||
use IPC::Open2;
|
||||
use POSIX qw(tmpnam);
|
||||
use File::Temp qw(tempdir);
|
||||
use readmanifest;
|
||||
|
||||
my $tmpdir;
|
||||
do { $tmpdir = tmpnam(); }
|
||||
until mkdir $tmpdir, 0777;
|
||||
my $tmpDir = tempdir("nix-pull.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
my $manifest = "$tmpdir/manifest";
|
||||
|
||||
END { unlink $manifest; rmdir $tmpdir; }
|
||||
my $manifest = "$tmpDir/manifest";
|
||||
|
||||
my $binDir = $ENV{"NIX_BIN_DIR"};
|
||||
$binDir = "@bindir@" unless defined $binDir;
|
||||
@@ -22,16 +18,21 @@ $libexecDir = "@libexecdir@" unless defined $libexecDir;
|
||||
my $stateDir = $ENV{"NIX_STATE_DIR"};
|
||||
$stateDir = "@localstatedir@/nix" unless defined $stateDir;
|
||||
|
||||
my $storeDir = $ENV{"NIX_STORE_DIR"};
|
||||
$storeDir = "@storedir@" unless defined $storeDir;
|
||||
|
||||
|
||||
# Prevent access problems in shared-stored installations.
|
||||
umask 0022;
|
||||
|
||||
|
||||
# Obtain URLs either from the command line or from a configuration file.
|
||||
# Process the URLs specified on the command line.
|
||||
my %narFiles;
|
||||
my %patches;
|
||||
my %successors;
|
||||
|
||||
my $skipWrongStore = 0;
|
||||
|
||||
sub processURL {
|
||||
my $url = shift;
|
||||
|
||||
@@ -46,6 +47,15 @@ sub processURL {
|
||||
die "manifest `$url' is too old (i.e., for Nix <= 0.7)\n";
|
||||
}
|
||||
|
||||
if ($skipWrongStore) {
|
||||
foreach my $path (keys %narFiles) {
|
||||
if (substr($path, 0, length($storeDir) + 1) ne "$storeDir/") {
|
||||
print STDERR "warning: manifest `$url' assumes a Nix store at a different location than $storeDir, skipping...\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $baseName = "unnamed";
|
||||
if ($url =~ /\/([^\/]+)\/[^\/]+$/) { # get the forelast component
|
||||
$baseName = $1;
|
||||
@@ -57,13 +67,17 @@ sub processURL {
|
||||
|
||||
my $finalPath = "$stateDir/manifests/$baseName-$hash.nixmanifest";
|
||||
|
||||
system("mv -f '$manifest' '$finalPath'") == 0
|
||||
system ("@coreutils@/mv", "-f", "$manifest", "$finalPath") == 0
|
||||
or die "cannot move `$manifest' to `$finalPath";
|
||||
}
|
||||
|
||||
while (@ARGV) {
|
||||
my $url = shift @ARGV;
|
||||
processURL $url;
|
||||
if ($url eq "--skip-wrong-store") {
|
||||
$skipWrongStore = 1;
|
||||
} else {
|
||||
processURL $url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,11 +88,9 @@ print "$size store paths in manifest\n";
|
||||
# Register all substitutes.
|
||||
print STDERR "registering substitutes...\n";
|
||||
|
||||
my $pid = open2(\*READ, \*WRITE, "$binDir/nix-store --register-substitutes")
|
||||
my $pid = open(WRITE, "|$binDir/nix-store --register-substitutes")
|
||||
or die "cannot run nix-store";
|
||||
|
||||
close READ;
|
||||
|
||||
foreach my $storePath (keys %narFiles) {
|
||||
my $narFileList = $narFiles{$storePath};
|
||||
foreach my $narFile (@{$narFileList}) {
|
||||
@@ -95,7 +107,4 @@ foreach my $storePath (keys %narFiles) {
|
||||
}
|
||||
}
|
||||
|
||||
close WRITE;
|
||||
|
||||
waitpid $pid, 0;
|
||||
$? == 0 or die "nix-store failed";
|
||||
close WRITE or die "nix-store failed: $?";
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
#! @perl@ -w -I@libexecdir@/nix
|
||||
|
||||
use strict;
|
||||
use IPC::Open2;
|
||||
use POSIX qw(tmpnam);
|
||||
use File::Temp qw(tempdir);
|
||||
use readmanifest;
|
||||
|
||||
my $hashAlgo = "sha256";
|
||||
|
||||
my $tmpdir;
|
||||
do { $tmpdir = tmpnam(); }
|
||||
until mkdir $tmpdir, 0777;
|
||||
my $tmpDir = tempdir("nix-push.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
my $nixfile = "$tmpdir/create-nars.nix";
|
||||
my $manifest = "$tmpdir/MANIFEST";
|
||||
|
||||
END { unlink $manifest; unlink $nixfile; rmdir $tmpdir; }
|
||||
my $nixExpr = "$tmpDir/create-nars.nix";
|
||||
my $manifest = "$tmpDir/MANIFEST";
|
||||
|
||||
my $curl = "@curl@ --fail --silent";
|
||||
my $extraCurlFlags = ${ENV{'CURL_FLAGS'}};
|
||||
@@ -32,20 +28,42 @@ my $localCopy;
|
||||
my $localArchivesDir;
|
||||
my $localManifestFile;
|
||||
|
||||
my $targetArchivesUrl;
|
||||
|
||||
my $archivesPutURL;
|
||||
my $archivesGetURL;
|
||||
my $manifestPutURL;
|
||||
|
||||
sub showSyntax {
|
||||
print STDERR <<EOF
|
||||
Usage: nix-push --copy ARCHIVES_DIR MANIFEST_FILE PATHS...
|
||||
or: nix-push ARCHIVES_PUT_URL ARCHIVES_GET_URL MANIFEST_PUT_URL PATHS...
|
||||
|
||||
`nix-push' copies or uploads the closure of PATHS to the given
|
||||
destination.
|
||||
EOF
|
||||
; # `
|
||||
exit 1;
|
||||
}
|
||||
|
||||
showSyntax if scalar @ARGV < 1;
|
||||
|
||||
if ($ARGV[0] eq "--copy") {
|
||||
die "syntax: nix-push --copy ARCHIVES_DIR MANIFEST_FILE PATHS...\n" if scalar @ARGV < 3;
|
||||
showSyntax if scalar @ARGV < 3;
|
||||
$localCopy = 1;
|
||||
shift @ARGV;
|
||||
$localArchivesDir = shift @ARGV;
|
||||
$localManifestFile = shift @ARGV;
|
||||
if ($ARGV[0] eq "--target") {
|
||||
shift @ARGV;
|
||||
$targetArchivesUrl = shift @ARGV;
|
||||
}
|
||||
else {
|
||||
$targetArchivesUrl = "file://$localArchivesDir";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die "syntax: nix-push ARCHIVES_PUT_URL ARCHIVES_GET_URL " .
|
||||
"MANIFEST_PUT_URL PATHS...\n" if scalar @ARGV < 3;
|
||||
showSyntax if scalar @ARGV < 3;
|
||||
$localCopy = 0;
|
||||
$archivesPutURL = shift @ARGV;
|
||||
$archivesGetURL = shift @ARGV;
|
||||
@@ -62,20 +80,17 @@ foreach my $path (@ARGV) {
|
||||
|
||||
# Get all paths referenced by the normalisation of the given
|
||||
# Nix expression.
|
||||
my $pid = open2(\*READ, \*WRITE,
|
||||
my $pid = open(READ,
|
||||
"$binDir/nix-store --query --requisites --force-realise " .
|
||||
"--include-outputs '$path'") or die;
|
||||
close WRITE;
|
||||
"--include-outputs '$path'|") or die;
|
||||
|
||||
while (<READ>) {
|
||||
chomp;
|
||||
die "bad: $_" unless /^\//;
|
||||
$storePaths{$_} = "";
|
||||
}
|
||||
close READ;
|
||||
|
||||
waitpid $pid, 0;
|
||||
$? == 0 or die "nix-store failed";
|
||||
|
||||
close READ or die "nix-store failed: $?";
|
||||
}
|
||||
|
||||
my @storePaths = keys %storePaths;
|
||||
@@ -83,16 +98,16 @@ my @storePaths = keys %storePaths;
|
||||
|
||||
# For each path, create a Nix expression that turns the path into
|
||||
# a Nix archive.
|
||||
open NIX, ">$nixfile";
|
||||
open NIX, ">$nixExpr";
|
||||
print NIX "[";
|
||||
|
||||
foreach my $storePath (@storePaths) {
|
||||
die unless ($storePath =~ /\/[0-9a-z]{32}.*$/);
|
||||
die unless ($storePath =~ /\/[0-9a-z]{32}[^\"\\\$]*$/);
|
||||
|
||||
# Construct a Nix expression that creates a Nix archive.
|
||||
my $nixexpr =
|
||||
"((import $dataDir/nix/corepkgs/nar/nar.nix) " .
|
||||
"{path = \"$storePath\"; system = \"@system@\"; hashAlgo = \"$hashAlgo\";}) ";
|
||||
"{storePath = builtins.toPath \"$storePath\"; system = \"@system@\"; hashAlgo = \"$hashAlgo\";}) ";
|
||||
|
||||
print NIX $nixexpr;
|
||||
}
|
||||
@@ -104,18 +119,14 @@ close NIX;
|
||||
# Instantiate store expressions from the Nix expression.
|
||||
my @storeExprs;
|
||||
print STDERR "instantiating store expressions...\n";
|
||||
my $pid = open2(\*READ, \*WRITE, "$binDir/nix-instantiate $nixfile")
|
||||
my $pid = open(READ, "$binDir/nix-instantiate $nixExpr|")
|
||||
or die "cannot run nix-instantiate";
|
||||
close WRITE;
|
||||
while (<READ>) {
|
||||
chomp;
|
||||
die unless /^\//;
|
||||
push @storeExprs, $_;
|
||||
}
|
||||
close READ;
|
||||
|
||||
waitpid $pid, 0;
|
||||
$? == 0 or die "nix-instantiate failed";
|
||||
close READ or die "nix-instantiate failed: $?";
|
||||
|
||||
|
||||
# Realise the store expressions.
|
||||
@@ -130,18 +141,19 @@ while (scalar @tmp > 0) {
|
||||
my @tmp2 = @tmp[0..$n - 1];
|
||||
@tmp = @tmp[$n..scalar @tmp - 1];
|
||||
|
||||
my $pid = open2(\*READ, \*WRITE, "$binDir/nix-store --realise @tmp2")
|
||||
# Note: we disable build hooks because of the impure path
|
||||
# reference (see above). Even if that is fixed, using a hook
|
||||
# probably wouldn't make that much sense; pumping lots of data
|
||||
# around just to compress them won't gain that much.
|
||||
$ENV{"NIX_BUILD_HOOK"} = "";
|
||||
my $pid = open(READ, "$binDir/nix-store --realise @tmp2|")
|
||||
or die "cannot run nix-store";
|
||||
close WRITE;
|
||||
while (<READ>) {
|
||||
chomp;
|
||||
die unless (/^\//);
|
||||
push @narPaths, "$_";
|
||||
}
|
||||
close READ;
|
||||
|
||||
waitpid $pid, 0;
|
||||
$? == 0 or die "nix-store failed";
|
||||
close READ or die "nix-store failed: $?";
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +203,7 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
|
||||
|
||||
my $url;
|
||||
if ($localCopy) {
|
||||
$url = "file://$localArchivesDir/$narName";
|
||||
$url = "$targetArchivesUrl/$narName";
|
||||
} else {
|
||||
$url = "$archivesGetURL/$narName";
|
||||
}
|
||||
@@ -212,7 +224,7 @@ writeManifest $manifest, \%narFiles, \%patches;
|
||||
sub copyFile {
|
||||
my $src = shift;
|
||||
my $dst = shift;
|
||||
system("cp '$src' '$dst.tmp'") == 0 or die "cannot copy file";
|
||||
system("@coreutils@/cp", $src, "$dst.tmp") == 0 or die "cannot copy file";
|
||||
rename("$dst.tmp", "$dst") or die "cannot rename file";
|
||||
}
|
||||
|
||||
|
||||
79
scripts/nix-unpack-closure.in
Normal file
79
scripts/nix-unpack-closure.in
Normal file
@@ -0,0 +1,79 @@
|
||||
#! @perl@ -w
|
||||
|
||||
# This tool unpacks the closures created by "nix-pack-closure" and
|
||||
# adds them to the Nix store.
|
||||
|
||||
# TODO: make this program "streamy", i.e., don't use a temporary
|
||||
# directory.
|
||||
|
||||
use strict;
|
||||
use File::Temp qw(tempdir);
|
||||
|
||||
my $binDir = $ENV{"NIX_BIN_DIR"};
|
||||
$binDir = "@bindir@" unless defined $binDir;
|
||||
|
||||
my $tmpDir = tempdir("nix-unpack-closure.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
|
||||
# Unpack the NAR archive on standard input.
|
||||
system("nix-store --restore '$tmpDir/unpacked'") == 0
|
||||
or die "nix-store --restore failed";
|
||||
|
||||
|
||||
open VALID, ">$tmpDir/validity" or die;
|
||||
|
||||
|
||||
# For each path in the closure that is not yet valid, add it to the
|
||||
# store. TODO: use proper locking. Or even better, let nix-store do
|
||||
# this.
|
||||
opendir(DIR, "$tmpDir/unpacked/contents") or die "cannot open directory: $!";
|
||||
|
||||
foreach my $name (sort(readdir DIR)) {
|
||||
next if $name eq "." or $name eq "..";
|
||||
|
||||
my $storePath = "@storedir@/$name"; # !!!
|
||||
|
||||
# !!! this really isn't a good validity check!
|
||||
system "$binDir/nix-store --check-validity '$storePath' 2> /dev/null";
|
||||
if ($? != 0) {
|
||||
print STDERR "unpacking `$storePath'...\n";
|
||||
|
||||
# !!! race
|
||||
system("@coreutils@/rm -rf '$storePath'") == 0
|
||||
or die "cannot remove `$storePath': $?";
|
||||
|
||||
system("$binDir/nix-store --restore '$storePath' < '$tmpDir/unpacked/contents/$name'") == 0
|
||||
or die "nix-store --dump failed on `$storePath': $?";
|
||||
|
||||
print VALID "$storePath\n";
|
||||
|
||||
open DRV, "<$tmpDir/unpacked/derivers/$name" or die;
|
||||
my $deriver = <DRV>;
|
||||
chomp $deriver;
|
||||
$deriver = "" if $deriver eq "unknown-deriver";
|
||||
close DRV;
|
||||
|
||||
my @refs;
|
||||
open REFS, "<$tmpDir/unpacked/references/$name" or die;
|
||||
while (<REFS>) {
|
||||
chomp;
|
||||
push @refs, $_;
|
||||
}
|
||||
close REFS;
|
||||
|
||||
print VALID "$deriver\n";
|
||||
|
||||
print VALID (scalar @refs), "\n";
|
||||
foreach my $ref (@refs) {
|
||||
print VALID "$ref\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir(DIR) or die;
|
||||
|
||||
|
||||
# Register the invalid paths as valid.
|
||||
system("nix-store --register-validity <'$tmpDir/validity'") == 0
|
||||
or die "nix-store --register-validity failed";
|
||||
@@ -1,69 +1,91 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
|
||||
{ my $ofh = select STDOUT;
|
||||
$| = 1;
|
||||
select $ofh;
|
||||
}
|
||||
|
||||
#my @paths = ("/nix/store/caef3a49150506d233f474322a824e50-glibc-2.3.3", "/nix/store/a8a9d585d1ad4b1bc911be7743b3b996-glibc-2.3.3");
|
||||
my @paths = ("/nix/store");
|
||||
|
||||
my $tmpfile = "/tmp/nix-optimise-hash-list";
|
||||
#my $tmpfile = "/data/nix-optimise-hash-list";
|
||||
|
||||
system("find @paths -type f -print0 | xargs -0 md5sum -- > $tmpfile") == 0
|
||||
print "hashing...\n";
|
||||
|
||||
my $hashList = "/tmp/nix-optimise-hash-list";
|
||||
|
||||
system("find @paths -type f -print0 | xargs -0 md5sum -- > $hashList") == 0
|
||||
or die "cannot hash store files";
|
||||
|
||||
system("sort $tmpfile > $tmpfile.sorted") == 0
|
||||
|
||||
print "sorting by hash...\n";
|
||||
|
||||
system("sort $hashList > $hashList.sorted") == 0
|
||||
or die "cannot sort list";
|
||||
|
||||
open LIST, "<$tmpfile.sorted" or die;
|
||||
|
||||
sub atomicLink {
|
||||
my $target = shift;
|
||||
my $new = shift;
|
||||
my $tmpNew = "${new}_optimise.$$";
|
||||
|
||||
# Make the directory writable temporarily.
|
||||
my $dir = dirname $new;
|
||||
my @st = stat $dir or die;
|
||||
|
||||
chmod ($st[2] | 0200, $dir) or die "cannot make `$dir' writable: $!";
|
||||
|
||||
link $target, $tmpNew or die "cannot create hard link `$tmpNew': $!";
|
||||
|
||||
rename $tmpNew, $new or die "cannot rename `$tmpNew' to `$new': $!";
|
||||
|
||||
chmod ($st[2], $dir) or die "cannot restore permission on `$dir': $!";
|
||||
utime ($st[8], $st[9], $dir) or die "cannot restore timestamp on `$dir': $!";
|
||||
}
|
||||
|
||||
|
||||
print "hard-linking...\n";
|
||||
|
||||
open LIST, "<$hashList.sorted" or die;
|
||||
|
||||
my $prevFile;
|
||||
my $prevHash;
|
||||
my $prevInode;
|
||||
my $prevExec;
|
||||
|
||||
my $totalSpace = 0;
|
||||
my $savedSpace = 0;
|
||||
|
||||
my $files = 0;
|
||||
|
||||
while (<LIST>) {
|
||||
# print "D";
|
||||
/^([0-9a-f]*)\s+(.*)$/ or die;
|
||||
my $curFile = $2;
|
||||
my $curHash = $1;
|
||||
|
||||
# print "A";
|
||||
my $fileSize = (stat $curFile)[7];
|
||||
# print "B";
|
||||
# my $fileSize = 1;
|
||||
my @st = stat $curFile or die;
|
||||
next if ($st[2] & 0222) != 0; # skip writable files
|
||||
|
||||
my $fileSize = $st[7];
|
||||
$totalSpace += $fileSize;
|
||||
my $isExec = ($st[2] & 0111) == 0111;
|
||||
|
||||
if (defined $prevHash && $curHash eq $prevHash) {
|
||||
if (defined $prevHash && $curHash eq $prevHash
|
||||
&& $prevExec == $isExec)
|
||||
{
|
||||
|
||||
# print "$curFile = $prevFile\n";
|
||||
|
||||
$savedSpace += $fileSize;
|
||||
if ($st[1] != $prevInode) {
|
||||
print "$curFile = $prevFile\n";
|
||||
atomicLink $prevFile, $curFile;
|
||||
$savedSpace += $fileSize;
|
||||
}
|
||||
|
||||
} else {
|
||||
$prevFile = $curFile;
|
||||
$prevHash = $curHash;
|
||||
$prevInode = $st[1];
|
||||
$prevExec = ($st[2] & 0111) == 0111;
|
||||
}
|
||||
|
||||
print "." if ($files++ % 100 == 0);
|
||||
#print ".";
|
||||
|
||||
# print "C";
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
print "total space = $totalSpace\n";
|
||||
print "saved space = $savedSpace\n";
|
||||
my $savings = ($savedSpace / $totalSpace) * 100.0;
|
||||
print "savings = $savings %\n";
|
||||
|
||||
|
||||
close LIST;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# A list of URLs from where `nix-pull' obtain Nix archives if
|
||||
# no URL is specified on the command line.
|
||||
17
scripts/readconfig.pm.in
Normal file
17
scripts/readconfig.pm.in
Normal file
@@ -0,0 +1,17 @@
|
||||
use strict;
|
||||
|
||||
sub readConfig {
|
||||
my %config;
|
||||
my $config = "@sysconfdir@/nix/nix.conf";
|
||||
return unless -f $config;
|
||||
|
||||
open CONFIG, "<$config" or die "cannot open `$config'";
|
||||
while (<CONFIG>) {
|
||||
/^\s*([\w|-]+)\s*=\s*(.*)$/ or next;
|
||||
$config{$1} = $2;
|
||||
print "|$1| -> |$2|\n";
|
||||
}
|
||||
close CONFIG;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -172,7 +172,7 @@ sub writeManifest
|
||||
print MANIFEST " ManifestVersion: 3\n";
|
||||
print MANIFEST "}\n";
|
||||
|
||||
foreach my $storePath (keys %{$narFiles}) {
|
||||
foreach my $storePath (sort (keys %{$narFiles})) {
|
||||
my $narFileList = $$narFiles{$storePath};
|
||||
foreach my $narFile (@{$narFileList}) {
|
||||
print MANIFEST "{\n";
|
||||
@@ -189,7 +189,7 @@ sub writeManifest
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $storePath (keys %{$patches}) {
|
||||
foreach my $storePath (sort (keys %{$patches})) {
|
||||
my $patchList = $$patches{$storePath};
|
||||
foreach my $patch (@{$patchList}) {
|
||||
print MANIFEST "patch {\n";
|
||||
|
||||
73
scripts/show-duplication.pl
Executable file
73
scripts/show-duplication.pl
Executable file
@@ -0,0 +1,73 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
if (scalar @ARGV != 1) {
|
||||
print "syntax: show-duplication.pl PATH\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $root = $ARGV[0];
|
||||
|
||||
|
||||
my $nameRE = "(?:(?:[A-Za-z0-9\+\_]|(?:-[^0-9]))+)";
|
||||
my $versionRE = "(?:[A-Za-z0-9\.\-]+)";
|
||||
|
||||
|
||||
my %pkgInstances;
|
||||
|
||||
|
||||
my $pid = open(PATHS, "-|") || exec "nix-store", "-qR", $root;
|
||||
while (<PATHS>) {
|
||||
chomp;
|
||||
/^.*\/[0-9a-z]*-(.*)$/;
|
||||
my $nameVersion = $1;
|
||||
$nameVersion =~ /^($nameRE)(-($versionRE))?$/;
|
||||
$name = $1;
|
||||
$version = $3;
|
||||
$version = "(unnumbered)" unless defined $version;
|
||||
# print "$nameVersion $name $version\n";
|
||||
push @{$pkgInstances{$name}}, {version => $version, path => $_};
|
||||
}
|
||||
close PATHS or exit 1;
|
||||
|
||||
|
||||
sub pathSize {
|
||||
my $path = shift;
|
||||
my @st = lstat $path or die;
|
||||
|
||||
my $size = $st[7];
|
||||
|
||||
if (-d $path) {
|
||||
opendir DIR, $path or die;
|
||||
foreach my $name (readdir DIR) {
|
||||
next if $name eq "." || $name eq "..";
|
||||
$size += pathSize("$path/$name");
|
||||
}
|
||||
}
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
my $totalPaths = 0;
|
||||
my $totalSize = 0, $totalWaste = 0;
|
||||
|
||||
foreach my $name (sort {scalar @{$pkgInstances{$b}} <=> scalar @{$pkgInstances{$a}}} (keys %pkgInstances)) {
|
||||
print "$name ", scalar @{$pkgInstances{$name}}, "\n";
|
||||
my $allSize = 0;
|
||||
foreach my $x (sort {$a->{version} cmp $b->{version}} @{$pkgInstances{$name}}) {
|
||||
$totalPaths++;
|
||||
my $size = pathSize $x->{path};
|
||||
$allSize += $size;
|
||||
print " $x->{version} $size\n";
|
||||
}
|
||||
my $avgSize = int($allSize / scalar @{$pkgInstances{$name}});
|
||||
my $waste = $allSize - $avgSize;
|
||||
$totalSize += $allSize;
|
||||
$totalWaste += $waste;
|
||||
print " average $avgSize, waste $waste\n";
|
||||
}
|
||||
|
||||
|
||||
my $avgDupl = $totalPaths / scalar (keys %pkgInstances);
|
||||
my $wasteFactor = ($totalWaste / $totalSize) * 100;
|
||||
print "average package duplication $avgDupl, total size $totalSize, total waste $totalWaste, $wasteFactor% wasted\n";
|
||||
@@ -1,5 +1,5 @@
|
||||
SUBDIRS = bin2c boost libutil libstore libmain nix-store nix-hash \
|
||||
libexpr nix-instantiate nix-env log2xml bsdiff-4.2
|
||||
libexpr nix-instantiate nix-env nix-log2xml bsdiff-4.3
|
||||
|
||||
EXTRA_DIST = aterm-helper.pl
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ my $initFun = "init";
|
||||
open HEADER, ">$ARGV[0]";
|
||||
open IMPL, ">$ARGV[1]";
|
||||
|
||||
print HEADER "#include <aterm2.h>\n";
|
||||
print HEADER "#ifdef __cplusplus\n";
|
||||
print HEADER "namespace nix {\n";
|
||||
print HEADER "#endif\n\n\n";
|
||||
print IMPL "namespace nix {\n";
|
||||
|
||||
while (<STDIN>) {
|
||||
next if (/^\s*$/);
|
||||
|
||||
@@ -99,8 +105,17 @@ while (<STDIN>) {
|
||||
|
||||
print IMPL "AFun sym$funname = 0;\n";
|
||||
|
||||
if ($arity == 0) {
|
||||
print HEADER "extern ATerm const$funname;\n\n";
|
||||
print IMPL "ATerm const$funname = 0;\n";
|
||||
}
|
||||
|
||||
print HEADER "static inline $result make$funname($formals) __attribute__ ((pure, nothrow));\n";
|
||||
print HEADER "static inline $result make$funname($formals) {\n";
|
||||
if ($arity <= 6) {
|
||||
if ($arity == 0) {
|
||||
print HEADER " return const$funname;\n";
|
||||
}
|
||||
elsif ($arity <= 6) {
|
||||
print HEADER " return (ATerm) ATmakeAppl$arity(sym$funname$args);\n";
|
||||
} else {
|
||||
$args =~ s/^,//;
|
||||
@@ -119,6 +134,10 @@ while (<STDIN>) {
|
||||
|
||||
$init .= " sym$funname = ATmakeAFun(\"$const\", $arity, ATfalse);\n";
|
||||
$init .= " ATprotectAFun(sym$funname);\n";
|
||||
if ($arity == 0) {
|
||||
$init .= " const$funname = (ATerm) ATmakeAppl0(sym$funname);\n";
|
||||
$init .= " ATprotect(&const$funname);\n";
|
||||
}
|
||||
}
|
||||
|
||||
elsif (/^\s*(\w+)\s*=\s*(.*)$/) {
|
||||
@@ -149,5 +168,10 @@ print IMPL "void $initFun() {\n";
|
||||
print IMPL "$init";
|
||||
print IMPL "}\n";
|
||||
|
||||
print HEADER "#ifdef __cplusplus\n";
|
||||
print HEADER "}\n";
|
||||
print HEADER "#endif\n\n\n";
|
||||
print IMPL "}\n";
|
||||
|
||||
close HEADER;
|
||||
close IMPL;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
SUBDIRS = format
|
||||
|
||||
EXTRA_DIST = assert.hpp checked_delete.hpp format.hpp \
|
||||
pkginclude_HEADERS = assert.hpp checked_delete.hpp format.hpp \
|
||||
shared_ptr.hpp weak_ptr.hpp throw_exception.hpp \
|
||||
enable_shared_from_this.hpp \
|
||||
detail/shared_count.hpp detail/workaround.hpp
|
||||
|
||||
pkgincludedir = ${includedir}/nix/boost
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
noinst_LIBRARIES = libformat.a
|
||||
pkglib_LTLIBRARIES = libformat.la
|
||||
|
||||
libformat_a_SOURCES = format_implementation.cc free_funcs.cc \
|
||||
parsing.cc exceptions.hpp feed_args.hpp format_class.hpp \
|
||||
libformat_la_SOURCES = format_implementation.cc free_funcs.cc \
|
||||
parsing.cc
|
||||
|
||||
pkginclude_HEADERS = exceptions.hpp feed_args.hpp format_class.hpp \
|
||||
format_fwd.hpp group.hpp internals.hpp internals_fwd.hpp \
|
||||
macros_default.hpp
|
||||
|
||||
AM_CXXFLAGS = -Wall -I../..
|
||||
pkgincludedir = ${includedir}/nix/boost/format
|
||||
|
||||
AM_CXXFLAGS = -Wall -I$(srcdir)/../..
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
BSD Protection License
|
||||
February 2002
|
||||
|
||||
Preamble
|
||||
--------
|
||||
|
||||
The Berkeley Software Distribution ("BSD") license has proven very effective
|
||||
over the years at allowing for a wide spread of work throughout both
|
||||
commercial and non-commercial products. For programmers whose primary
|
||||
intention is to improve the general quality of available software, it is
|
||||
arguable that there is no better license than the BSD license, as it
|
||||
permits improvements to be used wherever they will help, without idealogical
|
||||
or metallic constraint.
|
||||
|
||||
This is of particular value to those who produce reference implementations
|
||||
of proposed standards: The case of TCP/IP clearly illustrates that freely
|
||||
and universally available implementations leads the rapid acceptance of
|
||||
standards -- often even being used instead of a de jure standard (eg, OSI
|
||||
network models).
|
||||
|
||||
With the rapid proliferation of software licensed under the GNU General
|
||||
Public License, however, the continued success of this role is called into
|
||||
question. Given that the inclusion of a few lines of "GPL-tainted" work
|
||||
into a larger body of work will result in restricted distribution -- and
|
||||
given that further work will likely build upon the "tainted" portions,
|
||||
making them difficult to remove at a future date -- there are inevitable
|
||||
circumstances where authors would, in order to protect their goal of
|
||||
providing for the widespread usage of their work, wish to guard against
|
||||
such "GPL-taint".
|
||||
|
||||
In addition, one can imagine that companies which operate by producing and
|
||||
selling (possibly closed-source) code would wish to protect themselves
|
||||
against the rise of a GPL-licensed competitor. While under existing
|
||||
licenses this would mean not releasing their code under any form of open
|
||||
license, if a license existed under which they could incorporate any
|
||||
improvements back into their own (commercial) products then they might be
|
||||
far more willing to provide for non-closed distribution.
|
||||
|
||||
For the above reasons, we put forth this "BSD Protection License": A
|
||||
license designed to retain the freedom granted by the BSD license to use
|
||||
licensed works in a wide variety of settings, both non-commercial and
|
||||
commercial, while protecting the work from having future contributors
|
||||
restrict that freedom.
|
||||
|
||||
The precise terms and conditions for copying, distribution, and
|
||||
modification follow.
|
||||
|
||||
BSD PROTECTION LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION, AND MODIFICATION
|
||||
----------------------------------------------------------------
|
||||
|
||||
0. Definitions.
|
||||
a) "Program", below, refers to any program or work distributed under
|
||||
the terms of this license.
|
||||
b) A "work based on the Program", below, refers to either the Program
|
||||
or any derivative work under copyright law.
|
||||
c) "Modification", below, refers to the act of creating derivative works.
|
||||
d) "You", below, refers to each licensee.
|
||||
|
||||
1. Scope.
|
||||
This license governs the copying, distribution, and modification of the
|
||||
Program. Other activities are outside the scope of this license; The
|
||||
act of running the Program is not restricted, and the output from the
|
||||
Program is covered only if its contents constitute a work based on the
|
||||
Program.
|
||||
|
||||
2. Verbatim copies.
|
||||
You may copy and distribute verbatim copies of the Program as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice; keep
|
||||
intact all the notices that refer to this License and to the absence of
|
||||
any warranty; and give any other recipients of the Program a copy of this
|
||||
License along with the Program.
|
||||
|
||||
3. Modification and redistribution under closed license.
|
||||
You may modify your copy or copies of the Program, and distribute
|
||||
the resulting derivative works, provided that you meet the
|
||||
following conditions:
|
||||
a) The copyright notice and disclaimer on the Program must be reproduced
|
||||
and included in the source code, documentation, and/or other materials
|
||||
provided in a manner in which such notices are normally distributed.
|
||||
b) The derivative work must be clearly identified as such, in order that
|
||||
it may not be confused with the original work.
|
||||
c) The license under which the derivative work is distributed must
|
||||
expressly prohibit the distribution of further derivative works.
|
||||
|
||||
4. Modification and redistribution under open license.
|
||||
You may modify your copy or copies of the Program, and distribute
|
||||
the resulting derivative works, provided that you meet the
|
||||
following conditions:
|
||||
a) The copyright notice and disclaimer on the Program must be reproduced
|
||||
and included in the source code, documentation, and/or other materials
|
||||
provided in a manner in which such notices are normally distributed.
|
||||
b) You must clearly indicate the nature and date of any changes made
|
||||
to the Program. The full details need not necessarily be included in
|
||||
the individual modified files, provided that each modified file is
|
||||
clearly marked as such and instructions are included on where the
|
||||
full details of the modifications may be found.
|
||||
c) You must cause any work that you distribute or publish, that in whole
|
||||
or in part contains or is derived from the Program or any part
|
||||
thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
5. Implied acceptance.
|
||||
You may not copy or distribute the Program or any derivative works except
|
||||
as expressly provided under this license. Consequently, any such action
|
||||
will be taken as implied acceptance of the terms of this license.
|
||||
|
||||
6. NO WARRANTY.
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
@@ -1,7 +0,0 @@
|
||||
libexec_PROGRAMS = bsdiff bspatch
|
||||
|
||||
bsdiff_SOURCES = bsdiff.c
|
||||
|
||||
bspatch_SOURCES = bspatch.c
|
||||
|
||||
AM_CFLAGS = -O3 -DBZIP2=\"$(bzip2)\"
|
||||
@@ -1,18 +0,0 @@
|
||||
CFLAGS += -O3
|
||||
.ifdef BZIP2
|
||||
CFLAGS += -DBZIP2=\"${BZIP2}\"
|
||||
.endif
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
INSTALL_PROGRAM ?= ${INSTALL} -c -s -m 555
|
||||
INSTALL_MAN ?= ${INSTALL} -c -m 444
|
||||
|
||||
all: bsdiff bspatch
|
||||
bsdiff: bsdiff.c
|
||||
bspatch: bspatch.c
|
||||
|
||||
install:
|
||||
${INSTALL_PROGRAM} bsdiff bspatch ${PREFIX}/bin
|
||||
.ifndef WITHOUT_MAN
|
||||
${INSTALL_MAN} bsdiff.1 bspatch.1 ${PREFIX}/man/man1
|
||||
.endif
|
||||
@@ -1,36 +0,0 @@
|
||||
.Dd May 18, 2003
|
||||
.Dt BSDIFF 1
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
.Nm bsdiff
|
||||
.Nd generate a patch between two binary files
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ao Ar oldfile Ac Ao Ar newfile Ac Ao Ar patchfile Ac
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
compares
|
||||
.Ao Ar oldfile Ac
|
||||
to
|
||||
.Ao Ar newfile Ac
|
||||
and writes to
|
||||
.Ao Ar patchfile Ac
|
||||
a binary patch suitable for use by bspatch(1).
|
||||
When
|
||||
.Ao Ar oldfile Ac
|
||||
and
|
||||
.Ao Ar newfile Ac
|
||||
are two versions of an executable program, the
|
||||
patches produced are on average a factor of five smaller
|
||||
than those produced by any other binary patch tool known
|
||||
to the author.
|
||||
.Pp
|
||||
.Nm
|
||||
uses memory equal to 17 times the size of
|
||||
.Ao Ar oldfile Ac ,
|
||||
and requires
|
||||
an absolute minimum working set size of 8 times the size of oldfile.
|
||||
.Sh SEE ALSO
|
||||
.Xr bspatch 1
|
||||
.Sh AUTHORS
|
||||
.An Colin Percival Aq cperciva@daemonology.net
|
||||
@@ -1,32 +0,0 @@
|
||||
.Dd May 18, 2003
|
||||
.Dt BSPATCH 1
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
.Nm bspatch
|
||||
.Nd apply a patch built with bsdiff(1)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ao Ar oldfile Ac Ao Ar newfile Ac Ao Ar patchfile Ac
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
generates
|
||||
.Ao Ar newfile Ac
|
||||
from
|
||||
.Ao Ar oldfile Ac
|
||||
and
|
||||
.Ao Ar patchfile Ac
|
||||
where
|
||||
.Ao Ar patchfile Ac
|
||||
is a binary patch built by bsdiff(1).
|
||||
.Pp
|
||||
.Nm
|
||||
uses memory equal to the size of
|
||||
.Ao Ar oldfile Ac
|
||||
plus the size of
|
||||
.Ao Ar newfile Ac ,
|
||||
but can tolerate a very small working set without a dramatic loss
|
||||
of performance.
|
||||
.Sh SEE ALSO
|
||||
.Xr bsdiff 1
|
||||
.Sh AUTHORS
|
||||
.An Colin Percival Aq cperciva@daemonology.net
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
.c -- Binary patcher
|
||||
|
||||
Copyright 2003,2004 Colin Percival
|
||||
|
||||
For the terms under which this work may be distributed, please see
|
||||
the adjoining file "LICENSE".
|
||||
*/
|
||||
|
||||
#ifndef BZIP2
|
||||
#define BZIP2 "/usr/bin/bzip2"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
ssize_t loopread(int d,void *buf,size_t nbytes)
|
||||
{
|
||||
ssize_t ptr,lenread;
|
||||
|
||||
for(ptr=0;ptr<nbytes;ptr+=lenread) {
|
||||
lenread=read(d,buf+ptr,nbytes-ptr);
|
||||
if(lenread==0) return ptr;
|
||||
if(lenread==-1) return -1;
|
||||
};
|
||||
return ptr;
|
||||
}
|
||||
|
||||
int bz2read(int fd,off_t offset,off_t len,char * fname,pid_t * pids)
|
||||
{
|
||||
int p0[2],p1[2];
|
||||
u_char * data;
|
||||
|
||||
if((pipe(p0)==-1) || (pipe(p1)==-1)) err(1,NULL);
|
||||
|
||||
if((pids[0]=fork())==-1) err(1,NULL);
|
||||
if(pids[0]==0) {
|
||||
if(close(0) || close(1) || close(p0[0]) ||
|
||||
close(p1[0]) || close(p1[1])) err(1,NULL);
|
||||
if((data=malloc(len+1))==NULL) err(1,NULL);
|
||||
if((pread(fd,data,len,offset)!=len) || close(fd))
|
||||
err(1,"%s",fname);
|
||||
if((write(p0[1],data,len)!=len) || close(p0[1]))
|
||||
err(1,NULL);
|
||||
free(data);
|
||||
_exit(0);
|
||||
};
|
||||
|
||||
if((pids[1]=fork())==-1) err(1,NULL);
|
||||
if(pids[1]==0) {
|
||||
if(close(0) || close(1) || close(p0[1]) ||
|
||||
close(p1[0])) err(1,NULL);
|
||||
if((dup2(p0[0],0)==-1) || close(p0[0])) err(1,NULL);
|
||||
if((dup2(p1[1],1)==-1) || close(p1[1])) err(1,NULL);
|
||||
if(close(fd)==-1) err(1,"%s",fname);
|
||||
|
||||
execl(BZIP2,BZIP2,"-dc",NULL);
|
||||
err(1,"%s",BZIP2);
|
||||
};
|
||||
|
||||
if(close(p0[0]) || close(p0[1]) || close(p1[1])) err(1,NULL);
|
||||
|
||||
return p1[0];
|
||||
}
|
||||
|
||||
off_t offtin(u_char *buf)
|
||||
{
|
||||
off_t y;
|
||||
|
||||
y=buf[7]&0x7F;
|
||||
y=y*256;y+=buf[6];
|
||||
y=y*256;y+=buf[5];
|
||||
y=y*256;y+=buf[4];
|
||||
y=y*256;y+=buf[3];
|
||||
y=y*256;y+=buf[2];
|
||||
y=y*256;y+=buf[1];
|
||||
y=y*256;y+=buf[0];
|
||||
|
||||
if(buf[7]&0x80) y=-y;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
int main(int argc,char * argv[])
|
||||
{
|
||||
int fd,ctrlpipe,diffpipe,extrapipe;
|
||||
pid_t pids[6];
|
||||
ssize_t patchsize,oldsize,newsize;
|
||||
ssize_t bzctrllen,bzdatalen;
|
||||
u_char header[32],buf[8];
|
||||
int version=0;
|
||||
u_char *old, *new;
|
||||
off_t oldpos,newpos;
|
||||
off_t ctrl[3];
|
||||
off_t lenread;
|
||||
off_t i;
|
||||
|
||||
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
|
||||
if(((fd=open(argv[3],O_RDONLY,0))<0) ||
|
||||
((patchsize=lseek(fd,0,SEEK_END))==-1) ||
|
||||
(lseek(fd,0,SEEK_SET)!=0)) err(1,"%s",argv[3]);
|
||||
if(patchsize<32) errx(1,"Corrupt patch\n");
|
||||
|
||||
/*
|
||||
Ok, this is going to be messy. There are two different patch
|
||||
formats which we need to support.
|
||||
|
||||
The old format (pre-4.0) is:
|
||||
0 8 "QSUFDIFF" or "BSDIFF30"
|
||||
8 8 X
|
||||
16 8 Y
|
||||
24 8 sizeof(newfile)
|
||||
32 X bzip2(control block)
|
||||
32+X Y bzip2(data block)
|
||||
with control block a set of pairs (x,y) meaning "seek forward
|
||||
in oldfile by y bytes, and add the next x bytes to x bytes from
|
||||
the data block".
|
||||
|
||||
The new format (4.0) is:
|
||||
0 8 "BSDIFF40"
|
||||
8 8 X
|
||||
16 8 Y
|
||||
24 8 sizeof(newfile)
|
||||
32 X bzip2(control block)
|
||||
32+X Y bzip2(diff block)
|
||||
32+X+Y ??? bzip2(extra block)
|
||||
with control block a set of triples (x,y,z) meaning "add x bytes
|
||||
from oldfile to x bytes from the diff block; copy y bytes from the
|
||||
extra block; seek forwards in oldfile by z bytes".
|
||||
*/
|
||||
|
||||
if(read(fd,header,32)!=32) err(1,"%s",argv[3]);
|
||||
if(memcmp(header,"QSUFDIFF",8)==0) version=1;
|
||||
if(memcmp(header,"BSDIFF30",8)==0) version=1;
|
||||
if(memcmp(header,"BSDIFF40",8)==0) version=2;
|
||||
|
||||
if(!version) errx(1,"Corrupt patch\n");
|
||||
|
||||
bzctrllen=offtin(header+8);
|
||||
bzdatalen=offtin(header+16);
|
||||
newsize=offtin(header+24);
|
||||
if((bzctrllen<0) || (bzdatalen<0) || (newsize<0) ||
|
||||
((version==1) && (32+bzctrllen+bzdatalen!=patchsize)))
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
ctrlpipe=bz2read(fd,32,bzctrllen,argv[3],pids);
|
||||
diffpipe=bz2read(fd,32+bzctrllen,bzdatalen,argv[3],pids+2);
|
||||
if(version==2) {
|
||||
extrapipe=bz2read(fd,32+bzctrllen+bzdatalen,
|
||||
patchsize-(32+bzctrllen+bzdatalen),argv[3],pids+4);
|
||||
};
|
||||
|
||||
if(close(fd)==-1) err(1,"%s",argv[3]);
|
||||
if(((fd=open(argv[1],O_RDONLY,0))<0) ||
|
||||
((oldsize=lseek(fd,0,SEEK_END))==-1) ||
|
||||
((old=malloc(oldsize+1))==NULL) ||
|
||||
(lseek(fd,0,SEEK_SET)!=0) ||
|
||||
(read(fd,old,oldsize)!=oldsize) ||
|
||||
(close(fd)==-1)) err(1,"%s",argv[1]);
|
||||
if((new=malloc(newsize+1))==NULL) err(1,NULL);
|
||||
|
||||
oldpos=0;newpos=0;
|
||||
while(newpos<newsize) {
|
||||
for(i=0;i<=version;i++) {
|
||||
if((lenread=loopread(ctrlpipe,buf,8))<0) err(1,NULL);
|
||||
if(lenread<8) errx(1,"Corrupt patch\n");
|
||||
ctrl[i]=offtin(buf);
|
||||
};
|
||||
|
||||
if(version==1) oldpos+=ctrl[1];
|
||||
|
||||
if(newpos+ctrl[0]>newsize) errx(1,"Corrupt patch\n");
|
||||
if((lenread=loopread(diffpipe,new+newpos,ctrl[0]))<0)
|
||||
err(1,NULL);
|
||||
if(lenread!=ctrl[0]) errx(1,"Corrupt patch\n");
|
||||
for(i=0;i<ctrl[0];i++)
|
||||
if((oldpos+i>=0) && (oldpos+i<oldsize))
|
||||
new[newpos+i]+=old[oldpos+i];
|
||||
newpos+=ctrl[0];
|
||||
oldpos+=ctrl[0];
|
||||
|
||||
if(version==2) {
|
||||
if(newpos+ctrl[1]>newsize) errx(1,"Corrupt patch\n");
|
||||
if((lenread=loopread(extrapipe,new+newpos,ctrl[1]))<0)
|
||||
err(1,NULL);
|
||||
if(lenread!=ctrl[1]) errx(1,"Corrupt patch\n");
|
||||
|
||||
newpos+=ctrl[1];
|
||||
oldpos+=ctrl[2];
|
||||
};
|
||||
};
|
||||
|
||||
if(loopread(ctrlpipe,buf,1)!=0) errx(1,"Corrupt patch\n");
|
||||
if(loopread(diffpipe,buf,1)!=0) errx(1,"Corrupt patch\n");
|
||||
if(version==2)
|
||||
if(loopread(extrapipe,buf,1)!=0) errx(1,"Corrupt patch\n");
|
||||
|
||||
if(close(ctrlpipe) || close(diffpipe) ||
|
||||
((version==2) && close(extrapipe)))
|
||||
err(1,NULL);
|
||||
for(i=0;i<(version+1)*2;i++) waitpid(pids[i],NULL,0);
|
||||
|
||||
if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0666))<0) ||
|
||||
(write(fd,new,newsize)!=newsize) || (close(fd)==-1))
|
||||
err(1,"%s",argv[2]);
|
||||
|
||||
free(new);
|
||||
free(old);
|
||||
|
||||
return 0;
|
||||
}
|
||||
11
src/bsdiff-4.3/Makefile.am
Normal file
11
src/bsdiff-4.3/Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
||||
libexec_PROGRAMS = bsdiff bspatch
|
||||
|
||||
bsdiff_SOURCES = bsdiff.c
|
||||
|
||||
bsdiff_LDADD = ${bzip2_lib}
|
||||
|
||||
bspatch_SOURCES = bspatch.c
|
||||
|
||||
bspatch_LDADD = ${bzip2_lib}
|
||||
|
||||
AM_CFLAGS = -O3 ${bzip2_include}
|
||||
63
src/bsdiff-4.3/bsdiff.1
Normal file
63
src/bsdiff-4.3/bsdiff.1
Normal file
@@ -0,0 +1,63 @@
|
||||
.\"-
|
||||
.\" Copyright 2003-2005 Colin Percival
|
||||
.\" All rights reserved
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted providing that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.1,v 1.1 2005/08/06 01:59:05 cperciva Exp $
|
||||
.\"
|
||||
.Dd May 18, 2003
|
||||
.Dt BSDIFF 1
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
.Nm bsdiff
|
||||
.Nd generate a patch between two binary files
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ao Ar oldfile Ac Ao Ar newfile Ac Ao Ar patchfile Ac
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
compares
|
||||
.Ao Ar oldfile Ac
|
||||
to
|
||||
.Ao Ar newfile Ac
|
||||
and writes to
|
||||
.Ao Ar patchfile Ac
|
||||
a binary patch suitable for use by bspatch(1).
|
||||
When
|
||||
.Ao Ar oldfile Ac
|
||||
and
|
||||
.Ao Ar newfile Ac
|
||||
are two versions of an executable program, the
|
||||
patches produced are on average a factor of five smaller
|
||||
than those produced by any other binary patch tool known
|
||||
to the author.
|
||||
.Pp
|
||||
.Nm
|
||||
uses memory equal to 17 times the size of
|
||||
.Ao Ar oldfile Ac ,
|
||||
and requires
|
||||
an absolute minimum working set size of 8 times the size of oldfile.
|
||||
.Sh SEE ALSO
|
||||
.Xr bspatch 1
|
||||
.Sh AUTHORS
|
||||
.An Colin Percival Aq cperciva@freebsd.org
|
||||
@@ -1,27 +1,46 @@
|
||||
/*
|
||||
bsdiff.c -- Binary patch generator.
|
||||
/*-
|
||||
* Copyright 2003-2005 Colin Percival
|
||||
* All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted providing that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
Copyright 2003 Colin Percival
|
||||
|
||||
For the terms under which this work may be distributed, please see
|
||||
the adjoining file "LICENSE".
|
||||
*/
|
||||
|
||||
#ifndef BZIP2
|
||||
#define BZIP2 "/usr/bin/bzip2"
|
||||
#if 0
|
||||
__FBSDID("$FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.c,v 1.1 2005/08/06 01:59:05 cperciva Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <bzlib.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MIN(x,y) (((x)<(y)) ? (x) : (y))
|
||||
|
||||
void split(off_t *I,off_t *V,off_t start,off_t len,off_t h)
|
||||
static void split(off_t *I,off_t *V,off_t start,off_t len,off_t h)
|
||||
{
|
||||
off_t i,j,k,x,tmp,jj,kk;
|
||||
|
||||
@@ -82,7 +101,7 @@ void split(off_t *I,off_t *V,off_t start,off_t len,off_t h)
|
||||
if(start+len>kk) split(I,V,kk,start+len-kk,h);
|
||||
}
|
||||
|
||||
void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize)
|
||||
static void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize)
|
||||
{
|
||||
off_t buckets[256];
|
||||
off_t i,h,len;
|
||||
@@ -120,7 +139,7 @@ void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize)
|
||||
for(i=0;i<oldsize+1;i++) I[V[i]]=i;
|
||||
}
|
||||
|
||||
off_t matchlen(u_char *old,off_t oldsize,u_char *new,off_t newsize)
|
||||
static off_t matchlen(u_char *old,off_t oldsize,u_char *new,off_t newsize)
|
||||
{
|
||||
off_t i;
|
||||
|
||||
@@ -130,7 +149,7 @@ off_t matchlen(u_char *old,off_t oldsize,u_char *new,off_t newsize)
|
||||
return i;
|
||||
}
|
||||
|
||||
off_t search(off_t *I,u_char *old,off_t oldsize,
|
||||
static off_t search(off_t *I,u_char *old,off_t oldsize,
|
||||
u_char *new,off_t newsize,off_t st,off_t en,off_t *pos)
|
||||
{
|
||||
off_t x,y;
|
||||
@@ -156,7 +175,7 @@ off_t search(off_t *I,u_char *old,off_t oldsize,
|
||||
};
|
||||
}
|
||||
|
||||
void offtout(off_t x,u_char *buf)
|
||||
static void offtout(off_t x,u_char *buf)
|
||||
{
|
||||
off_t y;
|
||||
|
||||
@@ -176,25 +195,23 @@ void offtout(off_t x,u_char *buf)
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int fd,p[2];
|
||||
pid_t pid;
|
||||
int fd;
|
||||
u_char *old,*new;
|
||||
off_t oldsize,newsize;
|
||||
off_t *I,*V;
|
||||
|
||||
off_t scan,pos,len;
|
||||
off_t lastscan,lastpos,lastoffset;
|
||||
off_t oldscore,scsc;
|
||||
|
||||
off_t s,Sf,lenf,Sb,lenb;
|
||||
off_t overlap,Ss,lens;
|
||||
off_t i;
|
||||
|
||||
off_t dblen,eblen;
|
||||
u_char *db,*eb;
|
||||
|
||||
u_char buf[8];
|
||||
u_char header[32];
|
||||
FILE * pf;
|
||||
BZFILE * pfbz2;
|
||||
int bz2err;
|
||||
|
||||
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
|
||||
@@ -228,8 +245,9 @@ int main(int argc,char *argv[])
|
||||
dblen=0;
|
||||
eblen=0;
|
||||
|
||||
if((fd=open(argv[3],O_CREAT|O_TRUNC|O_WRONLY,0666))<0)
|
||||
err(1,"%s",argv[3]);
|
||||
/* Create the patch file */
|
||||
if ((pf = fopen(argv[3], "w")) == NULL)
|
||||
err(1, "%s", argv[3]);
|
||||
|
||||
/* Header is
|
||||
0 8 "BSDIFF40"
|
||||
@@ -242,20 +260,15 @@ int main(int argc,char *argv[])
|
||||
?? ?? Bzip2ed diff block
|
||||
?? ?? Bzip2ed extra block */
|
||||
memcpy(header,"BSDIFF40",8);
|
||||
memset(header+8,0,24);
|
||||
if(write(fd,header,32)!=32) err(1,"%s",argv[3]);
|
||||
|
||||
if((pipe(p)==-1) || ((pid=fork())==-1)) err(1,NULL);
|
||||
if(pid==0) {
|
||||
if((close(0)==-1) || (close(1)==-1) || (dup2(fd,1)==-1) ||
|
||||
(dup2(p[0],0)==-1) || (close(fd)==-1) ||
|
||||
(close(p[0])==-1) || (close(p[1])==-1))
|
||||
err(1,NULL);
|
||||
execl(BZIP2,BZIP2,"-zc",NULL);
|
||||
err(1,"%s",BZIP2);
|
||||
};
|
||||
if(close(p[0])==-1) err(1,NULL);
|
||||
offtout(0, header + 8);
|
||||
offtout(0, header + 16);
|
||||
offtout(newsize, header + 24);
|
||||
if (fwrite(header, 32, 1, pf) != 1)
|
||||
err(1, "fwrite(%s)", argv[3]);
|
||||
|
||||
/* Compute the differences, writing ctrl as we go */
|
||||
if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL)
|
||||
errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err);
|
||||
scan=0;len=0;
|
||||
lastscan=0;lastpos=0;lastoffset=0;
|
||||
while(scan<newsize) {
|
||||
@@ -319,62 +332,68 @@ int main(int argc,char *argv[])
|
||||
eblen+=(scan-lenb)-(lastscan+lenf);
|
||||
|
||||
offtout(lenf,buf);
|
||||
if(write(p[1],buf,8)!=8) err(1,NULL);
|
||||
BZ2_bzWrite(&bz2err, pfbz2, buf, 8);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
|
||||
|
||||
offtout((scan-lenb)-(lastscan+lenf),buf);
|
||||
if(write(p[1],buf,8)!=8) err(1,NULL);
|
||||
BZ2_bzWrite(&bz2err, pfbz2, buf, 8);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
|
||||
|
||||
offtout((pos-lenb)-(lastpos+lenf),buf);
|
||||
if(write(p[1],buf,8)!=8) err(1,NULL);
|
||||
BZ2_bzWrite(&bz2err, pfbz2, buf, 8);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
|
||||
|
||||
lastscan=scan-lenb;
|
||||
lastpos=pos-lenb;
|
||||
lastoffset=pos-scan;
|
||||
};
|
||||
};
|
||||
BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err);
|
||||
|
||||
if((close(p[1])==-1) || (waitpid(pid,NULL,0)!=pid)) err(1,NULL);
|
||||
/* Compute size of compressed ctrl data */
|
||||
if ((len = ftello(pf)) == -1)
|
||||
err(1, "ftello");
|
||||
offtout(len-32, header + 8);
|
||||
|
||||
if((len=lseek(fd,0,SEEK_END))==-1) err(1,"%s",argv[3]);
|
||||
offtout(len-32,buf);
|
||||
if((lseek(fd,8,SEEK_SET)!=8) || (write(fd,buf,8)!=8))
|
||||
err(1,"%s",argv[3]);
|
||||
offtout(newsize,buf);
|
||||
if((lseek(fd,24,SEEK_SET)!=24) || (write(fd,buf,8)!=8))
|
||||
err(1,"%s",argv[3]);
|
||||
/* Write compressed diff data */
|
||||
if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL)
|
||||
errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err);
|
||||
BZ2_bzWrite(&bz2err, pfbz2, db, dblen);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
|
||||
BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err);
|
||||
|
||||
if(lseek(fd,0,SEEK_END)==-1) err(1,"%s",argv[3]);
|
||||
if((pipe(p)==-1) || ((pid=fork())==-1)) err(1,NULL);
|
||||
if(pid==0) {
|
||||
if((close(0)==-1) || (close(1)==-1) || (dup2(fd,1)==-1) ||
|
||||
(dup2(p[0],0)==-1) || (close(fd)==-1) ||
|
||||
(close(p[0])==-1) || (close(p[1])==-1))
|
||||
err(1,NULL);
|
||||
execl(BZIP2,BZIP2,"-zc",NULL);
|
||||
err(1,"%s",BZIP2);
|
||||
};
|
||||
if(close(p[0])==-1) err(1,NULL);
|
||||
if(write(p[1],db,dblen)!=dblen) err(1,NULL);
|
||||
if((close(p[1])==-1) || (waitpid(pid,NULL,0)!=pid)) err(1,NULL);
|
||||
/* Compute size of compressed diff data */
|
||||
if ((newsize = ftello(pf)) == -1)
|
||||
err(1, "ftello");
|
||||
offtout(newsize - len, header + 16);
|
||||
|
||||
if((newsize=lseek(fd,0,SEEK_END))==-1) err(1,"%s",argv[3]);
|
||||
offtout(newsize-len,buf);
|
||||
if((lseek(fd,16,SEEK_SET)!=16) || (write(fd,buf,8)!=8))
|
||||
err(1,"%s",argv[3]);
|
||||
/* Write compressed extra data */
|
||||
if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL)
|
||||
errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err);
|
||||
BZ2_bzWrite(&bz2err, pfbz2, eb, eblen);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
|
||||
BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL);
|
||||
if (bz2err != BZ_OK)
|
||||
errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err);
|
||||
|
||||
if(lseek(fd,0,SEEK_END)==-1) err(1,"%s",argv[3]);
|
||||
if((pipe(p)==-1) || ((pid=fork())==-1)) err(1,NULL);
|
||||
if(pid==0) {
|
||||
if((close(0)==-1) || (close(1)==-1) || (dup2(fd,1)==-1) ||
|
||||
(dup2(p[0],0)==-1) || (close(fd)==-1) ||
|
||||
(close(p[0])==-1) || (close(p[1])==-1))
|
||||
err(1,NULL);
|
||||
execl(BZIP2,BZIP2,"-zc",NULL);
|
||||
err(1,"%s",BZIP2);
|
||||
};
|
||||
if(close(p[0])==-1) err(1,NULL);
|
||||
if(write(p[1],eb,eblen)!=eblen) err(1,NULL);
|
||||
if((close(p[1])==-1) || (waitpid(pid,NULL,0)!=pid)) err(1,NULL);
|
||||
if(close(fd)==-1) err(1,"%s",argv[3]);
|
||||
/* Seek to the beginning, write the header, and close the file */
|
||||
if (fseeko(pf, 0, SEEK_SET))
|
||||
err(1, "fseeko");
|
||||
if (fwrite(header, 32, 1, pf) != 1)
|
||||
err(1, "fwrite(%s)", argv[3]);
|
||||
if (fclose(pf))
|
||||
err(1, "fclose");
|
||||
|
||||
/* Free the memory we used */
|
||||
free(db);
|
||||
free(eb);
|
||||
free(I);
|
||||
59
src/bsdiff-4.3/bspatch.1
Normal file
59
src/bsdiff-4.3/bspatch.1
Normal file
@@ -0,0 +1,59 @@
|
||||
.\"-
|
||||
.\" Copyright 2003-2005 Colin Percival
|
||||
.\" All rights reserved
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted providing that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.1,v 1.1 2005/08/06 01:59:06 cperciva Exp $
|
||||
.\"
|
||||
.Dd May 18, 2003
|
||||
.Dt BSPATCH 1
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
.Nm bspatch
|
||||
.Nd apply a patch built with bsdiff(1)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ao Ar oldfile Ac Ao Ar newfile Ac Ao Ar patchfile Ac
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
generates
|
||||
.Ao Ar newfile Ac
|
||||
from
|
||||
.Ao Ar oldfile Ac
|
||||
and
|
||||
.Ao Ar patchfile Ac
|
||||
where
|
||||
.Ao Ar patchfile Ac
|
||||
is a binary patch built by bsdiff(1).
|
||||
.Pp
|
||||
.Nm
|
||||
uses memory equal to the size of
|
||||
.Ao Ar oldfile Ac
|
||||
plus the size of
|
||||
.Ao Ar newfile Ac ,
|
||||
but can tolerate a very small working set without a dramatic loss
|
||||
of performance.
|
||||
.Sh SEE ALSO
|
||||
.Xr bsdiff 1
|
||||
.Sh AUTHORS
|
||||
.An Colin Percival Aq cperciva@freebsd.org
|
||||
223
src/bsdiff-4.3/bspatch.c
Normal file
223
src/bsdiff-4.3/bspatch.c
Normal file
@@ -0,0 +1,223 @@
|
||||
/*-
|
||||
* Copyright 2003-2005 Colin Percival
|
||||
* All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted providing that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
__FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $");
|
||||
#endif
|
||||
|
||||
#include <bzlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static off_t offtin(u_char *buf)
|
||||
{
|
||||
off_t y;
|
||||
|
||||
y=buf[7]&0x7F;
|
||||
y=y*256;y+=buf[6];
|
||||
y=y*256;y+=buf[5];
|
||||
y=y*256;y+=buf[4];
|
||||
y=y*256;y+=buf[3];
|
||||
y=y*256;y+=buf[2];
|
||||
y=y*256;y+=buf[1];
|
||||
y=y*256;y+=buf[0];
|
||||
|
||||
if(buf[7]&0x80) y=-y;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
void writeFull(const char * name, int fd,
|
||||
const unsigned char * buf, size_t count)
|
||||
{
|
||||
while (count) {
|
||||
ssize_t res = write(fd, (char *) buf, count);
|
||||
if (res == -1) {
|
||||
if (errno == EINTR) continue;
|
||||
err(1,"writing to %s",name);
|
||||
}
|
||||
count -= res;
|
||||
buf += res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char * argv[])
|
||||
{
|
||||
FILE * f, * cpf, * dpf, * epf;
|
||||
BZFILE * cpfbz2, * dpfbz2, * epfbz2;
|
||||
int cbz2err, dbz2err, ebz2err;
|
||||
int fd;
|
||||
ssize_t oldsize,newsize;
|
||||
ssize_t bzctrllen,bzdatalen;
|
||||
u_char header[32],buf[8];
|
||||
u_char *old, *new;
|
||||
off_t oldpos,newpos;
|
||||
off_t ctrl[3];
|
||||
off_t lenread;
|
||||
off_t i;
|
||||
|
||||
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
|
||||
/* Open patch file */
|
||||
if ((f = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
|
||||
/*
|
||||
File format:
|
||||
0 8 "BSDIFF40"
|
||||
8 8 X
|
||||
16 8 Y
|
||||
24 8 sizeof(newfile)
|
||||
32 X bzip2(control block)
|
||||
32+X Y bzip2(diff block)
|
||||
32+X+Y ??? bzip2(extra block)
|
||||
with control block a set of triples (x,y,z) meaning "add x bytes
|
||||
from oldfile to x bytes from the diff block; copy y bytes from the
|
||||
extra block; seek forwards in oldfile by z bytes".
|
||||
*/
|
||||
|
||||
/* Read header */
|
||||
if (fread(header, 1, 32, f) < 32) {
|
||||
if (feof(f))
|
||||
errx(1, "Corrupt patch\n");
|
||||
err(1, "fread(%s)", argv[3]);
|
||||
}
|
||||
|
||||
/* Check for appropriate magic */
|
||||
if (memcmp(header, "BSDIFF40", 8) != 0)
|
||||
errx(1, "Corrupt patch\n");
|
||||
|
||||
/* Read lengths from header */
|
||||
bzctrllen=offtin(header+8);
|
||||
bzdatalen=offtin(header+16);
|
||||
newsize=offtin(header+24);
|
||||
if((bzctrllen<0) || (bzdatalen<0) || (newsize<0))
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
/* Close patch file and re-open it via libbzip2 at the right places */
|
||||
if (fclose(f))
|
||||
err(1, "fclose(%s)", argv[3]);
|
||||
if ((cpf = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
if (fseeko(cpf, 32, SEEK_SET))
|
||||
err(1, "fseeko(%s, %lld)", argv[3],
|
||||
(long long)32);
|
||||
if ((cpfbz2 = BZ2_bzReadOpen(&cbz2err, cpf, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", cbz2err);
|
||||
if ((dpf = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
|
||||
err(1, "fseeko(%s, %lld)", argv[3],
|
||||
(long long)(32 + bzctrllen));
|
||||
if ((dpfbz2 = BZ2_bzReadOpen(&dbz2err, dpf, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", dbz2err);
|
||||
if ((epf = fopen(argv[3], "r")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
|
||||
err(1, "fseeko(%s, %lld)", argv[3],
|
||||
(long long)(32 + bzctrllen + bzdatalen));
|
||||
if ((epfbz2 = BZ2_bzReadOpen(&ebz2err, epf, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err);
|
||||
|
||||
if(((fd=open(argv[1],O_RDONLY,0))<0) ||
|
||||
((oldsize=lseek(fd,0,SEEK_END))==-1) ||
|
||||
((old=malloc(oldsize+1))==NULL) ||
|
||||
(lseek(fd,0,SEEK_SET)!=0) ||
|
||||
(read(fd,old,oldsize)!=oldsize) ||
|
||||
(close(fd)==-1)) err(1,"%s",argv[1]);
|
||||
if((new=malloc(newsize+1))==NULL) err(1,NULL);
|
||||
|
||||
oldpos=0;newpos=0;
|
||||
while(newpos<newsize) {
|
||||
/* Read control data */
|
||||
for(i=0;i<=2;i++) {
|
||||
lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8);
|
||||
if ((lenread < 8) || ((cbz2err != BZ_OK) &&
|
||||
(cbz2err != BZ_STREAM_END)))
|
||||
errx(1, "Corrupt patch\n");
|
||||
ctrl[i]=offtin(buf);
|
||||
};
|
||||
|
||||
/* Sanity-check */
|
||||
if(newpos+ctrl[0]>newsize)
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
/* Read diff string */
|
||||
lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]);
|
||||
if ((lenread < ctrl[0]) ||
|
||||
((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END)))
|
||||
errx(1, "Corrupt patch\n");
|
||||
|
||||
/* Add old data to diff string */
|
||||
for(i=0;i<ctrl[0];i++)
|
||||
if((oldpos+i>=0) && (oldpos+i<oldsize))
|
||||
new[newpos+i]+=old[oldpos+i];
|
||||
|
||||
/* Adjust pointers */
|
||||
newpos+=ctrl[0];
|
||||
oldpos+=ctrl[0];
|
||||
|
||||
/* Sanity-check */
|
||||
if(newpos+ctrl[1]>newsize)
|
||||
errx(1,"Corrupt patch\n");
|
||||
|
||||
/* Read extra string */
|
||||
lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]);
|
||||
if ((lenread < ctrl[1]) ||
|
||||
((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END)))
|
||||
errx(1, "Corrupt patch\n");
|
||||
|
||||
/* Adjust pointers */
|
||||
newpos+=ctrl[1];
|
||||
oldpos+=ctrl[2];
|
||||
};
|
||||
|
||||
/* Clean up the bzip2 reads */
|
||||
BZ2_bzReadClose(&cbz2err, cpfbz2);
|
||||
BZ2_bzReadClose(&dbz2err, dpfbz2);
|
||||
BZ2_bzReadClose(&ebz2err, epfbz2);
|
||||
if (fclose(cpf) || fclose(dpf) || fclose(epf))
|
||||
err(1, "fclose(%s)", argv[3]);
|
||||
|
||||
/* Write the new file */
|
||||
if((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0666))<0)
|
||||
err(1,"%s",argv[2]);
|
||||
writeFull(argv[2], fd, new, newsize);
|
||||
if(close(fd)==-1)
|
||||
err(1,"%s",argv[2]);
|
||||
|
||||
free(new);
|
||||
free(old);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,35 +1,49 @@
|
||||
noinst_LIBRARIES = libexpr.a
|
||||
pkglib_LTLIBRARIES = libexpr.la
|
||||
|
||||
libexpr_a_SOURCES = nixexpr.cc nixexpr.hh parser.cc parser.hh \
|
||||
eval.cc eval.hh primops.cc \
|
||||
lexer-tab.c lexer-tab.h parser-tab.c parser-tab.h \
|
||||
nixexpr-ast.hh
|
||||
libexpr_la_SOURCES = \
|
||||
nixexpr.cc eval.cc primops.cc lexer-tab.cc parser-tab.cc \
|
||||
get-drvs.cc attr-path.cc expr-to-xml.cc
|
||||
|
||||
pkginclude_HEADERS = \
|
||||
nixexpr.hh eval.hh parser.hh lexer-tab.hh parser-tab.hh \
|
||||
get-drvs.hh attr-path.hh expr-to-xml.hh
|
||||
|
||||
libexpr_la_LIBADD = ../libutil/libutil.la ../libstore/libstore.la \
|
||||
../boost/format/libformat.la
|
||||
|
||||
BUILT_SOURCES = nixexpr-ast.cc nixexpr-ast.hh \
|
||||
parser-tab.hh lexer-tab.hh parser-tab.cc lexer-tab.cc
|
||||
|
||||
EXTRA_DIST = lexer.l parser.y nixexpr-ast.def nixexpr-ast.cc
|
||||
|
||||
AM_CXXFLAGS = \
|
||||
-I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore
|
||||
-I$(srcdir)/.. ${bdb_include} ${aterm_include} \
|
||||
-I$(srcdir)/../libutil -I$(srcdir)/../libstore
|
||||
AM_CFLAGS = \
|
||||
${aterm_include}
|
||||
|
||||
|
||||
# Parser generation.
|
||||
|
||||
parser.o: parser-tab.h lexer-tab.h
|
||||
parser-tab.cc parser-tab.hh: parser.y
|
||||
$(bison) -v -o parser-tab.cc $(srcdir)/parser.y -d
|
||||
|
||||
parser-tab.c parser-tab.h: parser.y
|
||||
$(bison) -v -o parser-tab.c parser.y -d
|
||||
|
||||
lexer-tab.c lexer-tab.h: lexer.l
|
||||
$(flex) --outfile lexer-tab.c --header-file=lexer-tab.h lexer.l
|
||||
lexer-tab.cc lexer-tab.hh: lexer.l
|
||||
$(flex) --outfile lexer-tab.cc --header-file=lexer-tab.hh $(srcdir)/lexer.l
|
||||
|
||||
|
||||
# ATerm helper function generation.
|
||||
|
||||
nixexpr-ast.cc nixexpr-ast.hh: ../aterm-helper.pl nixexpr-ast.def
|
||||
$(perl) ../aterm-helper.pl nixexpr-ast.hh nixexpr-ast.cc < nixexpr-ast.def
|
||||
|
||||
nixexpr.cc nixexpr.hh: nixexpr-ast.hh
|
||||
$(perl) $(srcdir)/../aterm-helper.pl nixexpr-ast.hh nixexpr-ast.cc < $(srcdir)/nixexpr-ast.def
|
||||
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
|
||||
# SDF stuff (not built by default).
|
||||
nix.tbl: nix.sdf
|
||||
sdf2table -m Nix -s -i nix.sdf -o nix.tbl
|
||||
|
||||
test.ast: test.nix nix.tbl
|
||||
sglri -p nix.tbl -i test.nix -o test.ast
|
||||
|
||||
82
src/libexpr/attr-path.cc
Normal file
82
src/libexpr/attr-path.cc
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "attr-path.hh"
|
||||
#include "nixexpr-ast.hh"
|
||||
#include "util.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
bool isAttrs(EvalState & state, Expr e, ATermMap & attrs)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
ATermList dummy;
|
||||
if (!matchAttrs(e, dummy)) return false;
|
||||
queryAllAttrs(e, attrs, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Expr findAlongAttrPath(EvalState & state, const string & attrPath,
|
||||
const ATermMap & autoArgs, Expr e)
|
||||
{
|
||||
Strings tokens = tokenizeString(attrPath, ".");
|
||||
|
||||
Error attrError =
|
||||
Error(format("attribute selection path `%1%' does not match expression") % attrPath);
|
||||
|
||||
string curPath;
|
||||
|
||||
for (Strings::iterator i = tokens.begin(); i != tokens.end(); ++i) {
|
||||
|
||||
if (!curPath.empty()) curPath += ".";
|
||||
curPath += *i;
|
||||
|
||||
/* Is *i an index (integer) or a normal attribute name? */
|
||||
enum { apAttr, apIndex } apType = apAttr;
|
||||
string attr = *i;
|
||||
int attrIndex = -1;
|
||||
if (string2Int(attr, attrIndex)) apType = apIndex;
|
||||
|
||||
/* Evaluate the expression. */
|
||||
e = evalExpr(state, autoCallFunction(evalExpr(state, e), autoArgs));
|
||||
|
||||
/* It should evaluate to either an attribute set or an
|
||||
expression, according to what is specified in the
|
||||
attrPath. */
|
||||
|
||||
if (apType == apAttr) {
|
||||
|
||||
ATermMap attrs(128);
|
||||
|
||||
if (!isAttrs(state, e, attrs))
|
||||
throw TypeError(
|
||||
format("the expression selected by the selection path `%1%' should be an attribute set but is %2%")
|
||||
% curPath % showType(e));
|
||||
|
||||
e = attrs.get(toATerm(attr));
|
||||
if (!e)
|
||||
throw Error(format("attribute `%1%' in selection path `%2%' not found") % attr % curPath);
|
||||
|
||||
}
|
||||
|
||||
else if (apType == apIndex) {
|
||||
|
||||
ATermList es;
|
||||
if (!matchList(e, es))
|
||||
throw TypeError(
|
||||
format("the expression selected by the selection path `%1%' should be a list but is %2%")
|
||||
% curPath % showType(e));
|
||||
|
||||
e = ATelementAt(es, attrIndex);
|
||||
if (!e)
|
||||
throw Error(format("list index %1% in selection path `%2%' not found") % attrIndex % curPath);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
20
src/libexpr/attr-path.hh
Normal file
20
src/libexpr/attr-path.hh
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef __ATTR_PATH_H
|
||||
#define __ATTR_PATH_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "eval.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
Expr findAlongAttrPath(EvalState & state, const string & attrPath,
|
||||
const ATermMap & autoArgs, Expr e);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* !__ATTR_PATH_H */
|
||||
@@ -1,13 +1,17 @@
|
||||
#include "eval.hh"
|
||||
#include "parser.hh"
|
||||
#include "hash.hh"
|
||||
#include "util.hh"
|
||||
#include "store.hh"
|
||||
#include "nixexpr-ast.hh"
|
||||
|
||||
|
||||
EvalState::EvalState()
|
||||
: normalForms(32768, 50)
|
||||
{
|
||||
blackHole = makeBlackHole();
|
||||
namespace nix {
|
||||
|
||||
|
||||
EvalState::EvalState()
|
||||
: normalForms(32768), primOps(128)
|
||||
{
|
||||
nrEvaluated = nrCached = 0;
|
||||
|
||||
initNixExprHelpers();
|
||||
@@ -19,46 +23,84 @@ EvalState::EvalState()
|
||||
void EvalState::addPrimOp(const string & name,
|
||||
unsigned int arity, PrimOp primOp)
|
||||
{
|
||||
primOps.set(name, makePrimOpDef(arity, ATmakeBlob(0, (void *) primOp)));
|
||||
primOps.set(toATerm(name), makePrimOpDef(arity, ATmakeBlob(0, (void *) primOp)));
|
||||
}
|
||||
|
||||
|
||||
/* Substitute an argument set into the body of a function. */
|
||||
static Expr substArgs(Expr body, ATermList formals, Expr arg)
|
||||
static Expr substArgs(EvalState & state,
|
||||
Expr body, ATermList formals, Expr arg)
|
||||
{
|
||||
ATermMap subs;
|
||||
Expr undefined = makeUndefined();
|
||||
unsigned int nrFormals = ATgetLength(formals);
|
||||
ATermMap subs(nrFormals);
|
||||
|
||||
/* Get the actual arguments and put them in the substitution. */
|
||||
ATermMap args(128); /* !!! fix */
|
||||
queryAllAttrs(arg, args);
|
||||
for (ATermMap::const_iterator i = args.begin(); i != args.end(); ++i)
|
||||
subs.set(i->key, i->value);
|
||||
|
||||
/* Get the formal arguments. */
|
||||
ATermVector defsUsed;
|
||||
ATermList recAttrs = ATempty;
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr name, def;
|
||||
if (matchNoDefFormal(*i, name))
|
||||
subs.set(name, undefined);
|
||||
else if (matchDefFormal(*i, name, def))
|
||||
subs.set(name, def);
|
||||
else abort(); /* can't happen */
|
||||
ValidValues valids2;
|
||||
DefaultValue def2;
|
||||
if (!matchFormal(*i, name, valids2, def2)) abort(); /* can't happen */
|
||||
|
||||
Expr value = subs[name];
|
||||
|
||||
if (value == 0) {
|
||||
if (!matchDefaultValue(def2, def)) def = 0;
|
||||
if (def == 0) throw TypeError(format("the argument named `%1%' required by the function is missing")
|
||||
% aterm2String(name));
|
||||
value = def;
|
||||
defsUsed.push_back(name);
|
||||
recAttrs = ATinsert(recAttrs, makeBind(name, def, makeNoPos()));
|
||||
}
|
||||
|
||||
ATermList valids;
|
||||
if (matchValidValues(valids2, valids)) {
|
||||
value = evalExpr(state, value);
|
||||
bool found = false;
|
||||
for (ATermIterator j(valids); j; ++j) {
|
||||
Expr v = evalExpr(state, *j);
|
||||
if (value == v) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) throw TypeError(format("the argument named `%1%' has an illegal value")
|
||||
% aterm2String(name));
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the actual arguments, and check that they match with the
|
||||
formals. */
|
||||
ATermMap args;
|
||||
queryAllAttrs(arg, args);
|
||||
for (ATermIterator i(args.keys()); i; ++i) {
|
||||
Expr key = *i;
|
||||
Expr cur = subs.get(key);
|
||||
if (!cur)
|
||||
throw Error(format("unexpected function argument `%1%'")
|
||||
% aterm2String(key));
|
||||
subs.set(key, args.get(key));
|
||||
/* Make a recursive attribute set out of the (argument-name,
|
||||
value) tuples. This is so that we can support default
|
||||
parameters that refer to each other, e.g. ({x, y ? x + x}: y)
|
||||
{x = "foo";} evaluates to "foofoo". */
|
||||
if (defsUsed.size() != 0) {
|
||||
for (ATermMap::const_iterator i = args.begin(); i != args.end(); ++i)
|
||||
recAttrs = ATinsert(recAttrs, makeBind(i->key, i->value, makeNoPos()));
|
||||
Expr rec = makeRec(recAttrs, ATempty);
|
||||
for (ATermVector::iterator i = defsUsed.begin(); i != defsUsed.end(); ++i)
|
||||
subs.set(*i, makeSelect(rec, *i));
|
||||
}
|
||||
|
||||
/* Check that all arguments are defined. */
|
||||
for (ATermIterator i(subs.keys()); i; ++i)
|
||||
if (subs.get(*i) == undefined)
|
||||
throw Error(format("required function argument `%1%' missing")
|
||||
% aterm2String(*i));
|
||||
|
||||
return substitute(subs, body);
|
||||
if (subs.size() != nrFormals) {
|
||||
/* One or more actual arguments were not declared as formal
|
||||
arguments. Find out which. */
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr name; ATerm d1, d2;
|
||||
if (!matchFormal(*i, name, d1, d2)) abort();
|
||||
subs.remove(name);
|
||||
}
|
||||
throw TypeError(format("the function does not expect an argument named `%1%'")
|
||||
% aterm2String(subs.begin()->key));
|
||||
}
|
||||
|
||||
return substitute(Substitution(0, &subs), body);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +116,7 @@ ATerm expandRec(ATerm e, ATermList rbnds, ATermList nrbnds)
|
||||
Pos pos;
|
||||
|
||||
/* Create the substitution list. */
|
||||
ATermMap subs;
|
||||
ATermMap subs(ATgetLength(rbnds) + ATgetLength(nrbnds));
|
||||
for (ATermIterator i(rbnds); i; ++i) {
|
||||
if (!matchBind(*i, name, e2, pos)) abort(); /* can't happen */
|
||||
subs.set(name, makeSelect(e, name));
|
||||
@@ -84,11 +126,13 @@ ATerm expandRec(ATerm e, ATermList rbnds, ATermList nrbnds)
|
||||
subs.set(name, e2);
|
||||
}
|
||||
|
||||
Substitution subs_(0, &subs);
|
||||
|
||||
/* Create the non-recursive set. */
|
||||
ATermMap as;
|
||||
ATermMap as(ATgetLength(rbnds) + ATgetLength(nrbnds));
|
||||
for (ATermIterator i(rbnds); i; ++i) {
|
||||
if (!matchBind(*i, name, e2, pos)) abort(); /* can't happen */
|
||||
as.set(name, makeAttrRHS(substitute(subs, e2), pos));
|
||||
as.set(name, makeAttrRHS(substitute(subs_, e2), pos));
|
||||
}
|
||||
|
||||
/* Copy the non-recursive bindings. !!! inefficient */
|
||||
@@ -105,7 +149,7 @@ static Expr updateAttrs(Expr e1, Expr e2)
|
||||
{
|
||||
/* Note: e1 and e2 should be in normal form. */
|
||||
|
||||
ATermMap attrs;
|
||||
ATermMap attrs(128); /* !!! */
|
||||
queryAllAttrs(e1, attrs, true);
|
||||
queryAllAttrs(e2, attrs, true);
|
||||
|
||||
@@ -117,7 +161,8 @@ string evalString(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
ATerm s;
|
||||
if (!matchStr(e, s)) throw Error("string expected");
|
||||
if (!matchStr(e, s))
|
||||
throw TypeError(format("value is %1% while a string was expected") % showType(e));
|
||||
return aterm2String(s);
|
||||
}
|
||||
|
||||
@@ -126,17 +171,165 @@ Path evalPath(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
ATerm s;
|
||||
if (!matchPath(e, s)) throw Error("path expected");
|
||||
if (!matchPath(e, s))
|
||||
throw TypeError(format("value is %1% while a path was expected") % showType(e));
|
||||
return aterm2String(s);
|
||||
}
|
||||
|
||||
|
||||
int evalInt(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
int i;
|
||||
if (!matchInt(e, i))
|
||||
throw TypeError(format("value is %1% while an integer was expected") % showType(e));
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
bool evalBool(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
if (e == eTrue) return true;
|
||||
else if (e == eFalse) return false;
|
||||
else throw Error("boolean expected");
|
||||
else throw TypeError(format("value is %1% while a boolean was expected") % showType(e));
|
||||
}
|
||||
|
||||
|
||||
ATermList evalList(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
ATermList list;
|
||||
if (!matchList(e, list))
|
||||
throw TypeError(format("value is %1% while a list was expected") % showType(e));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/* String concatenation and context nodes: in order to allow users to
|
||||
write things like
|
||||
|
||||
"--with-freetype2-library=" + freetype + "/lib"
|
||||
|
||||
where `freetype' is a derivation, we automatically coerce
|
||||
derivations into their output path (e.g.,
|
||||
/nix/store/hashcode-freetype) in concatenations. However, if we do
|
||||
this naively, we could introduce an undeclared dependency: when the
|
||||
string is used in another derivation, that derivation would not
|
||||
have an explicitly dependency on `freetype' in its inputDrvs
|
||||
field. Thus `freetype' would not necessarily be built.
|
||||
|
||||
To prevent this, we wrap the string resulting from the
|
||||
concatenation in a *context node*, like this:
|
||||
|
||||
Context([freetype],
|
||||
Str("--with-freetype2-library=/nix/store/hashcode-freetype/lib"))
|
||||
|
||||
Thus the context is the list of all derivations used in the
|
||||
computation of a value. These contexts are propagated through
|
||||
further concatenations. In processBinding() in primops.cc, context
|
||||
nodes are unwrapped and added to inputDrvs.
|
||||
|
||||
!!! Should the ordering of the context list have a canonical form?
|
||||
|
||||
!!! Contexts are not currently recognised in most places in the
|
||||
evaluator. */
|
||||
|
||||
|
||||
/* Coerce a value to a string, keeping track of contexts. */
|
||||
string coerceToStringWithContext(EvalState & state,
|
||||
ATermList & context, Expr e, bool & isPath)
|
||||
{
|
||||
isPath = false;
|
||||
|
||||
e = evalExpr(state, e);
|
||||
|
||||
ATermList es;
|
||||
ATerm e2;
|
||||
if (matchContext(e, es, e2)) {
|
||||
e = e2;
|
||||
context = ATconcat(es, context);
|
||||
}
|
||||
|
||||
ATerm s;
|
||||
if (matchStr(e, s) || matchUri(e, s))
|
||||
return aterm2String(s);
|
||||
|
||||
if (matchPath(e, s)) {
|
||||
isPath = true;
|
||||
Path path = aterm2String(s);
|
||||
if (isInStore(path)) {
|
||||
context = ATinsert(context, makePath(toATerm(toStorePath(path))));
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
if (matchAttrs(e, es)) {
|
||||
ATermMap attrs(128); /* !!! */
|
||||
queryAllAttrs(e, attrs, false);
|
||||
|
||||
Expr a = attrs.get(toATerm("type"));
|
||||
if (a && evalString(state, a) == "derivation") {
|
||||
a = attrs.get(toATerm("outPath"));
|
||||
if (!a) throw TypeError("output path missing from derivation");
|
||||
isPath = true;
|
||||
context = ATinsert(context, e);
|
||||
return evalPath(state, a);
|
||||
}
|
||||
}
|
||||
|
||||
throw TypeError(format("cannot coerce %1% to a string") % showType(e));
|
||||
}
|
||||
|
||||
|
||||
/* Wrap an expression in a context if the context is not empty. */
|
||||
Expr wrapInContext(ATermList context, Expr e)
|
||||
{
|
||||
return context == ATempty ? e : makeContext(context, e);
|
||||
}
|
||||
|
||||
|
||||
static ATerm concatStrings(EvalState & state, const ATermVector & args)
|
||||
{
|
||||
ATermList context = ATempty;
|
||||
std::ostringstream s;
|
||||
bool isPath = false;
|
||||
|
||||
for (ATermVector::const_iterator i = args.begin(); i != args.end(); ++i) {
|
||||
bool isPath2;
|
||||
s << coerceToStringWithContext(state, context, *i, isPath2);
|
||||
if (i == args.begin()) isPath = isPath2;
|
||||
}
|
||||
|
||||
Expr result = isPath
|
||||
? makePath(toATerm(canonPath(s.str())))
|
||||
: makeStr(toATerm(s.str()));
|
||||
return wrapInContext(context, result);
|
||||
}
|
||||
|
||||
|
||||
Expr autoCallFunction(Expr e, const ATermMap & args)
|
||||
{
|
||||
ATermList formals;
|
||||
ATerm body, pos;
|
||||
|
||||
if (matchFunction(e, formals, body, pos)) {
|
||||
ATermMap actualArgs(128);
|
||||
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr name, def, value; ATerm values, def2;
|
||||
if (!matchFormal(*i, name, values, def2)) abort();
|
||||
if ((value = args.get(name)))
|
||||
actualArgs.set(name, makeAttrRHS(value, makeNoPos()));
|
||||
else if (!matchDefaultValue(def2, def))
|
||||
throw TypeError(format("cannot auto-call a function that has an argument without a default value (`%1%')")
|
||||
% aterm2String(name));
|
||||
}
|
||||
|
||||
e = makeCall(e, makeAttrs(actualArgs));
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +342,6 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
/* Normal forms. */
|
||||
if (sym == symStr ||
|
||||
sym == symPath ||
|
||||
sym == symSubPath ||
|
||||
sym == symUri ||
|
||||
sym == symNull ||
|
||||
sym == symInt ||
|
||||
@@ -158,7 +350,8 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
sym == symFunction1 ||
|
||||
sym == symAttrs ||
|
||||
sym == symList ||
|
||||
sym == symPrimOp)
|
||||
sym == symPrimOp ||
|
||||
sym == symContext)
|
||||
return e;
|
||||
|
||||
/* The `Closed' constructor is just a way to prevent substitutions
|
||||
@@ -171,7 +364,7 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
if (matchVar(e, name)) {
|
||||
ATerm primOp = state.primOps.get(name);
|
||||
if (!primOp)
|
||||
throw Error(format("impossible: undefined variable `%1%'") % name);
|
||||
throw EvalError(format("impossible: undefined variable `%1%'") % aterm2String(name));
|
||||
int arity;
|
||||
ATermBlob fun;
|
||||
if (!matchPrimOpDef(primOp, arity, fun)) abort();
|
||||
@@ -212,25 +405,29 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
else if (matchFunction(e1, formals, e4, pos)) {
|
||||
e2 = evalExpr(state, e2);
|
||||
try {
|
||||
return evalExpr(state, substArgs(e4, formals, e2));
|
||||
return evalExpr(state, substArgs(state, e4, formals, e2));
|
||||
} catch (Error & e) {
|
||||
throw Error(format("while evaluating the function at %1%:\n%2%")
|
||||
% showPos(pos) % e.msg());
|
||||
e.addPrefix(format("while evaluating the function at %1%:\n")
|
||||
% showPos(pos));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
else if (matchFunction1(e1, name, e4, pos)) {
|
||||
try {
|
||||
ATermMap subs;
|
||||
ATermMap subs(1);
|
||||
subs.set(name, e2);
|
||||
return evalExpr(state, substitute(subs, e4));
|
||||
return evalExpr(state, substitute(Substitution(0, &subs), e4));
|
||||
} catch (Error & e) {
|
||||
throw Error(format("while evaluating the function at %1%:\n%2%")
|
||||
% showPos(pos) % e.msg());
|
||||
e.addPrefix(format("while evaluating the function at %1%:\n")
|
||||
% showPos(pos));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
else throw Error("function or primop expected in function call");
|
||||
else throw TypeError(
|
||||
format("the left-hand side of the function call is neither a function nor a primop (built-in operation) but %1%")
|
||||
% showType(e1));
|
||||
}
|
||||
|
||||
/* Attribute selection. */
|
||||
@@ -238,12 +435,13 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
ATerm pos;
|
||||
string s1 = aterm2String(name);
|
||||
Expr a = queryAttr(evalExpr(state, e1), s1, pos);
|
||||
if (!a) throw Error(format("attribute `%1%' missing") % s1);
|
||||
if (!a) throw EvalError(format("attribute `%1%' missing") % s1);
|
||||
try {
|
||||
return evalExpr(state, a);
|
||||
} catch (Error & e) {
|
||||
throw Error(format("while evaluating the attribute `%1%' at %2%:\n%3%")
|
||||
% s1 % showPos(pos) % e.msg());
|
||||
e.addPrefix(format("while evaluating the attribute `%1%' at %2%:\n")
|
||||
% s1 % showPos(pos));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,35 +461,41 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
/* Assertions. */
|
||||
if (matchAssert(e, e1, e2, pos)) {
|
||||
if (!evalBool(state, e1))
|
||||
throw Error(format("assertion failed at %1%") % showPos(pos));
|
||||
throw AssertionError(format("assertion failed at %1%") % showPos(pos));
|
||||
return evalExpr(state, e2);
|
||||
}
|
||||
|
||||
/* Withs. */
|
||||
if (matchWith(e, e1, e2, pos)) {
|
||||
ATermMap attrs;
|
||||
ATermMap attrs(128); /* !!! */
|
||||
try {
|
||||
e1 = evalExpr(state, e1);
|
||||
queryAllAttrs(e1, attrs);
|
||||
} catch (Error & e) {
|
||||
throw Error(format("while evaluating the `with' definitions at %1%:\n%2%")
|
||||
% showPos(pos) % e.msg());
|
||||
e.addPrefix(format("while evaluating the `with' definitions at %1%:\n")
|
||||
% showPos(pos));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
e2 = substitute(attrs, e2);
|
||||
e2 = substitute(Substitution(0, &attrs), e2);
|
||||
checkVarDefs(state.primOps, e2);
|
||||
return evalExpr(state, e2);
|
||||
} catch (Error & e) {
|
||||
throw Error(format("while evaluating the `with' body at %1%:\n%2%")
|
||||
% showPos(pos) % e.msg());
|
||||
e.addPrefix(format("while evaluating the `with' body at %1%:\n")
|
||||
% showPos(pos));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/* Generic equality. */
|
||||
/* Generic equality/inequality. Note that the behaviour on
|
||||
composite data (lists, attribute sets) and functions is
|
||||
undefined, since the subterms of those terms are not evaluated.
|
||||
However, we don't want to make (==) strict, because that would
|
||||
make operations like `big_derivation == null' very slow (unless
|
||||
we were to evaluate them side-by-side). */
|
||||
if (matchOpEq(e, e1, e2))
|
||||
return makeBool(evalExpr(state, e1) == evalExpr(state, e2));
|
||||
|
||||
/* Generic inequality. */
|
||||
if (matchOpNEq(e, e1, e2))
|
||||
return makeBool(evalExpr(state, e1) != evalExpr(state, e2));
|
||||
|
||||
@@ -317,23 +521,50 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||
|
||||
/* Attribute existence test (?). */
|
||||
if (matchOpHasAttr(e, e1, name)) {
|
||||
ATermMap attrs;
|
||||
ATermMap attrs(128); /* !!! */
|
||||
queryAllAttrs(evalExpr(state, e1), attrs);
|
||||
return makeBool(attrs.get(name) != 0);
|
||||
}
|
||||
|
||||
/* String or path concatenation. */
|
||||
if (matchOpPlus(e, e1, e2)) {
|
||||
e1 = evalExpr(state, e1);
|
||||
e2 = evalExpr(state, e2);
|
||||
ATerm s1, s2;
|
||||
if (matchStr(e1, s1) && matchStr(e2, s2))
|
||||
return makeStr(toATerm(
|
||||
(string) aterm2String(s1) + (string) aterm2String(s2)));
|
||||
else if (matchPath(e1, s1) && matchPath(e2, s2))
|
||||
return makePath(toATerm(canonPath(
|
||||
(string) aterm2String(s1) + "/" + (string) aterm2String(s2))));
|
||||
else throw Error("wrong argument types in `+' operator");
|
||||
ATermList es = ATempty;
|
||||
if (matchOpPlus(e, e1, e2) || matchConcatStrings(e, es)) {
|
||||
ATermVector args;
|
||||
if (matchOpPlus(e, e1, e2)) {
|
||||
args.push_back(e1);
|
||||
args.push_back(e2);
|
||||
} else
|
||||
for (ATermIterator i(es); i; ++i) args.push_back(*i);
|
||||
|
||||
try {
|
||||
return concatStrings(state, args);
|
||||
} catch (Error & e) {
|
||||
e.addPrefix(format("in a string concatenation:\n"));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/* Backwards compatability: subpath operator (~). */
|
||||
if (matchSubPath(e, e1, e2)) {
|
||||
static bool haveWarned = false;
|
||||
warnOnce(haveWarned, "the subpath operator (~) is deprecated, use string concatenation (+) instead");
|
||||
ATermList context = ATempty;
|
||||
bool dummy;
|
||||
string s1 = coerceToStringWithContext(state, context, e1, dummy);
|
||||
string s2 = coerceToStringWithContext(state, context, e2, dummy);
|
||||
return wrapInContext(context, makePath(toATerm(canonPath(s1 + "/" + s2))));
|
||||
}
|
||||
|
||||
/* List concatenation. */
|
||||
if (matchOpConcat(e, e1, e2)) {
|
||||
try {
|
||||
ATermList l1 = evalList(state, e1);
|
||||
ATermList l2 = evalList(state, e2);
|
||||
return makeList(ATconcat(l1, l2));
|
||||
} catch (Error & e) {
|
||||
e.addPrefix(format("in a list concatenation:\n"));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/* Barf. */
|
||||
@@ -354,15 +585,21 @@ Expr evalExpr(EvalState & state, Expr e)
|
||||
previously evaluated expressions. */
|
||||
Expr nf = state.normalForms.get(e);
|
||||
if (nf) {
|
||||
if (nf == state.blackHole)
|
||||
throw Error("infinite recursion encountered");
|
||||
if (nf == makeBlackHole())
|
||||
throw EvalError("infinite recursion encountered");
|
||||
state.nrCached++;
|
||||
return nf;
|
||||
}
|
||||
|
||||
/* Otherwise, evaluate and memoize. */
|
||||
state.normalForms.set(e, state.blackHole);
|
||||
nf = evalExpr2(state, e);
|
||||
state.normalForms.set(e, makeBlackHole());
|
||||
try {
|
||||
nf = evalExpr2(state, e);
|
||||
} catch (Error & err) {
|
||||
debug("removing black hole");
|
||||
state.normalForms.remove(e);
|
||||
throw;
|
||||
}
|
||||
state.normalForms.set(e, nf);
|
||||
return nf;
|
||||
}
|
||||
@@ -375,15 +612,81 @@ Expr evalFile(EvalState & state, const Path & path)
|
||||
try {
|
||||
return evalExpr(state, e);
|
||||
} catch (Error & e) {
|
||||
throw Error(format("while evaluating the file `%1%':\n%2%")
|
||||
% path % e.msg());
|
||||
e.addPrefix(format("while evaluating the file `%1%':\n")
|
||||
% path);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Expr strictEvalExpr(EvalState & state, Expr e, bool canonicalise)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
|
||||
ATermList as;
|
||||
if (matchAttrs(e, as)) {
|
||||
ATermList as2 = ATempty;
|
||||
for (ATermIterator i(as); i; ++i) {
|
||||
ATerm name; Expr e; ATerm pos;
|
||||
if (!matchBind(*i, name, e, pos)) abort(); /* can't happen */
|
||||
as2 = ATinsert(as2, makeBind(name, strictEvalExpr(state, e, canonicalise),
|
||||
canonicalise ? makeNoPos() : pos));
|
||||
}
|
||||
/* !!! sort attributes if canonicalise == true */
|
||||
return makeAttrs(ATreverse(as2));
|
||||
}
|
||||
|
||||
ATermList es;
|
||||
if (matchList(e, es)) {
|
||||
ATermList es2 = ATempty;
|
||||
for (ATermIterator i(es); i; ++i)
|
||||
es2 = ATinsert(es2, strictEvalExpr(state, *i, canonicalise));
|
||||
return makeList(ATreverse(es2));
|
||||
}
|
||||
|
||||
ATermList formals;
|
||||
ATerm body, pos;
|
||||
if (matchFunction(e, formals, body, pos)) {
|
||||
ATermList formals2 = ATempty;
|
||||
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr name; ValidValues valids; ATerm dummy;
|
||||
if (!matchFormal(*i, name, valids, dummy)) abort();
|
||||
|
||||
ATermList valids2;
|
||||
if (matchValidValues(valids, valids2)) {
|
||||
ATermList valids3 = ATempty;
|
||||
for (ATermIterator j(valids2); j; ++j)
|
||||
valids3 = ATinsert(valids3, strictEvalExpr(state, *j, canonicalise));
|
||||
valids = makeValidValues(ATreverse(valids3));
|
||||
}
|
||||
|
||||
formals2 = ATinsert(formals2, makeFormal(name, valids, dummy));
|
||||
}
|
||||
return makeFunction(ATreverse(formals2), body,
|
||||
canonicalise ? makeNoPos() : pos);
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
/* Yes, this is a really bad idea... */
|
||||
extern "C" {
|
||||
unsigned long AT_calcAllocatedSize();
|
||||
}
|
||||
|
||||
void printEvalStats(EvalState & state)
|
||||
{
|
||||
debug(format("evaluated %1% expressions, %2% cache hits, %3%%% efficiency")
|
||||
bool showStats = getEnv("NIX_SHOW_STATS", "0") != "0";
|
||||
printMsg(showStats ? lvlInfo : lvlDebug,
|
||||
format("evaluated %1% expressions, %2% cache hits, %3%%% efficiency, used %4% ATerm bytes")
|
||||
% state.nrEvaluated % state.nrCached
|
||||
% ((float) state.nrCached / (float) state.nrEvaluated * 100));
|
||||
% ((float) state.nrCached / (float) state.nrEvaluated * 100)
|
||||
% AT_calcAllocatedSize());
|
||||
if (showStats)
|
||||
printATermMapStats();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,12 +4,21 @@
|
||||
#include <map>
|
||||
|
||||
#include "aterm.hh"
|
||||
#include "hash.hh"
|
||||
#include "nixexpr.hh"
|
||||
|
||||
|
||||
typedef map<Path, PathSet> DrvRoots;
|
||||
typedef map<Path, Hash> DrvHashes;
|
||||
namespace nix {
|
||||
|
||||
|
||||
class Hash;
|
||||
|
||||
|
||||
typedef std::map<Path, PathSet> DrvRoots;
|
||||
typedef std::map<Path, Hash> DrvHashes;
|
||||
|
||||
/* Cache for calls to addToStore(); maps source paths to the store
|
||||
paths. */
|
||||
typedef std::map<Path, Path> SrcToStore;
|
||||
|
||||
struct EvalState;
|
||||
|
||||
@@ -24,7 +33,7 @@ struct EvalState
|
||||
ATermMap primOps;
|
||||
DrvRoots drvRoots;
|
||||
DrvHashes drvHashes; /* normalised derivation hashes */
|
||||
Expr blackHole;
|
||||
SrcToStore srcToStore;
|
||||
|
||||
unsigned int nrEvaluated;
|
||||
unsigned int nrCached;
|
||||
@@ -43,12 +52,36 @@ Expr evalExpr(EvalState & state, Expr e);
|
||||
/* Evaluate an expression read from the given file to normal form. */
|
||||
Expr evalFile(EvalState & state, const Path & path);
|
||||
|
||||
/* Evaluate an expression, and recursively evaluate list elements and
|
||||
attributes. If `canonicalise' is true, we remove things like
|
||||
position information and make sure that attribute sets are in
|
||||
sorded order. */
|
||||
Expr strictEvalExpr(EvalState & state, Expr e,
|
||||
bool canonicalise = false);
|
||||
|
||||
/* Specific results. */
|
||||
string evalString(EvalState & state, Expr e);
|
||||
Path evalPath(EvalState & state, Expr e);
|
||||
int evalInt(EvalState & state, Expr e);
|
||||
bool evalBool(EvalState & state, Expr e);
|
||||
ATermList evalList(EvalState & state, Expr e);
|
||||
ATerm coerceToString(Expr e);
|
||||
|
||||
/* Contexts. */
|
||||
string coerceToStringWithContext(EvalState & state,
|
||||
ATermList & context, Expr e, bool & isPath);
|
||||
Expr wrapInContext(ATermList context, Expr e);
|
||||
|
||||
/* Automatically call a function for which each argument has a default
|
||||
value or has a binding in the `args' map. Note: result is a call,
|
||||
not a normal form; it should be evaluated by calling evalExpr(). */
|
||||
Expr autoCallFunction(Expr e, const ATermMap & args);
|
||||
|
||||
/* Print statistics. */
|
||||
void printEvalStats(EvalState & state);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* !__EVAL_H */
|
||||
|
||||
104
src/libexpr/expr-to-xml.cc
Normal file
104
src/libexpr/expr-to-xml.cc
Normal file
@@ -0,0 +1,104 @@
|
||||
#include "expr-to-xml.hh"
|
||||
#include "xml-writer.hh"
|
||||
#include "nixexpr-ast.hh"
|
||||
#include "aterm.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
static XMLAttrs singletonAttrs(const string & name, const string & value)
|
||||
{
|
||||
XMLAttrs attrs;
|
||||
attrs[name] = value;
|
||||
return attrs;
|
||||
}
|
||||
|
||||
|
||||
static void printTermAsXML(Expr e, XMLWriter & doc, ATermList & context)
|
||||
{
|
||||
XMLAttrs attrs;
|
||||
ATerm s;
|
||||
int i;
|
||||
Expr e2;
|
||||
ATermList as, es, formals;
|
||||
ATerm body, pos;
|
||||
|
||||
while (matchContext(e, es, e2)) {
|
||||
e = e2;
|
||||
for (ATermIterator i(es); i; ++i)
|
||||
context = ATinsert(context, *i);
|
||||
}
|
||||
|
||||
if (matchStr(e, s))
|
||||
doc.writeEmptyElement("string", singletonAttrs("value", aterm2String(s)));
|
||||
|
||||
else if (matchPath(e, s))
|
||||
doc.writeEmptyElement("path", singletonAttrs("value", aterm2String(s)));
|
||||
|
||||
else if (matchUri(e, s))
|
||||
doc.writeEmptyElement("uri", singletonAttrs("value", aterm2String(s)));
|
||||
|
||||
else if (matchNull(e))
|
||||
doc.writeEmptyElement("null");
|
||||
|
||||
else if (matchInt(e, i))
|
||||
doc.writeEmptyElement("int", singletonAttrs("value", (format("%1%") % i).str()));
|
||||
|
||||
else if (e == eTrue)
|
||||
doc.writeEmptyElement("bool", singletonAttrs("value", "true"));
|
||||
|
||||
else if (e == eFalse)
|
||||
doc.writeEmptyElement("bool", singletonAttrs("value", "false"));
|
||||
|
||||
else if (matchAttrs(e, as)) {
|
||||
XMLOpenElement _(doc, "attrs");
|
||||
ATermMap attrs(128);
|
||||
queryAllAttrs(e, attrs);
|
||||
StringSet names;
|
||||
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i)
|
||||
names.insert(aterm2String(i->key));
|
||||
for (StringSet::iterator i = names.begin(); i != names.end(); ++i) {
|
||||
XMLOpenElement _(doc, "attr", singletonAttrs("name", *i));
|
||||
printTermAsXML(attrs.get(toATerm(*i)), doc, context);
|
||||
}
|
||||
}
|
||||
|
||||
else if (matchList(e, es)) {
|
||||
XMLOpenElement _(doc, "list");
|
||||
for (ATermIterator i(es); i; ++i)
|
||||
printTermAsXML(*i, doc, context);
|
||||
}
|
||||
|
||||
else if (matchFunction(e, formals, body, pos)) {
|
||||
XMLOpenElement _(doc, "function");
|
||||
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr name; ValidValues valids; ATerm dummy;
|
||||
if (!matchFormal(*i, name, valids, dummy)) abort();
|
||||
XMLOpenElement _(doc, "arg", singletonAttrs("name", aterm2String(name)));
|
||||
|
||||
ATermList valids2;
|
||||
if (matchValidValues(valids, valids2)) {
|
||||
for (ATermIterator j(valids2); j; ++j) {
|
||||
XMLOpenElement _(doc, "value");
|
||||
printTermAsXML(*j, doc, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
doc.writeEmptyElement("unevaluated");
|
||||
}
|
||||
|
||||
|
||||
void printTermAsXML(Expr e, std::ostream & out, ATermList & context)
|
||||
{
|
||||
XMLWriter doc(true, out);
|
||||
XMLOpenElement root(doc, "expr");
|
||||
printTermAsXML(e, doc, context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user