forked from mirrors/pacman
Compare commits
1512 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18c73b0002 | ||
|
|
1995561f56 | ||
|
|
21a881ec68 | ||
|
|
a93e058b68 | ||
|
|
8e8391e17c | ||
|
|
fa9cd98ecf | ||
|
|
31cb210057 | ||
|
|
dbd7d49d31 | ||
|
|
b750d3e7b0 | ||
|
|
fa47dd9615 | ||
|
|
6ebb6fec8b | ||
|
|
3901ca1a6d | ||
|
|
96432ab4ef | ||
|
|
0c320b5a51 | ||
|
|
aac9e7c280 | ||
|
|
ff6f6027f0 | ||
|
|
a479e0300b | ||
|
|
f888283910 | ||
|
|
272e9b355b | ||
|
|
ff1974c6e9 | ||
|
|
40fd8123a2 | ||
|
|
37df0d4f4f | ||
|
|
fc334b4e77 | ||
|
|
6a8b1c4f84 | ||
|
|
38e5a4a54f | ||
|
|
0458572a6e | ||
|
|
c377107346 | ||
|
|
d8d89d8d27 | ||
|
|
7f6d986ac9 | ||
|
|
39fd8bc318 | ||
|
|
20c4928ee1 | ||
|
|
a164c8405a | ||
|
|
541c2470b8 | ||
|
|
287e8d356e | ||
|
|
b6ecb2329b | ||
|
|
1a8c792e8f | ||
|
|
6303d4920c | ||
|
|
db722bb4b1 | ||
|
|
7a9b0e0f06 | ||
|
|
ea216d3f5a | ||
|
|
68701a98af | ||
|
|
3bc3999bd2 | ||
|
|
5a9a570dda | ||
|
|
c40fc6b80d | ||
|
|
7f480ccc0d | ||
|
|
e214b260ef | ||
|
|
c37c9c5dca | ||
|
|
14474a32c9 | ||
|
|
e68e994eb2 | ||
|
|
351942c71b | ||
|
|
115bf1bf9f | ||
|
|
87fbbdc649 | ||
|
|
02945ca7ad | ||
|
|
c46f21af0a | ||
|
|
7d899910c5 | ||
|
|
5eca2fbdf1 | ||
|
|
7b60a639d1 | ||
|
|
110eb314f0 | ||
|
|
834ba4da93 | ||
|
|
b0bb4f9024 | ||
|
|
9cab9807e0 | ||
|
|
c3e72e11b6 | ||
|
|
fd3acff5e6 | ||
|
|
d3b32a68fe | ||
|
|
451f9493f5 | ||
|
|
78e55be0e6 | ||
|
|
32e35d4028 | ||
|
|
bdc1508a06 | ||
|
|
67c0e9cab3 | ||
|
|
b0f9477f01 | ||
|
|
58df372be6 | ||
|
|
f6716ae94a | ||
|
|
b6cada3eed | ||
|
|
b48f718417 | ||
|
|
e47fc2d7c6 | ||
|
|
308aa38a40 | ||
|
|
3707d5bc46 | ||
|
|
40a6c5c5ec | ||
|
|
deed0286ef | ||
|
|
e28c47ade3 | ||
|
|
771c002c98 | ||
|
|
f1ea4c8d24 | ||
|
|
92630c6607 | ||
|
|
656b470163 | ||
|
|
9ae6ee0f09 | ||
|
|
36c570712a | ||
|
|
36df611203 | ||
|
|
21f16fa7ab | ||
|
|
f2023176f6 | ||
|
|
0b6aa428cf | ||
|
|
79f8cfb529 | ||
|
|
d68635e7c2 | ||
|
|
b12be99c89 | ||
|
|
09ce8b446c | ||
|
|
07538b948a | ||
|
|
aafb387455 | ||
|
|
23451e7fa4 | ||
|
|
dcd234ea27 | ||
|
|
1a524fa8b8 | ||
|
|
f45369800a | ||
|
|
5ea4706f57 | ||
|
|
1eccae3d93 | ||
|
|
2d25993d2d | ||
|
|
acd9269478 | ||
|
|
e8f799ba83 | ||
|
|
3149a45bfb | ||
|
|
1fcc496756 | ||
|
|
eefe8c8364 | ||
|
|
ab49bf6fa9 | ||
|
|
2f96764058 | ||
|
|
d4d304cdb7 | ||
|
|
7c14e48776 | ||
|
|
6735807c0f | ||
|
|
cfa7602032 | ||
|
|
00c393d49f | ||
|
|
d1cc1ef6c3 | ||
|
|
62a2e45b12 | ||
|
|
30f338cce6 | ||
|
|
3afe3b6dfb | ||
|
|
1358a4a80f | ||
|
|
0eac60cd9d | ||
|
|
06cbb516c3 | ||
|
|
56721c12ce | ||
|
|
62fc966882 | ||
|
|
942bb9e64a | ||
|
|
da3b934602 | ||
|
|
be9a60a338 | ||
|
|
bb071f4eb2 | ||
|
|
3cf870eda5 | ||
|
|
3865352d23 | ||
|
|
30bb969ace | ||
|
|
e17c4fe611 | ||
|
|
15e143bdfb | ||
|
|
fafa909a2d | ||
|
|
7664a58d4e | ||
|
|
e34fc4eddf | ||
|
|
c12ccbfb2c | ||
|
|
7467fb9e76 | ||
|
|
6b0d4674bb | ||
|
|
1f145bcd1a | ||
|
|
14fd1e63a2 | ||
|
|
09e582b411 | ||
|
|
01c3c7e4f2 | ||
|
|
11e5e86151 | ||
|
|
9320786349 | ||
|
|
c9820ec97b | ||
|
|
d843c86b7b | ||
|
|
021085624e | ||
|
|
ce54715112 | ||
|
|
f8fdce6cb0 | ||
|
|
5dae577a87 | ||
|
|
e17b0446bd | ||
|
|
f892775366 | ||
|
|
35a8cf134b | ||
|
|
d8c4b12c66 | ||
|
|
332dd86912 | ||
|
|
3444146b48 | ||
|
|
87240dae6d | ||
|
|
111e07d0be | ||
|
|
b6ec9019d7 | ||
|
|
b8d01dace8 | ||
|
|
09f9f24331 | ||
|
|
986edb8bd4 | ||
|
|
d6a9436143 | ||
|
|
2d5ec02d7c | ||
|
|
ed1aef7bc5 | ||
|
|
2e1b5c96a6 | ||
|
|
e263cf7231 | ||
|
|
05f2abfba9 | ||
|
|
2dd53e50de | ||
|
|
00fec5e250 | ||
|
|
2a90dbe3a8 | ||
|
|
eed7ba92e8 | ||
|
|
4a72c0964a | ||
|
|
953e0d48d7 | ||
|
|
f2fcf7eeb1 | ||
|
|
1767a569c6 | ||
|
|
fb7e1b4b9b | ||
|
|
b8590ed634 | ||
|
|
4097c98c1e | ||
|
|
ba97a22ce1 | ||
|
|
ce089e1b97 | ||
|
|
ef86da97f5 | ||
|
|
9b876fff09 | ||
|
|
272f7cf25e | ||
|
|
f95080884c | ||
|
|
7f93f0620c | ||
|
|
fe76c353af | ||
|
|
0f24390fe8 | ||
|
|
d6a997ee38 | ||
|
|
27e8f06e03 | ||
|
|
4d291508c2 | ||
|
|
d16a5ae7dd | ||
|
|
6e71922e6c | ||
|
|
a99e7272b8 | ||
|
|
b3d71bf7d0 | ||
|
|
cda7d7847f | ||
|
|
c91bd3dda9 | ||
|
|
61864e1f6f | ||
|
|
32727efc38 | ||
|
|
5699f2c94c | ||
|
|
2a3b5e40bc | ||
|
|
8f711a7181 | ||
|
|
ff96649eeb | ||
|
|
d94346ede2 | ||
|
|
946f4af7f3 | ||
|
|
2c6be06bba | ||
|
|
505ad87e67 | ||
|
|
0de314205f | ||
|
|
36ea02cc48 | ||
|
|
c4332c8091 | ||
|
|
a97e28205a | ||
|
|
51175f31c4 | ||
|
|
e277e838d7 | ||
|
|
b947db040c | ||
|
|
859bdb5b1d | ||
|
|
01403f423a | ||
|
|
b8ab96a270 | ||
|
|
bf46e04614 | ||
|
|
5c46ba14f7 | ||
|
|
e068b58507 | ||
|
|
50f446886b | ||
|
|
76735e6519 | ||
|
|
85d0111da8 | ||
|
|
3863e48788 | ||
|
|
c86ff120c8 | ||
|
|
01c8f39ab8 | ||
|
|
aff3e63c45 | ||
|
|
b40c8e2922 | ||
|
|
c49f198042 | ||
|
|
f65edb7f29 | ||
|
|
a88cb03a58 | ||
|
|
665528d7ba | ||
|
|
5615b71688 | ||
|
|
30f53cfe8d | ||
|
|
cae2bdafec | ||
|
|
8e30a46adb | ||
|
|
9e8af82c97 | ||
|
|
dd26592155 | ||
|
|
57c5afd69c | ||
|
|
0284cf2128 | ||
|
|
33240e87b9 | ||
|
|
25fab402c7 | ||
|
|
6942bba75d | ||
|
|
55bff19b76 | ||
|
|
fe6e90c21f | ||
|
|
9a82cb92a4 | ||
|
|
d0c327df17 | ||
|
|
eda4d9ec00 | ||
|
|
b04a56dbe9 | ||
|
|
0d4dd09993 | ||
|
|
7ce90bb135 | ||
|
|
a9cbd15260 | ||
|
|
3e1bdfa93c | ||
|
|
5f140a62de | ||
|
|
842cbc9ea4 | ||
|
|
d03b57f459 | ||
|
|
281a4c0a4f | ||
|
|
62f5da3779 | ||
|
|
f966f3a834 | ||
|
|
4bc6ed56aa | ||
|
|
d288240426 | ||
|
|
04dc87e012 | ||
|
|
26652768d6 | ||
|
|
46eda12c1b | ||
|
|
e57c3efeaa | ||
|
|
c41edf49be | ||
|
|
08d885fda5 | ||
|
|
351250adb4 | ||
|
|
6ddc115c7f | ||
|
|
df360b791d | ||
|
|
58ee249c86 | ||
|
|
cb7ba4e4e5 | ||
|
|
e0d327462c | ||
|
|
619c165d36 | ||
|
|
2052f29cdb | ||
|
|
0c29eb431a | ||
|
|
d227771464 | ||
|
|
81dd9d3ebc | ||
|
|
fcc09bd7e3 | ||
|
|
c002567d96 | ||
|
|
bd98b93a6e | ||
|
|
eb93955477 | ||
|
|
a7972625e3 | ||
|
|
a58083459b | ||
|
|
735a197fc2 | ||
|
|
34a78d935a | ||
|
|
e3c19569cf | ||
|
|
fbcc427754 | ||
|
|
f2dff08600 | ||
|
|
126f50ab0b | ||
|
|
c78a808c49 | ||
|
|
a611879318 | ||
|
|
5776090055 | ||
|
|
8ac7f7e6e5 | ||
|
|
45146dccbb | ||
|
|
ab9c0814d2 | ||
|
|
6605637b53 | ||
|
|
c7d332a26a | ||
|
|
919bb6c9e0 | ||
|
|
c2a73ba989 | ||
|
|
dbf59a6b14 | ||
|
|
d1d163c5a3 | ||
|
|
ba45cb4590 | ||
|
|
c5f6995aeb | ||
|
|
a5e43b1605 | ||
|
|
580fe21065 | ||
|
|
c00e05992e | ||
|
|
94d3d665f0 | ||
|
|
5f36523af9 | ||
|
|
8f18798d10 | ||
|
|
ed367fe96d | ||
|
|
1ff8118212 | ||
|
|
13a2847aa1 | ||
|
|
d98bacd4ec | ||
|
|
8f3b485517 | ||
|
|
21833d90e2 | ||
|
|
209d0643e5 | ||
|
|
b276a76dc9 | ||
|
|
3030542d10 | ||
|
|
9f96c5433a | ||
|
|
ef977865a1 | ||
|
|
b7015af0fc | ||
|
|
ec136784d4 | ||
|
|
24684a616e | ||
|
|
e22aa23c8f | ||
|
|
3f0d98c124 | ||
|
|
e527699ddd | ||
|
|
695656d252 | ||
|
|
f4e9deb6d7 | ||
|
|
adb10c3ab2 | ||
|
|
f0051a7678 | ||
|
|
fc74ef93b6 | ||
|
|
8e9a69e8f6 | ||
|
|
a44c7b8956 | ||
|
|
889c260cbf | ||
|
|
579533d1a0 | ||
|
|
330951200c | ||
|
|
970ffbb4c7 | ||
|
|
d4bab6f8fc | ||
|
|
622e7fdd4f | ||
|
|
65a96e900d | ||
|
|
6b928fc0bf | ||
|
|
7c06e66c24 | ||
|
|
abefa23341 | ||
|
|
3a9dec1048 | ||
|
|
c78f5fb99a | ||
|
|
d0d8f605d5 | ||
|
|
d5a7dc67d9 | ||
|
|
8791ae0fda | ||
|
|
a03daad073 | ||
|
|
c2cce1f46a | ||
|
|
0e39cf9275 | ||
|
|
a35610beba | ||
|
|
5c8083baa4 | ||
|
|
eedf4f4e63 | ||
|
|
bd08581d2e | ||
|
|
4fb3cfc48f | ||
|
|
a91250b7bb | ||
|
|
a08638edc8 | ||
|
|
592211b6dc | ||
|
|
d901646f7a | ||
|
|
0f3957ab48 | ||
|
|
ce96f39ac9 | ||
|
|
8f2eaa51c2 | ||
|
|
9d0b33fd33 | ||
|
|
30734c9a4a | ||
|
|
a2d7f6f206 | ||
|
|
7237903c66 | ||
|
|
f5059038f2 | ||
|
|
de5f438aef | ||
|
|
73886504d7 | ||
|
|
93718046d7 | ||
|
|
0d5fa576b3 | ||
|
|
8aa7ed5a7e | ||
|
|
6f37ba61ed | ||
|
|
42893e7165 | ||
|
|
feb9889f22 | ||
|
|
ef32aa0219 | ||
|
|
68b50c81c7 | ||
|
|
24d77291da | ||
|
|
5b17d8f27d | ||
|
|
fbcadebcab | ||
|
|
d39248120e | ||
|
|
e464339e3b | ||
|
|
448f78c067 | ||
|
|
5717c7d508 | ||
|
|
149ab6b272 | ||
|
|
4a8e396a58 | ||
|
|
5e61f07735 | ||
|
|
fc32faaa6a | ||
|
|
5b2de3d8ec | ||
|
|
6eedf06fcc | ||
|
|
96e277cfd9 | ||
|
|
0909a72000 | ||
|
|
c56b576f6f | ||
|
|
efbae3cfcb | ||
|
|
522ef5e981 | ||
|
|
b9a531c2d7 | ||
|
|
6cebd4e602 | ||
|
|
d1126db128 | ||
|
|
49176461a6 | ||
|
|
a7dc3875f1 | ||
|
|
5fcb005ebd | ||
|
|
827258f32e | ||
|
|
0ff2a91497 | ||
|
|
05f0a28932 | ||
|
|
bce3c8efc7 | ||
|
|
7d93777231 | ||
|
|
c9179b09db | ||
|
|
3a06a9fa9f | ||
|
|
53b41afbe8 | ||
|
|
fb79d58109 | ||
|
|
46ffd342a4 | ||
|
|
fa933df65b | ||
|
|
67068b64b9 | ||
|
|
73442a7e03 | ||
|
|
1e0e5b2a02 | ||
|
|
dff73a2a69 | ||
|
|
bef19a266b | ||
|
|
283ef6519a | ||
|
|
302188b169 | ||
|
|
c0f58ea9a2 | ||
|
|
960c2cdcf7 | ||
|
|
f2296aab89 | ||
|
|
022ec3dbb7 | ||
|
|
821ff061b1 | ||
|
|
f7895cc188 | ||
|
|
dff06a8170 | ||
|
|
900605912b | ||
|
|
28c662e7a4 | ||
|
|
879fed5098 | ||
|
|
f489e969f0 | ||
|
|
413508c6fa | ||
|
|
af31fd6494 | ||
|
|
541f183cd6 | ||
|
|
d2ff8f4b96 | ||
|
|
fd38319106 | ||
|
|
d201d1f312 | ||
|
|
c2993197ea | ||
|
|
79541193f7 | ||
|
|
e29dde9157 | ||
|
|
31aed1243e | ||
|
|
e344fab3b1 | ||
|
|
fe788ee4a6 | ||
|
|
6d41da4086 | ||
|
|
df15a8c432 | ||
|
|
881bf5c90f | ||
|
|
3739e2c10c | ||
|
|
3e7b90ff69 | ||
|
|
eba521913d | ||
|
|
24d8a15308 | ||
|
|
1cbc3c5c90 | ||
|
|
4e3bd7c137 | ||
|
|
5a25f54757 | ||
|
|
9d3a8efb7b | ||
|
|
a7c4159b16 | ||
|
|
54b63de098 | ||
|
|
38a60f49bd | ||
|
|
693ebbd16b | ||
|
|
0223a028e0 | ||
|
|
d14a98db25 | ||
|
|
a8dcfeccfc | ||
|
|
90c45f7bbe | ||
|
|
9fbf5d9336 | ||
|
|
8d88f0c897 | ||
|
|
a28868eeae | ||
|
|
08e1d4764c | ||
|
|
f04530eb61 | ||
|
|
68d8bfa0b5 | ||
|
|
3de32a0812 | ||
|
|
f27fed14b1 | ||
|
|
298cbf2cb1 | ||
|
|
48589ccc64 | ||
|
|
d896527d21 | ||
|
|
71660f55b2 | ||
|
|
4a487346c5 | ||
|
|
0478dfa1a5 | ||
|
|
ce3f4e7800 | ||
|
|
281bc72534 | ||
|
|
5908992e47 | ||
|
|
c3f5375380 | ||
|
|
b02bda75f1 | ||
|
|
8155571183 | ||
|
|
e7d5803f07 | ||
|
|
ddc4130c97 | ||
|
|
0d6efb35ce | ||
|
|
52118bf0f0 | ||
|
|
ff689b6a38 | ||
|
|
fa4f25626c | ||
|
|
f8d7cd6b26 | ||
|
|
e702f56ea6 | ||
|
|
7f5c486666 | ||
|
|
a835599496 | ||
|
|
68dcabdfbe | ||
|
|
60de8ec932 | ||
|
|
686b8c1463 | ||
|
|
1a9db4cac7 | ||
|
|
9ebb596805 | ||
|
|
fcb4f0264f | ||
|
|
3d8be4291c | ||
|
|
622326bb37 | ||
|
|
68dff73463 | ||
|
|
5a3aae02fe | ||
|
|
41724cbcde | ||
|
|
96a1255ead | ||
|
|
c11bf581a3 | ||
|
|
081e6a8360 | ||
|
|
0ea52e3a4f | ||
|
|
8b23aa172f | ||
|
|
d7c98d4e45 | ||
|
|
21d5dedfdd | ||
|
|
630e7508ee | ||
|
|
71330a4310 | ||
|
|
c6a94a8d22 | ||
|
|
6f4f9c1b66 | ||
|
|
07a9effdd0 | ||
|
|
708f186f98 | ||
|
|
226c137245 | ||
|
|
2222e9f8df | ||
|
|
67d71ea932 | ||
|
|
c2cf6a14cf | ||
|
|
6c00ca8f23 | ||
|
|
59c47aaf52 | ||
|
|
d7dccd5419 | ||
|
|
3e4d2c3aa6 | ||
|
|
f5f107674b | ||
|
|
1b93a116e7 | ||
|
|
70418e48f6 | ||
|
|
c7a37d039b | ||
|
|
cd042640c6 | ||
|
|
13748ca052 | ||
|
|
34229c5625 | ||
|
|
7fc50d7950 | ||
|
|
dc817a2061 | ||
|
|
09aae4b7a5 | ||
|
|
c71fe7db42 | ||
|
|
0e96532096 | ||
|
|
f258ffab25 | ||
|
|
95145d4c52 | ||
|
|
3c8816f74b | ||
|
|
892266277e | ||
|
|
2ee186506c | ||
|
|
1c59b9e881 | ||
|
|
2e5e3739a1 | ||
|
|
84b999823b | ||
|
|
c355d2a3b7 | ||
|
|
6e31ddf42e | ||
|
|
8fbc91e693 | ||
|
|
fe7b77cd8a | ||
|
|
ea7696b441 | ||
|
|
6297248087 | ||
|
|
5f5b6f16af | ||
|
|
f9c70d3140 | ||
|
|
d978039cf0 | ||
|
|
d73d055c6f | ||
|
|
b886362282 | ||
|
|
ac5c2fd09b | ||
|
|
8163beb622 | ||
|
|
88f139ab4e | ||
|
|
b00d911331 | ||
|
|
982018bf74 | ||
|
|
93def410b8 | ||
|
|
9a56830164 | ||
|
|
3012c0e091 | ||
|
|
b79193a37e | ||
|
|
a338778028 | ||
|
|
d58f398312 | ||
|
|
c80e04a151 | ||
|
|
a3b1585b7b | ||
|
|
a66f8dbbb1 | ||
|
|
10aba2fd53 | ||
|
|
46b170a26e | ||
|
|
5bf3ba1ca8 | ||
|
|
f60db581a7 | ||
|
|
a8a6eed9e8 | ||
|
|
d8d5d48270 | ||
|
|
5cddcc901b | ||
|
|
3739fe9913 | ||
|
|
756e49259d | ||
|
|
0ac96d94ec | ||
|
|
844d82fad8 | ||
|
|
ccea1b5576 | ||
|
|
2710b256cc | ||
|
|
5dffef787d | ||
|
|
fe1e3471f4 | ||
|
|
3064f8d08d | ||
|
|
80f7c1707c | ||
|
|
ae73d75660 | ||
|
|
3cd237dec3 | ||
|
|
52c3f871db | ||
|
|
f948cb25bb | ||
|
|
9ab6bfad22 | ||
|
|
ac722c9327 | ||
|
|
c1fc00508e | ||
|
|
0e7ba6bddd | ||
|
|
eada558e12 | ||
|
|
c6f0fc27ed | ||
|
|
d44e509933 | ||
|
|
d32f6daa66 | ||
|
|
5752e276fb | ||
|
|
a6ace987a9 | ||
|
|
3a85f83840 | ||
|
|
df842e11cf | ||
|
|
25cd6c2e8d | ||
|
|
f03f09011f | ||
|
|
10b0acfc20 | ||
|
|
07b2ba251f | ||
|
|
df833f6c64 | ||
|
|
7f02f7cb9f | ||
|
|
364ebf4e16 | ||
|
|
2ce444ee10 | ||
|
|
79987c92cb | ||
|
|
64c3255b0e | ||
|
|
590606a5d7 | ||
|
|
ccbef232c9 | ||
|
|
df99495b82 | ||
|
|
d485c0370f | ||
|
|
9528c36452 | ||
|
|
f9fa822ccb | ||
|
|
ac9dde072c | ||
|
|
6b6eb6345b | ||
|
|
eb6af031ec | ||
|
|
4f80993933 | ||
|
|
2a6f3f0652 | ||
|
|
8a6bbed98e | ||
|
|
90aca75cb9 | ||
|
|
753599b504 | ||
|
|
652762488a | ||
|
|
6995aed9ae | ||
|
|
7608dd74d7 | ||
|
|
88254d762d | ||
|
|
7965345d43 | ||
|
|
21abae98cb | ||
|
|
98ee520907 | ||
|
|
526806e7ac | ||
|
|
bf7c3eb17f | ||
|
|
cdbb90aceb | ||
|
|
ad4efa539d | ||
|
|
f6c7de77ed | ||
|
|
a36ff9404b | ||
|
|
1aa1d00248 | ||
|
|
be2f43191d | ||
|
|
2f4ee4341d | ||
|
|
69b3a811a1 | ||
|
|
d39b1dbe62 | ||
|
|
67700b926a | ||
|
|
e4be3e06af | ||
|
|
e5dce888c0 | ||
|
|
087be2f1fb | ||
|
|
6f0ffb2386 | ||
|
|
5fe41df8a9 | ||
|
|
22331fdadb | ||
|
|
65d43fbb84 | ||
|
|
a4e3fd1847 | ||
|
|
de5473c026 | ||
|
|
eee61a0bbc | ||
|
|
7ea0a115db | ||
|
|
1a00ee5c27 | ||
|
|
d85421ec62 | ||
|
|
afb61bb22a | ||
|
|
27bc2f7eb8 | ||
|
|
0eadc99240 | ||
|
|
8b3f5f0ce6 | ||
|
|
ce9bb994f8 | ||
|
|
0c3f502064 | ||
|
|
a12ed63545 | ||
|
|
afc37c58c7 | ||
|
|
335627d72d | ||
|
|
a6cca6e456 | ||
|
|
9fe27b068a | ||
|
|
05ff276eef | ||
|
|
66c6d288fd | ||
|
|
b805fe58ae | ||
|
|
a2c9cbdbdc | ||
|
|
b8b8c78627 | ||
|
|
51f9e5e40a | ||
|
|
444ff95641 | ||
|
|
e612eb6ba2 | ||
|
|
926dfe5827 | ||
|
|
03f35b1432 | ||
|
|
f2c9e51eb0 | ||
|
|
82443e0059 | ||
|
|
93862bd7cb | ||
|
|
6c8f817040 | ||
|
|
96b34308fe | ||
|
|
8a8dfc9d55 | ||
|
|
d2dbb04a9a | ||
|
|
be266b4364 | ||
|
|
120cd312e4 | ||
|
|
4d2ec3751c | ||
|
|
564352c4a2 | ||
|
|
9c34dfd908 | ||
|
|
c2999619d2 | ||
|
|
966c815881 | ||
|
|
5d5070f47d | ||
|
|
fb310fc01e | ||
|
|
77023978c5 | ||
|
|
77e84bea71 | ||
|
|
0199a7ee71 | ||
|
|
88706168f2 | ||
|
|
7ae15768e5 | ||
|
|
e09253d15b | ||
|
|
db756ed931 | ||
|
|
133a39e2bb | ||
|
|
3f7cc83e0d | ||
|
|
361a25c086 | ||
|
|
fff6d9dc2e | ||
|
|
7f0f319a3e | ||
|
|
0bc961a8be | ||
|
|
21caf8730f | ||
|
|
748bc8ebd4 | ||
|
|
013fc9a795 | ||
|
|
1000c0bd2e | ||
|
|
6ed7d001f6 | ||
|
|
c6095e1032 | ||
|
|
3758ccbb52 | ||
|
|
6c635d76a0 | ||
|
|
c7e4d10df3 | ||
|
|
2020e6297b | ||
|
|
2c2596177d | ||
|
|
3d67d9b16c | ||
|
|
5ffc1ad3cd | ||
|
|
4281a1a7f2 | ||
|
|
f9582c7df2 | ||
|
|
2cabe336eb | ||
|
|
da5fb3ee4f | ||
|
|
e3ac806262 | ||
|
|
c7d8601e12 | ||
|
|
ab3c6f01f5 | ||
|
|
72bc947cbb | ||
|
|
3dc87851cc | ||
|
|
14ab02e289 | ||
|
|
471b1fa543 | ||
|
|
caea098c21 | ||
|
|
35bbc96b99 | ||
|
|
302310c5aa | ||
|
|
4828d9ef7c | ||
|
|
6e312220ec | ||
|
|
3bc8c28ce3 | ||
|
|
145103aacc | ||
|
|
35dc9b0314 | ||
|
|
cf0d619670 | ||
|
|
5e03941ee5 | ||
|
|
f15c8d4616 | ||
|
|
aea22ac2fd | ||
|
|
9282a4a909 | ||
|
|
f77d73af4b | ||
|
|
ba14bd7728 | ||
|
|
8db120c260 | ||
|
|
a0acf8b509 | ||
|
|
a131c468f7 | ||
|
|
d7a20d9c41 | ||
|
|
42042723a8 | ||
|
|
44a57c890b | ||
|
|
8e7652f1af | ||
|
|
20392c0a02 | ||
|
|
2071286770 | ||
|
|
7f14f185a2 | ||
|
|
20aa17c276 | ||
|
|
86d4b8a3aa | ||
|
|
7cead800c5 | ||
|
|
5bea2c08a3 | ||
|
|
0f834c93c7 | ||
|
|
e76b3374d8 | ||
|
|
802b1a6f2f | ||
|
|
cfb86fed7c | ||
|
|
38ac020f51 | ||
|
|
9c13a6c364 | ||
|
|
03470c51ca | ||
|
|
ece8f6fb0b | ||
|
|
e6efd1932b | ||
|
|
c07aef0d6e | ||
|
|
72883e3bcb | ||
|
|
6bfca2fd14 | ||
|
|
ef37168770 | ||
|
|
481014e944 | ||
|
|
f4809dcc9c | ||
|
|
338c6546ff | ||
|
|
6685822e57 | ||
|
|
44cddb351b | ||
|
|
6cd8d6bd05 | ||
|
|
90a06b1cf0 | ||
|
|
ccf7c31f52 | ||
|
|
419c4a2afa | ||
|
|
65e7682638 | ||
|
|
259cb3aad4 | ||
|
|
9516d5afe6 | ||
|
|
5d0734861f | ||
|
|
9424197b42 | ||
|
|
ed9d459ee2 | ||
|
|
922448a9bf | ||
|
|
9d4448dc7f | ||
|
|
9505c594fd | ||
|
|
1df3b91931 | ||
|
|
08ee4059b5 | ||
|
|
95cb4b6874 | ||
|
|
d0d6c58c05 | ||
|
|
bc24c002fe | ||
|
|
b4317a740a | ||
|
|
19e07eb8e8 | ||
|
|
8ff3b87066 | ||
|
|
0da96abc90 | ||
|
|
b7db46d610 | ||
|
|
90e3e026d1 | ||
|
|
12b55958d8 | ||
|
|
902dfe5900 | ||
|
|
f53d9bab0e | ||
|
|
a2cd48960e | ||
|
|
cd5b029e93 | ||
|
|
43e16b373b | ||
|
|
cb1d4195bf | ||
|
|
2e7c569950 | ||
|
|
814cd7aee1 | ||
|
|
2f19072632 | ||
|
|
845f21207c | ||
|
|
0845b2f13c | ||
|
|
5dbd00faf7 | ||
|
|
c88ac86292 | ||
|
|
f53d2ac471 | ||
|
|
6e1b1aea59 | ||
|
|
b53aa87ea9 | ||
|
|
cb07265851 | ||
|
|
545eac145d | ||
|
|
b9dd8ce233 | ||
|
|
65c1f06be5 | ||
|
|
5b27e78ba0 | ||
|
|
594621cbeb | ||
|
|
1e51b81c63 | ||
|
|
7ddb645bd7 | ||
|
|
a05757f984 | ||
|
|
20ba3cfe4e | ||
|
|
82522dd8c1 | ||
|
|
92f0775e76 | ||
|
|
7dae79e7b9 | ||
|
|
bdd8e92ff6 | ||
|
|
6f97842ab2 | ||
|
|
8a55b79363 | ||
|
|
bba234a92e | ||
|
|
600782853a | ||
|
|
14a93b2e43 | ||
|
|
7bb9c4098b | ||
|
|
e8806748ec | ||
|
|
619d1fcf7f | ||
|
|
6d00025c18 | ||
|
|
3cf0ee98c0 | ||
|
|
68200676d2 | ||
|
|
d7675e393f | ||
|
|
ee43e75ed2 | ||
|
|
839bb56269 | ||
|
|
f16c7a4343 | ||
|
|
4fa6f262a6 | ||
|
|
8152077f6d | ||
|
|
aba58e95ab | ||
|
|
e8db103122 | ||
|
|
b2dcacb5aa | ||
|
|
a5ef0e072a | ||
|
|
ac37e92449 | ||
|
|
44359218ea | ||
|
|
bc83ff76c6 | ||
|
|
4eb1469765 | ||
|
|
cfc4c24db2 | ||
|
|
bf9249e929 | ||
|
|
4cadee4f08 | ||
|
|
fc29d0c990 | ||
|
|
9a0122982c | ||
|
|
433c52bb91 | ||
|
|
78e92b1d02 | ||
|
|
05533b8b11 | ||
|
|
00c26338de | ||
|
|
684047a764 | ||
|
|
e65d82afa1 | ||
|
|
734aa1ce59 | ||
|
|
4e643a3dd7 | ||
|
|
08c535e262 | ||
|
|
8fdab1e1f0 | ||
|
|
b9c6b41387 | ||
|
|
04c31828b6 | ||
|
|
44272ca0c8 | ||
|
|
3a6ed11428 | ||
|
|
9b086d8b9e | ||
|
|
fb1936bc19 | ||
|
|
2f0fc0decb | ||
|
|
5753c12e7b | ||
|
|
7f3a20612e | ||
|
|
fb97d325a5 | ||
|
|
2013d06266 | ||
|
|
a8ddc7618f | ||
|
|
597118ddd7 | ||
|
|
6fa5f2075a | ||
|
|
30c4d53ce5 | ||
|
|
1d19f0896c | ||
|
|
ca6ef852f9 | ||
|
|
4b21504ffc | ||
|
|
cf669eda9c | ||
|
|
1c4596b4be | ||
|
|
344ced22c3 | ||
|
|
60b6cde637 | ||
|
|
5d15bb68f7 | ||
|
|
45f90de0eb | ||
|
|
bfd6817112 | ||
|
|
a3ecbec6b5 | ||
|
|
8ebc07744a | ||
|
|
2e043aae36 | ||
|
|
41a55d4eff | ||
|
|
5dc0b80c26 | ||
|
|
104daa16a6 | ||
|
|
caa0f2205a | ||
|
|
68c10690ea | ||
|
|
8d7764abae | ||
|
|
6092dda177 | ||
|
|
e72cce352a | ||
|
|
621aa26e26 | ||
|
|
b312c820c8 | ||
|
|
617e7d512f | ||
|
|
c72b4543b6 | ||
|
|
be7266155f | ||
|
|
a21d1f99b8 | ||
|
|
6af163dd79 | ||
|
|
a89eae99f6 | ||
|
|
6d2930cc5a | ||
|
|
21fa09349b | ||
|
|
68813ca986 | ||
|
|
8c8fa2d82c | ||
|
|
8bbaf045b9 | ||
|
|
01f9ae63e7 | ||
|
|
02acf65ef3 | ||
|
|
b3a5535360 | ||
|
|
f250b034b4 | ||
|
|
ef500b44ce | ||
|
|
04d5c4294a | ||
|
|
aa579b8438 | ||
|
|
19b8b63885 | ||
|
|
e61ab1536f | ||
|
|
13b281d743 | ||
|
|
9af9c0f328 | ||
|
|
f4ecc908ec | ||
|
|
c520d38451 | ||
|
|
1b4135ca5d | ||
|
|
6360fe0100 | ||
|
|
30e2496775 | ||
|
|
35b9dfc380 | ||
|
|
c301d6aa25 | ||
|
|
0bf340f73c | ||
|
|
882bff36ac | ||
|
|
f89f7e136b | ||
|
|
212ea8a9ed | ||
|
|
a812ad4ea4 | ||
|
|
1bbb34365c | ||
|
|
1d8d932fa6 | ||
|
|
783e710839 | ||
|
|
c5d9b999c7 | ||
|
|
4a582fac2a | ||
|
|
86cd72573b | ||
|
|
80caeabce0 | ||
|
|
250e66e57b | ||
|
|
5e32928a42 | ||
|
|
de44a0f474 | ||
|
|
20017354f7 | ||
|
|
a783f3fbf1 | ||
|
|
f569c4a042 | ||
|
|
ed848b1c54 | ||
|
|
c27904661e | ||
|
|
10584ec8ea | ||
|
|
db3e166503 | ||
|
|
d70465decc | ||
|
|
4b78852f7e | ||
|
|
aefb4e0fa5 | ||
|
|
391952600d | ||
|
|
634304feae | ||
|
|
56fd24ecf8 | ||
|
|
77efd51216 | ||
|
|
93ca155b48 | ||
|
|
101c16b3eb | ||
|
|
52d184dae8 | ||
|
|
63fc93607b | ||
|
|
d15d4f923d | ||
|
|
6fb0c5abd7 | ||
|
|
20ab91fb79 | ||
|
|
afb2f39291 | ||
|
|
e37ecbe8a4 | ||
|
|
22a4616550 | ||
|
|
cb8aee58eb | ||
|
|
3cb4eaef4f | ||
|
|
f385242f99 | ||
|
|
5fcc9ae7f4 | ||
|
|
442b91a5dd | ||
|
|
deff57ce8b | ||
|
|
7370fd595b | ||
|
|
4c27a776bd | ||
|
|
7a8ba5a978 | ||
|
|
7df0d048d1 | ||
|
|
0c614c181e | ||
|
|
91d43ba4b4 | ||
|
|
59b4725bbb | ||
|
|
a556bc57fc | ||
|
|
bbcf96230a | ||
|
|
89685bdb29 | ||
|
|
994804f20e | ||
|
|
f8bb69c1d2 | ||
|
|
9fa18d9a4b | ||
|
|
c8beffa790 | ||
|
|
9519d22df7 | ||
|
|
de97282fbd | ||
|
|
36863b968f | ||
|
|
687f04ab46 | ||
|
|
a864a50bc6 | ||
|
|
d8d9ab8c87 | ||
|
|
4458f71851 | ||
|
|
b4e1365657 | ||
|
|
8c09c19139 | ||
|
|
f09f82ee59 | ||
|
|
b3c67a195f | ||
|
|
2268981ebf | ||
|
|
9d661240fe | ||
|
|
f57f8d3386 | ||
|
|
0268550401 | ||
|
|
a309a016bf | ||
|
|
c8a41b7d6d | ||
|
|
c590ac0997 | ||
|
|
1c4633ea2c | ||
|
|
6c4d702cb1 | ||
|
|
e7daa59f84 | ||
|
|
e515d89969 | ||
|
|
dce7aa8569 | ||
|
|
48b209d612 | ||
|
|
14c1a4423e | ||
|
|
eb1775e485 | ||
|
|
04c2b9d4ed | ||
|
|
ea84819bbb | ||
|
|
34e1413d75 | ||
|
|
14230869e6 | ||
|
|
eab9684837 | ||
|
|
c794661f1e | ||
|
|
8929769902 | ||
|
|
350c3eb6ec | ||
|
|
472e51b975 | ||
|
|
fba5771fa4 | ||
|
|
5bc23bc05d | ||
|
|
3d49d88009 | ||
|
|
e946ee7745 | ||
|
|
21b8a5418d | ||
|
|
708ce1480f | ||
|
|
9804911c5f | ||
|
|
08034ceb17 | ||
|
|
219cb2eaac | ||
|
|
a9f030e84c | ||
|
|
7a3a718c7a | ||
|
|
e3a06961f6 | ||
|
|
d7345da5ba | ||
|
|
b369f71fd6 | ||
|
|
1191303f8b | ||
|
|
e9ca40b56e | ||
|
|
3d6da93093 | ||
|
|
cb7337eb64 | ||
|
|
4da70d800a | ||
|
|
a888f377a5 | ||
|
|
8017b0bb8e | ||
|
|
4ec846f5ac | ||
|
|
94c2830572 | ||
|
|
0501d340cd | ||
|
|
c6bcdf4dc7 | ||
|
|
9f5e1dc8cd | ||
|
|
cebe36c42c | ||
|
|
301fe17f57 | ||
|
|
6f9539aefb | ||
|
|
997a611fa4 | ||
|
|
162e77ffdc | ||
|
|
a2cbccb8c7 | ||
|
|
c850786e43 | ||
|
|
3acc265f9d | ||
|
|
03a63e01a5 | ||
|
|
024012649f | ||
|
|
93d47ebbc0 | ||
|
|
c2dc05c065 | ||
|
|
fb18679a00 | ||
|
|
792ee97645 | ||
|
|
a30bf868ca | ||
|
|
1cc8ad6112 | ||
|
|
8f26bb9052 | ||
|
|
9a7f68317a | ||
|
|
774c252753 | ||
|
|
1b7ff7a636 | ||
|
|
bb9b19a6c4 | ||
|
|
b55f478042 | ||
|
|
a73ad4f0e3 | ||
|
|
b3169a5687 | ||
|
|
e49adbea4c | ||
|
|
f8b689d48e | ||
|
|
c31fcfd833 | ||
|
|
cb03817ee8 | ||
|
|
bd2de5cdf6 | ||
|
|
2f59996c54 | ||
|
|
f4651c49af | ||
|
|
751d37e749 | ||
|
|
08980fb4bc | ||
|
|
cc7f3b705e | ||
|
|
89b0a76b3c | ||
|
|
bd628274cc | ||
|
|
9ae7eb1292 | ||
|
|
818fae320f | ||
|
|
69be73f68c | ||
|
|
78cf32e194 | ||
|
|
59776ef306 | ||
|
|
b373b1d16b | ||
|
|
61c6552862 | ||
|
|
a1f7c83dbf | ||
|
|
6d8a6aef09 | ||
|
|
b99bebc008 | ||
|
|
a50b067470 | ||
|
|
346139298b | ||
|
|
f7192b5958 | ||
|
|
9394f229a0 | ||
|
|
43f9eb1aa9 | ||
|
|
8d4e1e6754 | ||
|
|
314b4462d2 | ||
|
|
c4b9991258 | ||
|
|
2890114600 | ||
|
|
8d33dcb81c | ||
|
|
cd51abf0c8 | ||
|
|
2e431e1cc3 | ||
|
|
a63aeed562 | ||
|
|
2f5d792725 | ||
|
|
1e656c0a6a | ||
|
|
50e3dc02bf | ||
|
|
d1fec15d81 | ||
|
|
d24592cbcd | ||
|
|
fa02a71abd | ||
|
|
91a013a879 | ||
|
|
f1f8f0e1c2 | ||
|
|
30851a24ff | ||
|
|
f0e1846b51 | ||
|
|
d7e502a467 | ||
|
|
927ce2b7a5 | ||
|
|
ce3d70aa99 | ||
|
|
f9be2334f7 | ||
|
|
18452a6c51 | ||
|
|
da933c223e | ||
|
|
242e9e90f4 | ||
|
|
95ea6fb3c1 | ||
|
|
1c47500ea6 | ||
|
|
afac773d19 | ||
|
|
8263bd0cc2 | ||
|
|
d6f62ba22d | ||
|
|
d05882db9e | ||
|
|
0701356260 | ||
|
|
9dbe5c9d1e | ||
|
|
a06d0de104 | ||
|
|
24d7c6a372 | ||
|
|
ece3d3606a | ||
|
|
81853893a5 | ||
|
|
eeb3c6868c | ||
|
|
cfc52dad98 | ||
|
|
49c58ce9db | ||
|
|
08b0fb856d | ||
|
|
6f38cedd8d | ||
|
|
a4100b3847 | ||
|
|
14203d77f4 | ||
|
|
ec928faad3 | ||
|
|
4b183bf9a9 | ||
|
|
7e8f1469c4 | ||
|
|
68e59ecbaf | ||
|
|
91eeee08de | ||
|
|
05d23059fd | ||
|
|
f56d763547 | ||
|
|
8f99f75e6e | ||
|
|
4b4ad18348 | ||
|
|
b0b5dabf1b | ||
|
|
31c7e82a51 | ||
|
|
496b687c3d | ||
|
|
baf5852555 | ||
|
|
8146f6f1c6 | ||
|
|
adc4078b87 | ||
|
|
7865fb9af4 | ||
|
|
3ff7701e89 | ||
|
|
b3033a59e9 | ||
|
|
5b51dbb11e | ||
|
|
e760c4f478 | ||
|
|
081f64aea3 | ||
|
|
0969c2e700 | ||
|
|
56f0cf9d15 | ||
|
|
96e023c7bd | ||
|
|
e27a8c9ae3 | ||
|
|
9451b2e4f2 | ||
|
|
901e4aa5c2 | ||
|
|
282eeadc68 | ||
|
|
9609c0f135 | ||
|
|
6417ac129d | ||
|
|
729651a554 | ||
|
|
232b838a54 | ||
|
|
fb5c5086e1 | ||
|
|
a28b8e187f | ||
|
|
89c2c51964 | ||
|
|
a23fc08758 | ||
|
|
57bd8974c7 | ||
|
|
d8f8a12665 | ||
|
|
57393eb730 | ||
|
|
f201f107db | ||
|
|
72c5a298a3 | ||
|
|
4476598e4e | ||
|
|
9bc799ec7b | ||
|
|
692ea72822 | ||
|
|
fabf7ad6c4 | ||
|
|
8485b7b3a4 | ||
|
|
115dcf0911 | ||
|
|
5949936777 | ||
|
|
a7244e6ab2 | ||
|
|
5d6788b36e | ||
|
|
6ede1a5af0 | ||
|
|
0e0a846135 | ||
|
|
428b2fd8cc | ||
|
|
9a6fd1b021 | ||
|
|
e4b1a97ff2 | ||
|
|
85f5279ec0 | ||
|
|
20a0b8e201 | ||
|
|
3bf9448943 | ||
|
|
cf25884e99 | ||
|
|
9f57921467 | ||
|
|
7bc34ccde3 | ||
|
|
b8e306b73e | ||
|
|
8877c88def | ||
|
|
dfae7bdd52 | ||
|
|
e6fb229534 | ||
|
|
5078ca580e | ||
|
|
310b13a4b7 | ||
|
|
c317222d71 | ||
|
|
67f388c3fc | ||
|
|
5e4882dfe8 | ||
|
|
075b244be2 | ||
|
|
69f00385a9 | ||
|
|
06a4a5bd68 | ||
|
|
22722261cc | ||
|
|
24783e6b6b | ||
|
|
c9550e9655 | ||
|
|
a7ee8f90f9 | ||
|
|
12e804511a | ||
|
|
6d4f235af9 | ||
|
|
441c2dd550 | ||
|
|
27f56304d6 | ||
|
|
501ce943e6 | ||
|
|
b169925c1e | ||
|
|
c1a648137e | ||
|
|
4ebad47ae7 | ||
|
|
ad697d2fd5 | ||
|
|
991dfca90e | ||
|
|
ae9e33ed88 | ||
|
|
b4f2cb53ef | ||
|
|
2b73d45127 | ||
|
|
a8405847e6 | ||
|
|
99be5ab8d1 | ||
|
|
471ed04790 | ||
|
|
5929508198 | ||
|
|
03021713e5 | ||
|
|
ffa3056010 | ||
|
|
37b5972212 | ||
|
|
17e9c9d9ff | ||
|
|
0bf66b097f | ||
|
|
95995ae93f | ||
|
|
8741908276 | ||
|
|
fd8969f678 | ||
|
|
f724fb2702 | ||
|
|
1d9d47d62c | ||
|
|
b196cc43a5 | ||
|
|
d92b0e674d | ||
|
|
30702350fa | ||
|
|
72c0ab5c51 | ||
|
|
8856146d71 | ||
|
|
616b5967b8 | ||
|
|
f7199f36ba | ||
|
|
2122eb1428 | ||
|
|
5f701005ed | ||
|
|
11695bd0d7 | ||
|
|
d534488f2d | ||
|
|
b15fb504a1 | ||
|
|
74eb2f5c61 | ||
|
|
7edb2e5b0d | ||
|
|
d594b6e797 | ||
|
|
5c6809987e | ||
|
|
deec3c8d00 | ||
|
|
d88524ea0e | ||
|
|
29bf6814f7 | ||
|
|
7ff5a917fd | ||
|
|
b9445c12cf | ||
|
|
b8a66d6859 | ||
|
|
2158b8e298 | ||
|
|
fff746052c | ||
|
|
a1dfa8e61f | ||
|
|
89819b3f92 | ||
|
|
c11bdf19b1 | ||
|
|
7313c8546a | ||
|
|
331891ceb1 | ||
|
|
6d737254fc | ||
|
|
0077bfa3a0 | ||
|
|
7fc306cd41 | ||
|
|
1824bc6ee6 | ||
|
|
f827c9572e | ||
|
|
4979157cba | ||
|
|
0fc538fcdb | ||
|
|
512282ca54 | ||
|
|
fcac23763b | ||
|
|
b04d6e751a | ||
|
|
5ae02e6ae7 | ||
|
|
d030d12542 | ||
|
|
0966c33a72 | ||
|
|
fe781e4ce4 | ||
|
|
0669c9bfac | ||
|
|
62b4195c76 | ||
|
|
4a802838cb | ||
|
|
5f0692def8 | ||
|
|
636610432a | ||
|
|
54e1e3e642 | ||
|
|
2cd0a87b3f | ||
|
|
b48f703aa6 | ||
|
|
009f89c4d2 | ||
|
|
b32aa81b5e | ||
|
|
62ee1bfff0 | ||
|
|
1cca4ef764 | ||
|
|
b262ddb2ed | ||
|
|
f30dab4b5a | ||
|
|
c1a5616c26 | ||
|
|
da1c11cc30 | ||
|
|
ad54b28680 | ||
|
|
ae40d1c05b | ||
|
|
9577c07d86 | ||
|
|
c33cabd675 | ||
|
|
20ae871940 | ||
|
|
b9369a747d | ||
|
|
149839c539 | ||
|
|
1d71079c5b | ||
|
|
398d4aff2d | ||
|
|
bf2964dc58 | ||
|
|
fb09d35e6a | ||
|
|
33e3182dbd | ||
|
|
a8ee185413 | ||
|
|
8428367285 | ||
|
|
dd98aa8564 | ||
|
|
a422f6e39c | ||
|
|
f671147282 | ||
|
|
ae5ef3b90f | ||
|
|
584ffa6aef | ||
|
|
d5278ebb3b | ||
|
|
f43805d875 | ||
|
|
8248b4bfb1 | ||
|
|
e80232f24c | ||
|
|
663408532a | ||
|
|
13f24a5bda | ||
|
|
0460038447 | ||
|
|
3c3cb001a4 | ||
|
|
3175faace4 | ||
|
|
e3d35b3274 | ||
|
|
0bfc8adf37 | ||
|
|
1ba0d84da2 | ||
|
|
b49fc504ac | ||
|
|
2edd01a973 | ||
|
|
502645c0e3 | ||
|
|
df5024fd64 | ||
|
|
081ba4816e | ||
|
|
7fccfc7819 | ||
|
|
a13bf74979 | ||
|
|
5389cdf654 | ||
|
|
6b31183576 | ||
|
|
8f902865d9 | ||
|
|
010279e449 | ||
|
|
4e6361642e | ||
|
|
1201c8ce3a | ||
|
|
245efca759 | ||
|
|
27943a04d6 | ||
|
|
6d79ba2db0 | ||
|
|
481c3edc89 | ||
|
|
8fdf08ef78 | ||
|
|
670fadf041 | ||
|
|
701a03dcdb | ||
|
|
30bdf94c2b | ||
|
|
ff9744aa1f | ||
|
|
1b5a851851 | ||
|
|
423820b34c | ||
|
|
7a873a8f12 | ||
|
|
64e1dd64a4 | ||
|
|
c465d9e848 | ||
|
|
5e375aa9d3 | ||
|
|
bf84c23266 | ||
|
|
0d8affeac0 | ||
|
|
c7a81c0b54 | ||
|
|
d685d0220f | ||
|
|
ba70c52945 | ||
|
|
2d991a25ae | ||
|
|
db4258c1fd | ||
|
|
9f56137034 | ||
|
|
ee2bbb39b5 | ||
|
|
4bd0a85095 | ||
|
|
e9a0d35d08 | ||
|
|
4b7f7e2a59 | ||
|
|
57acfced0d | ||
|
|
83c4b2aebb | ||
|
|
bec2ba5b40 | ||
|
|
9441fba124 | ||
|
|
a708c6eadc | ||
|
|
9c7ebe6872 | ||
|
|
4c872594da | ||
|
|
e4a4cf7ce5 | ||
|
|
4004bf9caf | ||
|
|
404e0a0e10 | ||
|
|
b3f4bd9750 | ||
|
|
073bac794d | ||
|
|
0b8abf376f | ||
|
|
ab9187d07d | ||
|
|
0bd6fb3bc2 | ||
|
|
5f17ac8150 | ||
|
|
4b8ada818e | ||
|
|
0d1263af26 | ||
|
|
41c1295559 | ||
|
|
d9b9e60d7d | ||
|
|
3fe43ffa04 | ||
|
|
562442633a | ||
|
|
d140b440a8 | ||
|
|
f8c737d3b6 | ||
|
|
1dfd841e40 | ||
|
|
5f1ccdbc27 | ||
|
|
d1ea16dfd0 | ||
|
|
6104f2e1fb | ||
|
|
1086950c82 | ||
|
|
7995a25d0e | ||
|
|
bf86700369 | ||
|
|
90a48c771d | ||
|
|
f7f43dbb48 | ||
|
|
3d10d460df | ||
|
|
5af076f09f | ||
|
|
2f8fb80ee6 | ||
|
|
7d451b6e6b | ||
|
|
d07001f3ab | ||
|
|
e7a2232934 | ||
|
|
73ab153c44 | ||
|
|
b3e6cf652c | ||
|
|
dae3f9deef | ||
|
|
1f30845e41 | ||
|
|
35135c0a0c | ||
|
|
6e4b020654 | ||
|
|
6820be9ba1 | ||
|
|
804ab37ea6 | ||
|
|
d060e31be3 | ||
|
|
f56f7ff391 | ||
|
|
91b7f288fe | ||
|
|
fc48dc3118 | ||
|
|
51e0303e84 | ||
|
|
2f9f48eddd | ||
|
|
1dfcf1495b | ||
|
|
724ed34ac5 | ||
|
|
74c5bd70cf | ||
|
|
797c190f93 | ||
|
|
3ec45486ff | ||
|
|
266f06866b | ||
|
|
69eb0c8014 | ||
|
|
49197b7492 | ||
|
|
73ac9f7b27 | ||
|
|
d734ebdde2 | ||
|
|
c2dbbd60bc | ||
|
|
4fe7eb66eb | ||
|
|
79945ef7ff | ||
|
|
d75f693155 | ||
|
|
f159203f6f | ||
|
|
81a2a06818 | ||
|
|
3e8ae774bd | ||
|
|
143135e666 | ||
|
|
ca1a187131 | ||
|
|
8cfccf68c1 | ||
|
|
3ad3077d8d | ||
|
|
3a6f62d4c7 | ||
|
|
a3e6a6b822 | ||
|
|
4bd52f3fe4 | ||
|
|
92ab7c33fb | ||
|
|
6b07b5d345 | ||
|
|
a16608c610 | ||
|
|
bfc024eab3 | ||
|
|
77c3cf9790 | ||
|
|
7dc37109b0 | ||
|
|
05d5634958 | ||
|
|
e63366ae5e | ||
|
|
e81dec9b8c | ||
|
|
eca30ed66a | ||
|
|
93a3050ed9 | ||
|
|
5d03a6fd94 | ||
|
|
4fad7855fa | ||
|
|
c492ca840c | ||
|
|
5647f7f512 | ||
|
|
1fc83f4af6 | ||
|
|
9fbb77c91b | ||
|
|
9bfbd73917 | ||
|
|
ea828b5693 | ||
|
|
f432ce41e0 | ||
|
|
88cbee3c24 | ||
|
|
69c6d59bb6 | ||
|
|
8240da6cb3 | ||
|
|
bd43a7f155 | ||
|
|
22c900e7d5 | ||
|
|
6b8f404a33 | ||
|
|
8ca6501ee1 | ||
|
|
9247ddbe8a | ||
|
|
36264a3ab9 | ||
|
|
cbcf542ad2 | ||
|
|
2a7101c049 | ||
|
|
b2914bf0af | ||
|
|
927af790ee | ||
|
|
f6785dcb89 | ||
|
|
38e981fab3 | ||
|
|
521de7ceed | ||
|
|
4f26701793 | ||
|
|
435ec29bc7 | ||
|
|
26f4993e1d | ||
|
|
2630556bde | ||
|
|
112caad838 | ||
|
|
3e133524a5 | ||
|
|
ccc1c73152 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.py diff=python
|
||||||
27
.gitignore
vendored
27
.gitignore
vendored
@@ -1,30 +1,21 @@
|
|||||||
Makefile
|
*~
|
||||||
Makefile.in
|
*.o
|
||||||
mkinstalldirs
|
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
config.guess
|
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
config.status.lineno
|
config.status.lineno
|
||||||
config.rpath
|
|
||||||
config.sub
|
|
||||||
configure
|
configure
|
||||||
configure.lineno
|
configure.lineno
|
||||||
depcomp
|
|
||||||
install-sh
|
|
||||||
libtool
|
|
||||||
ltmain.sh
|
|
||||||
missing
|
|
||||||
stamp-h1
|
|
||||||
|
|
||||||
*.o
|
|
||||||
*~
|
|
||||||
root
|
|
||||||
tags
|
|
||||||
cscope.out
|
|
||||||
cscope.in.out
|
cscope.in.out
|
||||||
|
cscope.out
|
||||||
cscope.po.out
|
cscope.po.out
|
||||||
|
libtool
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
pacman-*.tar.gz
|
pacman-*.tar.gz
|
||||||
|
root
|
||||||
|
stamp-h1
|
||||||
|
tags
|
||||||
|
|||||||
29
.mailmap
Normal file
29
.mailmap
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Aaron Griffin <aaron@archlinux.org> <aaronmgriffin@gmail.com>
|
||||||
|
Allan McRae <allan@archlinux.org> <mcrae_allan@hotmail.com>
|
||||||
|
Allan McRae <allan@archlinux.org> <mcrae_allan at hotmail.com>
|
||||||
|
Allan McRae <allan@archlinux.org> <allan.mcrae@qimr.edu.au>
|
||||||
|
Andres P <aepd87@gmail.com> <stderr@mail.com>
|
||||||
|
Bryan Ischo <bryan@ischo.com> <bji-keyword-pacman.3644cb@www.ischo.com>
|
||||||
|
Christos Nouskas <nous@archlinux.us> <nouskas@gmail.com>
|
||||||
|
Daenyth Blank <daenyth+arch@gmail.com> <Daenyth+Arch@gmail.com>
|
||||||
|
Daenyth Blank <Daenyth+arch@gmail.com> <Daenyth+git@gmail.com>
|
||||||
|
甘露(Gan Lu) <rhythm.gan@gmail.com>
|
||||||
|
Giovanni Scafora <giovanni@archlinux.org> <linuxmania@gmail.com>
|
||||||
|
Jaroslaw Swierczynski <swiergot@gmail.com> <swiergot@juvepoland.com>
|
||||||
|
Jonathan Conder <j@skurvy.no-ip.org> <jonno.conder@gmail.com>
|
||||||
|
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar>
|
||||||
|
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> <jotapesan@gmail.com>
|
||||||
|
Manuel Tortosa <manutortosa@chakra-project.org> <manutortosa@gmail.com>
|
||||||
|
Marc - A. Dahlhaus <mad@wol.de>
|
||||||
|
Matthias Gorissen <matthias@archlinux.de> <siquame@web.de>
|
||||||
|
Laszlo Papp <djszapi@archlinux.us> <djszapi2@gmail.com>
|
||||||
|
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba@petra.hos.u-szeged.hu>
|
||||||
|
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba at bibl.u-szeged.hu>
|
||||||
|
Nezmer <git@nezmer.info> <Nezmer@allurelinux.org>
|
||||||
|
Roman Kyrylych <roman@archlinux.org> <roman.kyrylych@gmail.com>
|
||||||
|
Sebastian Nowicki <sebnow@gmail.com> <xilonmu@gmail.com>
|
||||||
|
Vojtěch Gondžala <vojtech.gondzala@gmail.com> <vogo@seznam.cz>
|
||||||
|
Vojtěch Gondžala <vojtech.gondzala@gmail.com> Vojtech Gondzala <vojtech.gondzala@gmail.com>
|
||||||
|
Xavier Chantry <shiningxc@gmail.com>
|
||||||
|
Xavier Chantry <shiningxc@gmail.com> <chantry.xavier@gmail.com>
|
||||||
|
Xavier Chantry <shiningxc@gmail.com> <xav@chantry.homelinux.org>
|
||||||
13
.tx/config
Normal file
13
.tx/config
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[main]
|
||||||
|
host = https://www.transifex.net
|
||||||
|
|
||||||
|
[archlinux-pacman.libalpm-pot]
|
||||||
|
file_filter = lib/libalpm/po/<lang>.po
|
||||||
|
source_file = lib/libalpm/po/libalpm.pot
|
||||||
|
source_lang = en
|
||||||
|
|
||||||
|
[archlinux-pacman.pacman-pot]
|
||||||
|
file_filter = po/<lang>.po
|
||||||
|
source_file = po/pacman.pot
|
||||||
|
source_lang = en
|
||||||
|
|
||||||
2
AUTHORS
2
AUTHORS
@@ -11,6 +11,6 @@ James Rosten <seinfeld90@gmail.com>
|
|||||||
Roman Kyrylych <Roman.Kyrylych@gmail.com>
|
Roman Kyrylych <Roman.Kyrylych@gmail.com>
|
||||||
Andrew Fyfe <andrew@neptune-one.net>
|
Andrew Fyfe <andrew@neptune-one.net>
|
||||||
Chantry Xavier <shiningxc@gmail.com>
|
Chantry Xavier <shiningxc@gmail.com>
|
||||||
Nagy Gabor <ngaba@petra.hos.u-szeged.hu>
|
Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
||||||
Nathan Jones <nathanj@insightbb.com>
|
Nathan Jones <nathanj@insightbb.com>
|
||||||
Allan McRae <mcrae_allan@hotmail.com>
|
Allan McRae <mcrae_allan@hotmail.com>
|
||||||
|
|||||||
49
HACKING
49
HACKING
@@ -12,10 +12,10 @@ Coding style
|
|||||||
1. All code should be indented with tabs. (Ignore the use of only spaces in
|
1. All code should be indented with tabs. (Ignore the use of only spaces in
|
||||||
this file) By default, source files contain the following VIM modeline:
|
this file) By default, source files contain the following VIM modeline:
|
||||||
+
|
+
|
||||||
[C]
|
[source,C]
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
|
|
||||||
2. When opening new blocks such as 'while', 'if', or 'for', leave the opening
|
2. When opening new blocks such as 'while', 'if', or 'for', leave the opening
|
||||||
brace on the same line as the beginning of the codeblock. The closing brace
|
brace on the same line as the beginning of the codeblock. The closing brace
|
||||||
@@ -24,8 +24,8 @@ code~~~~~~~~~~
|
|||||||
braces, even if it's just a one-line block. This reduces future error when
|
braces, even if it's just a one-line block. This reduces future error when
|
||||||
blocks are expanded beyond one line.
|
blocks are expanded beyond one line.
|
||||||
+
|
+
|
||||||
[C]
|
[source,C]
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
for(lp = list; lp; lp = lp->next) {
|
for(lp = list; lp; lp = lp->next) {
|
||||||
newlist = _alpm_list_add(newlist, strdup(lp->data));
|
newlist = _alpm_list_add(newlist, strdup(lp->data));
|
||||||
}
|
}
|
||||||
@@ -40,14 +40,14 @@ while(it) {
|
|||||||
free(it);
|
free(it);
|
||||||
it = ptr;
|
it = ptr;
|
||||||
}
|
}
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
|
|
||||||
3. When declaring a new function, put the opening and closing braces on their
|
3. When declaring a new function, put the opening and closing braces on their
|
||||||
own line. Also, when declaring a pointer, do not put a space between the
|
own line. Also, when declaring a pointer, do not put a space between the
|
||||||
asterisk and the variable name.
|
asterisk and the variable name.
|
||||||
+
|
+
|
||||||
[C]
|
[source,C]
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
|
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
|
||||||
{
|
{
|
||||||
alpm_list_t *ptr, *lp;
|
alpm_list_t *ptr, *lp;
|
||||||
@@ -58,7 +58,7 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
}
|
}
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
|
|
||||||
4. Comments should be ANSI-C89 compliant. That means no `// Comment` style;
|
4. Comments should be ANSI-C89 compliant. That means no `// Comment` style;
|
||||||
use only `/* Comment */` style.
|
use only `/* Comment */` style.
|
||||||
@@ -101,37 +101,50 @@ Currently our #include usage is in messy shape, but this is no reason to
|
|||||||
continue down this messy path. When adding an include to a file, follow this
|
continue down this messy path. When adding an include to a file, follow this
|
||||||
general pattern, including blank lines:
|
general pattern, including blank lines:
|
||||||
|
|
||||||
[C]
|
[source,C]
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <standardheader.h>
|
#include <standardheader.h>
|
||||||
#include <another.h>
|
#include <another.h>
|
||||||
#include <...>
|
#include <...>
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
|
|
||||||
Follow this with some more headers, depending on whether the file is in libalpm
|
Follow this with some more headers, depending on whether the file is in libalpm
|
||||||
or pacman proper. For libalpm:
|
or pacman proper. For libalpm:
|
||||||
|
|
||||||
[C]
|
[source,C]
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "yourfile.h"
|
#include "yourfile.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "anythingelse.h"
|
#include "anythingelse.h"
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
|
|
||||||
For pacman:
|
For pacman:
|
||||||
|
|
||||||
[C]
|
[source,C]
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
#include <alpm.h>
|
#include <alpm.h>
|
||||||
#include <alpm_list.h>
|
#include <alpm_list.h>
|
||||||
|
|
||||||
/* pacman */
|
/* pacman */
|
||||||
#include "yourfile.h"
|
#include "yourfile.h"
|
||||||
#include "anythingelse.h"
|
#include "anythingelse.h"
|
||||||
code~~~~~~~~~~
|
-------------------------------------------
|
||||||
|
|
||||||
|
GDB and Valgrind Usage
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
When using GDB or valgrind on pacman, you will want to run it on the actual
|
||||||
|
binary rather than the shell script wrapper produced by libtool. The actual
|
||||||
|
binary lives at `src/pacman/.libs/lt-pacman`, and will exist after running
|
||||||
|
`./src/pacman/pacman` at least once.
|
||||||
|
|
||||||
|
For example, to run valgrind:
|
||||||
|
|
||||||
|
./src/pacman/pacman
|
||||||
|
valgrind --leak-check=full -- src/pacman/.libs/lt-pacman -Syu
|
||||||
|
|
||||||
/////
|
/////
|
||||||
vim: set ts=2 sw=2 syntax=asciidoc et:
|
vim: set ts=2 sw=2 syntax=asciidoc et:
|
||||||
|
|||||||
13
INSTALL
13
INSTALL
@@ -10,10 +10,19 @@ unlimited permission to copy, distribute and modify it.
|
|||||||
Basic Installation
|
Basic Installation
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
You will need to build and install two libraries before you can
|
||||||
|
properly build pacman.
|
||||||
|
|
||||||
|
libarchive
|
||||||
|
http://code.google.com/p/libarchive/
|
||||||
|
|
||||||
|
libfetch
|
||||||
|
ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/net/libfetch/README.html
|
||||||
|
|
||||||
Briefly, the shell commands `./configure; make; make install' should
|
Briefly, the shell commands `./configure; make; make install' should
|
||||||
configure, build, and install this package. The following
|
configure, build, and install this package. The following
|
||||||
more-detailed instructions are generic; see the `README' file for
|
instructions are generic. Run `./configure --help` for specific
|
||||||
instructions specific to this package.
|
options.
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
The `configure' shell script attempts to guess correct values for
|
||||||
various system-dependent variables used during compilation. It uses
|
various system-dependent variables used during compilation. It uses
|
||||||
|
|||||||
19
Makefile.am
19
Makefile.am
@@ -1,22 +1,29 @@
|
|||||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po pactest contrib
|
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po test/pacman test/util contrib
|
||||||
if WANT_DOC
|
if WANT_DOC
|
||||||
SUBDIRS += doc
|
SUBDIRS += doc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS = -I m4 --install
|
||||||
|
|
||||||
|
# Make sure we test and build manpages when doing distcheck
|
||||||
|
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
|
||||||
|
|
||||||
# Some files automatically included, so they aren't specified below:
|
# Some files automatically included, so they aren't specified below:
|
||||||
# AUTHORS, COPYING, NEWS, README
|
# AUTHORS, COPYING, NEWS, README
|
||||||
EXTRA_DIST = HACKING
|
EXTRA_DIST = HACKING
|
||||||
|
|
||||||
# Sample makepkg prototype files
|
# Sample makepkg prototype files
|
||||||
pkgdatadir = ${datadir}/${PACKAGE}
|
pkgdatadir = ${datadir}/${PACKAGE}
|
||||||
dist_pkgdata_DATA = PKGBUILD.proto proto.install ChangeLog.proto
|
dist_pkgdata_DATA = PKGBUILD.proto PKGBUILD-split.proto proto.install ChangeLog.proto
|
||||||
|
|
||||||
# run the pactest test suite
|
# run the pactest test suite and vercmp tests
|
||||||
check-local: src/pacman
|
check-local: test/pacman test/util src/pacman src/util
|
||||||
$(PYTHON) $(top_srcdir)/pactest/pactest.py --debug=1 \
|
$(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
|
||||||
--test $(top_srcdir)/pactest/tests/*.py \
|
--test $(top_srcdir)/test/pacman/tests/*.py \
|
||||||
-p $(top_builddir)/src/pacman/pacman
|
-p $(top_builddir)/src/pacman/pacman
|
||||||
rm -rf $(top_builddir)/root
|
rm -rf $(top_builddir)/root
|
||||||
|
$(SH) $(top_srcdir)/test/util/vercmptest.sh \
|
||||||
|
$(top_builddir)/src/util/vercmp
|
||||||
|
|
||||||
# create the pacman DB and cache directories upon install
|
# create the pacman DB and cache directories upon install
|
||||||
install-data-local:
|
install-data-local:
|
||||||
|
|||||||
311
NEWS
311
NEWS
@@ -1,5 +1,316 @@
|
|||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
3.5.2 - ensure we show correct missing dependency info (FS#23424)
|
||||||
|
- pacman usage/--help updates (FS#23433, FS#23369)
|
||||||
|
- ensure stdout/stderr are flushed before prompts (FS#23492)
|
||||||
|
- compile/portability fixes for FreeBSD platform
|
||||||
|
- extensive documentation updates for alpm.h interfaces
|
||||||
|
- fix several missing pm_errno error code returns
|
||||||
|
- makepkg:
|
||||||
|
- simplify log redirection and remove sync (FS#23378)
|
||||||
|
- improve parsing for sanity checks (FS#23524)
|
||||||
|
- avoid use of `tr` to avoid locale and other issues
|
||||||
|
- fix GNU-ism in `su` invocation
|
||||||
|
- bacman: update for new local database format (FS#23641)
|
||||||
|
- extensive translation updates and fixes
|
||||||
|
3.5.1 - don't error on unknown pacman.conf directives (FS#23055)
|
||||||
|
- only read arguments from stdin if '-' is provided as target
|
||||||
|
- fix case with ignore handling in argument list (FS#23342)
|
||||||
|
- don't show group selection prompt with -Sp (FS#23340)
|
||||||
|
- restore old --debug/--verbose behavior (FS#23370)
|
||||||
|
- ensure repo DBs are saved with sane umask (FS#23343)
|
||||||
|
- fix segfault when a repo includes deltas entries (FS#23314)
|
||||||
|
- fix potential data corruption issue on sync DB read
|
||||||
|
- get zsh completion in a working state (FS#23322)
|
||||||
|
- makepkg: improve optdepends extraction (FS#23307)
|
||||||
|
- translations:
|
||||||
|
- de: fix makepkg fatal error (FS#23315)
|
||||||
|
- sr, sr@latin: new Serbian translation
|
||||||
|
- various other translation updates
|
||||||
|
- build system: ensure libtool respects LDFLAGS (FS#23325)
|
||||||
|
3.5.0 - sync DBs read directly from the database tarball
|
||||||
|
(FS#8586, FS#20233)
|
||||||
|
- local DB "depends" file has been merged into the "desc" file
|
||||||
|
- pacman-db-upgrade script provided to update the local
|
||||||
|
database format
|
||||||
|
- sync database extension is .db (without compression suffix)
|
||||||
|
- requires repo-add from pacman-3.4+
|
||||||
|
- package versions can have an 'epoch' value defined that will
|
||||||
|
overrule any version comparison
|
||||||
|
- this replaces the use of the "force" option in allowing for
|
||||||
|
package updates with versions that do not conform to the
|
||||||
|
default version comparison operations
|
||||||
|
- package versions have the format [epoch:]pkgver-pkgrel
|
||||||
|
- check available disk space before installing packages (FS#11639)
|
||||||
|
- enabled by the "CheckSpace" option in pacman.conf
|
||||||
|
- attempt to stop install if we hit an extraction issue
|
||||||
|
(FS#7692, FS#22034)
|
||||||
|
- improved interactive selection for groups/provides
|
||||||
|
(FS#19704, FS#19853)
|
||||||
|
- finer grained control of ignoring dependency resolution
|
||||||
|
- -Sd to ignore dependency versions only
|
||||||
|
- -Sdd to ignore all dependency information
|
||||||
|
- clean-up of --help output (FS#19526)
|
||||||
|
- CleanMethod for package cache cleaning can use both
|
||||||
|
KeepInstalled and KeepCurrent simultaneously
|
||||||
|
- various speed-ups:
|
||||||
|
- improved internal storage of the package cache
|
||||||
|
- faster pkgname/depends searches
|
||||||
|
- use OpenSSL crypto functions if available
|
||||||
|
- makepkg:
|
||||||
|
- add support for running testsuites in a check() function
|
||||||
|
(FS#15145)
|
||||||
|
- controlled by BUILDENV option 'check' in makepkg.conf
|
||||||
|
which may be overridden by --check/--nocheck on the
|
||||||
|
command-line
|
||||||
|
- extract any file bsdtar recognizes
|
||||||
|
- STRIP_DIRS has been removed in favor of stripping all
|
||||||
|
recognized files
|
||||||
|
- improve $srcdir/$pkgdir check to reduce false positives
|
||||||
|
- $pkgname can be used in split package() functions (FS#22174)
|
||||||
|
- added '!buildflags' option to allow unsetting of CFLAGS,
|
||||||
|
CXXFLAGS and LDFLAGS
|
||||||
|
- repo-add: added -f/--files to create files database (FS#11302)
|
||||||
|
- pactree: rewritten in C using libalpm
|
||||||
|
3.4.3 - fix attempted double remove of all files issue during upgrades
|
||||||
|
- respect IgnorePkg/IgnoreGroup for group members (FS#19854)
|
||||||
|
- back out epoch changes; 3.5.X will handle them differently
|
||||||
|
3.4.2 - fix progress bar display with empty packages
|
||||||
|
- make pactest testsuite Python 2.7 compatible
|
||||||
|
- write epoch values in preparation for 3.5.X releases
|
||||||
|
- fix null pointer dereference in architecture check (FS#21668)
|
||||||
|
- documentation: remove unnecessary "|| return 1"
|
||||||
|
- contrib/bacman: update package compression selection
|
||||||
|
- contrib/PKGBUILD.vim: add a few more license options
|
||||||
|
- translations: es, kk, sv, pt, ru updated
|
||||||
|
3.4.1 - fix interaction of --needed and multiple repo groups (FS#20221)
|
||||||
|
- bash completion: small fixes to prevent alias problems
|
||||||
|
- rankmirrors: fix bogus/empty variable assignment (FS#19911)
|
||||||
|
- repo-add: ensure bare DB symlinks are relative (FS#20498)
|
||||||
|
- repo-add: fallback to copy if symlink not permitted (FS#19907)
|
||||||
|
- makepkg:
|
||||||
|
- use absolute path to 'du' to exclude wrapper progs (FS#19932)
|
||||||
|
- ensure $startdir check doesn't stall indefinitely (FS#19975)
|
||||||
|
- fix repackaging with multiple passed packages (FS#20272)
|
||||||
|
- translations:
|
||||||
|
- zh_CN: fix crash when using during install (FS#20188)
|
||||||
|
- sk: new Slovak translation
|
||||||
|
- pt: new European Portuguese translation
|
||||||
|
- other small updates to various translations
|
||||||
|
3.4.0 - new "Architecture" option that will restrict pacman to
|
||||||
|
installing only packages from the given architecture. Can be
|
||||||
|
set to "auto" in which case the output of "uname -m" is used
|
||||||
|
- use "$arch" when specifying a mirror url to automatically
|
||||||
|
select the correct architecture
|
||||||
|
- Installing packages with -U can handle installing
|
||||||
|
dependencies, conflict resolution and replacing packages
|
||||||
|
(FS#3492, FS#5798)
|
||||||
|
- can upgrade the system and install a new package using
|
||||||
|
"pacman -Syu <pkg>" (FS#15581)
|
||||||
|
- new -D/--database operation for modifying package install
|
||||||
|
reasons (FS#12950)
|
||||||
|
- new --print and --print-format options to output information
|
||||||
|
in suitable format for wrapper scripts (FS#14208)
|
||||||
|
- only extract new entries when updating a repo database
|
||||||
|
- show "Required by" in -Sii output (FS#16244)
|
||||||
|
- -U and -R options always ask for confirmation
|
||||||
|
- allow -Qo to perform a functional 'which' (FS#8798)
|
||||||
|
- cache cleaning cleans all directories, not just first
|
||||||
|
- cleanupdelta: new utility to help remove unused deltas from
|
||||||
|
a repo database
|
||||||
|
- bash completion: rewrite for size and performance (FS#16630)
|
||||||
|
- repo-add: handle removing the final package from a repo
|
||||||
|
- rankmirrors: rewrite using bash
|
||||||
|
- vercmp: does not link to libalpm to prevent upgrade issues
|
||||||
|
- makepkg:
|
||||||
|
- automatically aborts on any errors during packaging
|
||||||
|
- changelogs are now included via the "changelog" variable
|
||||||
|
- override pkgver, pkgrel and arch in split packages (FS#15955)
|
||||||
|
- repackaging without a package() function is deprecated
|
||||||
|
- stricter syntax checking for backup and optdepends entries
|
||||||
|
- file stripping options are configurable
|
||||||
|
- New --pkg flag to allow building specific package(s) from
|
||||||
|
split PKGBUILDs (FS#15956)
|
||||||
|
- build() function is now optional (FS#15147)
|
||||||
|
- warn about reference to build root in a package (FS#14751)
|
||||||
|
- configure source package destination with SRCPKGDEST
|
||||||
|
- major internal refactoring of handling tests ("[" to "[[")
|
||||||
|
- contrib/pactree: print reverse dependency tree
|
||||||
|
3.3.3 - correctly check the return code from opendir()
|
||||||
|
- fix possible infinite loop in alpm_list_remove()
|
||||||
|
- makepkg:
|
||||||
|
- quote arrays to preserve spaces in arrays (FS#16871)
|
||||||
|
- allow passing arguments with spaces
|
||||||
|
- adjust preselected option for clearing cache
|
||||||
|
- translations:
|
||||||
|
- zh_CN: fix positional parameter usage in makepkg (FS#16983)
|
||||||
|
- el: fix Y/N response translation (FS#16568)
|
||||||
|
3.3.2 - fix infinite filesize download issue (FS#16359)
|
||||||
|
- fix bogus download size on TotalDownload
|
||||||
|
- documentation updates
|
||||||
|
- small translation updates
|
||||||
|
- repo-add: use size of target files and not symlinks
|
||||||
|
- repo-remove: create empty DB when all packages are removed
|
||||||
|
3.3.1 - use full path to ldconfig when calling in chroot
|
||||||
|
- optimize the check for modified databases during sync
|
||||||
|
- ensure installed libfetch is new enough
|
||||||
|
- have -Q ops return 1 when no package matches (FS#15938)
|
||||||
|
- skip SyncFirst dialog if unnecessary (FS#15810)
|
||||||
|
- misc documentation updates (FS#15870, FS#15984)
|
||||||
|
- testdb: be less verbose during checks
|
||||||
|
- existing translation updates
|
||||||
|
- two new translations: Norwegian, Swedish
|
||||||
|
- makepkg:
|
||||||
|
- add --skipinteg option (FS#15830)
|
||||||
|
- fix .PKGINFO creation with -R option (FS#15851)
|
||||||
|
- always keep symlinks to sources when unpacking
|
||||||
|
3.3.0 - xdelta: many fixes and improvements
|
||||||
|
- new pkgdelta script to create deltas
|
||||||
|
- repo-add can add both deltas and packages to a database
|
||||||
|
- xz archive format supported for packages and databases
|
||||||
|
- in case of unresolvable packages, pacman now asks
|
||||||
|
if they should be skipped instead of aborting
|
||||||
|
- -Suu synchronizes all packages with the version from the
|
||||||
|
repository (including upgrade and downgrade)
|
||||||
|
- replace libdownload dependency by the original libfetch
|
||||||
|
- better support of -q/--quiet flag with -Qo and -Ql
|
||||||
|
- -Sp works without root (FS#8905)
|
||||||
|
- fix a bug where the replacement of a package failed because
|
||||||
|
of a file conflict, and the package was lost (FS#9088)
|
||||||
|
- improved behavior of HoldPkg option (FS#9173)
|
||||||
|
- allow to ignore a package from a group (FS#12059)
|
||||||
|
- search package groups when searching a db (FS#13099)
|
||||||
|
- asciidoc fixes
|
||||||
|
- documentation updates
|
||||||
|
- repo-add: cleanups, improvements and speedup
|
||||||
|
- makepkg:
|
||||||
|
- package splitting support! - see PKGBUILD-split.proto
|
||||||
|
- limit fakeroot usage with addition of package() function
|
||||||
|
- info is handled like man pages and not other documentation
|
||||||
|
- configuration option for man/info page directories
|
||||||
|
- added ability to automatically remove files from package
|
||||||
|
- configuration option for default LDFLAGS
|
||||||
|
- specify alternative configuration file with --config flag
|
||||||
|
- check all integrity checksums provided in PKGBUILD
|
||||||
|
- fix pkgver/pkgrel updating in SCM packages
|
||||||
|
- BUILDSCRIPT option removed from makepkg.conf. Now specified
|
||||||
|
during configure
|
||||||
|
- enforce no ">" or "<" in provides array
|
||||||
|
- package compression autodetection
|
||||||
|
- check PKGBUILD for CRLF line endings
|
||||||
|
- fix reading PKGBUILD from pipe
|
||||||
|
- increase compatibility with BSDs & Mac OSX
|
||||||
|
- contrib
|
||||||
|
- pacdiff - improvements and new -l flag for using locate
|
||||||
|
- pacscripts - print install scripts for a package
|
||||||
|
3.2.2 - log pacsave warnings to pacman.log (FS#12531)
|
||||||
|
- separate local DB creation and writing (FS#12263)
|
||||||
|
- pacman-optimize: rewrite and refresh (FS#11767)
|
||||||
|
- repo-add: use openssl instead of md5sum
|
||||||
|
- simplify doc building process for ease of development
|
||||||
|
- ensure correct handling of syscall interruptions
|
||||||
|
- readd missing newline on -Qi/-Si output (FS#11331)
|
||||||
|
- fix TotalDownload regression (FS#11339)
|
||||||
|
- makepkg:
|
||||||
|
- replace getopt with an internal function
|
||||||
|
- detect incorrect usage of provides (FS#12540)
|
||||||
|
- fix bash substitution to work in older versions
|
||||||
|
- fix updating PKGBUILD and simplify logic for SCM packages
|
||||||
|
- save/restore shell options before/after build() (FS#12344)
|
||||||
|
- documentation updates and asciidoc build fix
|
||||||
|
- existing translation updates
|
||||||
|
3.2.1 - drop special handling of file:// URLs
|
||||||
|
- display optdepends on install and upgrade
|
||||||
|
- fix segfault on x86_64 when using UseSyslog (FS#11096)
|
||||||
|
- fix detection of TotalDownload (FS#11180)
|
||||||
|
- fix "No such file" error during --force installs (FS#11218)
|
||||||
|
- better handling of progressbar when behind a proxy (FS#8725)
|
||||||
|
- repo-add: fix whitespace handling (FS#9171, FS#10630)
|
||||||
|
- repo-add: add optdepends to the sync DB (FS#10630)
|
||||||
|
- makepkg:
|
||||||
|
- allow specifying a download filename (related to FS#11292)
|
||||||
|
- fix download functions with weird URLs (FS#11076)
|
||||||
|
- fix creation of source package with local files (FS#11149)
|
||||||
|
- fix error when sourcing profile scripts (FS#11179)
|
||||||
|
- perform case-insensitive checksum comparison (FS#11283)
|
||||||
|
- documentation and help updates (including fix for FS#11203)
|
||||||
|
- new Ukrainian translation
|
||||||
|
- existing translation updates
|
||||||
|
3.2.0 - removed -A/--add option from pacman frontend
|
||||||
|
- added --asexplicit option
|
||||||
|
- new remove option --unneeded
|
||||||
|
- add -Rss option to remove all dependencies
|
||||||
|
- removed useless -e/--dependsonly option
|
||||||
|
- config options are now case sensitive
|
||||||
|
- added CleanMethod option for variety in cache cleaning
|
||||||
|
- new Turkish translation, all others updated and revised
|
||||||
|
- handle multiple groups in -Ss and -Qs operations
|
||||||
|
- allow -q/--quiet option with -o/--own and -g/--groups options
|
||||||
|
- removed hack for packages with unknown installed size
|
||||||
|
- add SyncFirst option to pacman.conf
|
||||||
|
- support installation of versioned deps : pacman -S "dep>=2.0"
|
||||||
|
- add --enable-git-version configure flag to identify
|
||||||
|
developmental build version
|
||||||
|
- do not duplicate packages in required by list
|
||||||
|
- pacman.static is no longer built
|
||||||
|
- all error messages use pm_fprintf
|
||||||
|
- disable geteuid in cygwin
|
||||||
|
- use off_t type for large file support
|
||||||
|
- add vercmp test script
|
||||||
|
- moved gensync and updatesync to contrib/
|
||||||
|
- rewrote pacsearch script in perl
|
||||||
|
- paclist script to list installed packages from a repo
|
||||||
|
- bacman script to make backup of package from filesystem
|
||||||
|
- combined repo-add and repo-remove into one script
|
||||||
|
- removed --force option from repo-add
|
||||||
|
- add --quiet option to repo-add/repo-remove
|
||||||
|
- update libtool version to 1.5.26
|
||||||
|
- allow disabling of internal download with new configure
|
||||||
|
flag --disable-internal-download
|
||||||
|
- pactest can now check file permissions
|
||||||
|
- add the possibility to mark the pactests known to fail,
|
||||||
|
which allows more informative results of make check
|
||||||
|
- libalpm-specific changes:
|
||||||
|
- use dynamic string allocation in package structure
|
||||||
|
- new functions for manipulating pmdepend_t objects
|
||||||
|
- store replaces and force in local database
|
||||||
|
- moved deptest functionality to backend
|
||||||
|
- add alpm_checkdbconflicts function
|
||||||
|
- fix PM_ERR_CONFLICTING_DEPS handling
|
||||||
|
- cleanup of pmsyncpkg_t
|
||||||
|
- add alpm_sync_newversion function
|
||||||
|
- cleanup of alpm_list code
|
||||||
|
- refactor of download code
|
||||||
|
- download callback API changes
|
||||||
|
- removed test_delta_md5sum and test_pkg_md5sum functions
|
||||||
|
- add _alpm_archive_fgets function to read line-by-line from
|
||||||
|
an archive
|
||||||
|
- read .PKGINFO directly from package file with no temp file
|
||||||
|
- native support for both libdownload and libfetch
|
||||||
|
- rework delta algorithm (we still need script updates)
|
||||||
|
- swap parameters of alpm_pkg_find for consistency with
|
||||||
|
other find functions
|
||||||
|
- swap parameters of PM_TRANS_CONV_INSTALL_IGNOREPKG to make
|
||||||
|
more sense
|
||||||
|
- fix -Rs when removing multiple items in dependency chain
|
||||||
|
- makepkg-specific changes:
|
||||||
|
- support for resuming source downloads
|
||||||
|
- added zipman option
|
||||||
|
- removed -b/--builddeps
|
||||||
|
- various portability fixes for BSD and Mac OS X
|
||||||
|
- check for valid options in PKGBUILD
|
||||||
|
- add --allsource option
|
||||||
|
- remove deprecated --usesudo option
|
||||||
|
- handle spaces in build directory
|
||||||
|
- made keeping docs the default option
|
||||||
|
- use pacman version dep resolving
|
||||||
|
- fix regression in library stripping
|
||||||
|
- make strip paths configurable
|
||||||
|
- MANY other bug fixes and small improvements
|
||||||
|
3.1.4 - various small code cleanups and fixes
|
||||||
|
- small documentation updates
|
||||||
|
- improvements to PKGBUILD.vim
|
||||||
|
- translation updates - ru, zh_CN
|
||||||
3.1.3 - major updates to i18n output in frontend (all UTF-8 characters
|
3.1.3 - major updates to i18n output in frontend (all UTF-8 characters
|
||||||
should now work with varying byte and char widths)
|
should now work with varying byte and char widths)
|
||||||
- new Simplified Chinese translation
|
- new Simplified Chinese translation
|
||||||
|
|||||||
70
PKGBUILD-split.proto
Normal file
70
PKGBUILD-split.proto
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# This is an example of a PKGBUILD for splitting packages. Use this as a
|
||||||
|
# start to creating your own, and remove these comments. For more information,
|
||||||
|
# see 'man PKGBUILD'. NOTE: Please fill out the license field for your package!
|
||||||
|
# If it is unknown, then please put 'unknown'.
|
||||||
|
|
||||||
|
# Maintainer: Your Name <youremail@domain.com>
|
||||||
|
pkgname=('pkg1' 'pkg2')
|
||||||
|
pkgbase=BASE
|
||||||
|
pkgver=VERSION
|
||||||
|
pkgrel=1
|
||||||
|
epoch=
|
||||||
|
pkgdesc=""
|
||||||
|
arch=()
|
||||||
|
url=""
|
||||||
|
license=('GPL')
|
||||||
|
groups=()
|
||||||
|
depends=()
|
||||||
|
makedepends=()
|
||||||
|
checkdepends=()
|
||||||
|
provides=()
|
||||||
|
conflicts=()
|
||||||
|
replaces=()
|
||||||
|
backup=()
|
||||||
|
options=()
|
||||||
|
install=
|
||||||
|
changelog=
|
||||||
|
source=($pkgbase-$pkgver.tar.gz)
|
||||||
|
noextract=()
|
||||||
|
md5sums=() #generate with 'makepkg -g'
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$srcdir/$pkgbase-$pkgver"
|
||||||
|
./configure --prefix=/usr
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
make -k check
|
||||||
|
}
|
||||||
|
|
||||||
|
package_pkg1() {
|
||||||
|
# options and directives that can be overridden
|
||||||
|
pkgver=
|
||||||
|
pkgrel=
|
||||||
|
pkgdesc=""
|
||||||
|
arch=()
|
||||||
|
license=()
|
||||||
|
groups=()
|
||||||
|
depends=()
|
||||||
|
optdepends=()
|
||||||
|
provides=()
|
||||||
|
conflicts=()
|
||||||
|
replaces=()
|
||||||
|
backup=()
|
||||||
|
options=()
|
||||||
|
install=
|
||||||
|
changelog=
|
||||||
|
|
||||||
|
cd "$srcdir/$pkgbase-$pkgver"
|
||||||
|
make DESTDIR="$pkgdir/" install-pkg1
|
||||||
|
}
|
||||||
|
|
||||||
|
package_pkg2() {
|
||||||
|
# options and directives overrides
|
||||||
|
pkgdesc=""
|
||||||
|
|
||||||
|
cd "$srcdir/$pkgbase-$pkgver"
|
||||||
|
make DESTDIR="$pkgdir/" install-pkg2
|
||||||
|
}
|
||||||
@@ -3,10 +3,11 @@
|
|||||||
# NOTE: Please fill out the license field for your package! If it is unknown,
|
# NOTE: Please fill out the license field for your package! If it is unknown,
|
||||||
# then please put 'unknown'.
|
# then please put 'unknown'.
|
||||||
|
|
||||||
# Contributor: Your Name <youremail@domain.com>
|
# Maintainer: Your Name <youremail@domain.com>
|
||||||
pkgname=NAME
|
pkgname=NAME
|
||||||
pkgver=VERSION
|
pkgver=VERSION
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
|
epoch=
|
||||||
pkgdesc=""
|
pkgdesc=""
|
||||||
arch=()
|
arch=()
|
||||||
url=""
|
url=""
|
||||||
@@ -14,22 +15,33 @@ license=('GPL')
|
|||||||
groups=()
|
groups=()
|
||||||
depends=()
|
depends=()
|
||||||
makedepends=()
|
makedepends=()
|
||||||
|
checkdepends=()
|
||||||
|
optdepends=()
|
||||||
provides=()
|
provides=()
|
||||||
conflicts=()
|
conflicts=()
|
||||||
replaces=()
|
replaces=()
|
||||||
backup=()
|
backup=()
|
||||||
options=()
|
options=()
|
||||||
install=
|
install=
|
||||||
|
changelog=
|
||||||
source=($pkgname-$pkgver.tar.gz)
|
source=($pkgname-$pkgver.tar.gz)
|
||||||
noextract=()
|
noextract=()
|
||||||
md5sums=() #generate with 'makepkg -g'
|
md5sums=() #generate with 'makepkg -g'
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir/$pkgname-$pkgver"
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make || return 1
|
make
|
||||||
make DESTDIR="$pkgdir" install
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
make -k check
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
make DESTDIR="$pkgdir/" install
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 et:
|
# vim:set ts=2 sw=2 et:
|
||||||
|
|||||||
278
README
278
README
@@ -2,7 +2,7 @@ ALPM library overview & internals
|
|||||||
=================================
|
=================================
|
||||||
|
|
||||||
Here is a list of the main objects and files from the ALPM (i.e. Arch Linux
|
Here is a list of the main objects and files from the ALPM (i.e. Arch Linux
|
||||||
Package Management) library. This document, whilst not exhaustive, also
|
Package Management) library. This document, while not exhaustive, also
|
||||||
indicates some limitations (on purpose, or sometimes due to its poor design) of
|
indicates some limitations (on purpose, or sometimes due to its poor design) of
|
||||||
the library at the present time.
|
the library at the present time.
|
||||||
|
|
||||||
@@ -13,9 +13,8 @@ the frontend. Lots of structures are of an opaque type and their fields are
|
|||||||
only accessible in read-only mode, through some clearly defined functions.
|
only accessible in read-only mode, through some clearly defined functions.
|
||||||
|
|
||||||
In addition to "alpm.h", the interfaces of "alpm_list.h" have also been made
|
In addition to "alpm.h", the interfaces of "alpm_list.h" have also been made
|
||||||
available to the frontend. It is not a requirement for the frontend to use
|
available to the frontend, for allowing it to manipulate the lists returned by
|
||||||
these list functions; however, it prevents frontends from having to reimplement
|
the backend.
|
||||||
a list data structure.
|
|
||||||
|
|
||||||
Several structures and functions have been renamed compared to pacman 2.9 code.
|
Several structures and functions have been renamed compared to pacman 2.9 code.
|
||||||
This was done at first for the sake of naming scheme consistency, and then
|
This was done at first for the sake of naming scheme consistency, and then
|
||||||
@@ -25,7 +24,7 @@ same name declared in both spaces. To avoid such conflicts, internal function
|
|||||||
names have been prepended with "_alpm_".
|
names have been prepended with "_alpm_".
|
||||||
|
|
||||||
In a general manner, public library functions are named "alpm_<type>_<action>"
|
In a general manner, public library functions are named "alpm_<type>_<action>"
|
||||||
(examples: alpm_trans_commit(), alpm_release(), alpm_pkg_getinfo(), ...).
|
(examples: alpm_trans_commit(), alpm_release(), alpm_pkg_get_name(), ...).
|
||||||
Internal (and thus private) functions should be named "_alpm_XXX" for instance
|
Internal (and thus private) functions should be named "_alpm_XXX" for instance
|
||||||
(examples: _alpm_needbackup(), _alpm_runscriplet(), ...). Functions defined and
|
(examples: _alpm_needbackup(), _alpm_runscriplet(), ...). Functions defined and
|
||||||
used inside a single file should be defined as "static".
|
used inside a single file should be defined as "static".
|
||||||
@@ -33,59 +32,60 @@ used inside a single file should be defined as "static".
|
|||||||
|
|
||||||
[Initialization]
|
[Initialization]
|
||||||
|
|
||||||
alpm_init() is used to initialize library internals and to create
|
alpm_initialize() is used to initialize library internals and to create
|
||||||
a transparent handle object. Before its call, the library can't be used.
|
a transparent handle object. Before its call, the library can't be used.
|
||||||
|
|
||||||
alpm_lib_release() just does the opposite (memory used by the library, and the
|
alpm_release() just does the opposite (memory used by the library, and the
|
||||||
handle is freed). After its call, the library is no longer available.
|
handle is freed). After its call, the library is no longer available.
|
||||||
|
|
||||||
|
|
||||||
[Options]
|
[Options]
|
||||||
|
|
||||||
In the future, the library will not use any configuration file. It will be up
|
The library does not use any configuration file. It is up to the front end to
|
||||||
to the front end to The handle holds a
|
configure the library as needed; the handle holds a number of configuration
|
||||||
number of configuration options instead (IGNOREPKG, SYSLOG usage,
|
options instead.
|
||||||
log file name, registered databases, ...).
|
|
||||||
|
|
||||||
All of the following options have a alpm_option_get_* and alpm_option_set_*
|
All of the following options have a alpm_option_get_* and alpm_option_set_*
|
||||||
function for getting and setting the value. The cannot be set before the
|
function for getting and setting the value. They cannot be set before the
|
||||||
library is initialized.
|
library is initialized.
|
||||||
|
|
||||||
* logcb: The callback function for "log" operations.
|
* logcb: The callback function for "log" operations.
|
||||||
* dlcb: The callback function for download progress.
|
* dlcb: The callback function for download progress of each package.
|
||||||
* logmask: The logging mask for which level of output is sent to the logcb.
|
* fetchcb: Callback for custom download function.
|
||||||
* root: The root directory on which pacman operates (Default: /)
|
* totaldlcb: The callback function for overall download progress.
|
||||||
* dbpath: The base path to pacman's databases (Default: var/lib/pacman)
|
* root: The root directory for pacman to install to (Default: /)
|
||||||
* cachedir: The base path to pacman's download cache (Default: var/cache/pacman)
|
* dbpath: The toplevel database directory (Default: /var/lib/pacman)
|
||||||
* logfile: The base path to pacman's log file (Default: var/log/pacman.log)
|
* logfile: The base path to pacman's log file (Default: /var/log/pacman.log)
|
||||||
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
|
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
|
||||||
* xfercommand: The command to use for downloading instead of pacman's internal
|
|
||||||
downloading functionality.
|
|
||||||
* nopassiveftp: Do not use passive FTP commands for ftp connections.
|
|
||||||
* chomp: No way, easter eggs are secret!
|
|
||||||
* usecolor: Unimplemented, but for the future. You can assume what it means.
|
|
||||||
|
|
||||||
The following options also have a `alpm_option_add_*` function, as the values
|
The following options also have `alpm_option_{add,remove}_*` functions, as the
|
||||||
are list structures (NOTE: The add functions are NOT plural, as they're in
|
values are list structures.
|
||||||
english: alpm_option_get_noupgrades -> alpm_option_add_noupgrade).
|
NOTE: The add and remove functions are NOT plural, as they are in English:
|
||||||
|
alpm_option_{get,set}_noupgrades -> alpm_option_{add,remove}_noupgrade.
|
||||||
|
|
||||||
|
* cachedirs: Paths to pacman's download caches (Default: /var/cache/pacman/pkg)
|
||||||
* noupgrades: Files which will never be touched by pacman (extracted as .pacnew)
|
* noupgrades: Files which will never be touched by pacman (extracted as .pacnew)
|
||||||
* noextracts: Files which will never be extracted at all (no .pacnew file)
|
* noextracts: Files which will never be extracted at all (no .pacnew file)
|
||||||
* ignorepkgs: Packages to ignore when upgrading.
|
* ignorepkgs: Packages to ignore when upgrading.
|
||||||
* holdpkgs: Packages which must be upgraded before continuing.
|
* ignoregrps: Groups to ignore when upgrading.
|
||||||
|
|
||||||
The following options are read-only, having ONLY alpm_option_get_* functions:
|
The following options are read-only, having ONLY alpm_option_get_* functions:
|
||||||
|
|
||||||
|
* lockfile: The file used for locking the database
|
||||||
|
(Default: <dbpath>/db.lck)
|
||||||
* localdb: A pmdb_t structure for the local (installed) database
|
* localdb: A pmdb_t structure for the local (installed) database
|
||||||
* syncdbs: A list of pmdb_t structures to which pacman can sync from.
|
* syncdbs: A list of pmdb_t structures to which pacman can sync from.
|
||||||
|
|
||||||
|
The following options are write-only, having ONLY alpm_option_set_* functions:
|
||||||
|
|
||||||
|
* usedelta: Download delta files instead of complete packages if possible.
|
||||||
|
|
||||||
[Transactions]
|
[Transactions]
|
||||||
|
|
||||||
The transaction sturcture permits easy manipulations of several packages
|
The transaction structure permits easy manipulations of several packages
|
||||||
at a time (i.e. adding, upgrade and removal operations).
|
at a time (i.e. adding, upgrade and removal operations).
|
||||||
|
|
||||||
A transaction can be initiated with a type (ADD, UPGRADE or REMOVE),
|
A transaction can be initiated with a type (SYNC, UPGRADE or REMOVE),
|
||||||
and some flags (NODEPS, FORCE, CASCADE, ...).
|
and some flags (NODEPS, FORCE, CASCADE, ...).
|
||||||
|
|
||||||
Note: there can only be one type at a time: a transaction is either
|
Note: there can only be one type at a time: a transaction is either
|
||||||
@@ -105,7 +105,7 @@ These targets represent the list of packages to be handled.
|
|||||||
|
|
||||||
Then, a transaction needs to be prepared (alpm_trans_prepare()). It
|
Then, a transaction needs to be prepared (alpm_trans_prepare()). It
|
||||||
means that the various targets added, will be inspected and challenged
|
means that the various targets added, will be inspected and challenged
|
||||||
against the set of already installed packages (dependency checkings,
|
against the set of already installed packages (dependency checking, etc...)
|
||||||
|
|
||||||
Last, a callback is associated with each transaction. During the
|
Last, a callback is associated with each transaction. During the
|
||||||
transaction resolution, each time a new step is started or done (i.e
|
transaction resolution, each time a new step is started or done (i.e
|
||||||
@@ -118,25 +118,25 @@ the resolution. Can be useful to implement a progress bar.
|
|||||||
|
|
||||||
libalpm maintains two caches for each DB. One is a general package cache, the
|
libalpm maintains two caches for each DB. One is a general package cache, the
|
||||||
other is a group cache (for package groups). These caches are loaded on demand,
|
other is a group cache (for package groups). These caches are loaded on demand,
|
||||||
and freed when the libary is.
|
and freed when the library is.
|
||||||
It is important to note tha, as a general rule, package structures should NOT be
|
|
||||||
freed manually, as they SHOULD be part of the cache.
|
It is important to note that, as a general rule, package structures should NOT
|
||||||
The cache of a database is always updated by the library after
|
be freed manually, as they SHOULD be part of the cache. The cache of a
|
||||||
an operation changing the database content (adding and/or removal of
|
database is always updated by the library after an operation changing the
|
||||||
packages). Beware frontends ;)
|
database content (adding and/or removal of packages). Beware frontends ;)
|
||||||
|
|
||||||
|
|
||||||
[Package]
|
[Package]
|
||||||
|
|
||||||
The package structure maintains all information for a package. In general,
|
The package structure maintains all information for a package. In general,
|
||||||
packages should never be freed from front-ends, as they should always be part of
|
packages should never be freed from front-ends, as they should always be part
|
||||||
the package cache.
|
of the package cache.
|
||||||
|
|
||||||
The 'origin' data member indicates whether the package is from a file
|
The 'origin' data member indicates whether the package is from a file (i.e. -U
|
||||||
(i.e. -U operations) or from the package cache. In the case of a file, all data
|
operations) or from the package cache. In the case of a file, all data members
|
||||||
members available are present in the structure. Packages indicated as being
|
available are present in the structure. Packages indicated as being from the
|
||||||
from the cache have data members filled on demand. For this reason, the
|
cache have data members filled on demand. For this reason, the alpm_pkg_get_*
|
||||||
alpm_pkg_get_* functions will load the data from the DB as needed.
|
functions will load the data from the DB as needed.
|
||||||
|
|
||||||
|
|
||||||
[Errors]
|
[Errors]
|
||||||
@@ -149,11 +149,13 @@ indicating success, -1 indicating a failure.
|
|||||||
If -1 is returned, the variable pm_errno is set to a meaningful value
|
If -1 is returned, the variable pm_errno is set to a meaningful value
|
||||||
Wise frontends should always care for these returned values.
|
Wise frontends should always care for these returned values.
|
||||||
|
|
||||||
Note: the helper function alpm_strerror() can also be used to translate
|
Note: the helper function alpm_strerror() can also be used to translate one
|
||||||
the error code into a more friendly sentence.
|
specified error code into a more friendly sentence, and alpm_strerrorlast()
|
||||||
|
does the same for the last error encountered (represented by pm_errno).
|
||||||
|
|
||||||
|
|
||||||
[List - alpm_list_t]
|
[List - alpm_list_t]
|
||||||
|
|
||||||
The alpm_list_t structure is a doubly-linked list for use with the libalpm
|
The alpm_list_t structure is a doubly-linked list for use with the libalpm
|
||||||
routines. This type is provided publicly so that frontends are free to use it
|
routines. This type is provided publicly so that frontends are free to use it
|
||||||
if they have no native list type (C++, glib, python, etc all have list types).
|
if they have no native list type (C++, glib, python, etc all have list types).
|
||||||
@@ -179,41 +181,187 @@ perform a special action.
|
|||||||
|
|
||||||
[MAIN] (see pacman.c)
|
[MAIN] (see pacman.c)
|
||||||
|
|
||||||
Calls for alpm_lib_init(), and alpm_lib_release().
|
Calls for alpm_initialize(), and alpm_release().
|
||||||
Read the configuration file, and parse command line arguments.
|
Read the configuration file, and parse command line arguments.
|
||||||
Based on the action requested, it initiates the appropriate transactions
|
Based on the action requested, it initiates the appropriate transactions
|
||||||
(see pacman_add(), pacman_remove(), pacman_sync() in files add.c,
|
(see pacman_upgrade(), pacman_remove(), pacman_sync() in files upgrade.c,
|
||||||
remove.c and sync.c).
|
remove.c and sync.c).
|
||||||
|
|
||||||
|
|
||||||
[CONFIGURATION] (see conf.c)
|
[CONFIGURATION] (see conf.h)
|
||||||
|
|
||||||
The frontend is using a configuration file, usually "/etc/pacman.conf".
|
The frontend is using a configuration file, usually "/etc/pacman.conf". Some
|
||||||
Part of these options are only useful for the frontend only (mainly,
|
of these options are only useful for the frontend only (mainly the ones used to
|
||||||
the download stuffs, and some options like HOLDPKG).
|
control the output like showsize or totaldownload, or the behavior with
|
||||||
The rest is used to configure the library.
|
cleanmethod and syncfirst). The rest is used to configure the library.
|
||||||
|
|
||||||
|
|
||||||
[ADD/UPGRADE/REMOVE/SYNC]
|
[UPGRADE/REMOVE/SYNC]
|
||||||
|
|
||||||
Nothing new here, excepted some reorganization.
|
|
||||||
|
|
||||||
The file pacman.c has been divided into several smaller files, namely
|
The file pacman.c has been divided into several smaller files, namely
|
||||||
add.c, remove.c, sync.c and query.c, to hold the big parts: pacman_add,
|
upgrade.c, remove.c, sync.c and query.c, to hold the big parts: pacman_upgrade,
|
||||||
pacman_remove, pacman_sync.
|
pacman_remove, pacman_sync.
|
||||||
|
|
||||||
These 3 functions have been split to ease the code reading.
|
These 3 functions have been split to ease the code reading.
|
||||||
|
|
||||||
|
|
||||||
LIMITATIONS/BEHAVIOR CHANGES COMPARED TO PACMAN 2.9
|
|
||||||
===================================================
|
|
||||||
|
|
||||||
Excepted missing features still needing to be implemented, one can
|
API CHANGES BETWEEN 3.1 AND 3.2
|
||||||
notice the following limitations:
|
===============================
|
||||||
|
|
||||||
- If pacman is out of date, the frontend displays a warning and recommends
|
[REMOVED]
|
||||||
to give up the on-going transanction. The frontend does not allow to
|
- alpm_db_whatprovides()
|
||||||
upgrade pacman itself on-the-fly, and thus it should be restarted with
|
- alpm_splitdep (no longer public)
|
||||||
only "pacman" as a target.
|
- trans->targets was removed, so alpm_trans_get_targets() as well
|
||||||
|
- error codes:
|
||||||
|
PM_ERR_OPT_*, PM_ERR_PKG_INSTALLED, PM_ERR_DLT_CORRUPTED,
|
||||||
|
PM_ERR_LIBARCHIVE_ERROR
|
||||||
|
- event: PM_TRANS_EVT_EXTRACT_DONE
|
||||||
|
- PM_TRANS_TYPE_ADD pmtranstype_t (add transaction)
|
||||||
|
- PM_TRANS_FLAG_DEPENDSONLY pmtransflag_t
|
||||||
|
|
||||||
- ...
|
[CHANGED]
|
||||||
|
- alpm_grp_get_pkgs returns with pmpkg_t list, not package-name list
|
||||||
|
- Swap parameters on PM_TRANS_CONV_INSTALL_IGNOREPKG callback function
|
||||||
|
- download callback API changed: alpm_cb_download, alpm_cb_totaldl split
|
||||||
|
(+ new alpm_option_get_totaldlcb(), alpm_option_set_totaldlcb() functions)
|
||||||
|
- unsigned long->off_t changes where size is used
|
||||||
|
- pmsyncpkg_t struct changes:
|
||||||
|
- pmsynctype_t and alpm_sync_get_type() were removed
|
||||||
|
- alpm_sync_get_data() was removed
|
||||||
|
- alpm_sync_get_removes() was added
|
||||||
|
|
||||||
|
[ADDED]
|
||||||
|
- alpm_delta_get_from_md5sum(), alpm_delta_get_to_md5sum()
|
||||||
|
- alpm_miss_get_causingpkg() (new causingpkg field in pmdepmissing_t)
|
||||||
|
- alpm_checkdbconflicts()
|
||||||
|
- alpm_sync_newversion()
|
||||||
|
- alpm_deptest()
|
||||||
|
- error codes :
|
||||||
|
PM_ERR_DLT_INVALID, PM_ERR_LIBARCHIVE, PM_ERR_LIBDOWNLOAD and
|
||||||
|
PM_ERR_EXTERNAL_DOWNLOAD
|
||||||
|
- flags:
|
||||||
|
PM_TRANS_FLAG_ALLEXPLICIT, PM_TRANS_FLAG_UNNEEDED and
|
||||||
|
PM_TRANS_FLAG_RECURSEALL
|
||||||
|
|
||||||
|
|
||||||
|
API CHANGES BETWEEN 3.2 AND 3.3
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[REMOVED]
|
||||||
|
- pmsyncpkg_t struct (pmpkg_t is used for all types of transaction targets):
|
||||||
|
- alpm_sync_get_pkg()
|
||||||
|
- alpm_sync_get_removes() (use alpm_pkg_get_removes() instead)
|
||||||
|
- HoldPkg handling (it is the front-end's task):
|
||||||
|
- alpm_option_get_holdpkgs()
|
||||||
|
- alpm_option_add_holdpkg()
|
||||||
|
- alpm_option_set_holdpkgs()
|
||||||
|
- alpm_option_remove_holdpkg()
|
||||||
|
- PM_TRANS_CONV_REMOVE_HOLDPKG conversation
|
||||||
|
- Print URIs feature (it is the front-end's task):
|
||||||
|
- flag: PM_TRANS_FLAG_PRINTURIS
|
||||||
|
- event: PM_TRANS_EVT_PRINTURI
|
||||||
|
- alpm_delta_get_from_md5sum() and alpm_delta_get_to_md5sum()
|
||||||
|
- alpm_sync_sysupgrade()
|
||||||
|
- error codes:
|
||||||
|
PM_ERR_TRANS_COMMITING, PM_ERR_TRANS_DOWNLOADING, PM_ERR_PKG_LOAD,
|
||||||
|
PM_ERR_PKG_CANT_FRESH, PM_ERR_GRP_NOT_FOUND, PM_ERR_USER_ABORT,
|
||||||
|
PM_ERR_INTERNAL_ERROR, PM_ERR_DB_SYNC, PM_ERR_PKG_HOLD and
|
||||||
|
PM_ERR_LIBDOWNLOAD
|
||||||
|
|
||||||
|
[CHANGED]
|
||||||
|
- XferCommand support was removed, any fetch callback function can be defined:
|
||||||
|
- alpm_option_get_xfercommand() and alpm_option_set_xfercommand() were removed
|
||||||
|
- alpm_option_get_fetchcb() and alpm_option_set_fetchcb() were added
|
||||||
|
- function renames:
|
||||||
|
- alpm_db_getpkgcache() -> alpm_db_get_pkgcache()
|
||||||
|
- alpm_db_getgrpcache() -> alpm_db_get_grpcache()
|
||||||
|
- alpm_dep_get_string() -> alpm_dep_compute_string()
|
||||||
|
- alpm_get_md5sum() -> alpm_compute_md5sum()
|
||||||
|
- alpm_checkdbconflicts() -> alpm_checkconflicts()
|
||||||
|
- alpm_trans_sysupgrade() has a new enable_downgrade parameter
|
||||||
|
- alpm_checkdeps() and alpm_checkconflicts() require local package list instead
|
||||||
|
of local database
|
||||||
|
- the to-be-upgraded package is passed to the callback function with
|
||||||
|
PM_TRANS_EVT_UPGRADE_START (as the second parameter)
|
||||||
|
- the "requiredby" package is never passed to the callback function with
|
||||||
|
PM_TRANS_CONV_INSTALL_IGNOREPKG (the second parameter is always NULL)
|
||||||
|
|
||||||
|
[ADDED]
|
||||||
|
- alpm_pkg_get_db()
|
||||||
|
- alpm_pkg_get_removes()
|
||||||
|
- conversation: PM_TRANS_CONV_REMOVE_PKGS (remove unresolvable targets)
|
||||||
|
- flag: PM_TRANS_FLAG_NOLOCK (do not lock database)
|
||||||
|
- error codes:
|
||||||
|
PM_ERR_SERVER_NONE, PM_ERR_TRANS_NOT_LOCKED, PM_ERR_PKG_IGNORED and
|
||||||
|
PM_ERR_LIBFETCH
|
||||||
|
|
||||||
|
|
||||||
|
API CHANGES BETWEEN 3.3 AND 3.4
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[REMOVED]
|
||||||
|
- pmtranstype_t struct (transaction type), alpm_trans_get_type()
|
||||||
|
- alpm_option_get_nopassiveftp(), alpm_option_set_nopassiveftp()
|
||||||
|
|
||||||
|
[CHANGED]
|
||||||
|
- interface for target loading:
|
||||||
|
- alpm_trans_addtarget() and alpm_trans_sysupgrade() were removed
|
||||||
|
- alpm_sync_target() and alpm_sync_dbtarget() can be used to add a sync target
|
||||||
|
- alpm_sync_sysupgrade() can be used to add outdated packages (for sysupgrade)
|
||||||
|
- alpm_add_target() can be used to add an add/upgrade target
|
||||||
|
- alpm_remove_target() can be used to add a remove target
|
||||||
|
- interface for target listing:
|
||||||
|
- alpm_trans_get_pkgs() was removed
|
||||||
|
- alpm_pkg_get_removes() was removed
|
||||||
|
- alpm_trans_get_add() can be used to list add/upgrade/sync targets
|
||||||
|
- alpm_trans_get_remove() can be used to list to-be-removed packages
|
||||||
|
- the type parameter of alpm_trans_init() was removed
|
||||||
|
- the type of alpm_db_fetch callback function: mtimeold and mtimenew parameters
|
||||||
|
were replaced by force parameter
|
||||||
|
- unsigned short -> int changes for Boolean variables
|
||||||
|
|
||||||
|
[ADDED]
|
||||||
|
- alpm_db_set_pkgreason()
|
||||||
|
- alpm_option_get_arch(), alpm_option_set_arch()
|
||||||
|
- alpm_option_get_usedelta()
|
||||||
|
- alpm_pkg_unused_deltas()
|
||||||
|
- alpm_conflict_get_reason()
|
||||||
|
- error code: PM_ERR_PKG_INVALID_ARCH
|
||||||
|
|
||||||
|
|
||||||
|
API CHANGES BETWEEN 3.4 AND 3.5
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[REMOVED]
|
||||||
|
- alpm_db_register_local()
|
||||||
|
- alpm_pkg_has_force()
|
||||||
|
- alpm_depcmp()
|
||||||
|
|
||||||
|
[CHANGED]
|
||||||
|
- alpm_trans_cb_progress type had some types changed from int to size_t
|
||||||
|
- alpm_cb_log format string is now const char *
|
||||||
|
- the interface to add/remove targets:
|
||||||
|
- functions take pmpkg_t * rather than char *.
|
||||||
|
- alpm_sync_target() and alpm_sync_dbtarget() are replaced by alpm_add_pkg()
|
||||||
|
- alpm_add_target() is replaced by alpm_add_pkg()
|
||||||
|
- alpm_remove_target() is replaced by alpm_remove_pkg()
|
||||||
|
- packages can come from:
|
||||||
|
- alpm_db_get_pkg() for normal targets
|
||||||
|
- alpm_find_dbs_satisfier() for versioned provisions
|
||||||
|
- alpm_find_grp_pkgs() for groups
|
||||||
|
- alpm_deptest() is replaced by the more flexibile alpm_find_satisfier()
|
||||||
|
- size_t used for alpm_list_t sizes
|
||||||
|
- return type for alpm_list_count()
|
||||||
|
- parameter type in alpm_list_msort() and alpm_list_nth()
|
||||||
|
|
||||||
|
[ADDED]
|
||||||
|
- alpm_option_get_checkspace(), alpm_option_set_checkspace()
|
||||||
|
- alpm_find_grp_pkgs()
|
||||||
|
- alpm_trans_get_flags()
|
||||||
|
- error codes:
|
||||||
|
PM_ERR_DISK_SPACE, PM_ERR_WRITE
|
||||||
|
- flags
|
||||||
|
PM_TRANS_FLAG_NODEPVERSION, PM_TRANS_EVT_DISKSPACE_START,
|
||||||
|
PM_TRANS_EVT_DISKSPACE_DONE, PM_TRANS_CONV_SELECT_PROVIDER,
|
||||||
|
PM_TRANS_PROGRESS_DISKSPACE_START, PM_TRANS_PROGRESS_INTEGRITY_START
|
||||||
|
|||||||
29
TRANSLATORS
29
TRANSLATORS
@@ -10,33 +10,52 @@ If your language is not listed here and you wish it was, let the pacman mailing
|
|||||||
list know you are interested in making a translation. We will be happy to add
|
list know you are interested in making a translation. We will be happy to add
|
||||||
your language to the mix.
|
your language to the mix.
|
||||||
|
|
||||||
|
Catalan (ca):
|
||||||
|
Manuel Tortosa <manutortosa@chakra-project.org>
|
||||||
Czech (cs):
|
Czech (cs):
|
||||||
Vojtěch Gondžala <vojtech.gondzala@gmail.com>
|
Vojtěch Gondžala <vojtech.gondzala@gmail.com>
|
||||||
German (de):
|
German (de):
|
||||||
Matthias Gorissen <matthias@archlinux.de>
|
Matthias Gorissen <matthias@archlinux.de>
|
||||||
Benjamin Andresen <benny@in-ulm.de>
|
Greek (el):
|
||||||
|
Christos Nouskas <nouskas@gmail.com>
|
||||||
British English (en_GB):
|
British English (en_GB):
|
||||||
Jeff Bailes <thepizzaking@gmail.com>
|
Jeff Bailes <thepizzaking@gmail.com>
|
||||||
Spanish (es):
|
Spanish (es):
|
||||||
|
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar>
|
||||||
Fernando Lagos <fernando@zerial.org>
|
Fernando Lagos <fernando@zerial.org>
|
||||||
Juan Pablo Gonzalez <jotapesan@gmail.com>
|
|
||||||
French (fr):
|
French (fr):
|
||||||
Chantry Xavier <shiningxc@gmail.com>
|
Chantry Xavier <shiningxc@gmail.com>
|
||||||
Hungarian (hu):
|
Hungarian (hu):
|
||||||
Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
||||||
|
Avramucz Péter <muczyjoe@gmail.com>
|
||||||
Italian (it):
|
Italian (it):
|
||||||
Giovanni 'voidnull' Scafora <linuxmania@gmail.com>
|
Giovanni Scafora <giovanni@archlinux.org>
|
||||||
|
Kazakh (kk):
|
||||||
|
Baurzhan Muftakhidinov <baurthefirst@gmail.com>
|
||||||
|
Norwegian (nb):
|
||||||
|
Hans-Kristian Arntzen <maister@archlinux.us>
|
||||||
Polish (pl):
|
Polish (pl):
|
||||||
Mateusz Herych <heniekk@gmail.com>
|
Mateusz Herych <heniekk@gmail.com>
|
||||||
Jaroslaw Swierczynski <swiergot@gmail.com>
|
Jaroslaw Swierczynski <swiergot@gmail.com>
|
||||||
Mateusz Jędrasik <m.jedrasik@gmail.com>
|
Mateusz Jędrasik <m.jedrasik@gmail.com>
|
||||||
Brazilian Portuguese (pt_BR):
|
Brazilian Portuguese (pt_BR):
|
||||||
<none>
|
Armando M. Baratti <ambaratti@archlinux-br.org>
|
||||||
|
Rodrigo Flores <flores@archlinux-br.org>
|
||||||
|
Marcelo Cavalcante <kalibslack@gmail.com>
|
||||||
|
Romanian (ro):
|
||||||
|
Volodia Macovei <blog@volodia.ro>
|
||||||
Russian (ru):
|
Russian (ru):
|
||||||
Sergey Tereschenko <serg.partizan@gmail.com>
|
Sergey Tereschenko <serg.partizan@gmail.com>
|
||||||
Vitaly Dolgov <ferhiord@gmail.com>
|
Vitaly Dolgov <ferhiord@gmail.com>
|
||||||
Oleg Finkelshteyn <olegfink@gmail.com>
|
Oleg Finkelshteyn <olegfink@gmail.com>
|
||||||
Vladimir Bayrakovskiy <4rayven@gmail.com>
|
Vladimir Bayrakovskiy <4rayven@gmail.com>
|
||||||
|
Swedish (sv):
|
||||||
|
Christian Larsson <congacx@gmail.com>
|
||||||
|
Turkish (tr):
|
||||||
|
Samed Beyribey <ras0ir@eventualis.org>
|
||||||
|
Alper KANAT <alperkanat@gmail.com>
|
||||||
|
Ukrainian (uk):
|
||||||
|
Roman Kyrylych (Роман Кирилич) <roman.kyrylych@gmail.com>
|
||||||
|
Ivan Kovnatsky (Іван Ковнацький) <sevenfourk@gmail.com>
|
||||||
Simplified Chinese (zh_CN):
|
Simplified Chinese (zh_CN):
|
||||||
甘露(Lu.Gan) <rhythm.gan@gmail.com>
|
甘露(Lu.Gan) <rhythm.gan@gmail.com>
|
||||||
|
|
||||||
|
|||||||
4942
acinclude.m4
4942
acinclude.m4
File diff suppressed because it is too large
Load Diff
57
autoclean.sh
57
autoclean.sh
@@ -2,33 +2,36 @@
|
|||||||
|
|
||||||
[ -f Makefile ] && make distclean
|
[ -f Makefile ] && make distclean
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
rm -rf {Makefile.in,Makefile}
|
rm -f {Makefile.in,Makefile}
|
||||||
rm -rf {config.h.in,config.h}
|
rm -f {config.h.in,config.h}
|
||||||
rm -rf config.status
|
rm -f config.status
|
||||||
rm -rf configure
|
rm -f configure
|
||||||
rm -rf stamp*
|
rm -f stamp*
|
||||||
rm -rf aclocal.m4
|
rm -f aclocal.m4
|
||||||
rm -rf compile
|
rm -f compile
|
||||||
rm -rf libtool
|
rm -f libtool
|
||||||
|
|
||||||
rm -rf lib/libalpm/{Makefile.in,Makefile}
|
rm -f lib/libalpm/{Makefile.in,Makefile}
|
||||||
rm -rf src/util/{Makefile.in,Makefile}
|
rm -f src/util/{Makefile.in,Makefile}
|
||||||
rm -rf src/pacman/{Makefile.in,Makefile}
|
rm -f src/pacman/{Makefile.in,Makefile}
|
||||||
rm -rf scripts/{Makefile.in,Makefile}
|
rm -f scripts/{Makefile.in,Makefile}
|
||||||
rm -rf etc/{Makefile.in,Makefile}
|
rm -f etc/{Makefile.in,Makefile}
|
||||||
rm -rf etc/pacman.d/{Makefile.in,Makefile}
|
rm -f etc/pacman.d/{Makefile.in,Makefile}
|
||||||
rm -rf etc/abs/{Makefile.in,Makefile}
|
rm -f etc/abs/{Makefile.in,Makefile}
|
||||||
rm -rf pactest/{Makefile.in,Makefile}
|
rm -f test/{pacman,util}{,/tests}/{Makefile.in,Makefile}
|
||||||
rm -rf doc/{Makefile.in,Makefile}
|
rm -f contrib/{Makefile.in,Makefile}
|
||||||
rm -rf doc/html/*.html
|
rm -f doc/{Makefile.in,Makefile}
|
||||||
rm -rf doc/man3/*.3
|
|
||||||
|
|
||||||
rm -rf src/pacman/po/{Makefile.in,Makefile}
|
rm -f test/pacman/*.pyc
|
||||||
rm -rf src/pacman/po/POTFILES
|
rm -f doc/html/*.html
|
||||||
rm -rf src/pacman/po/stamp-po
|
rm -f doc/man3/*.3
|
||||||
rm -rf src/pacman/po/*.gmo
|
|
||||||
|
|
||||||
rm -rf lib/libalpm/po/{Makefile.in,Makefile}
|
rm -f po/{Makefile.in,Makefile}
|
||||||
rm -rf lib/libalpm/po/POTFILES
|
rm -f po/POTFILES
|
||||||
rm -rf lib/libalpm/po/stamp-po
|
rm -f po/stamp-po
|
||||||
rm -rf lib/libalpm/po/*.gmo
|
rm -f po/*.gmo
|
||||||
|
|
||||||
|
rm -f lib/libalpm/po/{Makefile.in,Makefile}
|
||||||
|
rm -f lib/libalpm/po/POTFILES
|
||||||
|
rm -f lib/libalpm/po/stamp-po
|
||||||
|
rm -f lib/libalpm/po/*.gmo
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh -xu
|
#!/bin/sh -xu
|
||||||
|
|
||||||
aclocal
|
aclocal -I m4 --install
|
||||||
autoheader
|
autoheader
|
||||||
automake --foreign
|
automake --foreign
|
||||||
autoconf
|
autoconf
|
||||||
|
|||||||
275
config.guess
vendored
275
config.guess
vendored
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
# Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2007-05-17'
|
timestamp='2010-08-21'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
@@ -27,16 +27,16 @@ timestamp='2007-05-17'
|
|||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
|
||||||
# Originally written by Per Bothner <per@bothner.com>.
|
# Originally written by Per Bothner. Please send patches (context
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||||
# diff and a properly formatted ChangeLog entry.
|
# entry.
|
||||||
#
|
#
|
||||||
# This script attempts to guess a canonical system name similar to
|
# This script attempts to guess a canonical system name similar to
|
||||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||||
# exits with 0. Otherwise, it exits with 1.
|
# exits with 0. Otherwise, it exits with 1.
|
||||||
#
|
#
|
||||||
# The plan is that this can be called by configure scripts if you
|
# You can get the latest version of this script from:
|
||||||
# don't specify an explicit build system type.
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||||
|
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
@@ -56,8 +56,9 @@ version="\
|
|||||||
GNU config.guess ($timestamp)
|
GNU config.guess ($timestamp)
|
||||||
|
|
||||||
Originally written by Per Bothner.
|
Originally written by Per Bothner.
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
Free Software Foundation, Inc.
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||||
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@@ -91,7 +92,7 @@ if test $# != 0; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap 'exit 1' 1 2 15
|
trap 'exit 1' HUP INT TERM
|
||||||
|
|
||||||
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
|
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
|
||||||
# compiler to aid in system detection is discouraged as it requires
|
# compiler to aid in system detection is discouraged as it requires
|
||||||
@@ -105,7 +106,7 @@ trap 'exit 1' 1 2 15
|
|||||||
|
|
||||||
set_cc_for_build='
|
set_cc_for_build='
|
||||||
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
||||||
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
|
||||||
: ${TMPDIR=/tmp} ;
|
: ${TMPDIR=/tmp} ;
|
||||||
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
||||||
@@ -170,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
| grep __ELF__ >/dev/null
|
| grep -q __ELF__
|
||||||
then
|
then
|
||||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||||
# Return netbsd for either. FIX?
|
# Return netbsd for either. FIX?
|
||||||
@@ -324,14 +325,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
case `/usr/bin/uname -p` in
|
case `/usr/bin/uname -p` in
|
||||||
sparc) echo sparc-icl-nx7; exit ;;
|
sparc) echo sparc-icl-nx7; exit ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
s390x:SunOS:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
|
exit ;;
|
||||||
sun4H:SunOS:5.*:*)
|
sun4H:SunOS:5.*:*)
|
||||||
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
|
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
SUN_ARCH="i386"
|
||||||
|
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||||
|
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||||
|
# This test works for both compilers.
|
||||||
|
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||||
|
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||||
|
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||||
|
grep IS_64BIT_ARCH >/dev/null
|
||||||
|
then
|
||||||
|
SUN_ARCH="x86_64"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:6*:*)
|
sun4*:SunOS:6*:*)
|
||||||
# According to config.sub, this is the proper way to canonicalize
|
# According to config.sub, this is the proper way to canonicalize
|
||||||
@@ -532,7 +552,7 @@ EOF
|
|||||||
echo rs6000-ibm-aix3.2
|
echo rs6000-ibm-aix3.2
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
*:AIX:*:[45])
|
*:AIX:*:[4567])
|
||||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||||
IBM_ARCH=rs6000
|
IBM_ARCH=rs6000
|
||||||
@@ -640,7 +660,7 @@ EOF
|
|||||||
# => hppa64-hp-hpux11.23
|
# => hppa64-hp-hpux11.23
|
||||||
|
|
||||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||||
grep __LP64__ >/dev/null
|
grep -q __LP64__
|
||||||
then
|
then
|
||||||
HP_ARCH="hppa2.0w"
|
HP_ARCH="hppa2.0w"
|
||||||
else
|
else
|
||||||
@@ -791,18 +811,24 @@ EOF
|
|||||||
i*:PW*:*)
|
i*:PW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-pw32
|
echo ${UNAME_MACHINE}-pc-pw32
|
||||||
exit ;;
|
exit ;;
|
||||||
*:Interix*:[3456]*)
|
*:Interix*:*)
|
||||||
case ${UNAME_MACHINE} in
|
case ${UNAME_MACHINE} in
|
||||||
x86)
|
x86)
|
||||||
echo i586-pc-interix${UNAME_RELEASE}
|
echo i586-pc-interix${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
EM64T | authenticamd)
|
authenticamd | genuineintel | EM64T)
|
||||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
|
IA64)
|
||||||
|
echo ia64-unknown-interix${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||||
echo i${UNAME_MACHINE}-pc-mks
|
echo i${UNAME_MACHINE}-pc-mks
|
||||||
exit ;;
|
exit ;;
|
||||||
|
8664:Windows_NT:*)
|
||||||
|
echo x86_64-pc-mks
|
||||||
|
exit ;;
|
||||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||||
@@ -832,8 +858,29 @@ EOF
|
|||||||
i*86:Minix:*:*)
|
i*86:Minix:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit ;;
|
exit ;;
|
||||||
|
alpha:Linux:*:*)
|
||||||
|
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||||
|
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||||
|
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||||
|
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||||
|
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||||
|
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||||
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
|
esac
|
||||||
|
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||||
|
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||||
|
exit ;;
|
||||||
arm*:Linux:*:*)
|
arm*:Linux:*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
|
| grep -q __ARM_EABI__
|
||||||
|
then
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
else
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||||
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
avr32*:Linux:*:*)
|
avr32*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
@@ -847,6 +894,17 @@ EOF
|
|||||||
frv:Linux:*:*)
|
frv:Linux:*:*)
|
||||||
echo frv-unknown-linux-gnu
|
echo frv-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
|
i*86:Linux:*:*)
|
||||||
|
LIBC=gnu
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#ifdef __dietlibc__
|
||||||
|
LIBC=dietlibc
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||||
|
exit ;;
|
||||||
ia64:Linux:*:*)
|
ia64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -856,74 +914,33 @@ EOF
|
|||||||
m68*:Linux:*:*)
|
m68*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
mips:Linux:*:*)
|
mips:Linux:*:* | mips64:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
#undef CPU
|
#undef CPU
|
||||||
#undef mips
|
#undef ${UNAME_MACHINE}
|
||||||
#undef mipsel
|
#undef ${UNAME_MACHINE}el
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||||
CPU=mipsel
|
CPU=${UNAME_MACHINE}el
|
||||||
#else
|
#else
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||||
CPU=mips
|
CPU=${UNAME_MACHINE}
|
||||||
#else
|
#else
|
||||||
CPU=
|
CPU=
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||||
/^CPU/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
|
||||||
;;
|
|
||||||
mips64:Linux:*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#undef CPU
|
|
||||||
#undef mips64
|
|
||||||
#undef mips64el
|
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
|
||||||
CPU=mips64el
|
|
||||||
#else
|
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
|
||||||
CPU=mips64
|
|
||||||
#else
|
|
||||||
CPU=
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^CPU/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||||
;;
|
;;
|
||||||
or32:Linux:*:*)
|
or32:Linux:*:*)
|
||||||
echo or32-unknown-linux-gnu
|
echo or32-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc:Linux:*:*)
|
padre:Linux:*:*)
|
||||||
echo powerpc-unknown-linux-gnu
|
echo sparc-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc64:Linux:*:*)
|
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||||
echo powerpc64-unknown-linux-gnu
|
echo hppa64-unknown-linux-gnu
|
||||||
exit ;;
|
|
||||||
alpha:Linux:*:*)
|
|
||||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
|
||||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
|
||||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
|
||||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
|
||||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
|
||||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
|
||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
|
||||||
esac
|
|
||||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
|
||||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||||
# Look for CPU level
|
# Look for CPU level
|
||||||
@@ -933,8 +950,11 @@ EOF
|
|||||||
*) echo hppa-unknown-linux-gnu ;;
|
*) echo hppa-unknown-linux-gnu ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
ppc64:Linux:*:*)
|
||||||
echo hppa64-unknown-linux-gnu
|
echo powerpc64-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
ppc:Linux:*:*)
|
||||||
|
echo powerpc-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
s390:Linux:*:* | s390x:Linux:*:*)
|
s390:Linux:*:* | s390x:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-ibm-linux
|
echo ${UNAME_MACHINE}-ibm-linux
|
||||||
@@ -948,78 +968,18 @@ EOF
|
|||||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
|
tile*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-tilera-linux-gnu
|
||||||
|
exit ;;
|
||||||
vax:Linux:*:*)
|
vax:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
x86_64:Linux:*:*)
|
x86_64:Linux:*:*)
|
||||||
echo x86_64-unknown-linux-gnu
|
echo x86_64-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
xtensa:Linux:*:*)
|
xtensa*:Linux:*:*)
|
||||||
echo xtensa-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:Linux:*:*)
|
|
||||||
# The BFD linker knows what the default object file format is, so
|
|
||||||
# first see if it will tell us. cd to the root directory to prevent
|
|
||||||
# problems with other programs or directories called `ld' in the path.
|
|
||||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
|
||||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
|
||||||
| sed -ne '/supported targets:/!d
|
|
||||||
s/[ ][ ]*/ /g
|
|
||||||
s/.*supported targets: *//
|
|
||||||
s/ .*//
|
|
||||||
p'`
|
|
||||||
case "$ld_supported_targets" in
|
|
||||||
elf32-i386)
|
|
||||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
|
||||||
;;
|
|
||||||
a.out-i386-linux)
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
|
||||||
exit ;;
|
|
||||||
coff-i386)
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
|
||||||
exit ;;
|
|
||||||
"")
|
|
||||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
|
||||||
# one that does not give us useful --help.
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
|
||||||
exit ;;
|
|
||||||
esac
|
|
||||||
# Determine whether the default compiler is a.out or elf
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#include <features.h>
|
|
||||||
#ifdef __ELF__
|
|
||||||
# ifdef __GLIBC__
|
|
||||||
# if __GLIBC__ >= 2
|
|
||||||
LIBC=gnu
|
|
||||||
# else
|
|
||||||
LIBC=gnulibc1
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
LIBC=gnulibc1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
|
||||||
LIBC=gnu
|
|
||||||
#else
|
|
||||||
LIBC=gnuaout
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef __dietlibc__
|
|
||||||
LIBC=dietlibc
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^LIBC/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${LIBC}" != x && {
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
|
||||||
;;
|
|
||||||
i*86:DYNIX/ptx:4*:*)
|
i*86:DYNIX/ptx:4*:*)
|
||||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||||
# earlier versions are messed up and put the nodename in both
|
# earlier versions are messed up and put the nodename in both
|
||||||
@@ -1048,7 +1008,7 @@ EOF
|
|||||||
i*86:syllable:*:*)
|
i*86:syllable:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-syllable
|
echo ${UNAME_MACHINE}-pc-syllable
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:*DOS:*:*)
|
i*86:*DOS:*:*)
|
||||||
@@ -1092,8 +1052,11 @@ EOF
|
|||||||
pc:*:*:*)
|
pc:*:*:*)
|
||||||
# Left here for compatibility:
|
# Left here for compatibility:
|
||||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||||
# the processor, so we play safe by assuming i386.
|
# the processor, so we play safe by assuming i586.
|
||||||
echo i386-pc-msdosdjgpp
|
# Note: whatever this is, it MUST be the same as what config.sub
|
||||||
|
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||||
|
# this is a cross-build.
|
||||||
|
echo i586-pc-msdosdjgpp
|
||||||
exit ;;
|
exit ;;
|
||||||
Intel:Mach:3*:*)
|
Intel:Mach:3*:*)
|
||||||
echo i386-pc-mach3
|
echo i386-pc-mach3
|
||||||
@@ -1131,6 +1094,16 @@ EOF
|
|||||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||||
|
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||||
|
OS_REL='.3'
|
||||||
|
test -r /etc/.relid \
|
||||||
|
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||||
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
|
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
|
||||||
|
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||||
|
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
|
||||||
|
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
|
||||||
|
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||||
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
||||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1143,7 +1116,7 @@ EOF
|
|||||||
rs6000:LynxOS:2.*:*)
|
rs6000:LynxOS:2.*:*)
|
||||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
SM[BE]S:UNIX_SV:*:*)
|
SM[BE]S:UNIX_SV:*:*)
|
||||||
@@ -1206,6 +1179,9 @@ EOF
|
|||||||
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
||||||
echo i586-pc-beos
|
echo i586-pc-beos
|
||||||
exit ;;
|
exit ;;
|
||||||
|
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||||
|
echo i586-pc-haiku
|
||||||
|
exit ;;
|
||||||
SX-4:SUPER-UX:*:*)
|
SX-4:SUPER-UX:*:*)
|
||||||
echo sx4-nec-superux${UNAME_RELEASE}
|
echo sx4-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1233,6 +1209,16 @@ EOF
|
|||||||
*:Darwin:*:*)
|
*:Darwin:*:*)
|
||||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||||
case $UNAME_PROCESSOR in
|
case $UNAME_PROCESSOR in
|
||||||
|
i386)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||||
|
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||||
|
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||||
|
grep IS_64BIT_ARCH >/dev/null
|
||||||
|
then
|
||||||
|
UNAME_PROCESSOR="x86_64"
|
||||||
|
fi
|
||||||
|
fi ;;
|
||||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||||
esac
|
esac
|
||||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||||
@@ -1314,6 +1300,9 @@ EOF
|
|||||||
i*86:rdos:*:*)
|
i*86:rdos:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-rdos
|
echo ${UNAME_MACHINE}-pc-rdos
|
||||||
exit ;;
|
exit ;;
|
||||||
|
i*86:AROS:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-aros
|
||||||
|
exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||||
@@ -1474,9 +1463,9 @@ This script, last modified $timestamp, has failed to recognize
|
|||||||
the operating system you are using. It is advised that you
|
the operating system you are using. It is advised that you
|
||||||
download the most up to date version of the config scripts from
|
download the most up to date version of the config scripts from
|
||||||
|
|
||||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
|
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||||
and
|
and
|
||||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
|
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||||
|
|
||||||
If the version you run ($0) is already up to date, please
|
If the version you run ($0) is already up to date, please
|
||||||
send the following data and any information you think might be
|
send the following data and any information you think might be
|
||||||
|
|||||||
197
config.sub
vendored
197
config.sub
vendored
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
# Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2007-04-29'
|
timestamp='2010-09-11'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
@@ -32,13 +32,16 @@ timestamp='2007-04-29'
|
|||||||
|
|
||||||
|
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||||
# diff and a properly formatted ChangeLog entry.
|
# diff and a properly formatted GNU ChangeLog entry.
|
||||||
#
|
#
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
# Supply the specified configuration type as an argument.
|
# Supply the specified configuration type as an argument.
|
||||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
|
# You can get the latest version of this script from:
|
||||||
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
# This file is supposed to be the same for all GNU packages
|
||||||
# and recognize all the CPU types, system types and aliases
|
# and recognize all the CPU types, system types and aliases
|
||||||
# that are meaningful with *any* GNU software.
|
# that are meaningful with *any* GNU software.
|
||||||
@@ -72,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
Free Software Foundation, Inc.
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||||
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@@ -120,8 +124,10 @@ esac
|
|||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||||
|
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||||
|
kopensolaris*-gnu* | \
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
@@ -148,10 +154,13 @@ case $os in
|
|||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis | -knuth | -cray)
|
-apple | -axis | -knuth | -cray | -microblaze)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
|
-bluegene*)
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
-sim | -cisco | -oki | -wec | -winbond)
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
@@ -249,13 +258,16 @@ case $basic_machine in
|
|||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
|
| lm32 \
|
||||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
| maxq | mb | microblaze | mcore | mep \
|
| maxq | mb | microblaze | mcore | mep | metag \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
| mips64vr | mips64vrel \
|
| mips64octeon | mips64octeonel \
|
||||||
| mips64orion | mips64orionel \
|
| mips64orion | mips64orionel \
|
||||||
|
| mips64r5900 | mips64r5900el \
|
||||||
|
| mips64vr | mips64vrel \
|
||||||
| mips64vr4100 | mips64vr4100el \
|
| mips64vr4100 | mips64vr4100el \
|
||||||
| mips64vr4300 | mips64vr4300el \
|
| mips64vr4300 | mips64vr4300el \
|
||||||
| mips64vr5000 | mips64vr5000el \
|
| mips64vr5000 | mips64vr5000el \
|
||||||
@@ -268,28 +280,41 @@ case $basic_machine in
|
|||||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||||
| mipstx39 | mipstx39el \
|
| mipstx39 | mipstx39el \
|
||||||
| mn10200 | mn10300 \
|
| mn10200 | mn10300 \
|
||||||
|
| moxie \
|
||||||
| mt \
|
| mt \
|
||||||
| msp430 \
|
| msp430 \
|
||||||
|
| nds32 | nds32le | nds32be \
|
||||||
| nios | nios2 \
|
| nios | nios2 \
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
| or32 \
|
| or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pdp11 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
|
| rx \
|
||||||
| score \
|
| score \
|
||||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||||
| spu | strongarm \
|
| spu | strongarm \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||||
|
| ubicom32 \
|
||||||
| v850 | v850e \
|
| v850 | v850e \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||||
| z8k)
|
| z8k | z80)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m6811 | m68hc11 | m6812 | m68hc12)
|
c54x)
|
||||||
|
basic_machine=tic54x-unknown
|
||||||
|
;;
|
||||||
|
c55x)
|
||||||
|
basic_machine=tic55x-unknown
|
||||||
|
;;
|
||||||
|
c6x)
|
||||||
|
basic_machine=tic6x-unknown
|
||||||
|
;;
|
||||||
|
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||||
# Motorola 68HC11/12.
|
# Motorola 68HC11/12.
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
@@ -320,7 +345,7 @@ case $basic_machine in
|
|||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* | avr32-* \
|
| avr-* | avr32-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||||
| clipper-* | craynv-* | cydra-* \
|
| clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| elxsi-* \
|
||||||
@@ -329,14 +354,17 @@ case $basic_machine in
|
|||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
|
| lm32-* \
|
||||||
| m32c-* | m32r-* | m32rle-* \
|
| m32c-* | m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
| mips64vr-* | mips64vrel-* \
|
| mips64octeon-* | mips64octeonel-* \
|
||||||
| mips64orion-* | mips64orionel-* \
|
| mips64orion-* | mips64orionel-* \
|
||||||
|
| mips64r5900-* | mips64r5900el-* \
|
||||||
|
| mips64vr-* | mips64vrel-* \
|
||||||
| mips64vr4100-* | mips64vr4100el-* \
|
| mips64vr4100-* | mips64vr4100el-* \
|
||||||
| mips64vr4300-* | mips64vr4300el-* \
|
| mips64vr4300-* | mips64vr4300el-* \
|
||||||
| mips64vr5000-* | mips64vr5000el-* \
|
| mips64vr5000-* | mips64vr5000el-* \
|
||||||
@@ -351,27 +379,34 @@ case $basic_machine in
|
|||||||
| mmix-* \
|
| mmix-* \
|
||||||
| mt-* \
|
| mt-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
|
| nds32-* | nds32le-* | nds32be-* \
|
||||||
| nios-* | nios2-* \
|
| nios-* | nios2-* \
|
||||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
| romp-* | rs6000-* \
|
| romp-* | rs6000-* | rx-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* | thumb-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
|
| tile-* | tilegx-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
|
| ubicom32-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| v850-* | v850e-* | vax-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||||
| xstormy16-* | xtensa-* \
|
| xstormy16-* | xtensa*-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-*)
|
| z8k-* | z80-*)
|
||||||
|
;;
|
||||||
|
# Recognize the basic CPU types without company name, with glob match.
|
||||||
|
xtensa*)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
# Recognize the various machine names and aliases which stand
|
# Recognize the various machine names and aliases which stand
|
||||||
# for a CPU type and a company and sometimes even an OS.
|
# for a CPU type and a company and sometimes even an OS.
|
||||||
@@ -435,6 +470,10 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-apollo
|
basic_machine=m68k-apollo
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
|
aros)
|
||||||
|
basic_machine=i386-pc
|
||||||
|
os=-aros
|
||||||
|
;;
|
||||||
aux)
|
aux)
|
||||||
basic_machine=m68k-apple
|
basic_machine=m68k-apple
|
||||||
os=-aux
|
os=-aux
|
||||||
@@ -443,10 +482,35 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-sequent
|
basic_machine=ns32k-sequent
|
||||||
os=-dynix
|
os=-dynix
|
||||||
;;
|
;;
|
||||||
|
blackfin)
|
||||||
|
basic_machine=bfin-unknown
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
blackfin-*)
|
||||||
|
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
bluegene*)
|
||||||
|
basic_machine=powerpc-ibm
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
|
c54x-*)
|
||||||
|
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c55x-*)
|
||||||
|
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c6x-*)
|
||||||
|
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
|
cegcc)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
os=-cegcc
|
||||||
|
;;
|
||||||
convex-c1)
|
convex-c1)
|
||||||
basic_machine=c1-convex
|
basic_machine=c1-convex
|
||||||
os=-bsd
|
os=-bsd
|
||||||
@@ -475,8 +539,8 @@ case $basic_machine in
|
|||||||
basic_machine=craynv-cray
|
basic_machine=craynv-cray
|
||||||
os=-unicosmp
|
os=-unicosmp
|
||||||
;;
|
;;
|
||||||
cr16c)
|
cr16)
|
||||||
basic_machine=cr16c-unknown
|
basic_machine=cr16-unknown
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
crds | unos)
|
crds | unos)
|
||||||
@@ -514,6 +578,10 @@ case $basic_machine in
|
|||||||
basic_machine=m88k-motorola
|
basic_machine=m88k-motorola
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
dicos)
|
||||||
|
basic_machine=i686-pc
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
djgpp)
|
djgpp)
|
||||||
basic_machine=i586-pc
|
basic_machine=i586-pc
|
||||||
os=-msdosdjgpp
|
os=-msdosdjgpp
|
||||||
@@ -668,6 +736,14 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-isi
|
basic_machine=m68k-isi
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
m68knommu)
|
||||||
|
basic_machine=m68k-unknown
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
m68knommu-*)
|
||||||
|
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
m88k-omron*)
|
m88k-omron*)
|
||||||
basic_machine=m88k-omron
|
basic_machine=m88k-omron
|
||||||
;;
|
;;
|
||||||
@@ -679,6 +755,9 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-utek
|
basic_machine=ns32k-utek
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
microblaze)
|
||||||
|
basic_machine=microblaze-xilinx
|
||||||
|
;;
|
||||||
mingw32)
|
mingw32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
@@ -783,6 +862,12 @@ case $basic_machine in
|
|||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
|
neo-tandem)
|
||||||
|
basic_machine=neo-tandem
|
||||||
|
;;
|
||||||
|
nse-tandem)
|
||||||
|
basic_machine=nse-tandem
|
||||||
|
;;
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
@@ -813,6 +898,14 @@ case $basic_machine in
|
|||||||
basic_machine=i860-intel
|
basic_machine=i860-intel
|
||||||
os=-osf
|
os=-osf
|
||||||
;;
|
;;
|
||||||
|
parisc)
|
||||||
|
basic_machine=hppa-unknown
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
parisc-*)
|
||||||
|
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
pbd)
|
pbd)
|
||||||
basic_machine=sparc-tti
|
basic_machine=sparc-tti
|
||||||
;;
|
;;
|
||||||
@@ -1009,17 +1102,14 @@ case $basic_machine in
|
|||||||
basic_machine=t90-cray
|
basic_machine=t90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
tic54x | c54x*)
|
# This must be matched before tile*.
|
||||||
basic_machine=tic54x-unknown
|
tilegx*)
|
||||||
os=-coff
|
basic_machine=tilegx-unknown
|
||||||
|
os=-linux-gnu
|
||||||
;;
|
;;
|
||||||
tic55x | c55x*)
|
tile*)
|
||||||
basic_machine=tic55x-unknown
|
basic_machine=tile-unknown
|
||||||
os=-coff
|
os=-linux-gnu
|
||||||
;;
|
|
||||||
tic6x | c6x*)
|
|
||||||
basic_machine=tic6x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
;;
|
||||||
tx39)
|
tx39)
|
||||||
basic_machine=mipstx39-unknown
|
basic_machine=mipstx39-unknown
|
||||||
@@ -1096,6 +1186,10 @@ case $basic_machine in
|
|||||||
basic_machine=z8k-unknown
|
basic_machine=z8k-unknown
|
||||||
os=-sim
|
os=-sim
|
||||||
;;
|
;;
|
||||||
|
z80-*-coff)
|
||||||
|
basic_machine=z80-unknown
|
||||||
|
os=-sim
|
||||||
|
;;
|
||||||
none)
|
none)
|
||||||
basic_machine=none-none
|
basic_machine=none-none
|
||||||
os=-none
|
os=-none
|
||||||
@@ -1134,7 +1228,7 @@ case $basic_machine in
|
|||||||
we32k)
|
we32k)
|
||||||
basic_machine=we32k-att
|
basic_machine=we32k-att
|
||||||
;;
|
;;
|
||||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||||
basic_machine=sh-unknown
|
basic_machine=sh-unknown
|
||||||
;;
|
;;
|
||||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||||
@@ -1184,6 +1278,9 @@ case $os in
|
|||||||
# First match some system type aliases
|
# First match some system type aliases
|
||||||
# that might get confused with valid system types.
|
# that might get confused with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
|
-auroraux)
|
||||||
|
os=-auroraux
|
||||||
|
;;
|
||||||
-solaris1 | -solaris1.*)
|
-solaris1 | -solaris1.*)
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
;;
|
;;
|
||||||
@@ -1204,10 +1301,11 @@ case $os in
|
|||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||||
|
| -sym* | -kopensolaris* \
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* \
|
| -aos* | -aros* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||||
@@ -1216,9 +1314,10 @@ case $os in
|
|||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* \
|
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -mingw32* | -linux-gnu* | -linux-android* \
|
||||||
|
| -linux-newlib* | -linux-uclibc* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
@@ -1226,7 +1325,7 @@ case $os in
|
|||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@@ -1356,6 +1455,11 @@ case $os in
|
|||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
|
-dicos*)
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
|
-nacl*)
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1396,6 +1500,15 @@ case $basic_machine in
|
|||||||
c4x-* | tic4x-*)
|
c4x-* | tic4x-*)
|
||||||
os=-coff
|
os=-coff
|
||||||
;;
|
;;
|
||||||
|
tic54x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic55x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic6x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
# This must come before the *-dec entry.
|
# This must come before the *-dec entry.
|
||||||
pdp10-*)
|
pdp10-*)
|
||||||
os=-tops20
|
os=-tops20
|
||||||
@@ -1553,7 +1666,7 @@ case $basic_machine in
|
|||||||
-sunos*)
|
-sunos*)
|
||||||
vendor=sun
|
vendor=sun
|
||||||
;;
|
;;
|
||||||
-aix*)
|
-cnk*|-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
-beos*)
|
-beos*)
|
||||||
|
|||||||
233
configure.ac
233
configure.ac
@@ -1,7 +1,7 @@
|
|||||||
# -*- Autoconf -*-
|
# -*- Autoconf -*-
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
# Minimum version of autoconf required
|
# Minimum version of autoconf required
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.62)
|
||||||
|
|
||||||
# UPDATING VERSION NUMBERS FOR RELEASES
|
# UPDATING VERSION NUMBERS FOR RELEASES
|
||||||
#
|
#
|
||||||
@@ -40,29 +40,19 @@ AC_PREREQ(2.60)
|
|||||||
#
|
#
|
||||||
# Bugfix releases:
|
# Bugfix releases:
|
||||||
# pacman_version_micro += 1
|
# pacman_version_micro += 1
|
||||||
#
|
|
||||||
# pacman_version_suffix should be similar to one of the following:
|
|
||||||
# For beta releases: [beta2]
|
|
||||||
# For code under development: [devel]
|
|
||||||
# For production releases: []
|
|
||||||
|
|
||||||
m4_define([lib_current], [5])
|
m4_define([lib_current], [6])
|
||||||
m4_define([lib_revision], [0])
|
m4_define([lib_revision], [2])
|
||||||
m4_define([lib_age], [3])
|
m4_define([lib_age], [0])
|
||||||
|
|
||||||
m4_define([pacman_version_major], [3])
|
m4_define([pacman_version_major], [3])
|
||||||
m4_define([pacman_version_minor], [1])
|
m4_define([pacman_version_minor], [5])
|
||||||
m4_define([pacman_version_micro], [3])
|
m4_define([pacman_version_micro], [2])
|
||||||
m4_define([pacman_version_suffix], [])
|
|
||||||
m4_define([pacman_version],
|
m4_define([pacman_version],
|
||||||
[pacman_version_major.pacman_version_minor.pacman_version_micro])
|
[pacman_version_major.pacman_version_minor.pacman_version_micro])
|
||||||
m4_define([pacman_display_version],
|
|
||||||
pacman_version[]m4_ifdef([pacman_version_suffix],[pacman_version_suffix]))
|
|
||||||
|
|
||||||
# Autoconf initialization
|
# Autoconf initialization
|
||||||
# AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
|
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
|
||||||
AC_INIT([Pacman Package Manager], [pacman_display_version],
|
|
||||||
[pacman-dev@archlinux.org], [pacman])
|
|
||||||
AC_CONFIG_SRCDIR([config.h.in])
|
AC_CONFIG_SRCDIR([config.h.in])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
@@ -80,48 +70,54 @@ AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
|
|||||||
|
|
||||||
# Help line for root directory
|
# Help line for root directory
|
||||||
AC_ARG_WITH(root-dir,
|
AC_ARG_WITH(root-dir,
|
||||||
AC_HELP_STRING([--with-root-dir=path], [set the location of pacman's root operating directory]),
|
AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
|
||||||
[ROOTDIR=$withval], [ROOTDIR=/])
|
[ROOTDIR=$withval], [ROOTDIR=/])
|
||||||
|
|
||||||
# Help line for package extension
|
# Help line for package extension
|
||||||
AC_ARG_WITH(pkg-ext,
|
AC_ARG_WITH(pkg-ext,
|
||||||
AC_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
|
AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
|
||||||
[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
|
[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
|
||||||
|
|
||||||
# Help line for source package directory
|
# Help line for source package directory
|
||||||
AC_ARG_WITH(src-ext,
|
AC_ARG_WITH(src-ext,
|
||||||
AC_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
|
AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
|
||||||
[SRCEXT=$withval], [SRCEXT=.src.tar.gz])
|
[SRCEXT=$withval], [SRCEXT=.src.tar.gz])
|
||||||
|
|
||||||
# Help line for database extension
|
# Help line for buildscript filename
|
||||||
AC_ARG_WITH(db-ext,
|
AC_ARG_WITH(buildscript,
|
||||||
AC_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]),
|
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
|
||||||
[DBEXT=$withval], [DBEXT=.db.tar.gz])
|
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
|
||||||
|
|
||||||
|
# Help line for using OpenSSL
|
||||||
|
AC_ARG_WITH(openssl,
|
||||||
|
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
|
||||||
|
[], [with_openssl=check])
|
||||||
|
|
||||||
|
# Help line for libfetch
|
||||||
|
AC_ARG_WITH(fetch,
|
||||||
|
AS_HELP_STRING([--with-fetch], [use libfetch as an internal downloader]),
|
||||||
|
[], [with_fetch=check])
|
||||||
|
|
||||||
# Help line for documentation
|
# Help line for documentation
|
||||||
AC_ARG_ENABLE(doc,
|
AC_ARG_ENABLE(doc,
|
||||||
AC_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
|
AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
|
||||||
[wantdoc=$enableval], [wantdoc=yes])
|
[wantdoc=$enableval], [wantdoc=yes])
|
||||||
|
|
||||||
# Help line for doxygen
|
# Help line for doxygen
|
||||||
AC_ARG_ENABLE(doxygen,
|
AC_ARG_ENABLE(doxygen,
|
||||||
AC_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
|
AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
|
||||||
[wantdoxygen=$enableval], [wantdoxygen=no])
|
[wantdoxygen=$enableval], [wantdoxygen=no])
|
||||||
|
|
||||||
# Help line for asciidoc
|
|
||||||
AC_ARG_ENABLE(asciidoc,
|
|
||||||
AC_HELP_STRING([--enable-asciidoc], [build your own manpages with Asciidoc]),
|
|
||||||
[wantasciidoc=$enableval], [wantasciidoc=no])
|
|
||||||
|
|
||||||
# Help line for debug
|
# Help line for debug
|
||||||
AC_ARG_ENABLE(debug,
|
AC_ARG_ENABLE(debug,
|
||||||
AC_HELP_STRING([--enable-debug], [enable debugging support]),
|
AS_HELP_STRING([--enable-debug], [enable debugging support]),
|
||||||
[debug=$enableval], [debug=no])
|
[debug=$enableval], [debug=no])
|
||||||
|
|
||||||
# Help line for pacman.static
|
# Help line for using git version in pacman version string
|
||||||
AC_ARG_ENABLE(pacman-static,
|
AC_ARG_ENABLE(git-version,
|
||||||
AC_HELP_STRING([--disable-pacman-static], [do not build static version of pacman]),
|
AS_HELP_STRING([--enable-git-version],
|
||||||
[pacmanstatic=$enableval], [pacmanstatic=yes])
|
[enable use of git version in version string if available]),
|
||||||
|
[wantgitver=$enableval], [wantgitver=no])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
@@ -129,22 +125,53 @@ AC_PROG_CC_C99
|
|||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_RANLIB
|
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_CHECK_PROGS([PYTHON], [python2.5 python2.4 python], [false])
|
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
|
||||||
|
AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false])
|
||||||
|
|
||||||
# find installed gettext
|
# find installed gettext
|
||||||
AM_GNU_GETTEXT([external])
|
AM_GNU_GETTEXT([external])
|
||||||
AM_GNU_GETTEXT_VERSION(0.13.1)
|
AM_GNU_GETTEXT_VERSION(0.13.1)
|
||||||
|
|
||||||
# Check for libarchive
|
# Check for libarchive
|
||||||
AC_CHECK_LIB([archive], [archive_read_data], , AC_MSG_ERROR([libarchive is needed to compile pacman!]))
|
AC_CHECK_LIB([archive], [archive_read_data], ,
|
||||||
|
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
|
||||||
|
|
||||||
# Check for libdownload
|
# Check for OpenSSL
|
||||||
AC_CHECK_LIB([download], [downloadParseURL], , AC_MSG_ERROR([libdownload is needed to compile pacman!]))
|
AC_MSG_CHECKING(whether to link with libssl)
|
||||||
|
AS_IF([test "x$with_openssl" != "xno"],
|
||||||
|
[AC_MSG_RESULT(yes)
|
||||||
|
AC_CHECK_LIB([ssl], [MD5_Final], ,
|
||||||
|
[if test "x$with_openssl" != "xcheck"; then
|
||||||
|
AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found])
|
||||||
|
fi],
|
||||||
|
[-lcrypto])],
|
||||||
|
AC_MSG_RESULT(no))
|
||||||
|
AM_CONDITIONAL([HAVE_LIBSSL], [test "x$ac_cv_lib_ssl_MD5_Final" = "xyes"])
|
||||||
|
|
||||||
|
# Enable or disable usage of libfetch
|
||||||
|
AC_MSG_CHECKING(whether to link with libfetch)
|
||||||
|
AS_IF([test "x$with_fetch" != "xno"],
|
||||||
|
[AC_MSG_RESULT(yes)
|
||||||
|
AC_CHECK_LIB([fetch], [fetchParseURL], ,
|
||||||
|
[if test "x$with_fetch" != "xcheck"; then
|
||||||
|
AC_MSG_FAILURE([--with-fetch was given, but -lfetch was not found])
|
||||||
|
fi],
|
||||||
|
[-lcrypto -ldl])
|
||||||
|
# Check if libfetch supports connnection caching which we use
|
||||||
|
AS_IF([test "x$ac_cv_lib_fetch_fetchParseURL" = "xyes"],
|
||||||
|
[AC_CHECK_DECL(fetchConnectionCacheInit, ,
|
||||||
|
AC_MSG_ERROR([libfetch must be version 2.28 or greater]),
|
||||||
|
[#include <fetch.h>])
|
||||||
|
])
|
||||||
|
],
|
||||||
|
AC_MSG_RESULT(no))
|
||||||
|
AM_CONDITIONAL([HAVE_LIBFETCH], [test "x$ac_cv_lib_fetch_fetchParseURL" = "xyes"])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/statvfs.h sys/time.h syslog.h wchar.h])
|
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h locale.h mntent.h string.h \
|
||||||
|
sys/ioctl.h sys/mount.h sys/param.h sys/statvfs.h \
|
||||||
|
sys/time.h sys/types.h sys/ucred.h syslog.h wchar.h])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
@@ -154,15 +181,22 @@ AC_TYPE_PID_T
|
|||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
AC_TYPE_UID_T
|
AC_TYPE_UID_T
|
||||||
|
AC_STRUCT_DIRENT_D_TYPE
|
||||||
|
PATH_MAX_DEFINED
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_CLOSEDIR_VOID
|
|
||||||
AC_FUNC_FORK
|
AC_FUNC_FORK
|
||||||
|
AC_FUNC_GETMNTENT
|
||||||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||||
AC_FUNC_MKTIME
|
AC_FUNC_MKTIME
|
||||||
AC_TYPE_SIGNAL
|
AC_CHECK_FUNCS([geteuid getmntinfo realpath regcomp strcasecmp \
|
||||||
AC_CHECK_FUNCS([realpath regcomp strcasecmp strdup strerror strnlen \
|
strndup strrchr strsep swprintf \
|
||||||
strndup strrchr strsep strstr strverscmp uname geteuid])
|
wcwidth uname])
|
||||||
|
# For the diskspace code
|
||||||
|
FS_STATS_TYPE
|
||||||
|
AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
|
||||||
|
AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
|
||||||
|
#include <sys/mount.h>]])
|
||||||
|
|
||||||
# Enable large file support if available
|
# Enable large file support if available
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
@@ -172,13 +206,40 @@ GCC_VISIBILITY_CC
|
|||||||
# Check if we have -fgnu89-inline flag
|
# Check if we have -fgnu89-inline flag
|
||||||
GCC_GNU89_INLINE_CC
|
GCC_GNU89_INLINE_CC
|
||||||
|
|
||||||
# Host-dependant flags
|
# Host-dependant definitions
|
||||||
case "${host}" in
|
SIZECMD="stat -L -c %s"
|
||||||
*-*-cygwin*)
|
SEDINPLACE="sed -i"
|
||||||
|
STRIP_BINARIES="--strip-all"
|
||||||
|
STRIP_SHARED="--strip-unneeded"
|
||||||
|
STRIP_STATIC="--strip-debug"
|
||||||
|
case "${host_os}" in
|
||||||
|
*bsd*)
|
||||||
|
SIZECMD="stat -L -f %z"
|
||||||
|
SEDINPLACE="sed -i ''"
|
||||||
|
;;
|
||||||
|
cygwin*)
|
||||||
|
host_os_cygwin=yes
|
||||||
CFLAGS="$CFLAGS -DCYGWIN"
|
CFLAGS="$CFLAGS -DCYGWIN"
|
||||||
;;
|
;;
|
||||||
|
darwin*)
|
||||||
|
host_os_darwin=yes
|
||||||
|
SIZECMD="/usr/bin/stat -L -f %z"
|
||||||
|
SEDINPLACE="/usr/bin/sed -i ''"
|
||||||
|
STRIP_BINARIES=""
|
||||||
|
STRIP_SHARED="-S"
|
||||||
|
STRIP_STATIC="-S"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
|
||||||
|
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
|
||||||
|
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
|
||||||
|
AC_SUBST(SIZECMD)
|
||||||
|
AC_SUBST(SEDINPLACE)
|
||||||
|
AC_SUBST(STRIP_BINARIES)
|
||||||
|
AC_SUBST(STRIP_SHARED)
|
||||||
|
AC_SUBST(STRIP_STATIC)
|
||||||
|
|
||||||
# Check for architecture, used in default makepkg.conf
|
# Check for architecture, used in default makepkg.conf
|
||||||
# (Note single space left after CARCHFLAGS)
|
# (Note single space left after CARCHFLAGS)
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
@@ -224,9 +285,15 @@ AC_SUBST(CARCHFLAGS)
|
|||||||
AC_SUBST(CHOST)
|
AC_SUBST(CHOST)
|
||||||
|
|
||||||
# Check for documentation support and status
|
# Check for documentation support and status
|
||||||
|
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
|
||||||
AC_MSG_CHECKING([for building documentation])
|
AC_MSG_CHECKING([for building documentation])
|
||||||
if test "x$wantdoc" = "xyes" ; then
|
if test "x$wantdoc" = "xyes" ; then
|
||||||
AC_MSG_RESULT([yes])
|
if test $ASCIIDOC ; then
|
||||||
|
AC_MSG_RESULT([yes, enabled by configure])
|
||||||
|
else
|
||||||
|
asciidoc="(warning : asciidoc not installed)"
|
||||||
|
AC_MSG_RESULT([yes $asciidoc])
|
||||||
|
fi
|
||||||
wantdoc=yes
|
wantdoc=yes
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no, disabled by configure])
|
AC_MSG_RESULT([no, disabled by configure])
|
||||||
@@ -235,9 +302,9 @@ fi
|
|||||||
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
|
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
|
||||||
|
|
||||||
# Check for doxygen support and status
|
# Check for doxygen support and status
|
||||||
|
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
||||||
AC_MSG_CHECKING([for doxygen])
|
AC_MSG_CHECKING([for doxygen])
|
||||||
if test "x$wantdoxygen" = "xyes" ; then
|
if test "x$wantdoxygen" = "xyes" ; then
|
||||||
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
|
||||||
if test $DOXYGEN ; then
|
if test $DOXYGEN ; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
usedoxygen=yes
|
usedoxygen=yes
|
||||||
@@ -251,23 +318,6 @@ else
|
|||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")
|
AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")
|
||||||
|
|
||||||
# Check for asciidoc support and status
|
|
||||||
AC_MSG_CHECKING([for asciidoc])
|
|
||||||
if test "x$wantasciidoc" = "xyes" ; then
|
|
||||||
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
|
|
||||||
if test $ASCIIDOC ; then
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
useasciidoc=yes
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no, asciidoc missing])
|
|
||||||
useasciidoc=no
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no, disabled by configure])
|
|
||||||
useasciidoc=no
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(USE_ASCIIDOC, test "x$useasciidoc" = "xyes")
|
|
||||||
|
|
||||||
# Enable or disable debug code
|
# Enable or disable debug code
|
||||||
AC_MSG_CHECKING(for debug mode request)
|
AC_MSG_CHECKING(for debug mode request)
|
||||||
if test "x$debug" = "xyes" ; then
|
if test "x$debug" = "xyes" ; then
|
||||||
@@ -278,21 +328,31 @@ if test "x$debug" = "xyes" ; then
|
|||||||
# Check for -fstack-protector availability
|
# Check for -fstack-protector availability
|
||||||
GCC_STACK_PROTECT_LIB
|
GCC_STACK_PROTECT_LIB
|
||||||
GCC_STACK_PROTECT_CC
|
GCC_STACK_PROTECT_CC
|
||||||
CFLAGS="$CFLAGS -Wall -Werror"
|
GCC_FORTIFY_SOURCE_CC
|
||||||
|
CFLAGS="$CFLAGS -g -Wall -Werror"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
CFLAGS="$CFLAGS -Wall"
|
CFLAGS="$CFLAGS -Wall"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable or disable inclusion of pacman.static
|
# Enable or disable use of git version in pacman version string
|
||||||
AC_MSG_CHECKING(whether to build pacman.static)
|
AC_MSG_CHECKING(whether to use git version if available)
|
||||||
if test "x$pacmanstatic" = "xyes" ; then
|
if test "x$wantgitver" = "xyes" ; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_CHECK_PROGS([GIT], [git])
|
||||||
AC_DEFINE([INCLUDE_PACMAN_STATIC], , [Build pacman.static])
|
AC_CHECK_FILE([.git/], hasgitdir=yes)
|
||||||
|
if test $GIT -a "x$hasgitdir" = "xyes"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
usegitver=yes
|
||||||
|
AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT([no, git or .git dir missing])
|
||||||
|
usegitver=no
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(INCLUDE_PACMAN_STATIC, test "x$pacmanstatic" = "xyes")
|
else
|
||||||
|
AC_MSG_RESULT([no, disabled by configure])
|
||||||
|
usegitver=no
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
|
||||||
|
|
||||||
# Set root directory
|
# Set root directory
|
||||||
AC_SUBST(ROOTDIR)
|
AC_SUBST(ROOTDIR)
|
||||||
@@ -302,9 +362,9 @@ AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packa
|
|||||||
# Set source package file extension
|
# Set source package file extension
|
||||||
AC_SUBST(SRCEXT)
|
AC_SUBST(SRCEXT)
|
||||||
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
|
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
|
||||||
# Set database file extension
|
# Set makepkg build script name
|
||||||
AC_SUBST(DBEXT)
|
AC_SUBST(BUILDSCRIPT)
|
||||||
AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases])
|
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
@@ -316,14 +376,16 @@ scripts/Makefile
|
|||||||
doc/Makefile
|
doc/Makefile
|
||||||
etc/Makefile
|
etc/Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
pactest/Makefile
|
test/pacman/Makefile
|
||||||
|
test/pacman/tests/Makefile
|
||||||
|
test/util/Makefile
|
||||||
contrib/Makefile
|
contrib/Makefile
|
||||||
Makefile
|
Makefile
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
pacman_display_version:
|
${PACKAGE_NAME}:
|
||||||
|
|
||||||
Build information:
|
Build information:
|
||||||
source code location : ${srcdir}
|
source code location : ${srcdir}
|
||||||
@@ -340,23 +402,24 @@ pacman_display_version:
|
|||||||
Architecture : ${CARCH}
|
Architecture : ${CARCH}
|
||||||
Architecture flags : ${CARCHFLAGS}
|
Architecture flags : ${CARCHFLAGS}
|
||||||
Host Type : ${CHOST}
|
Host Type : ${CHOST}
|
||||||
|
Filesize command : ${SIZECMD}
|
||||||
|
In-place sed command : ${SEDINPLACE}
|
||||||
|
|
||||||
libalpm version : ${LIB_VERSION}
|
libalpm version : ${LIB_VERSION}
|
||||||
libalpm version info : ${LIB_VERSION_INFO}
|
libalpm version info : ${LIB_VERSION_INFO}
|
||||||
pacman version : ${PACKAGE_VERSION}
|
pacman version : ${PACKAGE_VERSION}
|
||||||
|
using git version : ${usegitver}
|
||||||
|
|
||||||
Directory and file information:
|
Directory and file information:
|
||||||
root working directory : ${ROOTDIR}
|
root working directory : ${ROOTDIR}
|
||||||
package extension : ${PKGEXT}
|
package extension : ${PKGEXT}
|
||||||
source pkg extension : ${SRCEXT}
|
source pkg extension : ${SRCEXT}
|
||||||
database extension : ${DBEXT}
|
build script name : ${BUILDSCRIPT}
|
||||||
|
|
||||||
Compilation options:
|
Compilation options:
|
||||||
Run make in doc/ dir : ${wantdoc}
|
Run make in doc/ dir : ${wantdoc} ${asciidoc}
|
||||||
Doxygen support : ${usedoxygen}
|
Doxygen support : ${usedoxygen}
|
||||||
Asciidoc support : ${useasciidoc}
|
|
||||||
debug support : ${debug}
|
debug support : ${debug}
|
||||||
build pacman.static : ${pacmanstatic}
|
|
||||||
"
|
"
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
8
contrib/.gitignore
vendored
8
contrib/.gitignore
vendored
@@ -0,0 +1,8 @@
|
|||||||
|
bacman
|
||||||
|
bash_completion
|
||||||
|
pacdiff
|
||||||
|
paclist
|
||||||
|
pacscripts
|
||||||
|
pacsearch
|
||||||
|
wget-xdelta.sh
|
||||||
|
zsh_completion
|
||||||
|
|||||||
@@ -1,12 +1,61 @@
|
|||||||
|
OURSCRIPTS = \
|
||||||
|
bacman \
|
||||||
|
pacdiff \
|
||||||
|
paclist \
|
||||||
|
pacscripts \
|
||||||
|
pacsearch \
|
||||||
|
wget-xdelta.sh
|
||||||
|
|
||||||
|
OURFILES = \
|
||||||
|
bash_completion \
|
||||||
|
zsh_completion
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
PKGBUILD.vim \
|
PKGBUILD.vim \
|
||||||
bash_completion \
|
bacman.in \
|
||||||
pacdiff \
|
bash_completion.in \
|
||||||
pacsearch \
|
pacdiff.in \
|
||||||
re-pacman \
|
paclist.in \
|
||||||
vimproject \
|
pacscripts.in \
|
||||||
wget-xdelta.sh \
|
pacsearch.in \
|
||||||
zsh_completion \
|
vimprojects \
|
||||||
|
wget-xdelta.sh.in \
|
||||||
|
zsh_completion.in \
|
||||||
README
|
README
|
||||||
|
|
||||||
|
# Files that should be removed, but which Automake does not know.
|
||||||
|
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
|
||||||
|
|
||||||
|
edit = sed \
|
||||||
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
|
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
-e 's|@BASH_SHELL[@]|$(BASH_SHELL)|g'
|
||||||
|
|
||||||
|
$(OURSCRIPTS): Makefile
|
||||||
|
@echo ' ' GEN $@;
|
||||||
|
@rm -f $@ $@.tmp
|
||||||
|
@$(edit) $(srcdir)/$@.in >$@.tmp
|
||||||
|
@chmod +x $@.tmp
|
||||||
|
@chmod a-w $@.tmp
|
||||||
|
@mv $@.tmp $@
|
||||||
|
|
||||||
|
$(OURFILES): Makefile
|
||||||
|
@echo ' ' GEN $@;
|
||||||
|
@rm -f $@ $@.tmp
|
||||||
|
@$(edit) $(srcdir)/$@.in >$@.tmp
|
||||||
|
@chmod a-w $@.tmp
|
||||||
|
@mv $@.tmp $@
|
||||||
|
|
||||||
|
all-am: $(OURSCRIPTS) $(OURFILES)
|
||||||
|
|
||||||
|
bacman: $(srcdir)/bacman.in
|
||||||
|
bash_completion: $(srcdir)/bash_completion.in
|
||||||
|
pacdiff: $(srcdir)/pacdiff.in
|
||||||
|
paclist: $(srcdir)/paclist.in
|
||||||
|
pacscripts: $(srcdir)/pacscripts.in
|
||||||
|
pacsearch: $(srcdir)/pacsearch.in
|
||||||
|
pactree: $(srcdir)/pactree.in
|
||||||
|
wget-xdelta.sh: $(srcdir)/wget-xdelta.sh.in
|
||||||
|
zsh_completion: $(srcdir)/zsh_completion.in
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIl
|
|||||||
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
|
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
|
||||||
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
|
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
|
" pkgbase
|
||||||
|
" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
|
||||||
|
syn keyword pb_k_pkgbase pkgbase contained
|
||||||
|
syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
|
||||||
|
syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
|
||||||
|
syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
" pkgver
|
" pkgver
|
||||||
syn keyword pb_k_pkgver pkgver contained
|
syn keyword pb_k_pkgver pkgver contained
|
||||||
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
|
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
|
||||||
@@ -33,7 +40,7 @@ syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k
|
|||||||
|
|
||||||
" pkgrel
|
" pkgrel
|
||||||
syn keyword pb_k_pkgrel pkgrel contained
|
syn keyword pb_k_pkgrel pkgrel contained
|
||||||
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgver
|
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
|
||||||
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
|
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
|
||||||
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
|
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
@@ -45,6 +52,12 @@ syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
|
|||||||
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
|
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
|
||||||
syn match pbPkgdescSign /[='"]/ contained
|
syn match pbPkgdescSign /[='"]/ contained
|
||||||
|
|
||||||
|
" epoch
|
||||||
|
syn keyword pb_k_epoch epoch contained
|
||||||
|
syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
|
||||||
|
syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
|
||||||
|
syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
" url
|
" url
|
||||||
syn keyword pb_k_url url contained
|
syn keyword pb_k_url url contained
|
||||||
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
|
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
|
||||||
@@ -54,10 +67,13 @@ syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubl
|
|||||||
|
|
||||||
" license
|
" license
|
||||||
syn keyword pb_k_license license contained
|
syn keyword pb_k_license license contained
|
||||||
syn keyword pbLicense APACHE CDDL EPL FDL GPL LGPL MPL PHP RUBY ZLIB ISC MIT BSD contained
|
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
|
||||||
|
syn keyword pbLicense APACHE CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RALINK RUBY ZPL contained
|
||||||
|
" special cases from http://wiki.archlinux.org/index.php/Arch_Packaging_Standards
|
||||||
|
syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained
|
||||||
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
|
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
|
||||||
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicense
|
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
|
||||||
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicense,pbIllegalLicense,shDoubleQuote,shSingleQuote
|
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
|
||||||
|
|
||||||
" backup
|
" backup
|
||||||
syn keyword pb_k_backup backup contained
|
syn keyword pb_k_backup backup contained
|
||||||
@@ -66,9 +82,9 @@ syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidB
|
|||||||
|
|
||||||
" arch
|
" arch
|
||||||
syn keyword pb_k_arch arch contained
|
syn keyword pb_k_arch arch contained
|
||||||
syn keyword pbArch i686 x86_64 ppc contained
|
syn keyword pbArch i686 x86_64 ppc any contained
|
||||||
syn match pbIllegalArch /[^='() ]/ contained contains=pbArch
|
syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
|
||||||
syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch,shDoubleQuote,shSingleQuote
|
syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
|
||||||
|
|
||||||
" groups
|
" groups
|
||||||
syn keyword pb_k_groups groups contained
|
syn keyword pb_k_groups groups contained
|
||||||
@@ -115,6 +131,12 @@ syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
|
|||||||
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
|
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
|
||||||
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
|
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
|
" changelog
|
||||||
|
syn keyword pb_k_changelog changelog contained
|
||||||
|
syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
|
||||||
|
syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
|
||||||
|
syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
" source:
|
" source:
|
||||||
" XXX remove source from shStatement, fix strange bug
|
" XXX remove source from shStatement, fix strange bug
|
||||||
syn clear shStatement
|
syn clear shStatement
|
||||||
@@ -127,13 +149,12 @@ syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
|
|||||||
hi def link pbDerefEmulation PreProc
|
hi def link pbDerefEmulation PreProc
|
||||||
|
|
||||||
" md5sums
|
" md5sums
|
||||||
|
|
||||||
syn keyword pb_k_md5sums md5sums contained
|
syn keyword pb_k_md5sums md5sums contained
|
||||||
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
|
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
|
||||||
syn match pbValidMd5sums /[[:alnum:]]\{32\}/ contained
|
syn match pbValidMd5sums /\x\{32\}/ contained
|
||||||
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums
|
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
|
||||||
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
|
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
|
||||||
syn match pbMd5Hash /[[:alnum:]]\+/ contained contains=pbValidMd5sums
|
syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
|
||||||
hi def link pbMd5Quotes Keyword
|
hi def link pbMd5Quotes Keyword
|
||||||
hi def link pbMd5Hash Error
|
hi def link pbMd5Hash Error
|
||||||
hi def link pbValidMd5sums Number
|
hi def link pbValidMd5sums Number
|
||||||
@@ -141,17 +162,17 @@ hi def link pbValidMd5sums Number
|
|||||||
" sha1sums
|
" sha1sums
|
||||||
syn keyword pb_k_sha1sums sha1sums contained
|
syn keyword pb_k_sha1sums sha1sums contained
|
||||||
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
|
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
|
||||||
syn match pbValidSha1sums /[[:alnum:]]\{40\}/ contained
|
syn match pbValidSha1sums /\x\{40\}/ contained
|
||||||
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums
|
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
|
||||||
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
|
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
|
||||||
syn match pbSha1Hash /[[:alnum:]]\+/ contained contains=pbValidSha1sums
|
syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
|
||||||
hi def link pbSha1Quotes Keyword
|
hi def link pbSha1Quotes Keyword
|
||||||
hi def link pbSha1Hash Error
|
hi def link pbSha1Hash Error
|
||||||
hi def link pbValidSha1sums Number
|
hi def link pbValidSha1sums Number
|
||||||
|
|
||||||
" options
|
" options
|
||||||
syn keyword pb_k_options options contained
|
syn keyword pb_k_options options contained
|
||||||
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|ccache\|distcc\|makeflags\|force\)/ contained
|
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|buildflags\)/ contained
|
||||||
syn match pbOptionsNeg /\!/ contained
|
syn match pbOptionsNeg /\!/ contained
|
||||||
syn match pbOptionsDeprec /no/ contained
|
syn match pbOptionsDeprec /no/ contained
|
||||||
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
|
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
|
||||||
@@ -181,6 +202,9 @@ hi def link pbTodo Todo
|
|||||||
hi def link pbIllegalPkgname Error
|
hi def link pbIllegalPkgname Error
|
||||||
hi def link pb_k_pkgname pbKeywords
|
hi def link pb_k_pkgname pbKeywords
|
||||||
|
|
||||||
|
hi def link pbIllegalPkgbase Error
|
||||||
|
hi def link pb_k_pkgbase pbKeywords
|
||||||
|
|
||||||
hi def link pbIllegalPkgver Error
|
hi def link pbIllegalPkgver Error
|
||||||
hi def link pb_k_pkgver pbKeywords
|
hi def link pb_k_pkgver pbKeywords
|
||||||
|
|
||||||
@@ -212,6 +236,9 @@ hi def link pb_k_provides pbKeywords
|
|||||||
hi def link pbIllegalInstall Error
|
hi def link pbIllegalInstall Error
|
||||||
hi def link pb_k_install pbKeywords
|
hi def link pb_k_install pbKeywords
|
||||||
|
|
||||||
|
hi def link pbIllegalChangelog Error
|
||||||
|
hi def link pb_k_changelog pbKeywords
|
||||||
|
|
||||||
hi def link pb_k_source pbKeywords
|
hi def link pb_k_source pbKeywords
|
||||||
hi def link pbIllegalSource Error
|
hi def link pbIllegalSource Error
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,21 @@ zsh_completion - a zsh completion script, install (with a rename) to
|
|||||||
|
|
||||||
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
|
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
|
||||||
|
|
||||||
|
paclist - list all packages installed from a given repository. Useful for
|
||||||
|
seeing which packages you may have installed from the testing repository,
|
||||||
|
for instance.
|
||||||
|
|
||||||
|
pacscripts - tries to print out the {pre,post}_{install,remove,upgrade}
|
||||||
|
scripts of a given package.
|
||||||
|
|
||||||
pacsearch - a colorized search combining both -Ss and -Qs output. Installed
|
pacsearch - a colorized search combining both -Ss and -Qs output. Installed
|
||||||
packages are easily identified with a *** and local-only packages are also
|
packages are easily identified with a *** and local-only packages are also
|
||||||
listed.
|
listed.
|
||||||
|
|
||||||
re-pacman - regenerate a pacman package based on installed files and the pacman
|
bacman - regenerate a pacman package based on installed files and the pacman
|
||||||
database entries. Useful for reuse, or possible config file extension.
|
database entries. Useful for reuse, or possible config file extension.
|
||||||
|
|
||||||
vimproject - a project file for the vim project plugin (some files listed
|
vimprojects - a project file for the vim project plugin.
|
||||||
may need to be updated).
|
|
||||||
|
|
||||||
wget-xdelta.sh - A download script for pacman which allows binary deltas
|
wget-xdelta.sh - A download script for pacman which allows binary deltas
|
||||||
generated with makepkg to be used instead of downloading full binary packages.
|
generated with makepkg to be used instead of downloading full binary packages.
|
||||||
|
|||||||
305
contrib/bacman.in
Executable file
305
contrib/bacman.in
Executable file
@@ -0,0 +1,305 @@
|
|||||||
|
#!@BASH_SHELL@
|
||||||
|
#
|
||||||
|
# bacman: recreate a package from a running system
|
||||||
|
# This script rebuilds an already installed package using metadata
|
||||||
|
# stored into the pacman database and system files
|
||||||
|
#
|
||||||
|
# (c) 2008 - locci <carlocci_at_gmail_dot_com>
|
||||||
|
#
|
||||||
|
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
readonly progname="bacman"
|
||||||
|
readonly progver="0.2.1"
|
||||||
|
|
||||||
|
#
|
||||||
|
# User Friendliness
|
||||||
|
#
|
||||||
|
function usage(){
|
||||||
|
echo "This program recreates a package using pacman's db and system files"
|
||||||
|
echo "Usage: $progname <installed package name>"
|
||||||
|
echo "Example: $progname kernel26"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 1 ] ; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "--help" -o "$1" = "-h" ] ; then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "--version" -o "$1" = "-v" ]; then
|
||||||
|
echo "$progname version $progver"
|
||||||
|
echo "Copyright (C) 2008 locci"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fakeroot support
|
||||||
|
#
|
||||||
|
if [ $EUID -gt 0 ]; then
|
||||||
|
if [ -f /usr/bin/fakeroot ]; then
|
||||||
|
echo "Entering fakeroot environment"
|
||||||
|
export INFAKEROOT="1"
|
||||||
|
/usr/bin/fakeroot -u -- $0 $1
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
echo "WARNING: installing fakeroot or running ${progname} as root is required to"
|
||||||
|
echo " preserve the ownership permissions of files in some packages"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Setting environmental variables
|
||||||
|
#
|
||||||
|
if [ ! -r @sysconfdir@/pacman.conf ]; then
|
||||||
|
echo "ERROR: unable to read @sysconfdir@/pacman.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
|
||||||
|
pac_db="${DBPath:-@localstatedir@/lib/pacman/}/local"
|
||||||
|
|
||||||
|
if [ ! -r @sysconfdir@/makepkg.conf ]; then
|
||||||
|
echo "ERROR: unable to read @sysconfdir@/makepkg.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "@sysconfdir@/makepkg.conf"
|
||||||
|
if [ -r ~/.makepkg.conf ]; then
|
||||||
|
source ~/.makepkg.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
pkg_arch=${CARCH:-'unknown'}
|
||||||
|
pkg_dest="${PKGDEST:-$PWD}"
|
||||||
|
pkg_pkger=${PACKAGER:-'Unknown Packager'}
|
||||||
|
|
||||||
|
pkg_name="$1"
|
||||||
|
pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)"
|
||||||
|
pkg_namver="${pkg_dir##*/}"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Checks everything is in place
|
||||||
|
#
|
||||||
|
if [ ! -d "$pac_db" ] ; then
|
||||||
|
echo "ERROR: pacman database directory ${pac_db} not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$pkg_dir" ] ; then
|
||||||
|
echo "ERROR: package ${pkg_name} not found in pacman database"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Begin
|
||||||
|
#
|
||||||
|
echo Package: ${pkg_namver}
|
||||||
|
work_dir=$(mktemp -d -p /tmp)
|
||||||
|
cd "$work_dir" || exit 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# File copying
|
||||||
|
#
|
||||||
|
echo "Copying package files..."
|
||||||
|
|
||||||
|
cat "$pkg_dir"/files |
|
||||||
|
while read i; do
|
||||||
|
if [ -z "$i" ] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$i" =~ %[A-Z]*% ]] ; then
|
||||||
|
current=$i
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $current in
|
||||||
|
%FILES%)
|
||||||
|
ret=0
|
||||||
|
if [ -e "/$i" ]; then
|
||||||
|
bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
|
||||||
|
|
||||||
|
# Workaround to bsdtar not reporting a missing file as an error
|
||||||
|
if [ ! -e "$work_dir/$i" -a ! -L "$work_dir/$i" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: unable to add /$i to the package"
|
||||||
|
echo " If your user does not have permssion to read this file then"
|
||||||
|
echo " you will need to run $progname as root"
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: package file /$i is missing"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pkg_size=$(du -sk | awk '{print $1 * 1024}')
|
||||||
|
|
||||||
|
#
|
||||||
|
# .PKGINFO stuff
|
||||||
|
#
|
||||||
|
echo Generating .PKGINFO metadata...
|
||||||
|
echo "# Generated by $progname $progver" > .PKGINFO
|
||||||
|
if [ "$INFAKEROOT" = "1" ]; then
|
||||||
|
echo "# Using $(fakeroot -v)" >> .PKGINFO
|
||||||
|
fi
|
||||||
|
echo "# $(LC_ALL=C date)" >> .PKGINFO
|
||||||
|
echo "#" >> .PKGINFO
|
||||||
|
|
||||||
|
cat "$pkg_dir"/{desc,files} |
|
||||||
|
while read i; do
|
||||||
|
if [[ -z "$i" ]]; then
|
||||||
|
continue;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$i" =~ %[A-Z]*% ]] ; then
|
||||||
|
current=$i
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$current" in
|
||||||
|
# desc
|
||||||
|
%NAME%)
|
||||||
|
echo "pkgname = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%VERSION%)
|
||||||
|
echo "pkgver = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%DESC%)
|
||||||
|
echo "pkgdesc = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%URL%)
|
||||||
|
echo "url = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%LICENSE%)
|
||||||
|
echo "license = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%ARCH%)
|
||||||
|
echo "arch = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%BUILDDATE%)
|
||||||
|
echo "builddate = $(date -u "+%s")" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%PACKAGER%)
|
||||||
|
echo "packager = $pkg_pkger" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%SIZE%)
|
||||||
|
echo "size = $pkg_size" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%GROUPS%)
|
||||||
|
echo "group = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%REPLACES%)
|
||||||
|
echo "replaces = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%DEPENDS%)
|
||||||
|
echo "depend = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%OPTDEPENDS%)
|
||||||
|
echo "optdepend = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%CONFLICTS%)
|
||||||
|
echo "conflict = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
%PROVIDES%)
|
||||||
|
echo "provides = $i" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
|
||||||
|
# files
|
||||||
|
%BACKUP%)
|
||||||
|
# strip the md5sum after the tab
|
||||||
|
echo "backup = ${i%%$'\t'*}" >> .PKGINFO
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
comp_files=".PKGINFO"
|
||||||
|
|
||||||
|
if [ -f "$pkg_dir/install" ] ; then
|
||||||
|
cp "$pkg_dir/install" "$work_dir/.INSTALL"
|
||||||
|
comp_files+=" .INSTALL"
|
||||||
|
fi
|
||||||
|
if [ -f $pkg_dir/changelog ] ; then
|
||||||
|
cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
|
||||||
|
comp_files+=" .CHANGELOG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
|
||||||
|
#
|
||||||
|
chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
|
||||||
|
chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generate the package
|
||||||
|
#
|
||||||
|
echo "Generating the package..."
|
||||||
|
|
||||||
|
case "$PKGEXT" in
|
||||||
|
*tar.gz) EXT=${PKGEXT%.gz} ;;
|
||||||
|
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
|
||||||
|
*tar.xz) EXT=${PKGEXT%.xz} ;;
|
||||||
|
*tar) EXT=${PKGEXT} ;;
|
||||||
|
*) echo "WARNING: '%s' is not a valid archive extension." \
|
||||||
|
"$PKGEXT" ; EXT=$PKGEXT ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
|
||||||
|
ret=0
|
||||||
|
|
||||||
|
# when fileglobbing, we want * in an empty directory to expand to
|
||||||
|
# the null string rather than itself
|
||||||
|
shopt -s nullglob
|
||||||
|
# TODO: Maybe this can be set globally for robustness
|
||||||
|
shopt -s -o pipefail
|
||||||
|
bsdtar -cf - $comp_files * |
|
||||||
|
case "$PKGEXT" in
|
||||||
|
*tar.gz) gzip -c -f -n ;;
|
||||||
|
*tar.bz2) bzip2 -c -f ;;
|
||||||
|
*tar.xz) xz -c -z - ;;
|
||||||
|
*tar) cat ;;
|
||||||
|
esac > ${pkg_file} || ret=$?
|
||||||
|
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
echo "ERROR: unable to write package to $pkg_dest"
|
||||||
|
echo " Maybe the disk is full or you do not have write access"
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
|
||||||
|
echo Done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
|
|
||||||
@@ -1,362 +0,0 @@
|
|||||||
# vim: set ft=sh ts=2 sw=2 et:
|
|
||||||
# file: /etc/bash_completion.d/pacman
|
|
||||||
|
|
||||||
# Bash completion for pacman
|
|
||||||
# Original: Manolis Tzanidakis <mtzanidakis@freemail.gr>
|
|
||||||
#
|
|
||||||
# Distributed under the terms of the GNU General Public License, v2 or later.
|
|
||||||
#
|
|
||||||
|
|
||||||
## initial functions
|
|
||||||
|
|
||||||
rem_selected ()
|
|
||||||
{
|
|
||||||
# (Adapted from bash_completion by Ian Macdonald <ian@caliban.org>)
|
|
||||||
# This removes any options from the list of completions that have
|
|
||||||
# already been specified on the command line.
|
|
||||||
COMPREPLY=($(echo "${COMP_WORDS[@]}" | \
|
|
||||||
(while read -d ' ' i; do
|
|
||||||
[ "${i}" == "" ] && continue
|
|
||||||
# flatten array with spaces on either side,
|
|
||||||
# otherwise we cannot grep on word boundaries of
|
|
||||||
# first and last word
|
|
||||||
COMPREPLY=" ${COMPREPLY[@]} "
|
|
||||||
# remove word from list of completions
|
|
||||||
COMPREPLY=(${COMPREPLY/ ${i%% *} / })
|
|
||||||
done
|
|
||||||
echo ${COMPREPLY[@]})))
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
_available_repos ()
|
|
||||||
{
|
|
||||||
COMPREPLY=( $( compgen -W "$(grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )" -- $cur ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_installed_pkgs ()
|
|
||||||
{
|
|
||||||
local installed_pkgs
|
|
||||||
installed_pkgs=$( ls /var/lib/pacman/local/ )
|
|
||||||
COMPREPLY=( $( compgen -W "$( for i in $installed_pkgs; do echo ${i%-*-*}; done )" -- $cur ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_available_pkgs ()
|
|
||||||
{
|
|
||||||
#find balks easilly on a find /foo/*/* type dir, especially one like
|
|
||||||
# /var/lib/pacman/*/*
|
|
||||||
# This little change-up removes the find *and* only uses enabled repos
|
|
||||||
local available_pkgs
|
|
||||||
local enabled_repos
|
|
||||||
enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )
|
|
||||||
available_pkgs=$( for r in $enabled_repos; do echo /var/lib/pacman/sync/$r/*; done )
|
|
||||||
COMPREPLY=( $( compgen -W "$( for i in $available_pkgs; do j=${i##*/}; echo ${j%-*-*}; done )" -- $cur ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_installed_groups ()
|
|
||||||
{
|
|
||||||
local installed_groups
|
|
||||||
installed_groups=$( find /var/lib/pacman/local -name desc -exec sed -ne '/%GROUPS%/,/^$/{//d; p}' {} \; | sort -u )
|
|
||||||
COMPREPLY=( $( compgen -W "$( for i in $installed_groups; do echo ${i%-*-*}; done )" -- $cur ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_available_groups ()
|
|
||||||
{
|
|
||||||
#find balks easilly on a find /foo/*/* type dir, especially one like
|
|
||||||
# /var/lib/pacman/*/*
|
|
||||||
# This little change-up removes the find *and* only uses enabled repos
|
|
||||||
local available_groups
|
|
||||||
local enabled_repos
|
|
||||||
enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )
|
|
||||||
available_groups=$( for r in $enabled_repos; do sed '/%GROUPS%/,/^$/{//d; p}' /var/lib/pacman/sync/$r/*/desc | sort -u; done )
|
|
||||||
COMPREPLY=( $( compgen -W "$( for i in $available_groups; do echo ${i%-*-*}; done )" -- $cur ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
## makepkg completion
|
|
||||||
|
|
||||||
_makepkg ()
|
|
||||||
{
|
|
||||||
local cur prev
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
|
|
||||||
case "$prev" in
|
|
||||||
-p)
|
|
||||||
_filedir
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
--help|--cleancache)
|
|
||||||
COMPREPLY=''
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=( $( compgen -W '\
|
|
||||||
-A --ignorearch \
|
|
||||||
-b --builddeps \
|
|
||||||
-c --clean \
|
|
||||||
-C --cleancache \
|
|
||||||
-d --nodeps \
|
|
||||||
-e --noextract \
|
|
||||||
-f --force \
|
|
||||||
-g --geninteg \
|
|
||||||
-h --help \
|
|
||||||
-i --install \
|
|
||||||
-L --log \
|
|
||||||
-m --nocolor \
|
|
||||||
-o --nobuild \
|
|
||||||
-p \
|
|
||||||
-r --rmdeps \
|
|
||||||
-s --syncdeps \
|
|
||||||
--asroot \
|
|
||||||
--source \
|
|
||||||
--noconfirm \
|
|
||||||
--noprogressbar' -- $cur ) )
|
|
||||||
fi
|
|
||||||
|
|
||||||
rem_selected
|
|
||||||
}
|
|
||||||
complete -o default -F _makepkg makepkg
|
|
||||||
|
|
||||||
## pacman completion
|
|
||||||
|
|
||||||
_instring ()
|
|
||||||
{
|
|
||||||
str="${1}"
|
|
||||||
shift 1
|
|
||||||
for c in "${@}"; do
|
|
||||||
if [ $(expr index "${str}" "${c}") -gt 0 ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
_pacman ()
|
|
||||||
{
|
|
||||||
local a arg toparse op mod cur
|
|
||||||
COMPREPLY=()
|
|
||||||
|
|
||||||
# This argument parsing is done so we can check for flag existance later
|
|
||||||
# right now it's a tad crappy, but does the job
|
|
||||||
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
|
|
||||||
a=${COMP_WORDS[i]}
|
|
||||||
arg="${a:0:2}"
|
|
||||||
toparse="${a:2}"
|
|
||||||
|
|
||||||
case "${arg}" in
|
|
||||||
-@(A|U|R|S|Q|h|V))
|
|
||||||
op="${arg/-}"
|
|
||||||
mod="${mod}${a:2}"
|
|
||||||
;;
|
|
||||||
--)
|
|
||||||
arg="${a:2}"
|
|
||||||
case "${arg}" in
|
|
||||||
add) op="A" ;;
|
|
||||||
remove) op="R" ;;
|
|
||||||
upgrade) op="U" ;;
|
|
||||||
query) op="Q" ;;
|
|
||||||
sync) op="S" ;;
|
|
||||||
help) op="h" ;;
|
|
||||||
version) op="V" ;;
|
|
||||||
verbose) mod="${mod}v" ;;
|
|
||||||
root) mod="${mod}r" ;;
|
|
||||||
dbpath) mod="${mod}b" ;;
|
|
||||||
nodeps) mod="${mod}d" ;;
|
|
||||||
force) mod="${mod}f" ;;
|
|
||||||
groups) mod="${mod}g" ;;
|
|
||||||
info) mod="${mod}i" ;;
|
|
||||||
list) mod="${mod}l" ;;
|
|
||||||
print-uris) mod="${mod}p" ;;
|
|
||||||
search) mod="${mod}s" ;;
|
|
||||||
sysupgrade) mod="${mod}u" ;;
|
|
||||||
upgrades) mod="${mod}u" ;;
|
|
||||||
downloadonly) mod="${mod}w" ;;
|
|
||||||
refresh) mod="${mod}y" ;;
|
|
||||||
changelog) mod="${mod}c" ;;
|
|
||||||
deps) mod="${mod}d" ;;
|
|
||||||
explicit) mod="${mod}e" ;;
|
|
||||||
unrequired) mod="${mod}t" ;;
|
|
||||||
foreign) mod="${mod}m" ;;
|
|
||||||
owns) mod="${mod}o" ;;
|
|
||||||
file) mod="${mod}p" ;;
|
|
||||||
search) mod="${mod}s" ;;
|
|
||||||
upgrades) mod="${mod}u" ;;
|
|
||||||
cascade) mod="${mod}c" ;;
|
|
||||||
dbonly) mod="${mod}k" ;;
|
|
||||||
nosave) mod="${mod}n" ;;
|
|
||||||
recursive) mod="${mod}s" ;;
|
|
||||||
esac ;;
|
|
||||||
*) toparse="${a}" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
arglen=$(( ${#toparse}-1 ))
|
|
||||||
for c in $(seq 0 "${arglen}"); do
|
|
||||||
arg=${toparse:$c:1}
|
|
||||||
[ "${arg}" != "-" ] && mod="${mod}${arg}"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
|
|
||||||
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=( $( compgen -W '\
|
|
||||||
-A --add \
|
|
||||||
-h --help \
|
|
||||||
-Q --query \
|
|
||||||
-R --remove \
|
|
||||||
-S --sync \
|
|
||||||
-U --upgrade \
|
|
||||||
-V --version \
|
|
||||||
' -- $cur ) )
|
|
||||||
rem_selected
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
case "${op}" in
|
|
||||||
A|U)
|
|
||||||
COMPREPLY=( $( compgen -W '\
|
|
||||||
--asdeps \
|
|
||||||
-d --nodeps \
|
|
||||||
-f --force \
|
|
||||||
-h --help \
|
|
||||||
--config \
|
|
||||||
--logfile \
|
|
||||||
--noconfirm \
|
|
||||||
--noprogressbar \
|
|
||||||
--noscriptlet \
|
|
||||||
-v --verbose \
|
|
||||||
-r --root \
|
|
||||||
-b --dbpath \
|
|
||||||
--cachedir \
|
|
||||||
' -- $cur ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
R)
|
|
||||||
COMPREPLY=( $( compgen -W '\
|
|
||||||
-c --cascade \
|
|
||||||
-d --nodeps \
|
|
||||||
-h --help \
|
|
||||||
-k --dbonly \
|
|
||||||
-n --nosave \
|
|
||||||
-s --recursive \
|
|
||||||
--config \
|
|
||||||
--logfile \
|
|
||||||
--noconfirm \
|
|
||||||
--noprogressbar \
|
|
||||||
--noscriptlet \
|
|
||||||
-v --verbose \
|
|
||||||
-r --root \
|
|
||||||
-b --dbpath \
|
|
||||||
--cachedir \
|
|
||||||
' -- $cur ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
S)
|
|
||||||
COMPREPLY=( $( compgen -W '\
|
|
||||||
--asdeps \
|
|
||||||
-c --clean \
|
|
||||||
-d --nodeps \
|
|
||||||
-e --dependsonly \
|
|
||||||
-f --force \
|
|
||||||
-g --groups \
|
|
||||||
-h --help \
|
|
||||||
-i --info \
|
|
||||||
-l --list \
|
|
||||||
-p --print-uris \
|
|
||||||
-s --search \
|
|
||||||
-u --sysupgrade \
|
|
||||||
-w --downloadonly \
|
|
||||||
-y --refresh \
|
|
||||||
--needed \
|
|
||||||
--ignore \
|
|
||||||
--ignoregroup \
|
|
||||||
--config \
|
|
||||||
--logfile \
|
|
||||||
--noconfirm \
|
|
||||||
--noprogressbar \
|
|
||||||
--noscriptlet \
|
|
||||||
-v --verbose \
|
|
||||||
-r --root \
|
|
||||||
-b --dbpath \
|
|
||||||
--cachedir \
|
|
||||||
' -- $cur ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
Q)
|
|
||||||
COMPREPLY=( $( compgen -W '\
|
|
||||||
-c --changelog \
|
|
||||||
-d --deps \
|
|
||||||
-e --explicit \
|
|
||||||
-g --groups \
|
|
||||||
-h --help \
|
|
||||||
-i --info \
|
|
||||||
-l --list \
|
|
||||||
-m --foreign \
|
|
||||||
-o --owns \
|
|
||||||
-p --file \
|
|
||||||
-s --search \
|
|
||||||
-t --unrequired \
|
|
||||||
-u --upgrades \
|
|
||||||
--config \
|
|
||||||
--logfile \
|
|
||||||
--noconfirm \
|
|
||||||
--noprogressbar \
|
|
||||||
--noscriptlet \
|
|
||||||
-v --verbose \
|
|
||||||
-r --root \
|
|
||||||
-b --dbpath \
|
|
||||||
--cachedir \
|
|
||||||
' -- $cur ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
rem_selected
|
|
||||||
else
|
|
||||||
case "${op}" in
|
|
||||||
A|U)
|
|
||||||
COMPREPLY=( $( compgen -d -- "$cur" ) \
|
|
||||||
$( compgen -f -X '!*.pkg.tar.gz' -- "$cur" ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
h|V)
|
|
||||||
COMPREPLY=''
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
Q)
|
|
||||||
if _instring $mod g; then
|
|
||||||
_installed_groups
|
|
||||||
elif _instring $mod o; then
|
|
||||||
COMPREPLY=( $( compgen -d -- "$cur" ) \
|
|
||||||
$( compgen -f -- "$cur" ) )
|
|
||||||
elif _instring $mod p; then
|
|
||||||
COMPREPLY=( $( compgen -d -- "$cur" ) \
|
|
||||||
$( compgen -f -X '!*.pkg.tar.gz' -- "$cur" ) )
|
|
||||||
elif _instring $mod u; then
|
|
||||||
COMPREPLY=''
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
_installed_pkgs
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
R)
|
|
||||||
_installed_pkgs
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
S)
|
|
||||||
if _instring $mod l; then
|
|
||||||
_available_repos
|
|
||||||
else
|
|
||||||
_available_pkgs
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
rem_selected
|
|
||||||
}
|
|
||||||
complete -o filenames -F _pacman pacman
|
|
||||||
113
contrib/bash_completion.in
Normal file
113
contrib/bash_completion.in
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# This file is in the public domain.
|
||||||
|
|
||||||
|
_arch_compgen() {
|
||||||
|
local i r
|
||||||
|
COMPREPLY=($(compgen -W '$*' -- "$cur"))
|
||||||
|
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
|
||||||
|
for r in ${!COMPREPLY[@]}; do
|
||||||
|
if [[ ${COMP_WORDS[i]} = ${COMPREPLY[r]} ]]; then
|
||||||
|
unset 'COMPREPLY[r]'; break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
_arch_ptr2comp() {
|
||||||
|
local list= x y
|
||||||
|
for x; do
|
||||||
|
for y in '0 --' '1 -'; do
|
||||||
|
eval 'set -- ${'$x'[${y% *}]}'
|
||||||
|
list+=\ ${@/#/${y#* }}
|
||||||
|
done
|
||||||
|
done
|
||||||
|
_arch_compgen $list
|
||||||
|
}
|
||||||
|
|
||||||
|
_arch_incomp() {
|
||||||
|
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
_makepkg() {
|
||||||
|
local cur opts prev
|
||||||
|
COMPREPLY=()
|
||||||
|
_get_comp_words_by_ref cur prev
|
||||||
|
if [[ $cur = -* && ! $prev =~ ^-(-(cleancache|config|help)$|\w*[Chp]) ]]; then
|
||||||
|
opts=('allsource asroot clean cleancache config force geninteg help holdver
|
||||||
|
ignorearch install log nobuild nocolor noconfirm nodeps noextract
|
||||||
|
noprogressbar pkg repackage rmdeps skipinteg source syncdeps'
|
||||||
|
'A C L R c d e f g h i m o p r s')
|
||||||
|
_arch_ptr2comp opts
|
||||||
|
fi
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
_pacman_pkg() {
|
||||||
|
_arch_compgen "$(
|
||||||
|
if [[ $2 ]]; then
|
||||||
|
\pacman -$1 | \cut -d' ' -f1 | \sort -u
|
||||||
|
else
|
||||||
|
\pacman -$1
|
||||||
|
fi
|
||||||
|
)"
|
||||||
|
}
|
||||||
|
|
||||||
|
_pacman() {
|
||||||
|
local common core cur database prev query remove sync upgrade o
|
||||||
|
COMPREPLY=()
|
||||||
|
_get_comp_words_by_ref cur prev
|
||||||
|
database=('asdeps asexplicit')
|
||||||
|
query=('changelog check deps explicit file foreign groups info list owns
|
||||||
|
search unrequired upgrades' 'c e g i k l m o p s t u')
|
||||||
|
remove=('cascade dbonly nodeps nosave print recursive unneeded' 'c k n p s u')
|
||||||
|
sync=('asdeps asexplicit clean downloadonly force groups ignore ignoregroup
|
||||||
|
info list needed nodeps print refresh search sysupgrade'
|
||||||
|
'c f g i l p s u w y')
|
||||||
|
upgrade=('asdeps asexplicit force nodeps print' 'f p')
|
||||||
|
common=('arch cachedir config dbpath debug help logfile noconfirm
|
||||||
|
noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
|
||||||
|
core=('database help query remove sync upgrade version' 'D Q R S U V h')
|
||||||
|
|
||||||
|
for o in 'D database' 'Q query' 'R remove' 'S sync' 'U upgrade'; do
|
||||||
|
_arch_incomp "$o" && break
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
_arch_ptr2comp core
|
||||||
|
elif [[ ! $prev =~ ^-\w*[Vbhr] &&
|
||||||
|
! $prev = --@(cachedir|config|dbpath|help|logfile|root|version) ]]
|
||||||
|
then
|
||||||
|
[[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
|
||||||
|
case ${o% *} in
|
||||||
|
D|R)
|
||||||
|
_pacman_pkg Qq;;
|
||||||
|
Q)
|
||||||
|
{ _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
|
||||||
|
{ _arch_incomp 'p file' && _pacman_file; } ||
|
||||||
|
_arch_incomp 'o owns' || _arch_incomp 'u upgrades' ||
|
||||||
|
_pacman_pkg Qq;;
|
||||||
|
S)
|
||||||
|
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
|
||||||
|
{ _arch_incomp 'l list' && _pacman_pkg Sl sort; } ||
|
||||||
|
_pacman_pkg Slq;;
|
||||||
|
U)
|
||||||
|
_pacman_file;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||||
|
_pacman_file() {
|
||||||
|
compopt -o filenames; _filedir 'pkg.tar.*'
|
||||||
|
}
|
||||||
|
complete -F _pacman -o default pacman
|
||||||
|
else
|
||||||
|
_pacman_file() {
|
||||||
|
_filedir 'pkg.tar.*'
|
||||||
|
}
|
||||||
|
complete -F _pacman -o filenames -o default pacman
|
||||||
|
fi
|
||||||
|
|
||||||
|
complete -F _makepkg -o default makepkg
|
||||||
|
|
||||||
|
# ex:et ts=2 sw=2 ft=sh
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# pacdiff : a simple pacnew/pacorig/pacsave updater for /etc/
|
|
||||||
#
|
|
||||||
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
|
|
||||||
#
|
|
||||||
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Original http://phraktured.net/config/bin/pacdiff
|
|
||||||
|
|
||||||
diffprog=${DIFFPROG:-vimdiff}
|
|
||||||
for x in $(find /etc/ -name *.pacnew -o -name *.pacorig -o -name *.pacsave)
|
|
||||||
do
|
|
||||||
echo "File: ${x%.pac*}"
|
|
||||||
chk="$(cmp $x ${x%.pac*})"
|
|
||||||
if [ -z "${chk}" ]; then
|
|
||||||
echo " Files are identical, removing..."
|
|
||||||
rm $x
|
|
||||||
else
|
|
||||||
echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
|
|
||||||
read c
|
|
||||||
c="$(echo $c| tr A-Z a-z)" #tolower
|
|
||||||
if [ "$c" = "r" ]; then
|
|
||||||
rm $x
|
|
||||||
elif [ "$c" = "s" ]; then
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
[ "$c" = "n" -o "$c" = "N" ] || $diffprog $x ${x%.pac*}
|
|
||||||
echo -n " Remove file? [Y/n] "
|
|
||||||
read c
|
|
||||||
[ "$c" = "n" -o "$c" = "N" ] || rm $x
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
80
contrib/pacdiff.in
Executable file
80
contrib/pacdiff.in
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
#!@BASH_SHELL@
|
||||||
|
# pacdiff : a simple pacnew/pacorig/pacsave updater
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
|
||||||
|
#
|
||||||
|
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
diffprog=${DIFFPROG:-vimdiff}
|
||||||
|
diffsearchpath=${DIFFSEARCHPATH:-/etc}
|
||||||
|
locate=0
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "pacdiff : a simple pacnew/pacorig/pacsave updater"
|
||||||
|
echo "Usage : pacdiff [-l]"
|
||||||
|
echo " -l/--locate makes pacdiff use locate rather than find"
|
||||||
|
echo " DIFFPROG variable allows to override the default vimdiff"
|
||||||
|
echo " DIFFSEARCHPATH allows to override the default /etc path"
|
||||||
|
echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" pacdiff"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd() {
|
||||||
|
if [ $locate -eq 1 ]; then
|
||||||
|
locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave
|
||||||
|
else
|
||||||
|
find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave \) -print0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
case $1 in
|
||||||
|
-l|--locate)
|
||||||
|
locate=1;;
|
||||||
|
*)
|
||||||
|
usage; exit 0;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# see http://mywiki.wooledge.org/BashFAQ/020
|
||||||
|
while IFS= read -u 3 -r -d '' pacfile; do
|
||||||
|
file="${pacfile%.pac*}"
|
||||||
|
echo "File: $file"
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
echo " $file does not exist"
|
||||||
|
rm -i "$pacfile"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
check="$(cmp "$pacfile" "$file")"
|
||||||
|
if [ -z "${check}" ]; then
|
||||||
|
echo " Files are identical, removing..."
|
||||||
|
rm "$pacfile"
|
||||||
|
else
|
||||||
|
echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
|
||||||
|
while read c; do
|
||||||
|
case $c in
|
||||||
|
r|R) rm "$pacfile"; break ;;
|
||||||
|
v|V)
|
||||||
|
$diffprog "$pacfile" "$file"
|
||||||
|
rm -i "$pacfile"; break ;;
|
||||||
|
s|S) break ;;
|
||||||
|
*) echo -n " Invalid answer. Try again: [v/s/r] "; continue ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done 3< <(cmd)
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
88
contrib/paclist.in
Executable file
88
contrib/paclist.in
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# paclist - List all packages installed from a given repo
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
|
||||||
|
#
|
||||||
|
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $progname = "paclist";
|
||||||
|
my $version = "1.0";
|
||||||
|
|
||||||
|
if ($#ARGV != 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
|
||||||
|
print "$progname - List all packages installed from a given repo\n";
|
||||||
|
print "Usage: $progname <repo>\n";
|
||||||
|
print "Example: $progname testing\n";
|
||||||
|
if ($#ARGV != 0) {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
|
||||||
|
print "$progname version $version\n";
|
||||||
|
print "Copyright (C) 2008 Dan McGee\n";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# This hash table will be used to store pairs of ('name version', count) from
|
||||||
|
# the return of both pacman -Sl <repo> and pacman -Q output. We then check to
|
||||||
|
# see if a value was added twice (count = 2)- if so, we will print that package
|
||||||
|
# as it is both in the repo we queried and installed on our local system.
|
||||||
|
my %packages = ();
|
||||||
|
my $output;
|
||||||
|
|
||||||
|
$output = `pacman -Sl $ARGV[0]`;
|
||||||
|
if ($? != 0) {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
my @sync = split(/\n/, $output);
|
||||||
|
# sample output from pacman -Sl:
|
||||||
|
# testing foobar 1.0-1
|
||||||
|
foreach $_ (@sync) {
|
||||||
|
my @info = split(/ /);
|
||||||
|
# we only want to store 'foobar 1.0-1' in our hash table
|
||||||
|
my $pkg = $info[1] . " " . $info[2];
|
||||||
|
$packages{$pkg}++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = `pacman -Q`;
|
||||||
|
if ($? != 0) {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
# sample output from pacman -Q:
|
||||||
|
# foobar 1.0-1
|
||||||
|
my @local = split(/\n/, $output);
|
||||||
|
foreach $_ (@local) {
|
||||||
|
# store 'foobar 1.0-1' in our hash table
|
||||||
|
$packages{$_}++;
|
||||||
|
}
|
||||||
|
|
||||||
|
# run comparison check- if value was added twice, it was in the intersection
|
||||||
|
my @intersection;
|
||||||
|
foreach $_ (keys %packages) {
|
||||||
|
if ($packages{$_} == 2) {
|
||||||
|
push @{ \@intersection }, $_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# print our intersection, and bask in the glory and speed of perl
|
||||||
|
@intersection = sort @intersection;
|
||||||
|
foreach $_ (@intersection) {
|
||||||
|
print $_ . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#vim: set noet:
|
||||||
132
contrib/pacscripts.in
Executable file
132
contrib/pacscripts.in
Executable file
@@ -0,0 +1,132 @@
|
|||||||
|
#!@BASH_SHELL@
|
||||||
|
#
|
||||||
|
# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
|
||||||
|
# scripts of a given package
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>
|
||||||
|
# Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
|
||||||
|
#
|
||||||
|
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
# bash options
|
||||||
|
set -o nounset
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
|
progname=$(basename $0)
|
||||||
|
progver="0.4"
|
||||||
|
|
||||||
|
conf="@sysconfdir@/pacman.conf"
|
||||||
|
|
||||||
|
if [ ! -r "$conf" ]; then
|
||||||
|
echo "ERROR: unable to read $conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
|
||||||
|
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
|
||||||
|
pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
|
||||||
|
pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}"
|
||||||
|
|
||||||
|
error() {
|
||||||
|
local mesg=$1; shift
|
||||||
|
printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "This program prints out the {pre,post}_{install,remove,upgrade} scripts"
|
||||||
|
echo "of a given package."
|
||||||
|
echo "Usage: $progname pkgname|pkgfile"
|
||||||
|
echo
|
||||||
|
echo " OPTIONS:"
|
||||||
|
echo " -h, --help Print this help message"
|
||||||
|
echo " -v, --version Print program name and version"
|
||||||
|
echo
|
||||||
|
echo "Example: $progname gconf-editor"
|
||||||
|
echo "Example: $progname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
|
||||||
|
}
|
||||||
|
|
||||||
|
spacman() {
|
||||||
|
if [ $EUID -eq 0 ]; then
|
||||||
|
pacman "$@"
|
||||||
|
else
|
||||||
|
if [ ! "$(type -p sudo)" ]; then
|
||||||
|
error "Cannot find the sudo binary! Is sudo installed?"
|
||||||
|
error "Otherwise try to run the program as root"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
sudo pacman "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
print_db() {
|
||||||
|
pkg=$(pacman -Q "$1")
|
||||||
|
pkg=${pkg/ /-}
|
||||||
|
if [ -f $pac_db/$pkg*/install ]; then
|
||||||
|
cat $pac_db/$pkg*/install
|
||||||
|
echo
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
error "Package $1 does not include any .INSTALL script"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
print_pkg() {
|
||||||
|
if ! bsdtar -xOf "$1" .INSTALL 2>/dev/null; then
|
||||||
|
error "Package $1 does not include any .INSTALL script"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
print_scriptlet() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
if bsdtar tf "$1" .PKGINFO &>/dev/null; then
|
||||||
|
print_pkg "$1"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if pacman -Q "$1" &>/dev/null; then
|
||||||
|
print_db "$1"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if ! pacman -Si $1 &>/dev/null; then
|
||||||
|
error "Package $1 not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
url=$(spacman -Sdp $1 | tail -n1)
|
||||||
|
filename=$(basename $url)
|
||||||
|
if [ ! -f "$pac_cache/$filename" ]; then
|
||||||
|
if ! spacman -Sdw --noconfirm $1 >&2; then
|
||||||
|
error "Failed to download $1"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo >&2
|
||||||
|
fi
|
||||||
|
print_pkg "$pac_cache/$filename"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 1 ] ; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--help|-h) usage; exit 0 ;;
|
||||||
|
--version|-v) echo "$progname version $progver"; exit 0 ;;
|
||||||
|
*) print_scriptlet $1 ;;
|
||||||
|
esac
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# pacsearch - Adds color and install information to a 'pacman -Ss' search
|
|
||||||
#
|
|
||||||
# Copyright (C) 2006-2007 Dan McGee <dpmcgee@gmail.com>
|
|
||||||
#
|
|
||||||
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#TODO: colors flag on commandline
|
|
||||||
|
|
||||||
readonly progname="pacsearch"
|
|
||||||
readonly version="1.0"
|
|
||||||
|
|
||||||
readonly CLR1='\\\e[0;34m'
|
|
||||||
readonly CLR2='\\\e[0;32m'
|
|
||||||
readonly CLR3='\\\e[0;35m'
|
|
||||||
readonly CLR4='\\\e[0;36m'
|
|
||||||
readonly CLR5='\\\e[0;31m'
|
|
||||||
readonly CLR6='\\\e[0;33m'
|
|
||||||
readonly CLR7='\\\e[1;36m'
|
|
||||||
readonly INST='\\\e[1;31m'
|
|
||||||
readonly BASE='\\\e[0m'
|
|
||||||
|
|
||||||
if [ "$1" = "--help" -o "$1" = "-h" ]; then
|
|
||||||
echo "Usage: $progname <pattern>"
|
|
||||||
echo "Ex: $progname ^gnome"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" = "--version" -o "$1" = "-v" ]; then
|
|
||||||
echo "$progname version $version"
|
|
||||||
echo "Copyright (C) 2006-2007 Dan McGee"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$1" -o "${1:0:1}" = "-" ]; then
|
|
||||||
echo "Usage: $progname <pattern>"
|
|
||||||
echo "Ex: $progname ^gnome"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make two temp files and send output of commands to these files
|
|
||||||
querydump=$(mktemp)
|
|
||||||
pacman -Qs $1 > $querydump
|
|
||||||
syncdump=$(mktemp)
|
|
||||||
pacman -Ss $1 > $syncdump
|
|
||||||
|
|
||||||
# Strip descriptions and 'local/' from -Qs query
|
|
||||||
instpkg=$(mktemp)
|
|
||||||
egrep '^[^ ]' $querydump | sed -e 's@^local/@@' > $instpkg
|
|
||||||
|
|
||||||
# Add pkgs not in sync db, mark pkgs that are installed
|
|
||||||
cat $instpkg | while read -r pkg; do
|
|
||||||
if [ -z "$(grep "$pkg" $syncdump)" ]; then
|
|
||||||
# grep package name; pipe to another grep that prints at most one
|
|
||||||
# line starting with 'local/', allows for comments >1 line
|
|
||||||
grep -A10 "$pkg" $querydump | grep -A10 -m1 "local/" >> $syncdump
|
|
||||||
fi
|
|
||||||
sed -i "s@^\(.\+/$pkg\)@\***\1@" $syncdump
|
|
||||||
done
|
|
||||||
|
|
||||||
# Print colorized package list and descriptions to screen
|
|
||||||
echo -e "$(sed -r \
|
|
||||||
-e "s@core/.*@$CLR1&$BASE@" \
|
|
||||||
-e "s@extra/.*@$CLR2&$BASE@" \
|
|
||||||
-e "s@community/.*@$CLR3&$BASE@" \
|
|
||||||
-e "s@testing/.*@$CLR4&$BASE@" \
|
|
||||||
-e "s@unstable/.*@$CLR5&$BASE@" \
|
|
||||||
-e "s@custom/.*@$CLR6&$BASE@" \
|
|
||||||
-e "s@local/.*@$CLR7&$BASE@" \
|
|
||||||
-e "s@(^|\*\*\*)([[:alnum:]]*/.* .*)@\1$CLR6\2$BASE@" \
|
|
||||||
-e "s@\*\*\*@$INST&@" \
|
|
||||||
< $syncdump )"
|
|
||||||
echo -en "\e[0m"
|
|
||||||
|
|
||||||
rm $querydump
|
|
||||||
rm $syncdump
|
|
||||||
rm $instpkg
|
|
||||||
|
|
||||||
136
contrib/pacsearch.in
Executable file
136
contrib/pacsearch.in
Executable file
@@ -0,0 +1,136 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# pacsearch - Adds color and install information to a 'pacman -Ss' search
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008-2011 Dan McGee <dan@archlinux.org>
|
||||||
|
#
|
||||||
|
# Based off original shell script version:
|
||||||
|
# Copyright (C) 2006-2007 Dan McGee <dan@archlinux.org>
|
||||||
|
#
|
||||||
|
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#TODO: colors flag on commandline
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $progname = "pacsearch";
|
||||||
|
my $version = "2.0";
|
||||||
|
|
||||||
|
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
|
||||||
|
print "$progname - Add color and install information to a pacman -Ss search\n";
|
||||||
|
print "Usage: $progname <pattern>\n";
|
||||||
|
print "Example: $progname ^gnome\n";
|
||||||
|
if ($#ARGV lt 0) {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
|
||||||
|
print "$progname version $version\n";
|
||||||
|
print "Copyright (C) 2006-2011 Dan McGee\n";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# define our colors to use when printing
|
||||||
|
my $CLR1 = "\e[0;34m";
|
||||||
|
my $CLR2 = "\e[0;32m";
|
||||||
|
my $CLR3 = "\e[0;35m";
|
||||||
|
my $CLR4 = "\e[0;36m";
|
||||||
|
my $CLR5 = "\e[0;31m";
|
||||||
|
my $CLR6 = "\e[0;33m";
|
||||||
|
my $CLR7 = "\e[1;36m";
|
||||||
|
my $INST = "\e[1;31m";
|
||||||
|
my $BASE = "\e[0m";
|
||||||
|
|
||||||
|
# color a "repo/pkgname pkgver" line based on the repository name
|
||||||
|
sub to_color {
|
||||||
|
my $line = shift;
|
||||||
|
# get the installed text colored first
|
||||||
|
$line =~ s/(\[.*\]$)/$INST$1$BASE/;
|
||||||
|
# and now the repo and dealings
|
||||||
|
$line =~ s/(^core\/.*)/$CLR1$1$BASE/;
|
||||||
|
$line =~ s/(^extra\/.*)/$CLR2$1$BASE/;
|
||||||
|
$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
|
||||||
|
$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
|
||||||
|
$line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
|
||||||
|
$line =~ s/(^multilib\/.*)/$CLR6$1$BASE/;
|
||||||
|
$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
|
||||||
|
# any other unknown repository
|
||||||
|
$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
|
||||||
|
return $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %allpkgs = ();
|
||||||
|
|
||||||
|
my $syncout = `pacman -Ss '@ARGV'`;
|
||||||
|
# split each sync search entry into its own array entry
|
||||||
|
my @syncpkgs = split(/\n^(?=\w)/m, $syncout);
|
||||||
|
# remove the extra \n from the last desc entry
|
||||||
|
if ($#syncpkgs >= 0) {
|
||||||
|
chomp($syncpkgs[$#syncpkgs]);
|
||||||
|
}
|
||||||
|
|
||||||
|
# counter var for packages, used here and in the query loop too
|
||||||
|
my $cnt = 0;
|
||||||
|
foreach $_ (@syncpkgs) {
|
||||||
|
# we grab 4 fields here: repo, name/ver, installed, and desc
|
||||||
|
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
|
||||||
|
if(not @pkgfields) {
|
||||||
|
# skip any non-matching line and just print it for the user
|
||||||
|
print $_, "\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
# since installed is optional, we should fill it in if necessary
|
||||||
|
$pkgfields[2] = "" if not defined $pkgfields[2];
|
||||||
|
# add a fifth field that indicates original order
|
||||||
|
push (@pkgfields, $cnt++);
|
||||||
|
# add each sync pkg by name/ver to a hash table for quick lookup
|
||||||
|
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
|
||||||
|
}
|
||||||
|
|
||||||
|
my $queryout = `pacman -Qs '@ARGV'`;
|
||||||
|
# split each querysearch entry into its own array entry
|
||||||
|
my @querypkgs = split(/\n^(?=\w)/m, $queryout);
|
||||||
|
# remove the extra \n from the last desc entry
|
||||||
|
if ($#querypkgs >= 0) {
|
||||||
|
chomp ($querypkgs[$#querypkgs]);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $_ (@querypkgs) {
|
||||||
|
# we grab 4 fields here: repo, name/ver, installed, and desc
|
||||||
|
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
|
||||||
|
# since installed is optional, we should fill it in if necessary
|
||||||
|
$pkgfields[2] = "" if not defined $pkgfields[2];
|
||||||
|
# check if the package was listed in the sync out
|
||||||
|
if (not exists $allpkgs{$pkgfields[1]}) {
|
||||||
|
$pkgfields[2] = "[installed]";
|
||||||
|
# add a fifth field that indicates original order (after sync)
|
||||||
|
push (@pkgfields, $cnt++);
|
||||||
|
# add our local-only package to the hash
|
||||||
|
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# sort by original order (the fifth field) and print
|
||||||
|
foreach $_ ( sort{ @{$allpkgs{$a}}[4] <=> @{$allpkgs{$b}}[4] } keys %allpkgs) {
|
||||||
|
my @v = @{$allpkgs{$_}};
|
||||||
|
my $line = "$v[0]/$v[1] $v[2]";
|
||||||
|
$line = to_color($line);
|
||||||
|
# print colorized "repo/pkgname pkgver" string with possible installed text
|
||||||
|
print "$line\n";
|
||||||
|
print "$v[3]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#vim: set noet:
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# re-pacman: regenerate a pacman package based on installed files and the
|
|
||||||
# pacman database entries. Useful for reuse, or possible config file
|
|
||||||
# extension
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Aaron Griffin <aaron@archlinux.org>
|
|
||||||
#
|
|
||||||
# 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 program 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
#TODO
|
|
||||||
# * Check for md5 changes in backup lines and change pkgrel
|
|
||||||
|
|
||||||
pacinfo () {
|
|
||||||
[ $# -ne 2 ] && return 1
|
|
||||||
#use echo to strip spaces
|
|
||||||
echo $(pacman -Qi ${1} | grep "${2}" | cut -d: -f2-)
|
|
||||||
}
|
|
||||||
|
|
||||||
make_pkginfo () {
|
|
||||||
echo "# Generated by re-pacman 1.0.0"
|
|
||||||
echo "# On $(date)"
|
|
||||||
echo "pkgname =$(pacinfo ${1} Name)"
|
|
||||||
echo "pkgver =$(pacinfo ${1} Version)"
|
|
||||||
echo "pkgdesc =$(pacinfo ${1} Description)"
|
|
||||||
echo "url =$(pacinfo ${1} URL)"
|
|
||||||
echo "builddate =$(pacinfo ${1} 'Build Date')"
|
|
||||||
echo "packager =$(pacinfo ${1} Packager)"
|
|
||||||
echo "size =$(pacinfo ${1} Size)"
|
|
||||||
echo "arch =$(pacinfo ${1} Architecture)"
|
|
||||||
deps=$(pacinfo ${1} 'Depends On')
|
|
||||||
for d in ${deps}; do
|
|
||||||
echo "depend = ${d}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
LANG="POSIX"
|
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "usage: re-pacman <installed package name>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ver=$(pacinfo ${1} Version)
|
|
||||||
if [ "x${ver}" = "x" ]; then
|
|
||||||
echo "Package '${1}' not found, aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ":: Cleaning up old files"
|
|
||||||
rm -f .PKGINFO "${1}-${ver}.pkg.tar.gz"
|
|
||||||
|
|
||||||
echo ":: Building PKGINFO"
|
|
||||||
make_pkginfo ${1} > .PKGINFO
|
|
||||||
|
|
||||||
flist=".PKGINFO"
|
|
||||||
flist="${flist} $(pacman -Ql ${1} | sed 's|\w* \(.*\)|/\1|g' | grep -v '/$')"
|
|
||||||
|
|
||||||
echo ":: Building final package tarball"
|
|
||||||
echo ${flist} | tr ' ' '\n' | tar czf "${1}-${ver}.pkg.tar.gz" -T - 2>/dev/null
|
|
||||||
|
|
||||||
rm -f .PKGINFO
|
|
||||||
echo ":: Package '${1}-${ver}.pkg.tar.gz' is now ready for installation"
|
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 noet:
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
This is a project file for the vim-project
|
|
||||||
plugin. I like it, so decided to contribute
|
|
||||||
this to the main repo.
|
|
||||||
$ pacman -S vim-project
|
|
||||||
change the pacman= path below
|
|
||||||
$ vim
|
|
||||||
:Project vimproject
|
|
||||||
|
|
||||||
pacman=~/devel/pacman-lib CD=. flags=S {
|
|
||||||
Makefile.am
|
|
||||||
configure.ac
|
|
||||||
libalpm=lib/libalpm/ filter="*.c *.h *.am"{
|
|
||||||
add.c
|
|
||||||
alpm.c
|
|
||||||
alpm_list.c
|
|
||||||
backup.c
|
|
||||||
be_files.c
|
|
||||||
cache.c
|
|
||||||
conflict.c
|
|
||||||
db.c
|
|
||||||
deps.c
|
|
||||||
error.c
|
|
||||||
group.c
|
|
||||||
handle.c
|
|
||||||
log.c
|
|
||||||
md5.c
|
|
||||||
package.c
|
|
||||||
provide.c
|
|
||||||
remove.c
|
|
||||||
server.c
|
|
||||||
sync.c
|
|
||||||
trans.c
|
|
||||||
util.c
|
|
||||||
add.h
|
|
||||||
alpm.h
|
|
||||||
alpm_list.h
|
|
||||||
backup.h
|
|
||||||
cache.h
|
|
||||||
conflict.h
|
|
||||||
db.h
|
|
||||||
deps.h
|
|
||||||
error.h
|
|
||||||
group.h
|
|
||||||
handle.h
|
|
||||||
log.h
|
|
||||||
md5.h
|
|
||||||
package.h
|
|
||||||
provide.h
|
|
||||||
remove.h
|
|
||||||
server.h
|
|
||||||
sync.h
|
|
||||||
trans.h
|
|
||||||
util.h
|
|
||||||
Makefile.am
|
|
||||||
Makefile.in
|
|
||||||
}
|
|
||||||
pacman=src/pacman/ filter="*.c *.h *.am" {
|
|
||||||
add.c
|
|
||||||
conf.c
|
|
||||||
deptest.c
|
|
||||||
downloadprog.c
|
|
||||||
log.c
|
|
||||||
package.c
|
|
||||||
pacman.c
|
|
||||||
query.c
|
|
||||||
remove.c
|
|
||||||
sync.c
|
|
||||||
trans.c
|
|
||||||
upgrade.c
|
|
||||||
util.c
|
|
||||||
add.h
|
|
||||||
conf.h
|
|
||||||
deptest.h
|
|
||||||
downloadprog.h
|
|
||||||
log.h
|
|
||||||
package.h
|
|
||||||
query.h
|
|
||||||
remove.h
|
|
||||||
sync.h
|
|
||||||
trans.h
|
|
||||||
upgrade.h
|
|
||||||
util.h
|
|
||||||
Makefile.am
|
|
||||||
}
|
|
||||||
utils=src/util filter="*.c *.h *.am" {
|
|
||||||
testpkg.c
|
|
||||||
vercmp.c
|
|
||||||
Makefile.am
|
|
||||||
}
|
|
||||||
contrib=contrib CD=. {
|
|
||||||
bash_completion
|
|
||||||
pacsearch
|
|
||||||
vimproject
|
|
||||||
zsh_completion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
25
contrib/vimprojects
Normal file
25
contrib/vimprojects
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
This is a project file
|
||||||
|
for the vim-project plugin.
|
||||||
|
Save it as ~/.vimprojects
|
||||||
|
|
||||||
|
$ pacman -S vim-project
|
||||||
|
change the pacman path below
|
||||||
|
$ vim
|
||||||
|
:Project
|
||||||
|
|
||||||
|
Press \r in the project view
|
||||||
|
on a project name to generate
|
||||||
|
the list of files
|
||||||
|
|
||||||
|
pacman=~/devel/pacman/ CD=. filter="*.ac *.am" flags=S {
|
||||||
|
libalpm=lib/libalpm/ filter="*.c *.h *.am" {
|
||||||
|
}
|
||||||
|
pacman=src/pacman/ filter="*.c *.h *.am" {
|
||||||
|
}
|
||||||
|
scripts=scripts/ filter="*.sh.in *.py.in *.am" {
|
||||||
|
}
|
||||||
|
utils=src/util filter="*.c *.h *.am" {
|
||||||
|
}
|
||||||
|
contrib=contrib CD=. {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!@BASH_SHELL@
|
||||||
|
|
||||||
if [ -r "/etc/makepkg.conf" ]; then
|
if [ -r "@sysconfdir@/makepkg.conf" ]; then
|
||||||
source /etc/makepkg.conf
|
source @sysconfdir@/makepkg.conf
|
||||||
else
|
else
|
||||||
echo "wget-xdelta: Unable to find makepkg.conf"
|
echo "wget-xdelta: Unable to find makepkg.conf"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -30,11 +30,11 @@ new_version=$(echo $pkg_data | cut -d ' ' -f 2)
|
|||||||
base_url=${file_url%/*}
|
base_url=${file_url%/*}
|
||||||
|
|
||||||
# Look for the last version
|
# Look for the last version
|
||||||
for file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
|
for file in $(ls -r @localstatedir@/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
|
||||||
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
|
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
|
||||||
check_version=$(echo $file | \
|
check_version=$(echo $file | \
|
||||||
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
|
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
|
||||||
grep -v "^/var/cache/pacman/pkg")
|
grep -v "^@localstatedir@/cache/pacman/pkg")
|
||||||
|
|
||||||
[ "$check_version" = "" ] && continue
|
[ "$check_version" = "" ] && continue
|
||||||
|
|
||||||
@@ -6,7 +6,6 @@ typeset -A opt_args
|
|||||||
|
|
||||||
# options for passing to _arguments: main pacman commands
|
# options for passing to _arguments: main pacman commands
|
||||||
_pacman_opts_commands=(
|
_pacman_opts_commands=(
|
||||||
'-A[Add a package to the system]'
|
|
||||||
'-Q[Query the package database]'
|
'-Q[Query the package database]'
|
||||||
'-R[Remove a package from the system]'
|
'-R[Remove a package from the system]'
|
||||||
'-S[Synchronize packages]'
|
'-S[Synchronize packages]'
|
||||||
@@ -27,13 +26,14 @@ _pacman_opts_common=(
|
|||||||
'--noconfirm[Do not ask for confirmation]'
|
'--noconfirm[Do not ask for confirmation]'
|
||||||
'--noprogressbar[Do not show a progress bar when downloading files]'
|
'--noprogressbar[Do not show a progress bar when downloading files]'
|
||||||
'--noscriptlet[Do not execute the install scriptlet if one exists]'
|
'--noscriptlet[Do not execute the install scriptlet if one exists]'
|
||||||
|
'--print[Only print the targets instead of performing the operation]'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: options for --add and --update commands
|
# options for passing to _arguments: options for --upgrade commands
|
||||||
_pacman_opts_pkgfile=(
|
_pacman_opts_pkgfile=(
|
||||||
'-d[Skip dependency checks]'
|
'-d[Skip dependency checks]'
|
||||||
'-f[Overwrite conflicting files]'
|
'-f[Overwrite conflicting files]'
|
||||||
'*:package file:_files -g "*.pkg.tar.gz(.)"'
|
'*:package file:_files -g "*.pkg.tar.*(.)"'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: subactions for --query command
|
# options for passing to _arguments: subactions for --query command
|
||||||
@@ -51,6 +51,7 @@ _pacman_opts_query_modifiers=(
|
|||||||
'-e[List packages explicitly installed]'
|
'-e[List packages explicitly installed]'
|
||||||
'-i[View package information]'
|
'-i[View package information]'
|
||||||
'-ii[View package information including backup files]'
|
'-ii[View package information including backup files]'
|
||||||
|
'-k[Check package files]'
|
||||||
'-l[List package contents]'
|
'-l[List package contents]'
|
||||||
'-m[List installed packages not found in sync db(s)]'
|
'-m[List installed packages not found in sync db(s)]'
|
||||||
'-t[List packages not required by any package]'
|
'-t[List packages not required by any package]'
|
||||||
@@ -78,7 +79,6 @@ _pacman_opts_sync_actions=(
|
|||||||
# options for passing to _arguments: options for --sync command
|
# options for passing to _arguments: options for --sync command
|
||||||
_pacman_opts_sync_modifiers=(
|
_pacman_opts_sync_modifiers=(
|
||||||
'-d[Skip dependency checks]'
|
'-d[Skip dependency checks]'
|
||||||
'-e[Install dependencies only]'
|
|
||||||
'-f[Overwrite conflicting files]'
|
'-f[Overwrite conflicting files]'
|
||||||
'-i[View package information]'
|
'-i[View package information]'
|
||||||
'-l[List all packages in a repository]'
|
'-l[List all packages in a repository]'
|
||||||
@@ -91,15 +91,9 @@ _pacman_opts_sync_modifiers=(
|
|||||||
'*--ignoregroup[Ignore a group upgrade]:package group:
|
'*--ignoregroup[Ignore a group upgrade]:package group:
|
||||||
_pacman_completions_all_groups'
|
_pacman_completions_all_groups'
|
||||||
'--asdeps[Install packages as non-explicitly installed]'
|
'--asdeps[Install packages as non-explicitly installed]'
|
||||||
|
'--asexplicit[Install packages as explicitly installed]'
|
||||||
)
|
)
|
||||||
|
|
||||||
# handles --action subcommand
|
|
||||||
_pacman_action_add() {
|
|
||||||
_arguments -s : \
|
|
||||||
"$_pacman_opts_common[@]" \
|
|
||||||
"$_pacman_opts_pkgfile[@]"
|
|
||||||
}
|
|
||||||
|
|
||||||
# handles --help subcommand
|
# handles --help subcommand
|
||||||
_pacman_action_help() {
|
_pacman_action_help() {
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
@@ -127,7 +121,7 @@ _pacman_action_query() {
|
|||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:package file:_files -g "*.pkg.tar.gz"'
|
'*:package file:_files -g "*.pkg.tar.*"'
|
||||||
;;
|
;;
|
||||||
query_group)
|
query_group)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
@@ -220,6 +214,7 @@ _pacman_completions_all_groups() {
|
|||||||
local -a cmd groups
|
local -a cmd groups
|
||||||
_pacman_get_command
|
_pacman_get_command
|
||||||
groups=( $(_call_program groups $cmd[@] -Sg) )
|
groups=( $(_call_program groups $cmd[@] -Sg) )
|
||||||
|
typeset -U groups
|
||||||
compadd "$@" -a groups
|
compadd "$@" -a groups
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,23 +222,20 @@ _pacman_completions_all_groups() {
|
|||||||
# these can be specified as either 'package' or 'repository/package'
|
# these can be specified as either 'package' or 'repository/package'
|
||||||
_pacman_completions_all_packages() {
|
_pacman_completions_all_packages() {
|
||||||
local -a cmd packages repositories packages_long
|
local -a cmd packages repositories packages_long
|
||||||
|
_pacman_get_command
|
||||||
|
|
||||||
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
if compset -P1 '*/*'; then
|
||||||
typeset -U repositories
|
packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) )
|
||||||
packages_long=(/var/lib/pacman/sync/${^repositories}/*(/))
|
|
||||||
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
|
|
||||||
typeset -U packages
|
|
||||||
_wanted packages expl "packages" compadd - "${(@)packages}"
|
|
||||||
if [[ $PREFIX != */* ]] ; then
|
|
||||||
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
|
||||||
typeset -U repositories
|
|
||||||
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
|
|
||||||
else
|
|
||||||
compset -P '*/'
|
|
||||||
packages_long=(/var/lib/pacman/sync/$IPREFIX*(/))
|
|
||||||
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
|
|
||||||
typeset -U packages
|
typeset -U packages
|
||||||
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
|
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
|
||||||
|
else
|
||||||
|
packages=( $(_call_program packages $cmd[@] -Sql) )
|
||||||
|
typeset -U packages
|
||||||
|
_wanted packages expl "packages" compadd - "${(@)packages}"
|
||||||
|
|
||||||
|
repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
||||||
|
typeset -U repositories
|
||||||
|
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +243,7 @@ _pacman_completions_all_packages() {
|
|||||||
_pacman_completions_installed_groups() {
|
_pacman_completions_installed_groups() {
|
||||||
local -a cmd groups
|
local -a cmd groups
|
||||||
_pacman_get_command
|
_pacman_get_command
|
||||||
groups=(${(o)${(f)"$(pacman -Qg)"}% *})
|
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
|
||||||
typeset -U groups
|
typeset -U groups
|
||||||
compadd "$@" -a groups
|
compadd "$@" -a groups
|
||||||
}
|
}
|
||||||
@@ -259,15 +251,15 @@ _pacman_completions_installed_groups() {
|
|||||||
# provides completions for installed packages
|
# provides completions for installed packages
|
||||||
_pacman_completions_installed_packages() {
|
_pacman_completions_installed_packages() {
|
||||||
local -a cmd packages packages_long
|
local -a cmd packages packages_long
|
||||||
packages_long=(/var/lib/pacman/local/*(/))
|
packages_long=(@localstatedir@/lib/pacman/local/*(/))
|
||||||
packages=( ${${packages_long/\/var\/lib\/pacman\/local\//}%-*-*} )
|
packages=( ${${packages_long#@localstatedir@/lib/pacman/local/}%-*-*} )
|
||||||
compadd "$@" -a packages
|
compadd "$@" -a packages
|
||||||
}
|
}
|
||||||
|
|
||||||
# provides completions for repository names
|
# provides completions for repository names
|
||||||
_pacman_completions_repositories() {
|
_pacman_completions_repositories() {
|
||||||
local -a cmd repositories
|
local -a cmd repositories
|
||||||
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
||||||
# Uniq the array
|
# Uniq the array
|
||||||
typeset -U repositories
|
typeset -U repositories
|
||||||
compadd "$@" -a repositories
|
compadd "$@" -a repositories
|
||||||
@@ -290,7 +282,6 @@ _pacman_get_command() {
|
|||||||
# main dispatcher
|
# main dispatcher
|
||||||
_pacman() {
|
_pacman() {
|
||||||
case $words[2] in
|
case $words[2] in
|
||||||
-A*) _pacman_action_add ;;
|
|
||||||
-Q*g*) # ipkg groups
|
-Q*g*) # ipkg groups
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
@@ -303,11 +294,11 @@ _pacman() {
|
|||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:package file:_files'
|
'*:package file:_files'
|
||||||
;;
|
;;
|
||||||
-Q*p*) # file *.pkg.tar.gz
|
-Q*p*) # file *.pkg.tar.*
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:package file:_files -g "*.pkg.tar.gz"'
|
'*:package file:_files -g "*.pkg.tar.*"'
|
||||||
;;
|
;;
|
||||||
-Q*) _pacman_action_query ;;
|
-Q*) _pacman_action_query ;;
|
||||||
-R*) _pacman_action_remove ;;
|
-R*) _pacman_action_remove ;;
|
||||||
116
depcomp
116
depcomp
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
|
||||||
scriptversion=2006-10-15.18
|
scriptversion=2009-04-28.21; # UTC
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||||
# Foundation, Inc.
|
# Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,9 +17,7 @@ scriptversion=2006-10-15.18
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
|
|||||||
depmode=dashmstdout
|
depmode=dashmstdout
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cygpath_u="cygpath -u -f -"
|
||||||
|
if test "$depmode" = msvcmsys; then
|
||||||
|
# This is just like msvisualcpp but w/o cygpath translation.
|
||||||
|
# Just convert the backslash-escaped backslashes to single forward
|
||||||
|
# slashes to satisfy depend.m4
|
||||||
|
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||||
|
depmode=msvisualcpp
|
||||||
|
fi
|
||||||
|
|
||||||
case "$depmode" in
|
case "$depmode" in
|
||||||
gcc3)
|
gcc3)
|
||||||
## gcc 3 implements dependency tracking that does exactly what
|
## gcc 3 implements dependency tracking that does exactly what
|
||||||
@@ -192,14 +199,14 @@ sgi)
|
|||||||
' < "$tmpdepfile" \
|
' < "$tmpdepfile" \
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||||
tr '
|
tr '
|
||||||
' ' ' >> $depfile
|
' ' ' >> "$depfile"
|
||||||
echo >> $depfile
|
echo >> "$depfile"
|
||||||
|
|
||||||
# The second pass generates a dummy entry for each header file.
|
# The second pass generates a dummy entry for each header file.
|
||||||
tr ' ' '
|
tr ' ' '
|
||||||
' < "$tmpdepfile" \
|
' < "$tmpdepfile" \
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||||
>> $depfile
|
>> "$depfile"
|
||||||
else
|
else
|
||||||
# The sourcefile does not contain any dependencies, so just
|
# The sourcefile does not contain any dependencies, so just
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
@@ -215,34 +222,39 @@ aix)
|
|||||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||||
# start of each line; $object doesn't have directory information.
|
# start of each line; $object doesn't have directory information.
|
||||||
# Version 6 uses the directory in both cases.
|
# Version 6 uses the directory in both cases.
|
||||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||||
tmpdepfile="$stripped.u"
|
test "x$dir" = "x$object" && dir=
|
||||||
|
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$base.u
|
||||||
|
tmpdepfile3=$dir.libs/$base.u
|
||||||
"$@" -Wc,-M
|
"$@" -Wc,-M
|
||||||
else
|
else
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$dir$base.u
|
||||||
|
tmpdepfile3=$dir$base.u
|
||||||
"$@" -M
|
"$@" -M
|
||||||
fi
|
fi
|
||||||
stat=$?
|
stat=$?
|
||||||
|
|
||||||
if test -f "$tmpdepfile"; then :
|
|
||||||
else
|
|
||||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
|
||||||
tmpdepfile="$stripped.u"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
|
do
|
||||||
|
test -f "$tmpdepfile" && break
|
||||||
|
done
|
||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
outname="$stripped.o"
|
|
||||||
# Each line is of the form `foo.o: dependent.h'.
|
# Each line is of the form `foo.o: dependent.h'.
|
||||||
# Do two passes, one to just change these to
|
# Do two passes, one to just change these to
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
# That's a tab and a space in the [].
|
||||||
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
else
|
else
|
||||||
# The sourcefile does not contain any dependencies, so just
|
# The sourcefile does not contain any dependencies, so just
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
@@ -323,7 +335,12 @@ hp2)
|
|||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||||
# Add `dependent.h:' lines.
|
# Add `dependent.h:' lines.
|
||||||
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
|
sed -ne '2,${
|
||||||
|
s/^ *//
|
||||||
|
s/ \\*$//
|
||||||
|
s/$/:/
|
||||||
|
p
|
||||||
|
}' "$tmpdepfile" >> "$depfile"
|
||||||
else
|
else
|
||||||
echo "#dummy" > "$depfile"
|
echo "#dummy" > "$depfile"
|
||||||
fi
|
fi
|
||||||
@@ -399,7 +416,7 @@ dashmstdout)
|
|||||||
|
|
||||||
# Remove the call to Libtool.
|
# Remove the call to Libtool.
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
while test $1 != '--mode=compile'; do
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
@@ -450,32 +467,39 @@ makedepend)
|
|||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
# Remove any Libtool call
|
# Remove any Libtool call
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
while test $1 != '--mode=compile'; do
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
# X makedepend
|
# X makedepend
|
||||||
shift
|
shift
|
||||||
cleared=no
|
cleared=no eat=no
|
||||||
for arg in "$@"; do
|
for arg
|
||||||
|
do
|
||||||
case $cleared in
|
case $cleared in
|
||||||
no)
|
no)
|
||||||
set ""; shift
|
set ""; shift
|
||||||
cleared=yes ;;
|
cleared=yes ;;
|
||||||
esac
|
esac
|
||||||
|
if test $eat = yes; then
|
||||||
|
eat=no
|
||||||
|
continue
|
||||||
|
fi
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
-D*|-I*)
|
-D*|-I*)
|
||||||
set fnord "$@" "$arg"; shift ;;
|
set fnord "$@" "$arg"; shift ;;
|
||||||
# Strip any option that makedepend may not understand. Remove
|
# Strip any option that makedepend may not understand. Remove
|
||||||
# the object too, otherwise makedepend will parse it as a source file.
|
# the object too, otherwise makedepend will parse it as a source file.
|
||||||
|
-arch)
|
||||||
|
eat=yes ;;
|
||||||
-*|$object)
|
-*|$object)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
set fnord "$@" "$arg"; shift ;;
|
set fnord "$@" "$arg"; shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||||
touch "$tmpdepfile"
|
touch "$tmpdepfile"
|
||||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
@@ -495,7 +519,7 @@ cpp)
|
|||||||
|
|
||||||
# Remove the call to Libtool.
|
# Remove the call to Libtool.
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
while test $1 != '--mode=compile'; do
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
@@ -533,13 +557,27 @@ cpp)
|
|||||||
|
|
||||||
msvisualcpp)
|
msvisualcpp)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the preprocessed file to stdout, regardless of -o,
|
# always write the preprocessed file to stdout.
|
||||||
# because we must use -o when running libtool.
|
|
||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
|
|
||||||
|
# Remove the call to Libtool.
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for arg
|
for arg
|
||||||
do
|
do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
|
-o)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
$object)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||||
set fnord "$@"
|
set fnord "$@"
|
||||||
shift
|
shift
|
||||||
@@ -552,16 +590,23 @@ msvisualcpp)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
"$@" -E |
|
"$@" -E 2>/dev/null |
|
||||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||||
echo " " >> "$depfile"
|
echo " " >> "$depfile"
|
||||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
msvcmsys)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
none)
|
none)
|
||||||
exec "$@"
|
exec "$@"
|
||||||
;;
|
;;
|
||||||
@@ -580,5 +625,6 @@ exit 0
|
|||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-end: "$"
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|||||||
4
doc/.gitignore
vendored
4
doc/.gitignore
vendored
@@ -6,5 +6,9 @@ pacman.8
|
|||||||
pacman.conf.5
|
pacman.conf.5
|
||||||
repo-add.8
|
repo-add.8
|
||||||
repo-remove.8
|
repo-remove.8
|
||||||
|
vercmp.8
|
||||||
|
*.css
|
||||||
|
*.html
|
||||||
*.xml
|
*.xml
|
||||||
man3
|
man3
|
||||||
|
website.tar.gz
|
||||||
|
|||||||
20
doc/Doxyfile
20
doc/Doxyfile
@@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.5.2
|
# Doxyfile 1.5.5
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
@@ -28,7 +28,8 @@ FULL_PATH_NAMES = NO
|
|||||||
STRIP_FROM_PATH =
|
STRIP_FROM_PATH =
|
||||||
STRIP_FROM_INC_PATH =
|
STRIP_FROM_INC_PATH =
|
||||||
SHORT_NAMES = NO
|
SHORT_NAMES = NO
|
||||||
JAVADOC_AUTOBRIEF = NO
|
JAVADOC_AUTOBRIEF = YES
|
||||||
|
QT_AUTOBRIEF = NO
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
DETAILS_AT_TOP = NO
|
DETAILS_AT_TOP = NO
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = YES
|
||||||
@@ -37,10 +38,14 @@ TAB_SIZE = 4
|
|||||||
ALIASES =
|
ALIASES =
|
||||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||||
OPTIMIZE_OUTPUT_JAVA = NO
|
OPTIMIZE_OUTPUT_JAVA = NO
|
||||||
|
OPTIMIZE_FOR_FORTRAN = NO
|
||||||
|
OPTIMIZE_OUTPUT_VHDL = NO
|
||||||
BUILTIN_STL_SUPPORT = NO
|
BUILTIN_STL_SUPPORT = NO
|
||||||
CPP_CLI_SUPPORT = NO
|
CPP_CLI_SUPPORT = NO
|
||||||
|
SIP_SUPPORT = NO
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
DISTRIBUTE_GROUP_DOC = NO
|
||||||
SUBGROUPING = YES
|
SUBGROUPING = YES
|
||||||
|
TYPEDEF_HIDES_STRUCT = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -49,6 +54,7 @@ EXTRACT_PRIVATE = NO
|
|||||||
EXTRACT_STATIC = NO
|
EXTRACT_STATIC = NO
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
EXTRACT_LOCAL_METHODS = NO
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
|
EXTRACT_ANON_NSPACES = NO
|
||||||
HIDE_UNDOC_MEMBERS = NO
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
HIDE_UNDOC_CLASSES = NO
|
HIDE_UNDOC_CLASSES = NO
|
||||||
HIDE_FRIEND_COMPOUNDS = NO
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
@@ -60,6 +66,7 @@ SHOW_INCLUDE_FILES = YES
|
|||||||
INLINE_INFO = YES
|
INLINE_INFO = YES
|
||||||
SORT_MEMBER_DOCS = YES
|
SORT_MEMBER_DOCS = YES
|
||||||
SORT_BRIEF_DOCS = NO
|
SORT_BRIEF_DOCS = NO
|
||||||
|
SORT_GROUP_NAMES = NO
|
||||||
SORT_BY_SCOPE_NAME = NO
|
SORT_BY_SCOPE_NAME = NO
|
||||||
GENERATE_TODOLIST = YES
|
GENERATE_TODOLIST = YES
|
||||||
GENERATE_TESTLIST = YES
|
GENERATE_TESTLIST = YES
|
||||||
@@ -126,6 +133,10 @@ HTML_FOOTER =
|
|||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
HTML_ALIGN_MEMBERS = YES
|
HTML_ALIGN_MEMBERS = YES
|
||||||
GENERATE_HTMLHELP = NO
|
GENERATE_HTMLHELP = NO
|
||||||
|
GENERATE_DOCSET = NO
|
||||||
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
|
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||||
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
CHM_FILE =
|
CHM_FILE =
|
||||||
HHC_LOCATION =
|
HHC_LOCATION =
|
||||||
GENERATE_CHI = NO
|
GENERATE_CHI = NO
|
||||||
@@ -194,7 +205,9 @@ EXPAND_ONLY_PREDEF = YES
|
|||||||
SEARCH_INCLUDES = YES
|
SEARCH_INCLUDES = YES
|
||||||
INCLUDE_PATH = ../..
|
INCLUDE_PATH = ../..
|
||||||
INCLUDE_FILE_PATTERNS = *.h
|
INCLUDE_FILE_PATTERNS = *.h
|
||||||
PREDEFINED = HAVE_CONFIG_H= SYMHIDDEN= SYMEXPORT=
|
PREDEFINED = HAVE_CONFIG_H= \
|
||||||
|
SYMHIDDEN= \
|
||||||
|
SYMEXPORT=
|
||||||
EXPAND_AS_DEFINED =
|
EXPAND_AS_DEFINED =
|
||||||
SKIP_FUNCTION_MACROS = YES
|
SKIP_FUNCTION_MACROS = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -227,6 +240,7 @@ DOT_IMAGE_FORMAT = png
|
|||||||
DOT_PATH =
|
DOT_PATH =
|
||||||
DOTFILE_DIRS =
|
DOTFILE_DIRS =
|
||||||
DOT_GRAPH_MAX_NODES = 50
|
DOT_GRAPH_MAX_NODES = 50
|
||||||
|
MAX_DOT_GRAPH_DEPTH = 3
|
||||||
DOT_TRANSPARENT = NO
|
DOT_TRANSPARENT = NO
|
||||||
DOT_MULTI_TARGETS = NO
|
DOT_MULTI_TARGETS = NO
|
||||||
GENERATE_LEGEND = YES
|
GENERATE_LEGEND = YES
|
||||||
|
|||||||
107
doc/Makefile.am
107
doc/Makefile.am
@@ -7,6 +7,7 @@ ASCIIDOC_MANS = \
|
|||||||
pacman.8 \
|
pacman.8 \
|
||||||
makepkg.8 \
|
makepkg.8 \
|
||||||
repo-add.8 \
|
repo-add.8 \
|
||||||
|
vercmp.8 \
|
||||||
PKGBUILD.5 \
|
PKGBUILD.5 \
|
||||||
makepkg.conf.5 \
|
makepkg.conf.5 \
|
||||||
pacman.conf.5 \
|
pacman.conf.5 \
|
||||||
@@ -14,23 +15,59 @@ ASCIIDOC_MANS = \
|
|||||||
|
|
||||||
DOXYGEN_MANS = $(wildcard man3/*.3)
|
DOXYGEN_MANS = $(wildcard man3/*.3)
|
||||||
|
|
||||||
|
HTML_MANPAGES = \
|
||||||
|
pacman.8.html \
|
||||||
|
makepkg.8.html \
|
||||||
|
repo-add.8.html \
|
||||||
|
vercmp.8.html \
|
||||||
|
PKGBUILD.5.html \
|
||||||
|
makepkg.conf.5.html \
|
||||||
|
pacman.conf.5.html \
|
||||||
|
libalpm.3.html
|
||||||
|
|
||||||
|
HTML_OTHER = \
|
||||||
|
index.html \
|
||||||
|
submitting-patches.html \
|
||||||
|
translation-help.html \
|
||||||
|
HACKING.html
|
||||||
|
|
||||||
|
HTML_DOCS = \
|
||||||
|
$(HTML_MANPAGES) \
|
||||||
|
$(HTML_OTHER)
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
|
asciidoc.conf \
|
||||||
pacman.8.txt \
|
pacman.8.txt \
|
||||||
makepkg.8.txt \
|
makepkg.8.txt \
|
||||||
repo-add.8.txt \
|
repo-add.8.txt \
|
||||||
|
vercmp.8.txt \
|
||||||
PKGBUILD.5.txt \
|
PKGBUILD.5.txt \
|
||||||
PKGBUILD-example.txt \
|
PKGBUILD-example.txt \
|
||||||
makepkg.conf.5.txt \
|
makepkg.conf.5.txt \
|
||||||
pacman.conf.5.txt \
|
pacman.conf.5.txt \
|
||||||
libalpm.3.txt \
|
libalpm.3.txt \
|
||||||
footer.txt \
|
footer.txt \
|
||||||
|
index.txt \
|
||||||
|
submitting-patches.txt \
|
||||||
|
translation-help.txt \
|
||||||
Doxyfile \
|
Doxyfile \
|
||||||
$(ASCIIDOC_MANS) \
|
$(ASCIIDOC_MANS) \
|
||||||
$(DOXYGEN_MANS)
|
$(DOXYGEN_MANS)
|
||||||
|
|
||||||
# Files that should be removed, but which Automake does not know.
|
# Files that should be removed, but which Automake does not know.
|
||||||
MOSTLYCLEANFILES = *.xml
|
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) repo-remove.8 website.tar.gz
|
||||||
MAINTAINERCLEANFILES = $(ASCIIDOC_MANS)
|
|
||||||
|
# Ensure manpages are fresh when building a dist tarball
|
||||||
|
dist-hook:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
|
||||||
|
if USE_GIT_VERSION
|
||||||
|
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
|
||||||
|
REAL_PACKAGE_VERSION = $(GIT_VERSION)
|
||||||
|
else
|
||||||
|
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
man_MANS =
|
man_MANS =
|
||||||
dist_man_MANS = $(ASCIIDOC_MANS) repo-remove.8
|
dist_man_MANS = $(ASCIIDOC_MANS) repo-remove.8
|
||||||
@@ -38,39 +75,71 @@ dist_man_MANS = $(ASCIIDOC_MANS) repo-remove.8
|
|||||||
if USE_DOXYGEN
|
if USE_DOXYGEN
|
||||||
man_MANS += $(DOXYGEN_MANS)
|
man_MANS += $(DOXYGEN_MANS)
|
||||||
|
|
||||||
all: doxygen.in
|
all-local: doxygen.in
|
||||||
|
|
||||||
doxygen.in:
|
doxygen.in:
|
||||||
$(DOXYGEN) $(srcdir)/Doxyfile
|
$(DOXYGEN) $(srcdir)/Doxyfile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_ASCIIDOC
|
html: $(HTML_DOCS)
|
||||||
|
|
||||||
|
website: html
|
||||||
|
bsdtar czf website.tar.gz $(HTML_DOCS) \
|
||||||
|
-C /etc/asciidoc/stylesheets/ \
|
||||||
|
xhtml11.css xhtml11-manpage.css xhtml11-quirks.css \
|
||||||
|
-C /etc/asciidoc/javascripts/ \
|
||||||
|
asciidoc-xhtml11.js \
|
||||||
|
-C /etc/asciidoc/ \
|
||||||
|
images
|
||||||
|
|
||||||
|
pkgdatadir = ${datadir}/${PACKAGE}
|
||||||
|
|
||||||
ASCIIDOC_OPTS = \
|
ASCIIDOC_OPTS = \
|
||||||
-f asciidoc.conf \
|
-f asciidoc.conf \
|
||||||
-a pacman_version="$(PACKAGE_VERSION)" \
|
-a pacman_version="$(REAL_PACKAGE_VERSION)" \
|
||||||
-a pacman_date="`date +%Y-%m-%d`" \
|
-a pacman_date="`date +%Y-%m-%d`" \
|
||||||
|
-a pkgdatadir=$(pkgdatadir) \
|
||||||
|
-a localstatedir=$(localstatedir) \
|
||||||
-a sysconfdir=$(sysconfdir)
|
-a sysconfdir=$(sysconfdir)
|
||||||
|
|
||||||
A2X_OPTS = \
|
A2X_OPTS = \
|
||||||
|
--no-xmllint \
|
||||||
-d manpage \
|
-d manpage \
|
||||||
-f manpage \
|
-f manpage \
|
||||||
--xsltproc-opts='-param man.endnotes.list.enabled 0' \
|
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
|
||||||
--xsltproc-opts='-param man.endnotes.are.numbered 0'
|
|
||||||
|
|
||||||
$(ASCIIDOC_MANS):
|
|
||||||
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt
|
|
||||||
|
|
||||||
# These rules are due to the includes and files of the asciidoc text
|
# These rules are due to the includes and files of the asciidoc text
|
||||||
$(ASCIIDOC_MANS): asciidoc.conf footer.txt
|
$(ASCIIDOC_MANS): asciidoc.conf footer.txt
|
||||||
pacman.8: pacman.8.txt
|
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt
|
||||||
makepkg.8: makepkg.8.txt
|
|
||||||
repo-add.8: repo-add.8.txt
|
%.html: %.txt
|
||||||
PKGBUILD.5: PKGBUILD.5.txt PKGBUILD-example.txt
|
asciidoc $(ASCIIDOC_OPTS) $*.txt
|
||||||
makepkg.conf.5: makepkg.conf.5.txt
|
dos2unix $@
|
||||||
pacman.conf.5: pacman.conf.5.txt
|
|
||||||
libalpm.3: libalpm.3.txt
|
HACKING.html: ../HACKING
|
||||||
|
asciidoc $(ASCIIDOC_OPTS) -o $@ ../HACKING
|
||||||
|
dos2unix $@
|
||||||
|
|
||||||
|
# Customizations for certain HTML docs
|
||||||
|
$(HTML_MANPAGES): asciidoc.conf footer.txt
|
||||||
|
$(HTML_OTHER): asciidoc.conf
|
||||||
|
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons
|
||||||
|
%.8.html: ASCIIDOC_OPTS += -d manpage
|
||||||
|
%.5.html: ASCIIDOC_OPTS += -d manpage
|
||||||
|
%.3.html: ASCIIDOC_OPTS += -d manpage
|
||||||
|
|
||||||
|
# Dependency rules
|
||||||
|
pacman.8 pacman.8.html: pacman.8.txt
|
||||||
|
makepkg.8 makepkg.8.html: makepkg.8.txt
|
||||||
|
repo-add.8 repo-add.8.html: repo-add.8.txt
|
||||||
|
vercmp.8 vercmp.8.html: vercmp.8.txt
|
||||||
|
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.txt PKGBUILD-example.txt
|
||||||
|
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.txt
|
||||||
|
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.txt
|
||||||
|
libalpm.3 libalpm.3.html: libalpm.3.txt
|
||||||
# this one is just a symlink
|
# this one is just a symlink
|
||||||
repo-remove.8: repo-add.8
|
repo-remove.8: repo-add.8
|
||||||
ln -s repo-add.8 repo-remove.8
|
rm -f repo-remove.8
|
||||||
endif
|
$(LN_S) repo-add.8 repo-remove.8
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# Maintainer: judd <jvinet@zeroflux.org>
|
# Maintainer: Joe User <joe.user@example.com>
|
||||||
|
|
||||||
pkgname=patch
|
pkgname=patch
|
||||||
pkgver=2.5.4
|
pkgver=2.5.4
|
||||||
pkgrel=3
|
pkgrel=3
|
||||||
pkgdesc="A utility to apply patch files to original sources"
|
pkgdesc="A utility to apply patch files to original sources"
|
||||||
arch=(i686 x86_64)
|
arch=('i686' 'x86_64')
|
||||||
url="http://www.gnu.org/software/patch/patch.html"
|
url="http://www.gnu.org/software/patch/patch.html"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
groups=('base-devel')
|
groups=('base-devel')
|
||||||
@@ -13,8 +13,8 @@ source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
|
|||||||
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
|
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd $startdir/src/$pkgname-$pkgver
|
cd $srcdir/$pkgname-$pkgver
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make || return 1
|
make
|
||||||
make prefix=$startdir/pkg/usr install
|
make prefix=$pkgdir/usr install
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,33 +20,53 @@ This manual page is meant to describe general rules about PKGBUILDs. Once a
|
|||||||
PKGBUILD is written, the actual package is built using makepkg and installed
|
PKGBUILD is written, the actual package is built using makepkg and installed
|
||||||
with pacman.
|
with pacman.
|
||||||
|
|
||||||
NOTE: If you are using Arch Linux and have a local copy of the Arch Build
|
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'.
|
||||||
System (ABS) tree on your computer, or are using another distribution that
|
Also located there are other example files such as a ChangeLog and an install
|
||||||
provides a similar tree of build files, you can copy the provided
|
script. You can copy the provided PKGBUILD.proto file to a new package build
|
||||||
PKGBUILD.proto file to a new package build directory and make customizations to
|
directory and make customizations to suit your needs.
|
||||||
suit your needs. An up to date prototype file can also be found in the source
|
|
||||||
distribution of this package.
|
|
||||||
|
|
||||||
|
|
||||||
Options and Directives
|
Options and Directives
|
||||||
----------------------
|
----------------------
|
||||||
*pkgname*::
|
The following is a list of standard options and directives available for use
|
||||||
|
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
|
||||||
|
will be directly transferred to the built package.
|
||||||
|
|
||||||
|
If you need to create any custom variables for use in your build process, it is
|
||||||
|
recommended to name your custom variables with an '_' (underscore) prefix.
|
||||||
|
This will prevent any possible name clashes with internal makepkg variables.
|
||||||
|
For example, to store the base kernel version in a variable, use something
|
||||||
|
similar to `$_basekernver`.
|
||||||
|
|
||||||
|
*pkgname (array)*::
|
||||||
The name of the package. This has be a unix-friendly name as it will be
|
The name of the package. This has be a unix-friendly name as it will be
|
||||||
used in the package filename.
|
used in the package filename. Members of the array are not allowed to start
|
||||||
|
with hyphens.
|
||||||
|
|
||||||
*pkgver*::
|
*pkgver*::
|
||||||
The version of the software as released from the author (e.g. \'2.7.1').
|
The version of the software as released from the author (e.g. '2.7.1').
|
||||||
|
The variable is not allowed to contain colons or hyphens.
|
||||||
|
|
||||||
*pkgrel*::
|
*pkgrel*::
|
||||||
This is the release number specific to the Arch Linux release. This
|
This is the release number specific to the Arch Linux release. This
|
||||||
allows package maintainers to make updates to the package's configure
|
allows package maintainers to make updates to the package's configure
|
||||||
flags, for example. A pkgrel of 1 is typically used for each upstream
|
flags, for example. A pkgrel of '1' is typically used for each upstream
|
||||||
software release and is incremented for intermediate PKGBUILD updates.
|
software release and is incremented for intermediate PKGBUILD updates. The
|
||||||
|
variable is not allowed to contain hyphens.
|
||||||
|
|
||||||
*pkgdesc*::
|
*pkgdesc*::
|
||||||
This should be a brief description of the package and its functionality.
|
This should be a brief description of the package and its functionality.
|
||||||
Try to keep the description to one line of text.
|
Try to keep the description to one line of text.
|
||||||
|
|
||||||
|
*epoch*::
|
||||||
|
Used to force the package to be seen as newer than any previous versions
|
||||||
|
with a lower epoch, even if the version number would normally not trigger
|
||||||
|
such an upgrade. This value is required to be a positive integer; the
|
||||||
|
default value if left unspecified is '0'. This is useful when the version
|
||||||
|
numbering scheme of a package changes (or is alphanumeric), breaking normal
|
||||||
|
version comparison logic. See linkman:pacman[8] for more information on
|
||||||
|
version comparisons.
|
||||||
|
|
||||||
*url*::
|
*url*::
|
||||||
This field contains a URL that is associated with the software being
|
This field contains a URL that is associated with the software being
|
||||||
packaged. This is typically the project's website.
|
packaged. This is typically the project's website.
|
||||||
@@ -55,19 +75,25 @@ Options and Directives
|
|||||||
This field specifies the license(s) that apply to the package.
|
This field specifies the license(s) that apply to the package.
|
||||||
Commonly-used licenses are found in '/usr/share/licenses/common'. If you
|
Commonly-used licenses are found in '/usr/share/licenses/common'. If you
|
||||||
see the package's license there, simply reference it in the license
|
see the package's license there, simply reference it in the license
|
||||||
field (e.g. `$$license=('GPL')$$`). If the package provides a license not
|
field (e.g. `license=('GPL')`). If the package provides a license not
|
||||||
found in '/usr/share/licenses/common', then you should include the license
|
found in '/usr/share/licenses/common', then you should include the license
|
||||||
in the package itself and set `$$license=('custom')$$` or
|
in the package itself and set `license=('custom')` or
|
||||||
`$$license=('custom:LicenseName')$$`. The license should be placed in
|
`license=('custom:LicenseName')`. The license should be placed in
|
||||||
'$pkgdir/usr/share/licenses/$pkgname' when building the package. If
|
'$pkgdir/usr/share/licenses/$pkgname' when building the package. If
|
||||||
multiple licenses are applicable for a package, list all of them:
|
multiple licenses are applicable for a package, list all of them:
|
||||||
`$$license=('GPL' 'FDL')$$`.
|
`license=('GPL' 'FDL')`.
|
||||||
|
|
||||||
*install*::
|
*install*::
|
||||||
Specifies a special install script that is to be included in the package.
|
Specifies a special install script that is to be included in the package.
|
||||||
This file should reside in the same directory as the PKGBUILD, and will
|
This file should reside in the same directory as the PKGBUILD, and will
|
||||||
be copied into the package by makepkg. It does not need to be included
|
be copied into the package by makepkg. It does not need to be included
|
||||||
in the source array (e.g. `$$install=pkgname.install$$`).
|
in the source array (e.g. `install=pkgname.install`).
|
||||||
|
|
||||||
|
*changelog*::
|
||||||
|
Specifies a changelog file that is to be included in the package.
|
||||||
|
This file should reside in the same directory as the PKGBUILD, and will
|
||||||
|
be copied into the package by makepkg. It does not need to be included
|
||||||
|
in the source array (e.g. `changelog=$pkgname.changelog`).
|
||||||
|
|
||||||
*source (array)*::
|
*source (array)*::
|
||||||
An array of source files required to build the package. Source files
|
An array of source files required to build the package. Source files
|
||||||
@@ -77,6 +103,10 @@ Options and Directives
|
|||||||
variables if possible when specifying the download location. Any files
|
variables if possible when specifying the download location. Any files
|
||||||
that are compressed will automatically be extracted, unless found in
|
that are compressed will automatically be extracted, unless found in
|
||||||
the noextract array listed below.
|
the noextract array listed below.
|
||||||
|
+
|
||||||
|
It is also possible to specify an optional filename, which is helpful
|
||||||
|
with weird URLs and for handling multiple source files with the same
|
||||||
|
name. The syntax is: `source=('filename::url')`.
|
||||||
|
|
||||||
*noextract (array)*::
|
*noextract (array)*::
|
||||||
An array of filenames corresponding to those from the source array. Files
|
An array of filenames corresponding to those from the source array. Files
|
||||||
@@ -89,14 +119,13 @@ Options and Directives
|
|||||||
source array (in the same order). makepkg will use this to verify source
|
source array (in the same order). makepkg will use this to verify source
|
||||||
file integrity during subsequent builds. To easily generate md5sums, run
|
file integrity during subsequent builds. To easily generate md5sums, run
|
||||||
``makepkg -g >> PKGBUILD''. If desired, move the md5sums line to an
|
``makepkg -g >> PKGBUILD''. If desired, move the md5sums line to an
|
||||||
appropriate location. *NOTE:* makepkg supports multiple integrity
|
appropriate location.
|
||||||
algorithms and their corresponding arrays (i.e. sha1sums for the SHA1
|
|
||||||
algorithm); however, official packages use only md5sums for the time
|
|
||||||
being.
|
|
||||||
|
|
||||||
*sha1sums, etc.*::
|
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
|
||||||
Alternative integrity checks that makepkg supports, as noted in md5sums
|
Alternative integrity checks that makepkg supports; these all behave
|
||||||
above.
|
similar to the md5sums option described above. To enable use and generation
|
||||||
|
of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
|
||||||
|
linkman:makepkg.conf[5].
|
||||||
|
|
||||||
*groups (array)*::
|
*groups (array)*::
|
||||||
An array of symbolic names that represent groups of packages, allowing
|
An array of symbolic names that represent groups of packages, allowing
|
||||||
@@ -105,7 +134,8 @@ Options and Directives
|
|||||||
|
|
||||||
*arch (array)*::
|
*arch (array)*::
|
||||||
Defines on which architectures the given package is available (e.g.
|
Defines on which architectures the given package is available (e.g.
|
||||||
`$$arch=('i686' 'x86_64')$$`).
|
`arch=('i686' 'x86_64')`). Packages that contain no architecture specific
|
||||||
|
files may use arch=('any').
|
||||||
|
|
||||||
*backup (array)*::
|
*backup (array)*::
|
||||||
A space-delimited array of filenames, without preceding slashes, that
|
A space-delimited array of filenames, without preceding slashes, that
|
||||||
@@ -126,12 +156,18 @@ Options and Directives
|
|||||||
needed at runtime. Packages in this list follow the same format as
|
needed at runtime. Packages in this list follow the same format as
|
||||||
depends.
|
depends.
|
||||||
|
|
||||||
|
*checkdepends (array)*::
|
||||||
|
An array of packages that this package depends on to run its test suite,
|
||||||
|
but are not needed at runtime. Packages in this list follow the same
|
||||||
|
format as depends. These dependencies are only considered when the
|
||||||
|
check() function is present and is to be run by makepkg.
|
||||||
|
|
||||||
*optdepends (array)*::
|
*optdepends (array)*::
|
||||||
An array of optional packages (and accompanying reasons) that are not
|
An array of packages (and accompanying reasons) that are not essential for
|
||||||
essential to the package, but would offer increased functionality or other
|
base functionality, but may be necessary to make full use of the contents
|
||||||
features when installed. optdepends are currently for informational
|
of this package. optdepends are currently for informational purposes only
|
||||||
purposes only and are not utilized by pacman during dependency resolution.
|
and are not utilized by pacman during dependency resolution. The format
|
||||||
The format should be similar to the following:
|
for specifying optdepends is:
|
||||||
|
|
||||||
optdepends=('fakeroot: for makepkg usage as normal user')
|
optdepends=('fakeroot: for makepkg usage as normal user')
|
||||||
|
|
||||||
@@ -147,7 +183,9 @@ Options and Directives
|
|||||||
depend on 'cron' rather than 'dcron OR fcron'.
|
depend on 'cron' rather than 'dcron OR fcron'.
|
||||||
Versioned provisions are also possible, in the 'name=version' format.
|
Versioned provisions are also possible, in the 'name=version' format.
|
||||||
For example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0'
|
For example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0'
|
||||||
dependency of other packages.
|
dependency of other packages. Provisions involving the '>' and '<'
|
||||||
|
operators are invalid as only specific versions of a package may be
|
||||||
|
provided.
|
||||||
|
|
||||||
*replaces (array)*::
|
*replaces (array)*::
|
||||||
An array of packages that this package should replace, and can be used
|
An array of packages that this package should replace, and can be used
|
||||||
@@ -163,8 +201,8 @@ Options and Directives
|
|||||||
in the options array. To reverse the default behavior, place an ``!'' at
|
in the options array. To reverse the default behavior, place an ``!'' at
|
||||||
the front of the option. Only specify the options you specifically want
|
the front of the option. Only specify the options you specifically want
|
||||||
to override, the rest will be taken from linkman:makepkg.conf[5].
|
to override, the rest will be taken from linkman:makepkg.conf[5].
|
||||||
*NOTE:* 'force' is a special option only used in a linkman:PKGBUILD[5],
|
*NOTE:* 'force' is a now-removed option in favor of the top level 'epoch'
|
||||||
do not use it unless you know what you are doing.
|
variable.
|
||||||
|
|
||||||
*strip*;;
|
*strip*;;
|
||||||
Strip symbols from binaries and libraries. If you frequently
|
Strip symbols from binaries and libraries. If you frequently
|
||||||
@@ -172,8 +210,8 @@ Options and Directives
|
|||||||
disable this option.
|
disable this option.
|
||||||
|
|
||||||
*docs*;;
|
*docs*;;
|
||||||
Save doc and info directories. If you wish to delete doc and
|
Save doc directories. If you wish to delete doc directories,
|
||||||
info directories, specify `!docs` in the array.
|
specify `!docs` in the array.
|
||||||
|
|
||||||
*libtool*;;
|
*libtool*;;
|
||||||
Leave libtool (.la) files in packages. Specify `!libtool` to
|
Leave libtool (.la) files in packages. Specify `!libtool` to
|
||||||
@@ -182,6 +220,9 @@ Options and Directives
|
|||||||
*emptydirs*;;
|
*emptydirs*;;
|
||||||
Leave empty directories in packages.
|
Leave empty directories in packages.
|
||||||
|
|
||||||
|
*zipman*;;
|
||||||
|
Compress man and info pages with gzip.
|
||||||
|
|
||||||
*ccache*;;
|
*ccache*;;
|
||||||
Allow the use of ccache during build. More useful in its negative
|
Allow the use of ccache during build. More useful in its negative
|
||||||
form `!ccache` with select packages that have problems building
|
form `!ccache` with select packages that have problems building
|
||||||
@@ -192,18 +233,87 @@ Options and Directives
|
|||||||
form `!distcc` with select packages that have problems building
|
form `!distcc` with select packages that have problems building
|
||||||
with distcc.
|
with distcc.
|
||||||
|
|
||||||
|
*buildflags*;;
|
||||||
|
Allow the use of user-specific buildflags (CFLAGS, CXXFLAGS, LDFLAGS)
|
||||||
|
during build as specified in linkman:makepkg.conf[5]. More useful in
|
||||||
|
its negative form `!buildflags` with select packages that have problems
|
||||||
|
building with custom buildflags.
|
||||||
|
|
||||||
*makeflags*;;
|
*makeflags*;;
|
||||||
Allow the use of user-specific makeflags during build as specified
|
Allow the use of user-specific makeflags during build as specified
|
||||||
in linkman:makepkg.conf[5]. More useful in its negative form
|
in linkman:makepkg.conf[5]. More useful in its negative form
|
||||||
`!makeflags` with select packages that have problems building with
|
`!makeflags` with select packages that have problems building with
|
||||||
custom makeflags such as `-j2` (or higher).
|
custom makeflags such as `-j2` (or higher).
|
||||||
|
|
||||||
*force*;;
|
|
||||||
Force the package to be upgraded by a pacman system upgrade
|
|
||||||
operation, even if the version number would normally not trigger
|
|
||||||
such an upgrade. This is useful when the version numbering scheme
|
|
||||||
of a package changes (or is alphanumeric).
|
|
||||||
|
|
||||||
|
build() Function
|
||||||
|
----------------
|
||||||
|
In addition to the above directives, the optional build() bash function usually
|
||||||
|
comprises the remainder of the PKGBUILD. This is directly sourced and executed
|
||||||
|
by makepkg, so anything that bash or the system has available is available for
|
||||||
|
use here. The function is run in `bash -e` mode, meaning any command that exits
|
||||||
|
with a non-zero status will cause the function to exit. Be sure any exotic
|
||||||
|
commands used are covered by `makedepends`.
|
||||||
|
|
||||||
|
All of the above variables such as `pkgname` and `pkgver` are available for use
|
||||||
|
in the build function. In addition, makepkg defines three variables for your
|
||||||
|
use during the build and install process. These three variables are as follows:
|
||||||
|
|
||||||
|
*startdir*::
|
||||||
|
This contains the absolute path to the directory where the PKGBUILD was
|
||||||
|
located, which is usually the output of `$(pwd)` when makepkg is started.
|
||||||
|
|
||||||
|
*srcdir*::
|
||||||
|
This points to the directory where makepkg extracts or copies all source
|
||||||
|
files.
|
||||||
|
|
||||||
|
*pkgdir*::
|
||||||
|
This points to the directory where makepkg bundles the installed package
|
||||||
|
(this directory will become the root directory of your built package).
|
||||||
|
|
||||||
|
If you create any variables of your own in the build function, it is
|
||||||
|
recommended to use the bash `local` keyword to scope the variable to inside
|
||||||
|
the build function.
|
||||||
|
|
||||||
|
check() Function
|
||||||
|
----------------
|
||||||
|
An optional check() function can be specified in which a packages test-suite
|
||||||
|
may be run. This function is run between the build() and package() functions.
|
||||||
|
The function is run in `bash -e` mode, meaning any command that exits with a
|
||||||
|
non-zero status will cause the function to exit. Be sure any exotic commands
|
||||||
|
used are covered by `checkdepends`.
|
||||||
|
|
||||||
|
package() Function
|
||||||
|
------------------
|
||||||
|
An optional package() function can be specified in addition to the build()
|
||||||
|
function. This function is run after the build() and check() functions. The
|
||||||
|
function is run in `bash -e` mode, meaning any command that exits with a
|
||||||
|
non-zero status will cause the function to exit. When specified in combination
|
||||||
|
with the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
|
||||||
|
will be limited to running the packaging stage. An existing build() function
|
||||||
|
will be run as the user calling makepkg.
|
||||||
|
|
||||||
|
Package Splitting
|
||||||
|
-----------------
|
||||||
|
makepkg supports building multiple packages from a single PKGBUILD. This is
|
||||||
|
achieved by assigning an array of package names to the `pkgname` directive.
|
||||||
|
Each split package uses a corresponding packaging function with name
|
||||||
|
`package_foo()`, where `foo` is the name of the split package.
|
||||||
|
|
||||||
|
All options and directives for the split packages default to the global values
|
||||||
|
given within the PKGBUILD. However, some of these can be overridden within each
|
||||||
|
split package's packaging function. The following variables can be overridden:
|
||||||
|
`pkgver`, `pkgrel`, `pkgdesc`, `arch`, `license`, `groups`, `depends`,
|
||||||
|
`optdepends`, `provides`, `conflicts`, `replaces`, `backup`, `options`,
|
||||||
|
`install` and `changelog`.
|
||||||
|
|
||||||
|
An optional global directive is available when building a split package:
|
||||||
|
|
||||||
|
*pkgbase*::
|
||||||
|
The name used to refer to the group of packages in the output of makepkg
|
||||||
|
and in the naming of source-only tarballs. If not specified, the first
|
||||||
|
element in the `pkgname` array is used. The variable is not allowed to
|
||||||
|
begin with a hyphen.
|
||||||
|
|
||||||
Install/Upgrade/Remove Scripting
|
Install/Upgrade/Remove Scripting
|
||||||
--------------------------------
|
--------------------------------
|
||||||
@@ -243,9 +353,8 @@ same directory as the PKGBUILD script. Then use the install directive:
|
|||||||
install=pkgname.install
|
install=pkgname.install
|
||||||
|
|
||||||
The install script does not need to be specified in the source array. A
|
The install script does not need to be specified in the source array. A
|
||||||
template install file is available with the source distribution of this
|
template install file is available in '{pkgdatadir}' as 'proto.install' for
|
||||||
program, or one may be provided by your distribution. For example, Arch Linux
|
reference with all of the available functions defined.
|
||||||
provides prototype install files in the ABS tree.
|
|
||||||
|
|
||||||
|
|
||||||
Development Directives
|
Development Directives
|
||||||
@@ -318,11 +427,10 @@ The following is an example PKGBUILD for the 'patch' package. For more
|
|||||||
examples, look through the build files of your distribution's packages. For
|
examples, look through the build files of your distribution's packages. For
|
||||||
those using Arch Linux, consult the ABS tree.
|
those using Arch Linux, consult the ABS tree.
|
||||||
|
|
||||||
[sh]
|
[source,sh]
|
||||||
source~~~~~
|
-------------------------------
|
||||||
include::PKGBUILD-example.txt[]
|
include::PKGBUILD-example.txt[]
|
||||||
source~~~~~
|
-------------------------------
|
||||||
|
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -8,7 +8,11 @@
|
|||||||
# Show man link as: <command>(<section>); if section is defined, else just show
|
# Show man link as: <command>(<section>); if section is defined, else just show
|
||||||
# the command.
|
# the command.
|
||||||
|
|
||||||
|
[macros]
|
||||||
|
(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
|
||||||
|
|
||||||
[attributes]
|
[attributes]
|
||||||
|
asterisk=*
|
||||||
plus=+
|
plus=+
|
||||||
caret=^
|
caret=^
|
||||||
startsb=[
|
startsb=[
|
||||||
@@ -30,13 +34,7 @@ ifndef::docbook-xsl-172[]
|
|||||||
[listingblock]
|
[listingblock]
|
||||||
<example><title>{title}</title>
|
<example><title>{title}</title>
|
||||||
<literallayout>
|
<literallayout>
|
||||||
ifdef::doctype-manpage[]
|
|
||||||
.ft C
|
|
||||||
endif::doctype-manpage[]
|
|
||||||
|
|
|
|
||||||
ifdef::doctype-manpage[]
|
|
||||||
.ft
|
|
||||||
endif::doctype-manpage[]
|
|
||||||
</literallayout>
|
</literallayout>
|
||||||
{title#}</example>
|
{title#}</example>
|
||||||
endif::docbook-xsl-172[]
|
endif::docbook-xsl-172[]
|
||||||
|
|||||||
@@ -15,9 +15,17 @@ mailto:pacman-dev@archlinux.org[].
|
|||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
Current maintainers:
|
||||||
|
|
||||||
|
* Allan McRae <allan@archlinux.org>
|
||||||
|
* Dan McGee <dan@archlinux.org>
|
||||||
|
* Xavier Chantry <shiningxc@gmail.com>
|
||||||
|
|
||||||
|
Past contributors:
|
||||||
|
|
||||||
* Judd Vinet <jvinet@zeroflux.org>
|
* Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Aurelien Foret <aurelien@archlinux.org>
|
* Aurelien Foret <aurelien@archlinux.org>
|
||||||
* Aaron Griffin <aaron@archlinux.org>
|
* Aaron Griffin <aaron@archlinux.org>
|
||||||
* Dan McGee <dan@archlinux.org>
|
|
||||||
|
|
||||||
See the 'AUTHORS' file for additional contributors.
|
See the 'AUTHORS' file for additional contributors.
|
||||||
|
|||||||
208
doc/index.txt
Normal file
208
doc/index.txt
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
Pacman Home Page
|
||||||
|
================
|
||||||
|
|
||||||
|
A simple library-based package manager.
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
pacman is a utility which manages software packages in Linux. It uses simple
|
||||||
|
compressed files as a package format, and maintains a text-based package
|
||||||
|
database (more of a hierarchy), just in case some hand tweaking is necessary.
|
||||||
|
|
||||||
|
pacman does not strive to "do everything." It will add, remove and upgrade
|
||||||
|
packages in the system, and it will allow you to query the package database for
|
||||||
|
installed packages, files and owners. It also attempts to handle dependencies
|
||||||
|
automatically and can download packages from a remote server.
|
||||||
|
|
||||||
|
History
|
||||||
|
~~~~~~~
|
||||||
|
Version 2.0 of pacman introduced the ability to sync packages (the `--sync`
|
||||||
|
option) with a master server through the use of package databases. Prior to
|
||||||
|
this, packages would have to be installed manually using the `--add` and
|
||||||
|
`--upgrade` operations.
|
||||||
|
|
||||||
|
Version 3.0 was the switch to a two-part pacman- a backend named libalpm
|
||||||
|
(library for Arch Linux Package Management), and the familiar pacman frontend.
|
||||||
|
Speed in many cases was improved, along with dependency and conflict resolution
|
||||||
|
being able to handle a much wider variety of cases. The switch to a
|
||||||
|
library-based program should also make it easier in the future to develop
|
||||||
|
alternative front ends.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Manpages
|
||||||
|
~~~~~~~~
|
||||||
|
There are several manpages available for the programs, utilities, and
|
||||||
|
configuration files dealing with pacman.
|
||||||
|
|
||||||
|
* linkman:PKGBUILD[5]
|
||||||
|
* linkman:libalpm[3]
|
||||||
|
* linkman:makepkg[8]
|
||||||
|
* linkman:makepkg.conf[5]
|
||||||
|
* linkman:pacman[8]
|
||||||
|
* linkman:pacman.conf[5]
|
||||||
|
* linkman:repo-add[8]
|
||||||
|
* linkman:vercmp[8]
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
~~~~~~~~~
|
||||||
|
For a good idea of what is going on in pacman development, take a look at the
|
||||||
|
link:http://projects.archlinux.org/pacman.git/[Git summary page] for the
|
||||||
|
project.
|
||||||
|
|
||||||
|
See the most recent
|
||||||
|
link:http://projects.archlinux.org/pacman.git/tree/NEWS[NEWS]
|
||||||
|
file for a not-as-frequently-updated list of changes. However, this should
|
||||||
|
contain the biggest changes in a format more concise than the commit log.
|
||||||
|
|
||||||
|
|
||||||
|
Releases
|
||||||
|
--------
|
||||||
|
|
||||||
|
`------------`-------
|
||||||
|
Date Version
|
||||||
|
---------------------
|
||||||
|
2011-04-18 v3.5.2
|
||||||
|
2011-03-23 v3.5.1
|
||||||
|
2011-03-16 v3.5.0
|
||||||
|
2011-01-22 v3.4.3
|
||||||
|
2010-12-29 v3.4.2
|
||||||
|
2010-09-03 v3.4.1
|
||||||
|
2010-06-16 v3.4.0
|
||||||
|
2009-11-10 v3.3.3
|
||||||
|
2009-10-05 v3.3.2
|
||||||
|
2009-09-22 v3.3.1
|
||||||
|
2009-08-02 v3.3.0
|
||||||
|
2009-01-05 v3.2.2
|
||||||
|
2008-08-26 v3.2.1
|
||||||
|
2008-07-30 v3.2.0
|
||||||
|
2008-04-01 v3.1.4
|
||||||
|
2008-03-06 v3.1.3
|
||||||
|
2008-02-20 v3.1.2
|
||||||
|
2008-01-20 v3.1.1
|
||||||
|
2008-01-09 v3.1.0
|
||||||
|
2007-09-16 v3.0.6
|
||||||
|
2007-06-17 v3.0.5
|
||||||
|
2007-05-08 v3.0.4
|
||||||
|
2007-04-28 v3.0.3
|
||||||
|
2007-04-23 v3.0.2
|
||||||
|
2007-04-04 v3.0.1
|
||||||
|
2007-03-25 v3.0.0
|
||||||
|
2006-02-02 v2.9.8
|
||||||
|
2005-09-16 v2.9.7
|
||||||
|
2005-06-10 v2.9.6
|
||||||
|
2005-01-11 v2.9.5
|
||||||
|
2004-12-19 v2.9.4
|
||||||
|
2004-12-18 v2.9.3
|
||||||
|
2004-09-25 v2.9.2
|
||||||
|
2004-09-24 v2.9.1
|
||||||
|
2004-09-18 v2.9
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Source code for all releases is available at
|
||||||
|
link:ftp://ftp.archlinux.org/other/pacman/[]. To install, download the newest
|
||||||
|
available source tarball, unpack it in a directory, and run the three magic
|
||||||
|
commands:
|
||||||
|
|
||||||
|
$ ./configure
|
||||||
|
$ make
|
||||||
|
# make install
|
||||||
|
|
||||||
|
You may wish to read the options presented by `./configure --help` in order to
|
||||||
|
set appropriate paths and build options that are correct for your system.
|
||||||
|
|
||||||
|
Development
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Mailing List
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
There is a mailing list devoted to pacman development, hosted by Arch Linux.
|
||||||
|
link:http://mailman.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
|
||||||
|
link:http://mailman.archlinux.org/pipermail/pacman-dev/[view the archives].
|
||||||
|
|
||||||
|
Source Code
|
||||||
|
~~~~~~~~~~~
|
||||||
|
Development of pacman is currently done in GIT. The central repository is
|
||||||
|
hosted by Arch Linux, although some of the developers have their own trees (ask
|
||||||
|
on the above mailing lists if you are interested in finding the locations of
|
||||||
|
these trees).
|
||||||
|
|
||||||
|
The current development tree can be fetched with the following command:
|
||||||
|
|
||||||
|
git clone git://projects.archlinux.org/pacman.git pacman
|
||||||
|
|
||||||
|
which will fetch the full development history into a directory named pacman.
|
||||||
|
You can browse the source as well using
|
||||||
|
link:http://projects.archlinux.org/pacman.git/[cgit]. HTTP/HTTPS URLs are also
|
||||||
|
available for cloning purposes; these URLs are listed at the above page.
|
||||||
|
|
||||||
|
If you are interested in hacking on pacman, it is highly recommended you join
|
||||||
|
the mailing list mentioned above, as well as take a quick glance at our
|
||||||
|
link:HACKING.html[HACKING] document.
|
||||||
|
link:submitting-patches.html[submitting-patches] is also a recommended read.
|
||||||
|
|
||||||
|
Not as familiar with code as you'd like to be, but still want to help out? If
|
||||||
|
you speak a foreign language, you can help by either creating or updating a
|
||||||
|
translation file for your native language. Instructions can be found in
|
||||||
|
link:translation-help.html[translation-help].
|
||||||
|
|
||||||
|
Other Utilities
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
Although the package manager itself is quite simple, many scripts have been
|
||||||
|
developed that help automate building and installing packages. These are used
|
||||||
|
extensively in link:http://archlinux.org/[Arch Linux]. Most of these utilities
|
||||||
|
are available in the Arch Linux projects
|
||||||
|
link:http://projects.archlinux.org/[code browser].
|
||||||
|
|
||||||
|
Utilities available:
|
||||||
|
|
||||||
|
* link:http://projects.archlinux.org/abs.git/[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
|
||||||
|
* link:http://projects.archlinux.org/dbscripts.git/[dbscripts] - scripts used by Arch Linux to manage the main package repositories
|
||||||
|
* link:http://projects.archlinux.org/devtools.git/[devtools] - tools to assist in packaging and dependency checking
|
||||||
|
* link:http://projects.archlinux.org/namcap.git/[namcap] - a package analysis utility written in python
|
||||||
|
* link:http://projects.archlinux.org/srcpac.git/[srcpac] - a bash build-from-source pacman wrapper
|
||||||
|
|
||||||
|
Bugs
|
||||||
|
----
|
||||||
|
If you find bugs (which is quite likely), please email them to the pacman-dev
|
||||||
|
mailing last at mailto:pacman-dev@archlinux.org[] with specific information
|
||||||
|
such as your commandline, the nature of the bug, and even the package database
|
||||||
|
if it helps.
|
||||||
|
|
||||||
|
You can also post a bug to the Arch Linux bug tracker
|
||||||
|
link:http://bugs.archlinux.org/index.php?project=3[Flyspray]. Be sure to file
|
||||||
|
bugs under the Pacman project.
|
||||||
|
|
||||||
|
Pacman/libalpm in the Wild
|
||||||
|
--------------------------
|
||||||
|
Although Arch Linux is the primary user of pacman and libalpm, other
|
||||||
|
distributions and projects also use pacman as a package management tool. In
|
||||||
|
addition, there have been several projects started to provide a frontend GUI to
|
||||||
|
pacman and/or libalpm.
|
||||||
|
|
||||||
|
Arch derivatives:
|
||||||
|
|
||||||
|
* link:http://archie.dotsrc.org/[Archie] - Arch Live on steroids
|
||||||
|
* link:http://www.faunos.com/[FaunOS] - A portable, fully integrated operating system based on Arch Linux
|
||||||
|
* link:http://larch.berlios.de/[larch] - A live CD/DVD/USB-stick construction kit for Arch Linux
|
||||||
|
|
||||||
|
Other distributions:
|
||||||
|
|
||||||
|
* link:http://www.delilinux.org/[DeLi Linux] - "Desktop Light" Linux, a Linux distribution for old computers
|
||||||
|
* link:http://www.frugalware.org/[Frugalware Linux] - A general purpose Linux distribution for intermediate users (pacman is forked and maintained separately)
|
||||||
|
|
||||||
|
Pacman/libalpm frontends:
|
||||||
|
|
||||||
|
* link:http://shaman.iskrembilen.com/[Shaman] - A GUI frontend using Qt and libalpm
|
||||||
|
|
||||||
|
Copyright
|
||||||
|
---------
|
||||||
|
pacman is Copyright (C) 2006-2011 Pacman Development Team
|
||||||
|
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
|
||||||
|
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
|
||||||
|
version 2 or later.
|
||||||
|
|
||||||
|
/////
|
||||||
|
vim: set ts=2 sw=2 syntax=asciidoc et:
|
||||||
|
/////
|
||||||
@@ -43,14 +43,7 @@ Options
|
|||||||
*-A, \--ignorearch*::
|
*-A, \--ignorearch*::
|
||||||
Ignore a missing or incomplete arch field in the build script. This is
|
Ignore a missing or incomplete arch field in the build script. This is
|
||||||
for rebuilding packages from source when the PKGBUILD may be slightly
|
for rebuilding packages from source when the PKGBUILD may be slightly
|
||||||
outdated and not updated with an `$$arch=('yourarch')$$` field.
|
outdated and not updated with an `arch=('yourarch')` field.
|
||||||
|
|
||||||
*-b, \--builddeps*::
|
|
||||||
Build missing dependencies from source. When makepkg finds missing
|
|
||||||
build-time or run-time dependencies, it will look for the dependencies'
|
|
||||||
PKGBUILD files under `SRCROOT` (set in linkman:makepkg.conf[5]). If it
|
|
||||||
finds them it will call makepkg to build and install the missing
|
|
||||||
dependencies. The child calls will be made with the `-b` and `-i` options.
|
|
||||||
|
|
||||||
*-c, \--clean*::
|
*-c, \--clean*::
|
||||||
Clean up leftover work files and directories after a successful build.
|
Clean up leftover work files and directories after a successful build.
|
||||||
@@ -59,6 +52,10 @@ Options
|
|||||||
Removes all cached source files from the directory specified in `SRCDEST`
|
Removes all cached source files from the directory specified in `SRCDEST`
|
||||||
in linkman:makepkg.conf[5].
|
in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
*\--config* <file>::
|
||||||
|
Use an alternate config file instead of the `{sysconfdir}/makepkg.conf`
|
||||||
|
default.
|
||||||
|
|
||||||
*-d, \--nodeps*::
|
*-d, \--nodeps*::
|
||||||
Do not perform any dependency checks. This will let you override and
|
Do not perform any dependency checks. This will let you override and
|
||||||
ignore any dependencies required. There is a good chance this option
|
ignore any dependencies required. There is a good chance this option
|
||||||
@@ -85,10 +82,14 @@ Options
|
|||||||
|
|
||||||
*-g, \--geninteg*::
|
*-g, \--geninteg*::
|
||||||
For each source file in the source array of PKGBUILD, download the file
|
For each source file in the source array of PKGBUILD, download the file
|
||||||
if required and generate integrity checks. The integrity checks
|
if required and generate integrity checks. The integrity checks generated
|
||||||
generated are determined by the value of the INTEGRITY_CHECK array in
|
are determined by the checks present in the PKGBUILD, falling back to the
|
||||||
linkman:makepkg.conf[5]. This output can be redirected into your
|
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent
|
||||||
PKGBUILD for source validation using "`makepkg -g >> PKGBUILD`".
|
This output can be redirected into your PKGBUILD for source validation
|
||||||
|
using "`makepkg -g >> PKGBUILD`".
|
||||||
|
|
||||||
|
*--skipinteg*::
|
||||||
|
Do not perform any integrity checks, just print a warning instead.
|
||||||
|
|
||||||
*-h, \--help*::
|
*-h, \--help*::
|
||||||
Output syntax and command line options.
|
Output syntax and command line options.
|
||||||
@@ -117,28 +118,48 @@ Options
|
|||||||
`\--noextract` option if you wish to tweak the files in src/ before
|
`\--noextract` option if you wish to tweak the files in src/ before
|
||||||
building.
|
building.
|
||||||
|
|
||||||
*-p* <`buildscript`>::
|
*-p* <buildscript>::
|
||||||
Read the package script `buildscript` instead of the `PKGBUILD` default;
|
Read the package script `buildscript` instead of the `PKGBUILD` default;
|
||||||
see linkman:PKGBUILD[5].
|
see linkman:PKGBUILD[5].
|
||||||
|
|
||||||
*-r, \--rmdeps*::
|
*-r, \--rmdeps*::
|
||||||
Upon successful build, remove any dependencies installed by makepkg
|
Upon successful build, remove any dependencies installed by makepkg
|
||||||
during dependency auto-resolution (using `-b` or `-s`).
|
during dependency auto-resolution and installation when using `-s`.
|
||||||
|
|
||||||
*-R, \--repackage*::
|
*-R, \--repackage*::
|
||||||
Repackage contents of pkg/ without rebuilding the package. This is
|
Repackage contents of the package without rebuilding the package. This
|
||||||
useful if you forgot a depend or install file in your PKGBUILD and the
|
is useful if you forgot a depend or install file in your PKGBUILD and
|
||||||
build itself will not change.
|
the build itself will not change.
|
||||||
|
|
||||||
*-s, \--syncdeps*::
|
*-s, \--syncdeps*::
|
||||||
Install missing dependencies using pacman. When build-time or run-time
|
Install missing dependencies using pacman. When build-time or run-time
|
||||||
dependencies are not found, pacman will try to resolve them. If
|
dependencies are not found, pacman will try to resolve them. If
|
||||||
successful, the missing packages will be downloaded and installed.
|
successful, the missing packages will be downloaded and installed.
|
||||||
|
|
||||||
|
*\--allsource*::
|
||||||
|
Do not actually build the package, but build a source-only tarball that
|
||||||
|
includes all sources, including those that are normally download via
|
||||||
|
makepkg. This is useful for passing a single tarball to another program
|
||||||
|
such as a chroot or remote builder. It will also satisfy requirements of
|
||||||
|
the GPL when distributing binary packages.
|
||||||
|
|
||||||
*\--source*::
|
*\--source*::
|
||||||
Do not actually build the package, but build a source-only tarball. This
|
Do not actually build the package, but build a source-only tarball that
|
||||||
is useful for passing a single tarball to another program such as a
|
does not include sources that can be fetched via a download URL. This is
|
||||||
chroot, remote builder, or an AUR upload.
|
useful for passing a single tarball to another program such as a chroot,
|
||||||
|
remote builder, or a tarball upload. Because integrity checks are verified,
|
||||||
|
all source files of the package need to be present or downloadable.
|
||||||
|
|
||||||
|
*\--pkg <list>*::
|
||||||
|
Only build listed packages from a split package. The use of quotes is
|
||||||
|
necessary when specifying multiple packages. e.g. `--pkg "pkg1 pkg3"`
|
||||||
|
|
||||||
|
*\--check*::
|
||||||
|
Run the check() function in the PKGBUILD, overriding the setting in
|
||||||
|
linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
*\--nocheck*::
|
||||||
|
Do not run the check() function in the PKGBUILD or handle the checkdepends.
|
||||||
|
|
||||||
*\--noconfirm*::
|
*\--noconfirm*::
|
||||||
(Passed to pacman) Prevent pacman from waiting for user input before
|
(Passed to pacman) Prevent pacman from waiting for user input before
|
||||||
@@ -157,6 +178,23 @@ separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
|
|||||||
set up a development PKGBUILD.
|
set up a development PKGBUILD.
|
||||||
|
|
||||||
|
|
||||||
|
Environment Variables
|
||||||
|
---------------------
|
||||||
|
*PACMAN*::
|
||||||
|
The command that will be used to check for missing dependencies and to
|
||||||
|
install and remove packages. Pacman's -Qq, -Rns, -S, -T, and -U
|
||||||
|
operations must be supported by this command. If the variable is not
|
||||||
|
set or empty, makepkg will fall back to `pacman'.
|
||||||
|
|
||||||
|
**PKGDEST=**"/path/to/folder"::
|
||||||
|
Folder where the resulting packages will be stored. Overrides the
|
||||||
|
corresponding value defined in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
**SRCDEST=**"/path/to/folder"::
|
||||||
|
Folder where the downloaded sources will be stored. Overrides the
|
||||||
|
corresponding value defined in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
|
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
|
||||||
|
|||||||
@@ -34,9 +34,13 @@ Options
|
|||||||
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
|
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
|
||||||
Sets the download agents used to fetch source files specified with a URL in
|
Sets the download agents used to fetch source files specified with a URL in
|
||||||
the linkman:PKGBUILD[5] file. Options can be specified for each command as
|
the linkman:PKGBUILD[5] file. Options can be specified for each command as
|
||||||
well; the download URL is placed on the end of the command. This is more
|
well, and any protocol can have a download agent. Several examples are provided
|
||||||
flexible than the former `FTPAGENT` variable, as any protocol can have a
|
in the default makepkg.conf.
|
||||||
download agent. Several examples are provided in the default makepkg.conf.
|
+
|
||||||
|
If present, `%u` will be replaced with the download URL. Otherwise, the
|
||||||
|
download URL will be placed on the end of the command. If present, `%o` will
|
||||||
|
be replaced with the local filename, plus a ``.part'' extension, which allows
|
||||||
|
makepkg to handle resuming file downloads.
|
||||||
|
|
||||||
**CARCH=**"carch"::
|
**CARCH=**"carch"::
|
||||||
Specifies your computer architecture; possible values include such things
|
Specifies your computer architecture; possible values include such things
|
||||||
@@ -57,11 +61,16 @@ Options
|
|||||||
**CXXFLAGS=**"cxxflags"::
|
**CXXFLAGS=**"cxxflags"::
|
||||||
Flags used for the C++ compiler; see CFLAGS for more info.
|
Flags used for the C++ compiler; see CFLAGS for more info.
|
||||||
|
|
||||||
|
**LDFLAGS=**"ldflags"::
|
||||||
|
Flags used for the linker. Several options may be specified with common
|
||||||
|
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
|
||||||
|
available linker flags.
|
||||||
|
|
||||||
**MAKEFLAGS=**"makeflags"::
|
**MAKEFLAGS=**"makeflags"::
|
||||||
This is often used to set the number of jobs used, for example, `-j2`.
|
This is often used to set the number of jobs used, for example, `-j2`.
|
||||||
Other flags that make accepts can also be passed.
|
Other flags that make accepts can also be passed.
|
||||||
|
|
||||||
**BUILDENV=(**fakeroot !distcc color !ccache !xdelta**)**::
|
**BUILDENV=(**fakeroot !distcc color !ccache**)**::
|
||||||
This array contains options that affect the build environment, the defaults
|
This array contains options that affect the build environment, the defaults
|
||||||
are shown here. All options should always be left in the array; to enable
|
are shown here. All options should always be left in the array; to enable
|
||||||
or disable an option simply remove or place an ``!'' at the front of the
|
or disable an option simply remove or place an ``!'' at the front of the
|
||||||
@@ -84,18 +93,18 @@ Options
|
|||||||
be disabled for individual packages by placing `!ccache` in the
|
be disabled for individual packages by placing `!ccache` in the
|
||||||
PKGBUILD options array.
|
PKGBUILD options array.
|
||||||
|
|
||||||
*xdelta*;;
|
*check*;;
|
||||||
Generate an xdelta binary patch from previous to current package. The
|
Run the check() function if present in the PKGBUILD. This can be
|
||||||
previous package must be available in the makepkg cache directory for
|
enabled or disabled for individual packages through the use of
|
||||||
this to occur.
|
makepkg's `--check` and `--nocheck` options respectively.
|
||||||
|
|
||||||
**DISTCC_HOSTS=**"host1 ..."::
|
**DISTCC_HOSTS=**"host1 ..."::
|
||||||
If using DistCC, this is used to specify a space-delimited list of hosts
|
If using DistCC, this is used to specify a space-delimited list of hosts
|
||||||
running in the DistCC cluster. In addition, you will want to modify your
|
running in the DistCC cluster. In addition, you will want to modify your
|
||||||
`MAKEFLAGS`.
|
`MAKEFLAGS`.
|
||||||
|
|
||||||
**OPTIONS=(**strip !docs libtool emptydirs**)**::
|
**OPTIONS=(**strip !docs libtool emptydirs zipman**)**::
|
||||||
This array contains options that affect the default packaging. All four are
|
This array contains options that affect the default packaging. They are
|
||||||
equivalent to options that can be placed in the PKGBUILD; the defaults are
|
equivalent to options that can be placed in the PKGBUILD; the defaults are
|
||||||
shown here. All options should always be left in the array; to enable or
|
shown here. All options should always be left in the array; to enable or
|
||||||
disable an option simply remove or place an ``!'' at the front of the
|
disable an option simply remove or place an ``!'' at the front of the
|
||||||
@@ -107,27 +116,60 @@ Options
|
|||||||
option.
|
option.
|
||||||
|
|
||||||
*docs*;;
|
*docs*;;
|
||||||
Save doc and info directories. If you wish to delete doc and info
|
Save doc directories. If you wish to delete doc directories, specify
|
||||||
directories, specify `!docs' in the array.
|
`!docs` in the array. The directories affected are specified by the
|
||||||
|
`DOC_DIRS` variable.
|
||||||
|
|
||||||
*libtool*;;
|
*libtool*;;
|
||||||
Leave libtool (.la) files in packages. Specify `!libtool' to remove
|
Leave libtool (.la) files in packages. Specify `!libtool` to remove
|
||||||
them.
|
them.
|
||||||
|
|
||||||
*emptydirs*;;
|
*emptydirs*;;
|
||||||
Leave empty directories in packages.
|
Leave empty directories in packages.
|
||||||
|
|
||||||
|
*zipman*;;
|
||||||
|
Compress manual (man and info) pages with gzip. The directories
|
||||||
|
affected are specified by the `MAN_DIRS` variable.
|
||||||
|
|
||||||
|
*purge*;;
|
||||||
|
Remove files specified by the `PURGE_TARGETS` variable from the
|
||||||
|
package.
|
||||||
|
|
||||||
**INTEGRITY_CHECK=(**check1 ...**)**::
|
**INTEGRITY_CHECK=(**check1 ...**)**::
|
||||||
File integrity checks to use. Multiple checks may be specified; this
|
File integrity checks to use. Multiple checks may be specified; this
|
||||||
affects both generation and checking. The current valid options are:
|
affects both generation and checking. The current valid options are:
|
||||||
`md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
|
`md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
|
||||||
|
|
||||||
**DOC_DIRS=(**usr/{,share/}{info,doc} ...**)**::
|
**STRIP_BINARIES=**"--strip-all"::
|
||||||
If "!docs" is specified in the OPTIONS array, this variable will
|
Options to be used when stripping binaries. See linkman:strip[1]
|
||||||
|
for details.
|
||||||
|
|
||||||
|
**STRIP_SHARED=**"--strip-unneeded"::
|
||||||
|
Options to be used when stripping shared libraries. See linkman:strip[1]
|
||||||
|
for details.
|
||||||
|
|
||||||
|
**STRIP_STATIC=**"--strip-debug"::
|
||||||
|
Options to be used when stripping static libraries. See linkman:strip[1]
|
||||||
|
for details.
|
||||||
|
|
||||||
|
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
|
||||||
|
If `zipman` is specified in the OPTIONS array, this variable will
|
||||||
|
instruct makepkg where to look to compress manual (man and info)
|
||||||
|
pages. If you build packages that are located in opt/, you may need
|
||||||
|
to add the directory to this array. *NOTE:* Do not add the leading
|
||||||
|
slash to the directory name.
|
||||||
|
|
||||||
|
**DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**::
|
||||||
|
If `!docs` is specified in the OPTIONS array, this variable will
|
||||||
instruct makepkg where to look to remove docs. If you build packages
|
instruct makepkg where to look to remove docs. If you build packages
|
||||||
that are located in opt/, you may need to add the directory to this
|
that are located in opt/, you may need to add the directory to this
|
||||||
array. *NOTE:* Do not add the leading slash to the directory name.
|
array. *NOTE:* Do not add the leading slash to the directory name.
|
||||||
|
|
||||||
|
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
|
||||||
|
If `purge` is specified in the OPTIONS array, this variable will
|
||||||
|
instruct makepkg which files to remove from the package. This is
|
||||||
|
useful for index files that are added by multiple packages.
|
||||||
|
|
||||||
**PKGDEST=**"/path/to/folder"::
|
**PKGDEST=**"/path/to/folder"::
|
||||||
If this value is not set, packages will by default be placed in the
|
If this value is not set, packages will by default be placed in the
|
||||||
current directory (location of the linkman:PKGBUILD[5]). Many people
|
current directory (location of the linkman:PKGBUILD[5]). Many people
|
||||||
@@ -139,14 +181,20 @@ Options
|
|||||||
in the current directory. Many people like to keep all source files in
|
in the current directory. Many people like to keep all source files in
|
||||||
a central location for easy cleanup, so this path can be set here.
|
a central location for easy cleanup, so this path can be set here.
|
||||||
|
|
||||||
**PACKAGER=**"John Doe <john@doe.com>"::
|
**SRCPKGDEST=**"/path/to/folder"::
|
||||||
|
If this value is not set, source package files will be stored in
|
||||||
|
in the current directory. Many people like to keep all source package files
|
||||||
|
in a central location for easy cleanup, so this path can be set here.
|
||||||
|
|
||||||
|
**PACKAGER=**"John Doe <john@example.com>"::
|
||||||
This value is used when querying a package to see who was the builder.
|
This value is used when querying a package to see who was the builder.
|
||||||
It is recommended you change this to your name and email address.
|
It is recommended you change this to your name and email address.
|
||||||
|
|
||||||
*BUILDSCRIPT*, *PKGEXT*, *SRCEXT*, *DB_COMPRESSION*, *DB_CHECKSUMS*::
|
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
|
||||||
|
Sets the compression used when making compiled or source packages. The
|
||||||
|
current valid suffixes are `.tar`, `.tar.gz`, `.tar,bz2` and `.tar.xz`.
|
||||||
Do not touch these unless you know what you are doing.
|
Do not touch these unless you know what you are doing.
|
||||||
|
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
|
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
|
||||||
|
|||||||
311
doc/pacman.8.txt
311
doc/pacman.8.txt
@@ -11,7 +11,7 @@ pacman - package manager utility
|
|||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
'pacman' <operation> [options] [packages]
|
'pacman' <operation> [options] [targets]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@@ -22,32 +22,40 @@ hooks, and the ability to sync your local machine with a remote ftp server to
|
|||||||
automatically upgrade packages. Pacman packages are a zipped tar format.
|
automatically upgrade packages. Pacman packages are a zipped tar format.
|
||||||
|
|
||||||
Since version 3.0.0, pacman has been the frontend to linkman:libalpm[3], the
|
Since version 3.0.0, pacman has been the frontend to linkman:libalpm[3], the
|
||||||
"Arch Linux Package Management" library. This library allows alternative front
|
``Arch Linux Package Management'' library. This library allows alternative
|
||||||
ends to be written (for instance, a GUI front end).
|
front ends to be written (for instance, a GUI front end).
|
||||||
|
|
||||||
|
Invoking pacman involves specifying an operation with any potential options and
|
||||||
|
targets to operate on. A 'target' is usually a package name, filename, URL, or
|
||||||
|
a search string. Targets can be provided as command line arguments.
|
||||||
|
Additionally, if a single dash (-) is passed as an argument, targets will be
|
||||||
|
read from stdin.
|
||||||
|
|
||||||
|
|
||||||
Operations
|
Operations
|
||||||
----------
|
----------
|
||||||
*-A, \--add* (deprecated)::
|
*-D, \--database*::
|
||||||
Add a package to the system. Either a URL or file path can be specified.
|
Modify the package database. This options allows you to modify certain
|
||||||
The package will be uncompressed into the installation root and the
|
attributes of the installed packages in pacman's database. At the
|
||||||
database will be updated. The package will not be installed if another
|
moment, you can only change the install reason using '\--asdeps' and
|
||||||
version is already installed. *NOTE*: please use '\--upgrade' in place of
|
'\--asexplicit' options.
|
||||||
this option.
|
|
||||||
|
|
||||||
*-Q, \--query*::
|
*-Q, \--query*::
|
||||||
Query the package database. This operation allows you to view installed
|
Query the package database. This operation allows you to view installed
|
||||||
packages and their files, as well as meta-information about individual
|
packages and their files, as well as meta-information about individual
|
||||||
packages (dependencies, conflicts, install date, build date, size). This
|
packages (dependencies, conflicts, install date, build date, size). This
|
||||||
can be run against the local package database or can be used on
|
can be run against the local package database or can be used on
|
||||||
individual '.tar.gz' packages. See <<QO,Query Options>> below.
|
individual '.tar.gz' packages. In the first case, if no package names
|
||||||
|
are provided in the command line, all installed packages will be
|
||||||
|
queried. Additionally, various filters can be applied on the package
|
||||||
|
list. See <<QO,Query Options>> below.
|
||||||
|
|
||||||
*-R, \--remove*::
|
*-R, \--remove*::
|
||||||
Remove a package from the system. Groups can also be specified to be
|
Remove package(s) from the system. Groups can also be specified to be
|
||||||
removed, in which case every package in that group will be removed.
|
removed, in which case every package in that group will be removed.
|
||||||
Files belonging to the specified package will be deleted, and the
|
Files belonging to the specified package will be deleted, and the
|
||||||
database will be updated. Most configuration files will be saved
|
database will be updated. Most configuration files will be saved
|
||||||
with a `.pacsave` extension unless the '\--nosave' option is used.
|
with a '.pacsave' extension unless the '\--nosave' option is used.
|
||||||
See <<RO,Remove Options>> below.
|
See <<RO,Remove Options>> below.
|
||||||
|
|
||||||
*-S, \--sync*::
|
*-S, \--sync*::
|
||||||
@@ -56,7 +64,9 @@ Operations
|
|||||||
example, `pacman -S qt` will download and install qt and all the
|
example, `pacman -S qt` will download and install qt and all the
|
||||||
packages it depends on. If a package name exists in more than one repo, the
|
packages it depends on. If a package name exists in more than one repo, the
|
||||||
repo can be explicitly specified to clarify the package to install:
|
repo can be explicitly specified to clarify the package to install:
|
||||||
`pacman -S testing/qt`.
|
`pacman -S testing/qt`. You can also specify version requirements:
|
||||||
|
`pacman -S "bash>=3.2"`. (Quotes are needed, otherwise your shell
|
||||||
|
interprets ">" as redirection to file.)
|
||||||
+
|
+
|
||||||
In addition to packages, groups can be specified as well. For example, if
|
In addition to packages, groups can be specified as well. For example, if
|
||||||
gnome is a defined package group, then `pacman -S gnome` will install every
|
gnome is a defined package group, then `pacman -S gnome` will install every
|
||||||
@@ -68,12 +78,32 @@ provide the same functionality as foo will be searched for. If any package is
|
|||||||
found, it will be installed.
|
found, it will be installed.
|
||||||
+
|
+
|
||||||
You can also use `pacman -Su` to upgrade all packages that are out of date. See
|
You can also use `pacman -Su` to upgrade all packages that are out of date. See
|
||||||
<<SO,Sync Options>> below.
|
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
|
||||||
|
to determine which packages need upgrading. This behavior operates as follows:
|
||||||
|
|
||||||
|
Alphanumeric:
|
||||||
|
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
|
||||||
|
Numeric:
|
||||||
|
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
|
||||||
|
+
|
||||||
|
Additionally, version strings can have an 'epoch' value defined that will
|
||||||
|
overrule any version comparison (unless the epoch values are equal). This is
|
||||||
|
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
|
||||||
|
greater than `1:3.6-1`.
|
||||||
|
|
||||||
|
*-T, \--deptest*::
|
||||||
|
Check dependencies; this is useful in scripts such as makepkg to check
|
||||||
|
installed packages. This operation will check each dependency specified and
|
||||||
|
return a list of those which are not currently satisfied on the system.
|
||||||
|
This operation accepts no other options. Example usage: `pacman -T qt
|
||||||
|
"bash>=3.2"`.
|
||||||
|
|
||||||
*-U, \--upgrade*::
|
*-U, \--upgrade*::
|
||||||
Upgrade or add a package to the system. Either a URL or file path can be
|
Upgrade or add package(s) to the system and install the required
|
||||||
specified. This is a "remove-then-add" process. See <<HCF,Handling Config
|
dependencies from sync repos. Either a URL or file path can be
|
||||||
Files>> for an explanation on how pacman takes care of config files.
|
specified. This is a ``remove-then-add'' process. See <<UO,Upgrade
|
||||||
|
Options>> below; also see <<HCF,Handling Config Files>> for an explanation
|
||||||
|
on how pacman takes care of config files.
|
||||||
|
|
||||||
*-V, \--version*::
|
*-V, \--version*::
|
||||||
Display version and exit.
|
Display version and exit.
|
||||||
@@ -85,59 +115,59 @@ You can also use `pacman -Su` to upgrade all packages that are out of date. See
|
|||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
*\--asdeps*::
|
*-b, \--dbpath* <path>::
|
||||||
Install packages non-explicitly; in other works, fake their install reason
|
|
||||||
to be installed as a dependency. This is useful for makepkg and other
|
|
||||||
build from source tools that need to install dependencies before building
|
|
||||||
the package.
|
|
||||||
|
|
||||||
*-b, \--dbpath* <'path'>::
|
|
||||||
Specify an alternative database location (a typical default is
|
Specify an alternative database location (a typical default is
|
||||||
``/var/lib/pacman''). This should not be used unless you know what you are
|
`{localstatedir}/lib/pacman`). This should not be used unless you know what you are
|
||||||
doing. *NOTE*: if specified, this is an absolute path and the root path is
|
doing. *NOTE*: if specified, this is an absolute path and the root path is
|
||||||
not automatically prepended. This behavior changed in pacman 3.1.0.
|
not automatically prepended.
|
||||||
|
|
||||||
*-d, \--nodeps*::
|
*-r, \--root* <path>::
|
||||||
Skips all dependency checks. Normally, pacman will always check a
|
Specify an alternative installation root (default is `/`). This should
|
||||||
package's dependency fields to ensure that all dependencies are
|
not be used as a way to install software into `/usr/local` instead of
|
||||||
installed and there are no package conflicts in the system.
|
`/usr`. This option is used if you want to install a package on a
|
||||||
|
|
||||||
*-f, \--force*::
|
|
||||||
Bypass file conflict checks and overwrite conflicting files. If the
|
|
||||||
package that is about to be installed contains files that are already
|
|
||||||
installed, this option will cause all those files to be overwritten.
|
|
||||||
This option should be used with care, ideally not at all.
|
|
||||||
|
|
||||||
*-r, \--root* <'path'>::
|
|
||||||
Specify an alternative installation root (default is ``/''). This should
|
|
||||||
not be used as a way to install software into ``/usr/local'' instead of
|
|
||||||
``/usr''. This option is used if you want to install a package on a
|
|
||||||
temporary mounted partition which is "owned" by another system.
|
temporary mounted partition which is "owned" by another system.
|
||||||
*NOTE*: If database path or logfile are not specified on either the
|
*NOTE*: if database path or logfile are not specified on either the
|
||||||
command line or in linkman:pacman.conf[5], their default location will
|
command line or in linkman:pacman.conf[5], their default location will
|
||||||
be inside this root path.
|
be inside this root path.
|
||||||
|
|
||||||
*-v, --verbose*::
|
*-v, \--verbose*::
|
||||||
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
|
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
|
||||||
|
|
||||||
*\--cachedir* <'dir'>::
|
*\--arch* <arch>::
|
||||||
Specify an alternative package cache location (a typical default is
|
Specify an alternate architecture.
|
||||||
``/var/cache/pacman/pkg''). Multiple cache directories can be specified,
|
|
||||||
and they are tried in the order they are passed to pacman. *NOTE*: this
|
|
||||||
is an absolute path, the root path is not automatically prepended. This
|
|
||||||
behavior changed in pacman 3.1.0.
|
|
||||||
|
|
||||||
*\--config* <'file'>::
|
*\--cachedir* <dir>::
|
||||||
|
Specify an alternative package cache location (a typical default is
|
||||||
|
`{localstatedir}/cache/pacman/pkg`). Multiple cache directories can be specified,
|
||||||
|
and they are tried in the order they are passed to pacman. *NOTE*: this
|
||||||
|
is an absolute path, the root path is not automatically prepended.
|
||||||
|
|
||||||
|
*\--config* <file>::
|
||||||
Specify an alternate configuration file.
|
Specify an alternate configuration file.
|
||||||
|
|
||||||
*\--logfile* <'file'>::
|
*\--debug*::
|
||||||
|
Display debug messages. When reporting bugs, this option is recommended
|
||||||
|
to be used.
|
||||||
|
|
||||||
|
*\--logfile* <file>::
|
||||||
Specify an alternate log file. This is an absolute path, regardless of
|
Specify an alternate log file. This is an absolute path, regardless of
|
||||||
the installation root setting.
|
the installation root setting.
|
||||||
|
|
||||||
*\--noconfirm*::
|
*\--noconfirm*::
|
||||||
Bypass any and all "Are you sure?" messages. It's not a good idea to do
|
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
|
||||||
this unless you want to run pacman from a script.
|
this unless you want to run pacman from a script.
|
||||||
|
|
||||||
|
Transaction Options (apply to '-S', '-R' and '-U')
|
||||||
|
--------------------------------------------------
|
||||||
|
*-d, \--nodeps*::
|
||||||
|
Skips dependency version checks. Package names are still checked. Normally,
|
||||||
|
pacman will always check a package's dependency fields to ensure that all
|
||||||
|
dependencies are installed and there are no package conflicts in the
|
||||||
|
system. Specify this option twice to skip all dependency checks.
|
||||||
|
|
||||||
|
*-k, \--dbonly*::
|
||||||
|
Adds/Removes the database entry only, leaves all files in place.
|
||||||
|
|
||||||
*\--noprogressbar*::
|
*\--noprogressbar*::
|
||||||
Do not show a progress bar when downloading files. This can be useful
|
Do not show a progress bar when downloading files. This can be useful
|
||||||
for scripts that call pacman and capture the output.
|
for scripts that call pacman and capture the output.
|
||||||
@@ -146,24 +176,62 @@ Options
|
|||||||
If an install scriptlet exists, do not execute it. Do not use this
|
If an install scriptlet exists, do not execute it. Do not use this
|
||||||
unless you know what you are doing.
|
unless you know what you are doing.
|
||||||
|
|
||||||
|
*-p, \--print*::
|
||||||
|
Only print the targets instead of performing the actual operation (sync,
|
||||||
|
remove or upgrade). Use '\--print-format' to specify how targets are
|
||||||
|
displayed. The default format string is "%l", which displays URLs with
|
||||||
|
'-S', filenames with '-U' and pkgname-pkgver with '-R'.
|
||||||
|
|
||||||
|
*\--print-format* <format>::
|
||||||
|
Specify a printf-like format to control the output of the '\--print'
|
||||||
|
operation. The possible attributes are: %n for pkgname, %v for pkgver,
|
||||||
|
%l for location, %r for repo and %s for size.
|
||||||
|
|
||||||
|
Upgrade Options (apply to '-S' and '-U')[[UO]]
|
||||||
|
--------------------------------------------
|
||||||
|
*-f, \--force*::
|
||||||
|
Bypass file conflict checks and overwrite conflicting files. If the
|
||||||
|
package that is about to be installed contains files that are already
|
||||||
|
installed, this option will cause all those files to be overwritten.
|
||||||
|
This option should be used with care, ideally not at all.
|
||||||
|
|
||||||
|
*\--asdeps*::
|
||||||
|
Install packages non-explicitly; in other words, fake their install reason
|
||||||
|
to be installed as a dependency. This is useful for makepkg and other
|
||||||
|
build from source tools that need to install dependencies before building
|
||||||
|
the package.
|
||||||
|
|
||||||
|
*\--asexplicit*::
|
||||||
|
Install packages explicitly; in other words, fake their install reason to
|
||||||
|
be explicitly installed. This is useful if you want to mark a dependency
|
||||||
|
as explicitly installed so it will not be removed by the '\--recursive'
|
||||||
|
remove operation.
|
||||||
|
|
||||||
|
*\--ignore* <package>::
|
||||||
|
Directs pacman to ignore upgrades of package even if there is one
|
||||||
|
available. Multiple packages can be specified by separating them
|
||||||
|
with a comma.
|
||||||
|
|
||||||
|
*\--ignoregroup* <group>::
|
||||||
|
Directs pacman to ignore upgrades of all packages in 'group' even if
|
||||||
|
there is one available. Multiple groups can be specified by
|
||||||
|
separating them with a comma.
|
||||||
|
|
||||||
Query Options[[QO]]
|
Query Options[[QO]]
|
||||||
-------------------
|
-------------------
|
||||||
*-c, \--changelog*::
|
*-c, \--changelog*::
|
||||||
View the ChangeLog of a package. Not every package will provide one but
|
View the ChangeLog of a package if it exists.
|
||||||
it will be shown if available.
|
|
||||||
|
|
||||||
*-d, \--deps*::
|
*-d, \--deps*::
|
||||||
List all packages installed as dependencies. This option can be combined
|
Restrict or filter output to packages installed as dependencies. This
|
||||||
with '-t' for listing real orphans- packages that were installed as
|
option can be combined with '-t' for listing real orphans - packages that
|
||||||
dependencies but are no longer required by any installed package. ('-Qdt'
|
were installed as dependencies but are no longer required by any
|
||||||
is equivalent to the pacman 3.0.X '-Qe' option.)
|
installed package.
|
||||||
|
|
||||||
*-e, \--explicit*::
|
*-e, \--explicit*::
|
||||||
List all packages explicitly installed. This option can be combined with
|
Restrict or filter output to explicitly installed packages. This option
|
||||||
'-t' to list top-level packages- those packages that were explicitly
|
can be combined with '-t' to list explicitly installed packages which
|
||||||
installed but are not required by any other package. ('-Qet' is equivalent
|
are not required by any other package.
|
||||||
to the pacman 2.9.X '-Qe' option.)
|
|
||||||
|
|
||||||
*-g, \--groups*::
|
*-g, \--groups*::
|
||||||
Display all packages that are members of a named group. If a name is not
|
Display all packages that are members of a named group. If a name is not
|
||||||
@@ -175,6 +243,11 @@ Query Options[[QO]]
|
|||||||
'\--info' or '-i' flags will also display the list of backup files and
|
'\--info' or '-i' flags will also display the list of backup files and
|
||||||
their modification states.
|
their modification states.
|
||||||
|
|
||||||
|
*-k \--check*::
|
||||||
|
Check that all files owned by the given package(s) are present on the
|
||||||
|
system. If packages are not specified or filter flags are not provided,
|
||||||
|
check all installed packages.
|
||||||
|
|
||||||
*-l, \--list*::
|
*-l, \--list*::
|
||||||
List all files owned by a given package. Multiple packages can be
|
List all files owned by a given package. Multiple packages can be
|
||||||
specified on the command line.
|
specified on the command line.
|
||||||
@@ -184,26 +257,39 @@ Query Options[[QO]]
|
|||||||
database(s). Typically these are packages that were downloaded manually
|
database(s). Typically these are packages that were downloaded manually
|
||||||
and installed with '\--upgrade'.
|
and installed with '\--upgrade'.
|
||||||
|
|
||||||
*-o, \--owns* <'file'>::
|
*-o, \--owns* <file>::
|
||||||
Search for the package that owns file. The path can be relative or
|
Search for packages that own the specified file(s). The path can be
|
||||||
absolute.
|
relative or absolute and one or more files can be specified.
|
||||||
|
|
||||||
*-p, \--file*::
|
*-p, \--file*::
|
||||||
Signifies that the package supplied on the command line is a file and
|
Signifies that the package supplied on the command line is a file and
|
||||||
not an entry in the database. The file will be decompressed and queried.
|
not an entry in the database. The file will be decompressed and queried.
|
||||||
This is useful in combination with '\--info' and '\--list'.
|
This is useful in combination with '\--info' and '\--list'.
|
||||||
|
|
||||||
*-s, \--search* <'regexp'>::
|
*-q, \--quiet*::
|
||||||
This will search each locally-installed package for names or
|
Show less information for certain query operations. (This is useful when
|
||||||
descriptions that match `regexp`.
|
pacman's output is processed in a script.) Search will only show package
|
||||||
|
names and not version, group, and description information; owns will
|
||||||
|
only show package names instead of "file is owned by pkg" messages; group
|
||||||
|
will only show package names and omit group names; list will only show
|
||||||
|
files and omit package names; check will only show pairs of package names
|
||||||
|
and missing files; a bare query will only show package names
|
||||||
|
rather than names and versions.
|
||||||
|
|
||||||
|
*-s, \--search* <regexp>::
|
||||||
|
Search each locally-installed package for names or descriptions that
|
||||||
|
match `regexp`. When including multiple search terms, only packages
|
||||||
|
with descriptions matching ALL of those terms are returned.
|
||||||
|
|
||||||
*-t, \--unrequired*::
|
*-t, \--unrequired*::
|
||||||
Restrict or filter output to packages not required by any currently
|
Restrict or filter output to packages not required by any currently
|
||||||
installed package.
|
installed package.
|
||||||
|
|
||||||
*-u, \--upgrades*::
|
*-u, \--upgrades*::
|
||||||
Lists all packages that are out of date on the local system. This option
|
Restrict or filter output to packages that are out of date on the local
|
||||||
works best if the sync database is refreshed using '-Sy'.
|
system. (Only package versions are used to find outdated packages,
|
||||||
|
replacements are not checked here.) This option works best if the sync
|
||||||
|
database is refreshed using '-Sy'.
|
||||||
|
|
||||||
|
|
||||||
Remove Options[[RO]]
|
Remove Options[[RO]]
|
||||||
@@ -213,20 +299,22 @@ Remove Options[[RO]]
|
|||||||
or more target packages. This operation is recursive, and must be used
|
or more target packages. This operation is recursive, and must be used
|
||||||
with care since it can remove many potentially needed packages.
|
with care since it can remove many potentially needed packages.
|
||||||
|
|
||||||
*-k, \--keep*::
|
|
||||||
Removes the database entry only. Leaves all files in place.
|
|
||||||
|
|
||||||
*-n, \--nosave*::
|
*-n, \--nosave*::
|
||||||
Instructs pacman to ignore file backup designations. Normally, when a
|
Instructs pacman to ignore file backup designations. Normally, when a
|
||||||
file is removed from the system the database is checked to see if the
|
file is removed from the system the database is checked to see if the
|
||||||
file should be renamed with a ``.pacsave'' extension.
|
file should be renamed with a '.pacsave' extension.
|
||||||
|
|
||||||
*-s, \--recursive*::
|
*-s, \--recursive*::
|
||||||
Remove each target specified including all of their dependencies, provided
|
Remove each target specified including all of their dependencies, provided
|
||||||
that (A) they are not required by other packages; and (B) they were not
|
that (A) they are not required by other packages; and (B) they were not
|
||||||
explicitly installed by the user. This operation is recursive and analogous
|
explicitly installed by the user. This operation is recursive and analogous
|
||||||
to a backwards '\--sync' operation, and helps keep a clean system without
|
to a backwards '\--sync' operation, and helps keep a clean system without
|
||||||
orphans.
|
orphans. If you want to omit condition (B), pass this option twice.
|
||||||
|
|
||||||
|
*-u, \--unneeded*::
|
||||||
|
Removes targets that are not required by any other packages.
|
||||||
|
This is mostly useful when removing a group without using the '-c' option,
|
||||||
|
to avoid breaking any dependencies.
|
||||||
|
|
||||||
|
|
||||||
Sync Options[[SO]]
|
Sync Options[[SO]]
|
||||||
@@ -241,10 +329,9 @@ Sync Options[[SO]]
|
|||||||
packages that are no longer installed; use two to remove all packages
|
packages that are no longer installed; use two to remove all packages
|
||||||
from the cache. In both cases, you will have a yes or no option to
|
from the cache. In both cases, you will have a yes or no option to
|
||||||
remove packages and/or unused downloaded databases.
|
remove packages and/or unused downloaded databases.
|
||||||
|
+
|
||||||
*-e, \--dependsonly*::
|
If you use a network shared cache, see the 'CleanMethod' option in
|
||||||
Install all dependencies of a package, but not the specified package
|
linkman:pacman.conf[5].
|
||||||
itself. This is pretty useless and we're not sure why it even exists.
|
|
||||||
|
|
||||||
*-g, \--groups*::
|
*-g, \--groups*::
|
||||||
Display all the members for each package group specified. If no group
|
Display all the members for each package group specified. If no group
|
||||||
@@ -252,21 +339,26 @@ Sync Options[[SO]]
|
|||||||
view all groups and their members.
|
view all groups and their members.
|
||||||
|
|
||||||
*-i, \--info*::
|
*-i, \--info*::
|
||||||
Display dependency and other information for a given package. This will
|
Display information on a given sync database package. Passing two '\--info'
|
||||||
search through all repositories for a matching package.
|
or '-i' flags will also display those packages in all repositories that
|
||||||
|
depend on this package.
|
||||||
|
|
||||||
*-l, \--list*::
|
*-l, \--list*::
|
||||||
List all packages in the specified repositories. Multiple repositories
|
List all packages in the specified repositories. Multiple repositories
|
||||||
can be specified on the command line.
|
can be specified on the command line.
|
||||||
|
|
||||||
*-p, \--print-uris*::
|
*-q, \--quiet*::
|
||||||
Print out URIs for each package that will be installed, including any
|
Show less information for certain sync operations. (This is useful when
|
||||||
dependencies yet to be installed. These can be piped to a file and
|
pacman's output is processed in a script.) Search will only show package
|
||||||
downloaded at a later time, using a program like wget.
|
names and not repo, version, group, and description information; list
|
||||||
|
will only show package names and omit databases and versions; group will
|
||||||
|
only show package names and omit group names.
|
||||||
|
|
||||||
*-s, \--search* <'regexp'>::
|
*-s, \--search* <regexp>::
|
||||||
This will search each package in the sync databases for names or
|
This will search each package in the sync databases for names or
|
||||||
descriptions that match `regexp`.
|
descriptions that match `regexp`. When you include multiple search
|
||||||
|
terms, only packages with descriptions matching ALL of those terms will
|
||||||
|
be returned.
|
||||||
|
|
||||||
*-u, \--sysupgrade*::
|
*-u, \--sysupgrade*::
|
||||||
Upgrades all packages that are out of date. Each currently-installed
|
Upgrades all packages that are out of date. Each currently-installed
|
||||||
@@ -274,31 +366,25 @@ Sync Options[[SO]]
|
|||||||
report of all packages to upgrade will be presented and the operation
|
report of all packages to upgrade will be presented and the operation
|
||||||
will not proceed without user confirmation. Dependencies are
|
will not proceed without user confirmation. Dependencies are
|
||||||
automatically resolved at this level and will be installed/upgraded if
|
automatically resolved at this level and will be installed/upgraded if
|
||||||
necessary.
|
necessary. Pass this option twice to enable package downgrade; in this
|
||||||
|
case pacman will select sync packages whose version does not match with
|
||||||
|
the local version. This can be useful when the user switches from a testing
|
||||||
|
repo to a stable one. Additional targets can also be specified manually, so
|
||||||
|
that '-Su foo' will do a system upgrade and install/upgrade the foo package in
|
||||||
|
the same operation.
|
||||||
|
|
||||||
*-w, \--downloadonly*::
|
*-w, \--downloadonly*::
|
||||||
Retrieve all packages from the server, but do not install/upgrade
|
Retrieve all packages from the server, but do not install/upgrade anything.
|
||||||
anything.
|
|
||||||
|
|
||||||
*-y, \--refresh*::
|
*-y, \--refresh*::
|
||||||
Download a fresh copy of the master package list from the server(s)
|
Download a fresh copy of the master package list from the server(s)
|
||||||
defined in linkman:pacman.conf[5]. This should typically be used each time
|
defined in linkman:pacman.conf[5]. This should typically be used each time
|
||||||
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
|
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
|
||||||
will force a refresh of all package lists even if they are thought to be up
|
will force a refresh of all package lists even if they appear to be up
|
||||||
to date.
|
to date.
|
||||||
|
|
||||||
*\--needed*::
|
*\--needed*::
|
||||||
Only install the targets that are not already installed and up-to-date.
|
Don't reinstall the targets that are already up to date.
|
||||||
|
|
||||||
*\--ignore* <'package'>::
|
|
||||||
Directs pacman to ignore upgrades of package even if there is one
|
|
||||||
available. Multiple packages can be specified by separating them
|
|
||||||
with a comma.
|
|
||||||
|
|
||||||
*\--ignoregroup* <'group'>::
|
|
||||||
Directs pacman to ignore upgrades of all packages in 'group' even if
|
|
||||||
there is one available. Multiple groups can be specified by
|
|
||||||
separating them with a comma.
|
|
||||||
|
|
||||||
|
|
||||||
Handling Config Files[[HCF]]
|
Handling Config Files[[HCF]]
|
||||||
@@ -311,7 +397,7 @@ actual file existing on the filesystem. After comparing these 3 hashes, the
|
|||||||
follow scenarios can result:
|
follow scenarios can result:
|
||||||
|
|
||||||
original=X, current=X, new=X::
|
original=X, current=X, new=X::
|
||||||
All three files are the same, so overwrites are not an issue Install the
|
All three files are the same, so overwrites are not an issue. Install the
|
||||||
new file.
|
new file.
|
||||||
|
|
||||||
original=X, current=X, new=Y::
|
original=X, current=X, new=Y::
|
||||||
@@ -332,6 +418,25 @@ original=X, current=Y, new=Z::
|
|||||||
necessary changes into the original file.
|
necessary changes into the original file.
|
||||||
|
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
pacman -Ss ne.hack::
|
||||||
|
Search for regexp "ne.hack" in package database.
|
||||||
|
|
||||||
|
pacman -S gpm::
|
||||||
|
Download and install gpm including dependencies.
|
||||||
|
|
||||||
|
pacman -U /home/user/ceofhack-0.6-1-x86_64.pkg.tar.gz::
|
||||||
|
Install ceofhack-0.6-1 package from a local file.
|
||||||
|
|
||||||
|
pacman -Syu::
|
||||||
|
Update package list and upgrade all packages afterwards.
|
||||||
|
|
||||||
|
pacman -Syu gpm::
|
||||||
|
Update package list, upgrade all packages, and then install gpm if it
|
||||||
|
wasn't already installed.
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
See linkman:pacman.conf[5] for more details on configuring pacman using the
|
See linkman:pacman.conf[5] for more details on configuring pacman using the
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ which defines global options.
|
|||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|
||||||
--------
|
--------
|
||||||
#
|
#
|
||||||
# pacman.conf
|
# pacman.conf
|
||||||
@@ -34,12 +35,15 @@ NoUpgrade = etc/passwd etc/group etc/shadow
|
|||||||
NoUpgrade = etc/fstab
|
NoUpgrade = etc/fstab
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
Include = /etc/pacman.d/core
|
Include = {sysconfdir}/pacman.d/core
|
||||||
|
|
||||||
[custom]
|
[custom]
|
||||||
Server = file:///home/pkgs
|
Server = file:///home/pkgs
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
NOTE: Each directive must be in CamelCase. If the case isn't respected, the
|
||||||
|
directive won't be recognized. For example. noupgrade or NOUPGRADE will not
|
||||||
|
work.
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
@@ -53,24 +57,23 @@ Options
|
|||||||
|
|
||||||
*DBPath =* path/to/db/dir::
|
*DBPath =* path/to/db/dir::
|
||||||
Overrides the default location of the toplevel database directory. A
|
Overrides the default location of the toplevel database directory. A
|
||||||
typical default is ``/var/lib/pacman/''. Most users will not need to set
|
typical default is `{localstatedir}/lib/pacman/`. Most users will not need to set
|
||||||
this option. *NOTE*: if specified, this is an absolute path and the root
|
this option. *NOTE*: if specified, this is an absolute path and the root
|
||||||
path is not automatically prepended. This behavior changed in pacman 3.1.0.
|
path is not automatically prepended.
|
||||||
|
|
||||||
*CacheDir =* path/to/cache/dir::
|
*CacheDir =* path/to/cache/dir::
|
||||||
Overrides the default location of the package cache directory. A typical
|
Overrides the default location of the package cache directory. A typical
|
||||||
default is ``/var/cache/pacman/pkg/''. Multiple cache directories can be
|
default is `{localstatedir}/cache/pacman/pkg/`. Multiple cache directories can be
|
||||||
specified, and they are tried in the order they are listed in the config
|
specified, and they are tried in the order they are listed in the config
|
||||||
file. If a file is not found in any cache directory, it will be downloaded
|
file. If a file is not found in any cache directory, it will be downloaded
|
||||||
to the first cache directory with write access. *NOTE*: this is an absolute
|
to the first cache directory with write access. *NOTE*: this is an absolute
|
||||||
path, the root path is not automatically prepended. This behavior changed
|
path, the root path is not automatically prepended.
|
||||||
in pacman 3.1.0.
|
|
||||||
|
|
||||||
|
|
||||||
*LogFile =* '/path/to/file'::
|
*LogFile =* '/path/to/file'::
|
||||||
Log actions directly to a file. A typical default is
|
Overrides the default location of the pacman log file. A typical default
|
||||||
``/var/log/pacman.log''. As of pacman 3.1.0, this does not need to be
|
is `{localstatedir}/log/pacman.log`. This is an absolute path and the root directory
|
||||||
specified by default. This is an absolute path and root is not prepended.
|
is not prepended.
|
||||||
|
|
||||||
*HoldPkg =* package ...::
|
*HoldPkg =* package ...::
|
||||||
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
|
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
|
||||||
@@ -80,13 +83,31 @@ Options
|
|||||||
Instructs pacman to ignore any upgrades for this package when performing
|
Instructs pacman to ignore any upgrades for this package when performing
|
||||||
a '\--sysupgrade'.
|
a '\--sysupgrade'.
|
||||||
|
|
||||||
|
*SyncFirst =* package ...::
|
||||||
|
Instructs pacman to check for newer version of these packages before any
|
||||||
|
sync operation. The user will have the choice to either cancel the current
|
||||||
|
operation and upgrade these packages first or go on with the current
|
||||||
|
operation. This option is typically used with the 'pacman' package.
|
||||||
|
*NOTE*: when a `SyncFirst` transaction takes place, no command line flags
|
||||||
|
(e.g. '\--force') are honored. If this is not ideal, disabling `SyncFirst`
|
||||||
|
and performing a manual sync of the involved packages may be required.
|
||||||
|
|
||||||
*IgnoreGroup =* group ...::
|
*IgnoreGroup =* group ...::
|
||||||
Instructs pacman to ignore any upgrades for all packages in this
|
Instructs pacman to ignore any upgrades for all packages in this
|
||||||
group when performing a '\--sysupgrade'.
|
group when performing a '\--sysupgrade'.
|
||||||
|
|
||||||
*Include =* path::
|
*Include =* path::
|
||||||
Include another config file. This file can include repositories or
|
Include another config file. This file can include repositories or
|
||||||
general configuration options.
|
general configuration options. Wildcards in the specified paths will get
|
||||||
|
expanded based on linkman:glob[7] rules.
|
||||||
|
|
||||||
|
*Architecture =* auto | i686 | x86_64 | ...::
|
||||||
|
If set, pacman will only allow installation of packages of the given
|
||||||
|
architecture (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
|
||||||
|
use the system architecture, provided by in ``uname -m''. If unset, no
|
||||||
|
architecture checks are made. *NOTE*: packages with the special
|
||||||
|
architecture 'any' can always be installed, as they are meant to be
|
||||||
|
architecture independent.
|
||||||
|
|
||||||
*XferCommand =* /path/to/command %u::
|
*XferCommand =* /path/to/command %u::
|
||||||
If set, an external program will be used to download all remote files.
|
If set, an external program will be used to download all remote files.
|
||||||
@@ -99,13 +120,12 @@ Options
|
|||||||
http/ftp support, or need the more advanced proxy support that comes with
|
http/ftp support, or need the more advanced proxy support that comes with
|
||||||
utilities like wget.
|
utilities like wget.
|
||||||
|
|
||||||
*NoPassiveFtp*::
|
|
||||||
Disables passive ftp connections when downloading packages. (aka Active Mode)
|
|
||||||
|
|
||||||
*NoUpgrade =* file ...::
|
*NoUpgrade =* file ...::
|
||||||
All files listed with a `NoUpgrade` directive will never be touched during
|
All files listed with a `NoUpgrade` directive will never be touched during
|
||||||
a package install/upgrade. Do not include the leading slash when specifying
|
a package install/upgrade, and the new files will be installed with a
|
||||||
files.
|
'.pacnew' extension.
|
||||||
|
These files refer to files in the package archive, so do not include the
|
||||||
|
leading slash (the RootDir) when specifying them.
|
||||||
|
|
||||||
*NoExtract =* file ...::
|
*NoExtract =* file ...::
|
||||||
All files listed with a `NoExtract` directive will never be extracted from
|
All files listed with a `NoExtract` directive will never be extracted from
|
||||||
@@ -113,24 +133,41 @@ Options
|
|||||||
of a package to be installed. For example, if your httpd root uses an
|
of a package to be installed. For example, if your httpd root uses an
|
||||||
'index.php', then you would not want the 'index.html' file to be extracted
|
'index.php', then you would not want the 'index.html' file to be extracted
|
||||||
from the 'apache' package.
|
from the 'apache' package.
|
||||||
|
These files refer to files in the package archive, so do not include the
|
||||||
|
leading slash (the RootDir) when specifying them.
|
||||||
|
|
||||||
|
*CleanMethod =* KeepInstalled &| KeepCurrent::
|
||||||
|
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
|
||||||
|
packages that are no longer installed (not present in the local database).
|
||||||
|
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
|
||||||
|
any sync database).
|
||||||
|
The second behavior is useful when the package cache is shared among
|
||||||
|
multiple machines, where the local databases are usually different, but the
|
||||||
|
sync databases in use could be the same. If both values are specified,
|
||||||
|
packages are only cleaned if not installed locally and not present in any
|
||||||
|
known sync database.
|
||||||
|
|
||||||
*UseSyslog*::
|
*UseSyslog*::
|
||||||
Log action messages through syslog(). This will insert log entries into
|
Log action messages through syslog(). This will insert log entries into
|
||||||
``/var/log/messages'' or equivalent.
|
`{localstatedir}/log/messages` or equivalent.
|
||||||
|
|
||||||
*ShowSize*::
|
*ShowSize*::
|
||||||
Display the size of individual packages for '\--sync' and '\--query' modes.
|
Display the size of individual packages for '\--sync' and '\--query' modes.
|
||||||
|
|
||||||
*UseDelta*::
|
*UseDelta*::
|
||||||
Download delta files instead of complete packages if possible. Requires
|
Download delta files instead of complete packages if possible. Requires
|
||||||
the xdelta program to be installed.
|
the xdelta3 program to be installed.
|
||||||
|
|
||||||
*TotalDownload*::
|
*TotalDownload*::
|
||||||
When downloading, display the amount downloaded, download rate, ETA,
|
When downloading, display the amount downloaded, download rate, ETA,
|
||||||
and completed percentage of the entire download list list rather
|
and completed percentage of the entire download list rather
|
||||||
than the percent of each individual download target. The progress
|
than the percent of each individual download target. The progress
|
||||||
bar is still based solely on the current file download.
|
bar is still based solely on the current file download.
|
||||||
|
|
||||||
|
*CheckSpace*::
|
||||||
|
Performs an approximate check for adequate available disk space before
|
||||||
|
installing packages.
|
||||||
|
|
||||||
Repository Sections
|
Repository Sections
|
||||||
-------------------
|
-------------------
|
||||||
Each repository section defines a section name and at least one location where
|
Each repository section defines a section name and at least one location where
|
||||||
@@ -149,15 +186,17 @@ contain a file that lists the servers for that repository.
|
|||||||
# use this repository first
|
# use this repository first
|
||||||
Server = ftp://ftp.archlinux.org/core/os/arch
|
Server = ftp://ftp.archlinux.org/core/os/arch
|
||||||
# next use servers as defined in the mirrorlist below
|
# next use servers as defined in the mirrorlist below
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = {sysconfdir}/pacman.d/mirrorlist
|
||||||
--------
|
--------
|
||||||
|
|
||||||
During parsing, pacman will define the `$repo` variable to the name of the
|
During parsing, pacman will define the `$repo` variable to the name of the
|
||||||
current section. This is often utilized in files specified using the 'Include'
|
current section. This is often utilized in files specified using the 'Include'
|
||||||
directive so all repositories can use the same mirrorfile.
|
directive so all repositories can use the same mirrorfile. pacman also defines
|
||||||
|
the `$arch` variable to the value of `Architecture`, so the same mirrorfile can
|
||||||
|
even be used for different architectures.
|
||||||
|
|
||||||
--------
|
--------
|
||||||
Server = ftp://ftp.archlinux.org/$repo/os/arch
|
Server = ftp://ftp.archlinux.org/$repo/os/$arch
|
||||||
--------
|
--------
|
||||||
|
|
||||||
The order of repositories in the configuration files matters; repositories
|
The order of repositories in the configuration files matters; repositories
|
||||||
|
|||||||
@@ -6,19 +6,13 @@ repo-add(8)
|
|||||||
|
|
||||||
Name
|
Name
|
||||||
----
|
----
|
||||||
////
|
|
||||||
* If we use this below line, the manpage name comes out all weird. We also
|
|
||||||
* can't use two separate lines, which is quite annoying. *
|
|
||||||
repo-add, repo-remove - package database maintenance utilities
|
|
||||||
////
|
|
||||||
repo-add - package database maintenance utility
|
repo-add - package database maintenance utility
|
||||||
|
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
repo-add <path-to-db> [--force] <package> ...
|
repo-add [-d] [-f] [-q] <path-to-db> <package1> [<package2> ...]
|
||||||
|
|
||||||
repo-remove <path-to-db> <packagename> ...
|
repo-remove [-q] <path-to-db> <packagename> [<packagename2> ...]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@@ -36,13 +30,18 @@ on the command line.
|
|||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
*--force* (repo-add only)::
|
*-d, \--delta*::
|
||||||
Add a force entry to the sync database, which tells pacman to skip version
|
Automatically generate and add a delta file between the old entry and the
|
||||||
number comparison and update the package regardless. This flag can be
|
new one, if the old package file is found next to the new one.
|
||||||
specified in the middle of the command line, with any packages listed
|
|
||||||
before the flag being added as normal entries, and any specified after
|
|
||||||
being marked as force upgrades.
|
|
||||||
|
|
||||||
|
*-f, \--files*::
|
||||||
|
Tells repo-add also to create and include a list of the files in the
|
||||||
|
specified packages. This is useful for creating databases listing all files
|
||||||
|
in a given sync repository for tools that may use this information.
|
||||||
|
|
||||||
|
*-q, \--quiet*::
|
||||||
|
Force this program to keep quiet and run silent except for warning and
|
||||||
|
error messages.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
|||||||
98
doc/submitting-patches.txt
Normal file
98
doc/submitting-patches.txt
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
Pacman - Submitting Patches
|
||||||
|
===========================
|
||||||
|
|
||||||
|
This document is here mainly to make the job of those who review patches
|
||||||
|
easier and is more of a guideline and not a strict set of rules. However,
|
||||||
|
please try to follow as much as you can.
|
||||||
|
|
||||||
|
NOTE: Some of this is paraphrased from the kernel documentation's
|
||||||
|
"SubmittingPatches" file.
|
||||||
|
|
||||||
|
Getting the most recent source
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
Patches need to be submitted in GIT format and are best if they are against the
|
||||||
|
latest version of the code. There are several helpful tutorials for getting
|
||||||
|
started with GIT if you have not worked with it before.
|
||||||
|
|
||||||
|
* http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
|
||||||
|
* http://wiki.archlinux.org/index.php/Super_Quick_Git_Guide
|
||||||
|
|
||||||
|
The pacman code can be fetched using the following command:
|
||||||
|
|
||||||
|
git clone git://projects.archlinux.org/pacman.git
|
||||||
|
|
||||||
|
|
||||||
|
Creating your patch
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
* use `git commit -s` for creating a commit of your changes.
|
||||||
|
|
||||||
|
The -s allows you to credit yourself by adding a "Signed Off By" line to
|
||||||
|
indicate who has "signed" the patch - who has approved it.
|
||||||
|
|
||||||
|
Signed-off-by: Aaron Griffin <aaron@archlinux.org>
|
||||||
|
|
||||||
|
Please use your real name and email address. Feel free to "scramble" the
|
||||||
|
address if you're afraid of spam.
|
||||||
|
|
||||||
|
* Describe your patch.
|
||||||
|
|
||||||
|
It helps if you describe the overview and goals of the patch in the git commit
|
||||||
|
log. This allows others to see what you intended so as to compare it to what
|
||||||
|
was actually done, and allows better feedback.
|
||||||
|
|
||||||
|
* Use `git format-patch` to create patches.
|
||||||
|
|
||||||
|
Your commit message will be shown above the patch by default when you will use
|
||||||
|
`git-format-patch`, including the signoff line.
|
||||||
|
--
|
||||||
|
|
||||||
|
Submitting your patch
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
* Send the patch to the pacman-dev mailing list
|
||||||
|
|
||||||
|
The mailing list is the primary queue for review and acceptance. Here you
|
||||||
|
will get feedback, and let me know the details of your patch.
|
||||||
|
|
||||||
|
* No MIME, no links, no compression, no attachments. Just plain text.
|
||||||
|
|
||||||
|
Patches should be contained in the actual body of the email. There are many
|
||||||
|
reasons for this. First, it makes them easier to read with any mail reader,
|
||||||
|
it allows easier review "at a glance", and most importantly, it allows people
|
||||||
|
to comment on exact lines of the patch in reply emails.
|
||||||
|
|
||||||
|
`git send-email` allows you to send git formatted patches in plain text easily
|
||||||
|
and is the preferred method for submission to the mailing list.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
After you submit
|
||||||
|
----------------
|
||||||
|
|
||||||
|
--
|
||||||
|
* Don't get discouraged
|
||||||
|
|
||||||
|
Any feedback you get, positive or negative, has nothing to do with you. If a
|
||||||
|
patch is rejected, try taking the suggestions into account and re-submitting.
|
||||||
|
We welcome most submissions here, and some may take a bit longer to get
|
||||||
|
looked over than others. If you think your patch got lost in the shuffle,
|
||||||
|
send another email to the list in reply to the original asking if anyone has
|
||||||
|
looked at it yet.
|
||||||
|
|
||||||
|
* Respond to feedback
|
||||||
|
|
||||||
|
When you do get feedback, it usually merits a response, whether this be a
|
||||||
|
resubmit of the patch with corrections or a follow-up email asking for
|
||||||
|
clarifications. When neither of these occurs, don't expect your patch to see
|
||||||
|
further review. The all-volunteer staff don't have time to fix up patches that
|
||||||
|
aren't their own.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
/////
|
||||||
|
vim: set ts=2 sw=2 syntax=asciidoc et:
|
||||||
|
/////
|
||||||
@@ -4,13 +4,17 @@ Pacman - Translating
|
|||||||
This document is here to guide you in helping translate pacman messages,
|
This document is here to guide you in helping translate pacman messages,
|
||||||
libalpm messages, and the manpages for the entire pacman package.
|
libalpm messages, and the manpages for the entire pacman package.
|
||||||
|
|
||||||
A quick note- the gettext website is a very useful guide to read before
|
We are currently using http://www.transifex.net/[Transifex] as the translation
|
||||||
embarking on translation work, as it describes many of the commands in more
|
platform for pacman and libalpm. You will need to sign up for an account there
|
||||||
detail than I will here:
|
and then register with a translation team on the
|
||||||
http://www.gnu.org/software/gettext/manual/html_node/gettext.html[]
|
http://www.transifex.net/projects/p/archlinux-pacman/[pacman project page].
|
||||||
|
|
||||||
In addition, this site presents a small tutorial that I found useful:
|
NOTE: This may be old information due to our switch to Transifex, but the
|
||||||
http://oriya.sarovar.org/docs/gettext/[]
|
gettext website is a very useful guide to read before embarking on translation
|
||||||
|
work, as it describes many of the commands in more detail than I will here:
|
||||||
|
http://www.gnu.org/software/gettext/manual/html_node/gettext.html[]. In
|
||||||
|
addition, this site presents a small tutorial that I found useful:
|
||||||
|
http://oriya.sarovar.org/docs/gettext/[].
|
||||||
|
|
||||||
|
|
||||||
Translating Messages
|
Translating Messages
|
||||||
@@ -28,35 +32,46 @@ original message and the corresponding translation. These po files can then
|
|||||||
either be hand edited, or modified with a tool such as poedit, gtranslator or
|
either be hand edited, or modified with a tool such as poedit, gtranslator or
|
||||||
kbabel. Using a translation tool tends to make the job easier.
|
kbabel. Using a translation tool tends to make the job easier.
|
||||||
|
|
||||||
|
Please read up on Transifex usage using the
|
||||||
|
http://help.transifex.net/[Transifex Help] if you are not familiar.
|
||||||
|
|
||||||
|
Here is an example set of commands if you have a source code checkout and are
|
||||||
|
not worried about any local translations being overwritten. The .tx/ directory
|
||||||
|
is checked into the git repository so is preconfigured with the two project
|
||||||
|
resources (See `tx status` output for a quick overview).
|
||||||
|
|
||||||
|
tx pull -f
|
||||||
|
poedit po/<mylang>.po
|
||||||
|
poedit lib/libalpm/po/<mylang>.po
|
||||||
|
tx push -t -l <mylang>
|
||||||
|
|
||||||
|
Or to just push one of the two available resources:
|
||||||
|
|
||||||
|
tx push -r archlinux-pacman.pacman-pot -t -l fi
|
||||||
|
tx push -r archlinux-pacman.libalpm-pot -t -l fi
|
||||||
|
|
||||||
See the <<Notes,Notes>> section for additional hints on translating.
|
See the <<Notes,Notes>> section for additional hints on translating.
|
||||||
|
|
||||||
Pre-release Updates
|
Pre-release Updates
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
A week or two before each release, the codebase will go into a string freeze
|
A week or two before each release, the codebase will go into a string freeze
|
||||||
and an email will be sent by the 'translation lieutenant' to the
|
and an email will be sent to the mailto:pacman-dev@archlinux.org[pacman-dev]
|
||||||
mailto:pacman-dev@archlinux.org[pacman-dev] mailing list asking for
|
mailing list asking for translations. This email will have a prefix of
|
||||||
translations. This email will have a prefix of *[translation]* for anyone
|
*[translation]* for anyone looking to set up an email filter.
|
||||||
looking to set up an email filter.
|
|
||||||
|
|
||||||
At this time, the `.po` language files will be made available at a URL
|
At this time, the latest `.po` language files will be made available at the
|
||||||
specified in the email. Each language will have two files available (backend
|
Transifex project page. Each language will have two files available (backend
|
||||||
and frontend). Translators interested in helping are encouraged to send a
|
and frontend). Translators interested in helping are encouraged to use the
|
||||||
follow-up message to the mailing list stating exactly what they intend to
|
features of Transifex to let others know they are currently translating their
|
||||||
translate so efforts are not duplicated on the same language.
|
language.
|
||||||
|
|
||||||
Once a translator has completed the translation (*OR* realizes they do not have
|
Once a translator has completed the translation (*OR* realizes they do not have
|
||||||
time to finish), please email the `.po` files back to the list with a subject
|
time to finish), please upload your progress back to the Transifex site.
|
||||||
such as '[translation] Updated German translation'. At this point, the
|
|
||||||
'translation lieutenant' will gather the translations together for inclusion in
|
|
||||||
the upcoming release.
|
|
||||||
|
|
||||||
NOTE: Please email your translations back to the list as soon as possible- this
|
NOTE: Please upload your translations as soon as possible- this will give other
|
||||||
will give other speakers of your language time to review your translations and
|
speakers of your language time to review your translations and update them as
|
||||||
update them as necessary.
|
necessary.
|
||||||
|
|
||||||
For those familiar with GIT, you may wish to follow the procedure outlined
|
|
||||||
below as another alternative.
|
|
||||||
|
|
||||||
Incremental Updates
|
Incremental Updates
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
71
doc/vercmp.8.txt
Normal file
71
doc/vercmp.8.txt
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/////
|
||||||
|
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
||||||
|
/////
|
||||||
|
vercmp(8)
|
||||||
|
=========
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
vercmp - version comparsion utility
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
'vercmp' <version1> <version2>
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
'vercmp' is used to determine the relationship between two given version
|
||||||
|
numbers. It outputs values as follows:
|
||||||
|
|
||||||
|
* < 0 : if ver1 < ver2
|
||||||
|
* = 0 : if ver1 == ver2
|
||||||
|
* > 0 : if ver1 > ver2
|
||||||
|
|
||||||
|
Version comparsion operates as follows:
|
||||||
|
|
||||||
|
Alphanumeric:
|
||||||
|
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
|
||||||
|
Numeric:
|
||||||
|
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
|
||||||
|
|
||||||
|
Additionally, version strings can have an 'epoch' value defined that will
|
||||||
|
overrule any version comparison (unless the epoch values are equal). This is
|
||||||
|
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
|
||||||
|
greater than `1:3.6-1`.
|
||||||
|
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
*-h, \--help*::
|
||||||
|
Display syntax for the given operation. If no operation was supplied
|
||||||
|
then the general syntax is shown.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
$ vercmp 1 2
|
||||||
|
-1
|
||||||
|
|
||||||
|
$ vercmp 2 1
|
||||||
|
1
|
||||||
|
|
||||||
|
$ vercmp 2.0-1 1.7-6
|
||||||
|
1
|
||||||
|
|
||||||
|
$ vercmp 2.0 2.0-13
|
||||||
|
0
|
||||||
|
|
||||||
|
$ vercmp 4.34 1:001
|
||||||
|
-1
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
There is none.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
linkman:pacman[8], linkman:makepkg[8], linkman:libalpm[3]
|
||||||
|
|
||||||
|
include::footer.txt[]
|
||||||
@@ -13,6 +13,9 @@ edit = sed \
|
|||||||
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
|
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
|
||||||
-e 's|@PKGEXT[@]|$(PKGEXT)|g' \
|
-e 's|@PKGEXT[@]|$(PKGEXT)|g' \
|
||||||
-e 's|@SRCEXT[@]|$(SRCEXT)|g' \
|
-e 's|@SRCEXT[@]|$(SRCEXT)|g' \
|
||||||
|
-e 's|@STRIP_BINARIES[@]|$(STRIP_BINARIES)|g' \
|
||||||
|
-e 's|@STRIP_SHARED[@]|$(STRIP_SHARED)|g' \
|
||||||
|
-e 's|@STRIP_STATIC[@]|$(STRIP_STATIC)|g' \
|
||||||
-e 's|@CARCH[@]|$(CARCH)|g' \
|
-e 's|@CARCH[@]|$(CARCH)|g' \
|
||||||
-e 's|@CHOST[@]|$(CHOST)|g' \
|
-e 's|@CHOST[@]|$(CHOST)|g' \
|
||||||
-e 's|@ARCHSWITCH[@]|$(ARCHSWITCH)|g' \
|
-e 's|@ARCHSWITCH[@]|$(ARCHSWITCH)|g' \
|
||||||
@@ -20,9 +23,10 @@ edit = sed \
|
|||||||
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
|
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
|
||||||
|
|
||||||
$(dist_sysconf_DATA): Makefile
|
$(dist_sysconf_DATA): Makefile
|
||||||
rm -f $@ $@.tmp
|
@echo ' ' GEN $@;
|
||||||
$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
|
@rm -f $@ $@.tmp
|
||||||
mv $@.tmp $@
|
@$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
|
||||||
|
@mv $@.tmp $@
|
||||||
|
|
||||||
makepkg.conf: $(srcdir)/makepkg.conf.in
|
makepkg.conf: $(srcdir)/makepkg.conf.in
|
||||||
pacman.conf: $(srcdir)/pacman.conf.in
|
pacman.conf: $(srcdir)/pacman.conf.in
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
#
|
#
|
||||||
#-- The download utilities that makepkg should use to acquire sources
|
#-- The download utilities that makepkg should use to acquire sources
|
||||||
# Format: 'protocol::agent'
|
# Format: 'protocol::agent'
|
||||||
DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3'
|
DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
|
||||||
'http::/usr/bin/wget -c -t 3 --waitretry=3'
|
'http::/usr/bin/wget -c -t 3 --waitretry=3 -O %o %u'
|
||||||
'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate'
|
'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate -O %o %u'
|
||||||
'rsync::/usr/bin/rsync -z'
|
'rsync::/usr/bin/rsync -z %u %o'
|
||||||
'scp::/usr/bin/scp -C')
|
'scp::/usr/bin/scp -C %u %o')
|
||||||
|
|
||||||
# Other common tools:
|
# Other common tools:
|
||||||
# /usr/bin/snarf
|
# /usr/bin/snarf
|
||||||
@@ -26,11 +26,12 @@ DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3'
|
|||||||
CARCH="@CARCH@"
|
CARCH="@CARCH@"
|
||||||
CHOST="@CHOST@"
|
CHOST="@CHOST@"
|
||||||
|
|
||||||
#-- Exclusive: will only run on @CARCHFLAGS@
|
#-- Exclusive: will only run on @CARCH@
|
||||||
# -march (or -mcpu) builds exclusively for an architecture
|
# -march (or -mcpu) builds exclusively for an architecture
|
||||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||||
CFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
CFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
||||||
CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
||||||
|
#LDFLAGS=""
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
|
|
||||||
@@ -38,16 +39,16 @@ CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
|||||||
# BUILD ENVIRONMENT
|
# BUILD ENVIRONMENT
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache !xdelta)
|
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check)
|
||||||
# A negated environment option will do the opposite of the comments below.
|
# A negated environment option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- fakeroot: Allow building packages as a non-root user
|
#-- fakeroot: Allow building packages as a non-root user
|
||||||
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
||||||
#-- color: Colorize output messages
|
#-- color: Colorize output messages
|
||||||
#-- ccache: Use ccache to cache compilation
|
#-- ccache: Use ccache to cache compilation
|
||||||
#-- xdelta: Generate delta patch from previous to current package
|
#-- check: Run the check() function if present in the PKGBUILD
|
||||||
#
|
#
|
||||||
BUILDENV=(fakeroot !distcc color !ccache !xdelta)
|
BUILDENV=(fakeroot !distcc color !ccache check)
|
||||||
#
|
#
|
||||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
||||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
||||||
@@ -58,20 +59,32 @@ BUILDENV=(fakeroot !distcc color !ccache !xdelta)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip !docs libtool emptydirs)
|
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
#-- docs: Save doc and info directories
|
#-- docs: Save doc directories specified by DOC_DIRS
|
||||||
#-- libtool: Leave libtool (.la) files in packages
|
#-- libtool: Leave libtool (.la) files in packages
|
||||||
#-- emptydirs: Leave empty directories in packages
|
#-- emptydirs: Leave empty directories in packages
|
||||||
|
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||||
|
#-- purge: Remove files specified by PURGE_TARGETS
|
||||||
#
|
#
|
||||||
OPTIONS=(strip !docs libtool emptydirs)
|
OPTIONS=(strip docs libtool emptydirs zipman purge)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
#-- Info and doc directories to remove (if option set correctly above)
|
#-- Options to be used when stripping binaries. See `man strip' for details.
|
||||||
DOC_DIRS=(usr/{,share/}{info,doc,gtk-doc} opt/*/{info,doc,gtk-doc})
|
STRIP_BINARIES="@STRIP_BINARIES@"
|
||||||
|
#-- Options to be used when stripping shared libraries. See `man strip' for details.
|
||||||
|
STRIP_SHARED="@STRIP_SHARED@"
|
||||||
|
#-- Options to be used when stripping static libraries. See `man strip' for details.
|
||||||
|
STRIP_STATIC="@STRIP_STATIC@"
|
||||||
|
#-- Manual (man and info) directories to compress (if zipman is specified)
|
||||||
|
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
|
||||||
|
#-- Doc directories to remove (if !docs is specified)
|
||||||
|
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
||||||
|
#-- Files to be removed from all packages (if purge is specified)
|
||||||
|
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# PACKAGE OUTPUT
|
# PACKAGE OUTPUT
|
||||||
@@ -83,22 +96,19 @@ DOC_DIRS=(usr/{,share/}{info,doc,gtk-doc} opt/*/{info,doc,gtk-doc})
|
|||||||
#PKGDEST=/home/packages
|
#PKGDEST=/home/packages
|
||||||
#-- Source cache: specify a fixed directory where source files will be cached
|
#-- Source cache: specify a fixed directory where source files will be cached
|
||||||
#SRCDEST=/home/sources
|
#SRCDEST=/home/sources
|
||||||
#-- Source root: specify location where PKGBUILDs are located for '--builddeps'
|
#-- Source packages: specify a fixed directory where all src packages will be placed
|
||||||
#SRCROOT=/home/pkgbuilds
|
#SRCPKGDEST=/home/srcpackages
|
||||||
#-- Packager: name/email of the person or organization building packages
|
#-- Packager: name/email of the person or organization building packages
|
||||||
#PACKAGER="John Doe <john@doe.com>"
|
#PACKAGER="John Doe <john@doe.com>"
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# BUILDSCRIPT/EXTENSION DEFAULTS
|
# EXTENSION DEFAULTS
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# WARNING: Do NOT modify these variables unless you know what you are
|
# WARNING: Do NOT modify these variables unless you know what you are
|
||||||
# doing.
|
# doing.
|
||||||
#
|
#
|
||||||
BUILDSCRIPT='PKGBUILD'
|
|
||||||
PKGEXT='@PKGEXT@'
|
PKGEXT='@PKGEXT@'
|
||||||
SRCEXT='@SRCEXT@'
|
SRCEXT='@SRCEXT@'
|
||||||
DB_COMPRESSION='gz'
|
|
||||||
DB_CHECKSUMS=(md5)
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=2 sw=2 et:
|
# vim: set ft=sh ts=2 sw=2 et:
|
||||||
|
|||||||
@@ -14,7 +14,26 @@
|
|||||||
#CacheDir = @localstatedir@/cache/pacman/pkg/
|
#CacheDir = @localstatedir@/cache/pacman/pkg/
|
||||||
#LogFile = @localstatedir@/log/pacman.log
|
#LogFile = @localstatedir@/log/pacman.log
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
|
# If upgrades are available for these packages they will be asked for first
|
||||||
|
SyncFirst = pacman
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
|
#CleanMethod = KeepInstalled
|
||||||
|
Architecture = auto
|
||||||
|
|
||||||
|
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||||
|
#IgnorePkg =
|
||||||
|
#IgnoreGroup =
|
||||||
|
|
||||||
|
#NoUpgrade =
|
||||||
|
#NoExtract =
|
||||||
|
|
||||||
|
# Misc options (all disabled by default)
|
||||||
|
#UseSyslog
|
||||||
|
#ShowSize
|
||||||
|
#UseDelta
|
||||||
|
#TotalDownload
|
||||||
|
#CheckSpace
|
||||||
|
|
||||||
#
|
#
|
||||||
# REPOSITORIES
|
# REPOSITORIES
|
||||||
@@ -24,6 +43,7 @@ HoldPkg = pacman glibc
|
|||||||
# - repositories listed first will take precedence when packages
|
# - repositories listed first will take precedence when packages
|
||||||
# have identical names, regardless of version number
|
# have identical names, regardless of version number
|
||||||
# - URLs will have $repo replaced by the name of the current repo
|
# - URLs will have $repo replaced by the name of the current repo
|
||||||
|
# - URLs will have $arch replaced by the name of the architecture
|
||||||
#
|
#
|
||||||
# Repository entries are of the format:
|
# Repository entries are of the format:
|
||||||
# [repo-name]
|
# [repo-name]
|
||||||
@@ -39,7 +59,7 @@ HoldPkg = pacman glibc
|
|||||||
# servers immediately after the header and they will be used before the
|
# servers immediately after the header and they will be used before the
|
||||||
# default mirrors.
|
# default mirrors.
|
||||||
#[core]
|
#[core]
|
||||||
#Server = ftp://ftp.example.com/foobar/$repo/os/i686/
|
#Server = ftp://ftp.example.com/foobar/$repo/os/$arch/
|
||||||
# The file referenced here should contain a list of 'Server = ' lines.
|
# The file referenced here should contain a list of 'Server = ' lines.
|
||||||
#Include = @sysconfdir@/pacman.d/mirrorlist
|
#Include = @sysconfdir@/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
|||||||
181
install-sh
181
install-sh
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
|
|
||||||
scriptversion=2006-10-14.15
|
scriptversion=2010-02-06.18; # UTC
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||||
@@ -48,7 +48,7 @@ IFS=" "" $nl"
|
|||||||
# set DOITPROG to echo to test this script
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
doit="${DOITPROG-}"
|
doit=${DOITPROG-}
|
||||||
if test -z "$doit"; then
|
if test -z "$doit"; then
|
||||||
doit_exec=exec
|
doit_exec=exec
|
||||||
else
|
else
|
||||||
@@ -58,34 +58,49 @@ fi
|
|||||||
# Put in absolute file names if you don't have them in your path;
|
# Put in absolute file names if you don't have them in your path;
|
||||||
# or use environment vars.
|
# or use environment vars.
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
chgrpprog=${CHGRPPROG-chgrp}
|
||||||
cpprog="${CPPROG-cp}"
|
chmodprog=${CHMODPROG-chmod}
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
chownprog=${CHOWNPROG-chown}
|
||||||
chownprog="${CHOWNPROG-chown}"
|
cmpprog=${CMPPROG-cmp}
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
cpprog=${CPPROG-cp}
|
||||||
stripprog="${STRIPPROG-strip}"
|
mkdirprog=${MKDIRPROG-mkdir}
|
||||||
rmprog="${RMPROG-rm}"
|
mvprog=${MVPROG-mv}
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
rmprog=${RMPROG-rm}
|
||||||
|
stripprog=${STRIPPROG-strip}
|
||||||
|
|
||||||
|
posix_glob='?'
|
||||||
|
initialize_posix_glob='
|
||||||
|
test "$posix_glob" != "?" || {
|
||||||
|
if (set -f) 2>/dev/null; then
|
||||||
posix_glob=
|
posix_glob=
|
||||||
|
else
|
||||||
|
posix_glob=:
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
'
|
||||||
|
|
||||||
posix_mkdir=
|
posix_mkdir=
|
||||||
|
|
||||||
# Desired mode of installed file.
|
# Desired mode of installed file.
|
||||||
mode=0755
|
mode=0755
|
||||||
|
|
||||||
|
chgrpcmd=
|
||||||
chmodcmd=$chmodprog
|
chmodcmd=$chmodprog
|
||||||
chowncmd=
|
chowncmd=
|
||||||
chgrpcmd=
|
mvcmd=$mvprog
|
||||||
stripcmd=
|
|
||||||
rmcmd="$rmprog -f"
|
rmcmd="$rmprog -f"
|
||||||
mvcmd="$mvprog"
|
stripcmd=
|
||||||
|
|
||||||
src=
|
src=
|
||||||
dst=
|
dst=
|
||||||
dir_arg=
|
dir_arg=
|
||||||
dstarg=
|
dst_arg=
|
||||||
|
|
||||||
|
copy_on_change=false
|
||||||
no_target_directory=
|
no_target_directory=
|
||||||
|
|
||||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
usage="\
|
||||||
|
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||||
or: $0 [OPTION]... -d DIRECTORIES...
|
or: $0 [OPTION]... -d DIRECTORIES...
|
||||||
@@ -95,7 +110,11 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
|||||||
In the 4th, create DIRECTORIES.
|
In the 4th, create DIRECTORIES.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
--help display this help and exit.
|
||||||
|
--version display version info and exit.
|
||||||
|
|
||||||
-c (ignored)
|
-c (ignored)
|
||||||
|
-C install only if different (preserve the last data modification time)
|
||||||
-d create directories instead of installing files.
|
-d create directories instead of installing files.
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
-g GROUP $chgrpprog installed files to GROUP.
|
||||||
-m MODE $chmodprog installed files to MODE.
|
-m MODE $chmodprog installed files to MODE.
|
||||||
@@ -103,57 +122,43 @@ Options:
|
|||||||
-s $stripprog installed files.
|
-s $stripprog installed files.
|
||||||
-t DIRECTORY install into DIRECTORY.
|
-t DIRECTORY install into DIRECTORY.
|
||||||
-T report an error if DSTFILE is a directory.
|
-T report an error if DSTFILE is a directory.
|
||||||
--help display this help and exit.
|
|
||||||
--version display version info and exit.
|
|
||||||
|
|
||||||
Environment variables override the default commands:
|
Environment variables override the default commands:
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||||
|
RMPROG STRIPPROG
|
||||||
"
|
"
|
||||||
|
|
||||||
while test $# -ne 0; do
|
while test $# -ne 0; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c) shift
|
-c) ;;
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
-C) copy_on_change=true;;
|
||||||
shift
|
|
||||||
continue;;
|
-d) dir_arg=true;;
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--help) echo "$usage"; exit $?;;
|
--help) echo "$usage"; exit $?;;
|
||||||
|
|
||||||
-m) mode=$2
|
-m) mode=$2
|
||||||
shift
|
|
||||||
shift
|
|
||||||
case $mode in
|
case $mode in
|
||||||
*' '* | *' '* | *'
|
*' '* | *' '* | *'
|
||||||
'* | *'*'* | *'?'* | *'['*)
|
'* | *'*'* | *'?'* | *'['*)
|
||||||
echo "$0: invalid mode: $mode" >&2
|
echo "$0: invalid mode: $mode" >&2
|
||||||
exit 1;;
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
continue;;
|
shift;;
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
-o) chowncmd="$chownprog $2"
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog
|
-s) stripcmd=$stripprog;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t) dstarg=$2
|
-t) dst_arg=$2
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-T) no_target_directory=true
|
-T) no_target_directory=true;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit $?;;
|
--version) echo "$0 $scriptversion"; exit $?;;
|
||||||
|
|
||||||
@@ -165,21 +170,22 @@ while test $# -ne 0; do
|
|||||||
|
|
||||||
*) break;;
|
*) break;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
|
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||||
# When -d is used, all remaining arguments are directories to create.
|
# When -d is used, all remaining arguments are directories to create.
|
||||||
# When -t is used, the destination is already specified.
|
# When -t is used, the destination is already specified.
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||||
for arg
|
for arg
|
||||||
do
|
do
|
||||||
if test -n "$dstarg"; then
|
if test -n "$dst_arg"; then
|
||||||
# $@ is not empty: it contains at least $arg.
|
# $@ is not empty: it contains at least $arg.
|
||||||
set fnord "$@" "$dstarg"
|
set fnord "$@" "$dst_arg"
|
||||||
shift # fnord
|
shift # fnord
|
||||||
fi
|
fi
|
||||||
shift # arg
|
shift # arg
|
||||||
dstarg=$arg
|
dst_arg=$arg
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -194,7 +200,11 @@ if test $# -eq 0; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dir_arg"; then
|
if test -z "$dir_arg"; then
|
||||||
trap '(exit $?); exit' 1 2 13 15
|
do_exit='(exit $ret); exit $ret'
|
||||||
|
trap "ret=129; $do_exit" 1
|
||||||
|
trap "ret=130; $do_exit" 2
|
||||||
|
trap "ret=141; $do_exit" 13
|
||||||
|
trap "ret=143; $do_exit" 15
|
||||||
|
|
||||||
# Set umask so as not to create temps with too-generous modes.
|
# Set umask so as not to create temps with too-generous modes.
|
||||||
# However, 'strip' requires both read and write access to temps.
|
# However, 'strip' requires both read and write access to temps.
|
||||||
@@ -242,12 +252,12 @@ do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dstarg"; then
|
if test -z "$dst_arg"; then
|
||||||
echo "$0: no destination specified." >&2
|
echo "$0: no destination specified." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dst=$dstarg
|
dst=$dst_arg
|
||||||
# Protect names starting with `-'.
|
# Protect names starting with `-'.
|
||||||
case $dst in
|
case $dst in
|
||||||
-*) dst=./$dst;;
|
-*) dst=./$dst;;
|
||||||
@@ -257,7 +267,7 @@ do
|
|||||||
# if double slashes aren't ignored.
|
# if double slashes aren't ignored.
|
||||||
if test -d "$dst"; then
|
if test -d "$dst"; then
|
||||||
if test -n "$no_target_directory"; then
|
if test -n "$no_target_directory"; then
|
||||||
echo "$0: $dstarg: Is a directory" >&2
|
echo "$0: $dst_arg: Is a directory" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
dstdir=$dst
|
dstdir=$dst
|
||||||
@@ -378,26 +388,19 @@ do
|
|||||||
# directory the slow way, step by step, checking for races as we go.
|
# directory the slow way, step by step, checking for races as we go.
|
||||||
|
|
||||||
case $dstdir in
|
case $dstdir in
|
||||||
/*) prefix=/ ;;
|
/*) prefix='/';;
|
||||||
-*) prefix=./ ;;
|
-*) prefix='./';;
|
||||||
*) prefix= ;;
|
*) prefix='';;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $posix_glob in
|
eval "$initialize_posix_glob"
|
||||||
'')
|
|
||||||
if (set -f) 2>/dev/null; then
|
|
||||||
posix_glob=true
|
|
||||||
else
|
|
||||||
posix_glob=false
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
oIFS=$IFS
|
oIFS=$IFS
|
||||||
IFS=/
|
IFS=/
|
||||||
$posix_glob && set -f
|
$posix_glob set -f
|
||||||
set fnord $dstdir
|
set fnord $dstdir
|
||||||
shift
|
shift
|
||||||
$posix_glob && set +f
|
$posix_glob set +f
|
||||||
IFS=$oIFS
|
IFS=$oIFS
|
||||||
|
|
||||||
prefixes=
|
prefixes=
|
||||||
@@ -459,41 +462,54 @@ do
|
|||||||
# ignore errors from any of these, just make sure not to ignore
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||||
#
|
#
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||||
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||||
|
|
||||||
|
# If -C, don't bother to copy if it wouldn't change the file.
|
||||||
|
if $copy_on_change &&
|
||||||
|
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||||
|
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||||
|
|
||||||
|
eval "$initialize_posix_glob" &&
|
||||||
|
$posix_glob set -f &&
|
||||||
|
set X $old && old=:$2:$4:$5:$6 &&
|
||||||
|
set X $new && new=:$2:$4:$5:$6 &&
|
||||||
|
$posix_glob set +f &&
|
||||||
|
|
||||||
|
test "$old" = "$new" &&
|
||||||
|
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
rm -f "$dsttmp"
|
||||||
|
else
|
||||||
|
# Rename the file to the real destination.
|
||||||
|
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|
|
||||||
|| {
|
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
# The rename failed, perhaps because mv can't rename something else
|
||||||
# to itself, or perhaps because mv is so ancient that it does not
|
# to itself, or perhaps because mv is so ancient that it does not
|
||||||
# support -f.
|
# support -f.
|
||||||
|
{
|
||||||
# Now remove or move aside any old file at destination location.
|
# Now remove or move aside any old file at destination location.
|
||||||
# We try this two ways since rm can't unlink itself on some
|
# We try this two ways since rm can't unlink itself on some
|
||||||
# systems and the destination file might be busy for other
|
# systems and the destination file might be busy for other
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
# reasons. In this case, the final cleanup might fail but the new
|
||||||
# file should still install successfully.
|
# file should still install successfully.
|
||||||
{
|
{
|
||||||
if test -f "$dst"; then
|
test ! -f "$dst" ||
|
||||||
$doit $rmcmd -f "$dst" 2>/dev/null \
|
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||||
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
|
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||||
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||||
|| {
|
} ||
|
||||||
echo "$0: cannot unlink or rename $dst" >&2
|
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||||
(exit 1); exit 1
|
(exit 1); exit 1
|
||||||
}
|
}
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
} &&
|
} &&
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
# Now rename the file to the real destination.
|
||||||
$doit $mvcmd "$dsttmp" "$dst"
|
$doit $mvcmd "$dsttmp" "$dst"
|
||||||
}
|
}
|
||||||
} || exit 1
|
fi || exit 1
|
||||||
|
|
||||||
trap '' 0
|
trap '' 0
|
||||||
fi
|
fi
|
||||||
@@ -503,5 +519,6 @@ done
|
|||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-end: "$"
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|||||||
@@ -10,8 +10,12 @@ DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
|
|||||||
AM_CFLAGS = -pedantic -D_GNU_SOURCE
|
AM_CFLAGS = -pedantic -D_GNU_SOURCE
|
||||||
|
|
||||||
if ENABLE_VISIBILITY_CC
|
if ENABLE_VISIBILITY_CC
|
||||||
|
if DARWIN
|
||||||
|
AM_CFLAGS += -fvisibility=hidden
|
||||||
|
else
|
||||||
AM_CFLAGS += -fvisibility=internal
|
AM_CFLAGS += -fvisibility=internal
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
if ENABLE_GNU89_INLINE_CC
|
if ENABLE_GNU89_INLINE_CC
|
||||||
AM_CFLAGS += -fgnu89-inline
|
AM_CFLAGS += -fgnu89-inline
|
||||||
endif
|
endif
|
||||||
@@ -21,24 +25,34 @@ libalpm_la_SOURCES = \
|
|||||||
alpm.h alpm.c \
|
alpm.h alpm.c \
|
||||||
alpm_list.h alpm_list.c \
|
alpm_list.h alpm_list.c \
|
||||||
backup.h backup.c \
|
backup.h backup.c \
|
||||||
be_files.c \
|
be_local.c \
|
||||||
cache.h cache.c \
|
be_package.c \
|
||||||
|
be_sync.c \
|
||||||
conflict.h conflict.c \
|
conflict.h conflict.c \
|
||||||
db.h db.c \
|
db.h db.c \
|
||||||
delta.h delta.c \
|
delta.h delta.c \
|
||||||
deps.h deps.c \
|
deps.h deps.c \
|
||||||
error.h error.c \
|
diskspace.h diskspace.c \
|
||||||
|
dload.h dload.c \
|
||||||
|
error.c \
|
||||||
|
graph.h \
|
||||||
group.h group.c \
|
group.h group.c \
|
||||||
handle.h handle.c \
|
handle.h handle.c \
|
||||||
log.h log.c \
|
log.h log.c \
|
||||||
md5.h md5.c \
|
|
||||||
package.h package.c \
|
package.h package.c \
|
||||||
|
pkghash.h pkghash.c \
|
||||||
remove.h remove.c \
|
remove.h remove.c \
|
||||||
server.h server.c \
|
|
||||||
sync.h sync.c \
|
sync.h sync.c \
|
||||||
trans.h trans.c \
|
trans.h trans.c \
|
||||||
util.h util.c
|
util.h util.c \
|
||||||
|
version.c
|
||||||
|
|
||||||
|
if !HAVE_LIBSSL
|
||||||
|
libalpm_la_SOURCES += \
|
||||||
|
md5.h md5.c
|
||||||
|
endif
|
||||||
|
|
||||||
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
|
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
|
||||||
|
libalpm_la_LIBADD = $(LTLIBINTL)
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* add.c
|
* add.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,6 +28,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <inttypes.h> /* int64_t */
|
||||||
|
#include <stdint.h> /* intmax_t */
|
||||||
|
|
||||||
/* libarchive */
|
/* libarchive */
|
||||||
#include <archive.h>
|
#include <archive.h>
|
||||||
@@ -37,8 +40,6 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "error.h"
|
|
||||||
#include "cache.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "backup.h"
|
#include "backup.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
@@ -48,240 +49,91 @@
|
|||||||
#include "remove.h"
|
#include "remove.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
|
||||||
int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
|
/** Add a package to the transaction.
|
||||||
|
* @param pkg the package to add
|
||||||
|
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||||
|
*/
|
||||||
|
int SYMEXPORT alpm_add_pkg(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
pmpkg_t *pkg = NULL;
|
|
||||||
const char *pkgname, *pkgver;
|
const char *pkgname, *pkgver;
|
||||||
alpm_list_t *i;
|
pmtrans_t *trans;
|
||||||
|
pmdb_t *db_local;
|
||||||
|
pmpkg_t *local;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
trans = handle->trans;
|
||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
|
||||||
ASSERT(name != NULL && strlen(name) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||||
|
db_local = handle->db_local;
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "loading target '%s'\n", name);
|
|
||||||
|
|
||||||
if(alpm_pkg_load(name, 1, &pkg) != 0) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
pkgname = alpm_pkg_get_name(pkg);
|
pkgname = alpm_pkg_get_name(pkg);
|
||||||
pkgver = alpm_pkg_get_version(pkg);
|
pkgver = alpm_pkg_get_version(pkg);
|
||||||
|
|
||||||
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
|
_alpm_log(PM_LOG_DEBUG, "adding package '%s'\n", pkgname);
|
||||||
/* only install this package if it is not already installed */
|
|
||||||
if(_alpm_db_get_pkgfromcache(db, pkgname)) {
|
if(_alpm_pkg_find(trans->add, pkgname)) {
|
||||||
pm_errno = PM_ERR_PKG_INSTALLED;
|
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if an older version of said package is already in transaction
|
local = _alpm_db_get_pkgfromcache(db_local, pkgname);
|
||||||
* packages. if so, replace it in the list */
|
if(local) {
|
||||||
for(i = trans->packages; i; i = i->next) {
|
const char *localpkgname = alpm_pkg_get_name(local);
|
||||||
pmpkg_t *pkg = i->data;
|
const char *localpkgver = alpm_pkg_get_version(local);
|
||||||
if(strcmp(pkg->name, pkgname) == 0) {
|
int cmp = _alpm_pkg_compare_versions(pkg, local);
|
||||||
if(_alpm_versioncmp(pkg->version, pkgver) < 0) {
|
|
||||||
pmpkg_t *newpkg;
|
if(cmp == 0) {
|
||||||
_alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list\n"),
|
if(trans->flags & PM_TRANS_FLAG_NEEDED) {
|
||||||
pkg->name, pkg->version, pkgver);
|
/* with the NEEDED flag, packages up to date are not reinstalled */
|
||||||
if((newpkg = _alpm_pkg_load(name, 1)) == NULL) {
|
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
|
||||||
/* pm_errno is already set by pkg_load() */
|
localpkgname, localpkgver);
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_pkg_free(i->data);
|
|
||||||
i->data = newpkg;
|
|
||||||
} else {
|
|
||||||
_alpm_log(PM_LOG_WARNING, _("newer version %s-%s is in the target list -- skipping\n"),
|
|
||||||
pkg->name, pkg->version);
|
|
||||||
}
|
|
||||||
return(0);
|
return(0);
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
|
||||||
|
localpkgname, localpkgver);
|
||||||
}
|
}
|
||||||
|
} else if(cmp < 0) {
|
||||||
|
/* local version is newer */
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"),
|
||||||
|
localpkgname, localpkgver, pkgver);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
|
|
||||||
pkg->reason = PM_PKG_REASON_DEPEND;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the package to the transaction */
|
/* add the package to the transaction */
|
||||||
trans->packages = alpm_list_add(trans->packages, pkg);
|
pkg->reason = PM_PKG_REASON_EXPLICIT;
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n",
|
||||||
return(0);
|
pkgname, pkgver);
|
||||||
|
trans->add = alpm_list_add(trans->add, pkg);
|
||||||
error:
|
|
||||||
_alpm_pkg_free(pkg);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* This is still messy. We have a lot of compare functions, and we should
|
|
||||||
* try to consolidate them as much as we can (between add and sync) */
|
|
||||||
/*static int deppkg_cmp(const void *p1, const void *p2)
|
|
||||||
{
|
|
||||||
return(strcmp(((pmdepmissing_t *)p1)->target,
|
|
||||||
((pmdepmissing_t *)p2)->target));
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
|
||||||
{
|
|
||||||
alpm_list_t *lp = NULL;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
|
||||||
|
|
||||||
/* Check dependencies
|
|
||||||
*/
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
|
|
||||||
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
|
|
||||||
|
|
||||||
/* look for unsatisfied dependencies */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies\n");
|
|
||||||
lp = alpm_checkdeps(db, trans->type == PM_TRANS_TYPE_UPGRADE, NULL, trans->packages);
|
|
||||||
if(lp != NULL) {
|
|
||||||
if(data) {
|
|
||||||
*data = lp;
|
|
||||||
} else {
|
|
||||||
FREELIST(lp);
|
|
||||||
}
|
|
||||||
RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* no unsatisfied deps, so look for conflicts */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "looking for conflicts\n");
|
|
||||||
alpm_list_t *inner = _alpm_innerconflicts(trans->packages);
|
|
||||||
alpm_list_t *outer = _alpm_outerconflicts(db, trans->packages);
|
|
||||||
lp = alpm_list_join(inner, outer);
|
|
||||||
|
|
||||||
/* TODO : factorize the conflict resolving code from sync.c to use it here (FS#3492) */
|
|
||||||
|
|
||||||
if(lp != NULL) {
|
|
||||||
if(data) {
|
|
||||||
*data = lp;
|
|
||||||
} else {
|
|
||||||
FREELIST(lp);
|
|
||||||
}
|
|
||||||
if(inner) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("conflicting packages were found in the target list\n"));
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("you cannot install two conflicting packages at the same time\n"));
|
|
||||||
}
|
|
||||||
if(outer) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("replacing packages with -A and -U is not supported yet\n"));
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("you can replace packages manually using -Rd and -U\n"));
|
|
||||||
}
|
|
||||||
RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* re-order w.r.t. dependencies */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies\n");
|
|
||||||
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
|
|
||||||
/* free the old alltargs */
|
|
||||||
alpm_list_free(trans->packages);
|
|
||||||
trans->packages = lp;
|
|
||||||
|
|
||||||
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for file conflicts */
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
|
|
||||||
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "looking for file conflicts\n");
|
|
||||||
lp = _alpm_db_find_fileconflicts(db, trans, handle->root);
|
|
||||||
if(lp != NULL) {
|
|
||||||
if(data) {
|
|
||||||
*data = lp;
|
|
||||||
} else {
|
|
||||||
FREELIST(lp);
|
|
||||||
}
|
|
||||||
RET_ERR(PM_ERR_FILE_CONFLICTS, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t *newpkg, pmtrans_t *trans, pmdb_t *db) {
|
static int perform_extraction(struct archive *archive,
|
||||||
/* this is kinda odd. If the old package exists, at this point we make a
|
struct archive_entry *entry, const char *filename, const char *origname)
|
||||||
* NEW transaction, unrelated to handle->trans, and instantiate a "remove"
|
{
|
||||||
* with the type PM_TRANS_TYPE_REMOVEUPGRADE. TODO: kill this weird
|
int ret;
|
||||||
* behavior. */
|
const int archive_flags = ARCHIVE_EXTRACT_OWNER |
|
||||||
pmtrans_t *tr = _alpm_trans_new();
|
ARCHIVE_EXTRACT_PERM |
|
||||||
_alpm_log(PM_LOG_DEBUG, "removing old package first (%s-%s)\n",
|
ARCHIVE_EXTRACT_TIME;
|
||||||
oldpkg->name, oldpkg->version);
|
|
||||||
|
|
||||||
if(!tr) {
|
archive_entry_set_pathname(entry, filename);
|
||||||
RET_ERR(PM_ERR_TRANS_ABORT, -1);
|
|
||||||
|
ret = archive_read_extract(archive, entry, archive_flags);
|
||||||
|
if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) {
|
||||||
|
/* operation succeeded but a "non-critical" error was encountered */
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("warning given when extracting %s (%s)\n"),
|
||||||
|
origname, archive_error_string(archive));
|
||||||
|
} else if(ret != ARCHIVE_OK) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
||||||
|
origname, archive_error_string(archive));
|
||||||
|
alpm_logaction("error: could not extract %s (%s)\n",
|
||||||
|
origname, archive_error_string(archive));
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVEUPGRADE, trans->flags,
|
|
||||||
NULL, NULL, NULL) == -1) {
|
|
||||||
_alpm_trans_free(tr);
|
|
||||||
tr = NULL;
|
|
||||||
RET_ERR(PM_ERR_TRANS_ABORT, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_alpm_remove_loadtarget(tr, db, newpkg->name) == -1) {
|
|
||||||
_alpm_trans_free(tr);
|
|
||||||
tr = NULL;
|
|
||||||
RET_ERR(PM_ERR_TRANS_ABORT, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy the remove skiplist over */
|
|
||||||
tr->skip_remove = alpm_list_strdup(trans->skip_remove);
|
|
||||||
const alpm_list_t *b;
|
|
||||||
|
|
||||||
/* Add files in the NEW backup array to the NoUpgrade array
|
|
||||||
* so this removal operation doesn't kill them */
|
|
||||||
alpm_list_t *old_noupgrade = alpm_list_strdup(handle->noupgrade);
|
|
||||||
/* old package backup list */
|
|
||||||
alpm_list_t *filelist = alpm_pkg_get_files(newpkg);
|
|
||||||
for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) {
|
|
||||||
char *backup = _alpm_backup_file(b->data);
|
|
||||||
/* safety check (fix the upgrade026 pactest) */
|
|
||||||
if(!alpm_list_find_str(filelist, backup)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n",
|
|
||||||
backup);
|
|
||||||
handle->noupgrade = alpm_list_add(handle->noupgrade,
|
|
||||||
backup);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: we could also add files in the OLD backup array, but this would
|
|
||||||
* change the backup handling behavior, and break several pactests, and we
|
|
||||||
* can't do this just before 3.1 release.
|
|
||||||
* The unlink_file function in remove.c would also need to be reviewed. */
|
|
||||||
#if 0
|
|
||||||
/* new package backup list */
|
|
||||||
for(b = alpm_pkg_get_backup(oldpkg); b; b = b->next) {
|
|
||||||
char *backup = _alpm_backup_file(b->data);
|
|
||||||
/* make sure we don't add duplicate entries */
|
|
||||||
if(!alpm_list_find_ptr(handle->noupgrade, backup)) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n",
|
|
||||||
backup);
|
|
||||||
handle->noupgrade = alpm_list_add(handle->noupgrade,
|
|
||||||
backup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int ret = _alpm_remove_commit(tr, db);
|
|
||||||
|
|
||||||
_alpm_trans_free(tr);
|
|
||||||
tr = NULL;
|
|
||||||
|
|
||||||
/* restore our "NoUpgrade" list to previous state */
|
|
||||||
FREELIST(handle->noupgrade);
|
|
||||||
handle->noupgrade = old_noupgrade;
|
|
||||||
|
|
||||||
if(ret == -1) {
|
|
||||||
RET_ERR(PM_ERR_TRANS_ABORT, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,14 +141,12 @@ static int extract_single_file(struct archive *archive,
|
|||||||
struct archive_entry *entry, pmpkg_t *newpkg, pmpkg_t *oldpkg,
|
struct archive_entry *entry, pmpkg_t *newpkg, pmpkg_t *oldpkg,
|
||||||
pmtrans_t *trans, pmdb_t *db)
|
pmtrans_t *trans, pmdb_t *db)
|
||||||
{
|
{
|
||||||
const char *entryname; /* the name of the file in the archive */
|
const char *entryname;
|
||||||
mode_t entrymode;
|
mode_t entrymode;
|
||||||
char filename[PATH_MAX]; /* the actual file we're extracting */
|
char filename[PATH_MAX]; /* the actual file we're extracting */
|
||||||
int needbackup = 0, notouch = 0;
|
int needbackup = 0, notouch = 0;
|
||||||
char *hash_orig = NULL;
|
char *hash_orig = NULL;
|
||||||
const int archive_flags = ARCHIVE_EXTRACT_OWNER |
|
char *entryname_orig = NULL;
|
||||||
ARCHIVE_EXTRACT_PERM |
|
|
||||||
ARCHIVE_EXTRACT_TIME;
|
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
entryname = archive_entry_pathname(entry);
|
entryname = archive_entry_pathname(entry);
|
||||||
@@ -306,14 +156,14 @@ static int extract_single_file(struct archive *archive,
|
|||||||
|
|
||||||
if(strcmp(entryname, ".INSTALL") == 0) {
|
if(strcmp(entryname, ".INSTALL") == 0) {
|
||||||
/* the install script goes inside the db */
|
/* the install script goes inside the db */
|
||||||
snprintf(filename, PATH_MAX, "%s/%s-%s/install", db->path,
|
snprintf(filename, PATH_MAX, "%s%s-%s/install",
|
||||||
newpkg->name, newpkg->version);
|
_alpm_db_path(db), newpkg->name, newpkg->version);
|
||||||
archive_entry_set_mode(entry, 0644);
|
archive_entry_set_perm(entry, 0644);
|
||||||
} else if(strcmp(entryname, ".CHANGELOG") == 0) {
|
} else if(strcmp(entryname, ".CHANGELOG") == 0) {
|
||||||
/* the changelog goes inside the db */
|
/* the changelog goes inside the db */
|
||||||
snprintf(filename, PATH_MAX, "%s/%s-%s/changelog", db->path,
|
snprintf(filename, PATH_MAX, "%s%s-%s/changelog",
|
||||||
newpkg->name, newpkg->version);
|
_alpm_db_path(db), newpkg->name, newpkg->version);
|
||||||
archive_entry_set_mode(entry, 0644);
|
archive_entry_set_perm(entry, 0644);
|
||||||
} else if(*entryname == '.') {
|
} else if(*entryname == '.') {
|
||||||
/* for now, ignore all files starting with '.' that haven't
|
/* for now, ignore all files starting with '.' that haven't
|
||||||
* already been handled (for future possibilities) */
|
* already been handled (for future possibilities) */
|
||||||
@@ -335,13 +185,6 @@ static int extract_single_file(struct archive *archive,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if a file is in the add skiplist we never extract it */
|
|
||||||
if(alpm_list_find_str(trans->skip_add, filename)) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_add, skipping extraction\n", entryname);
|
|
||||||
archive_read_data_skip(archive);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for file existence. This is one of the more crucial parts
|
/* Check for file existence. This is one of the more crucial parts
|
||||||
* to get 'right'. Here are the possibilities, with the filesystem
|
* to get 'right'. Here are the possibilities, with the filesystem
|
||||||
* on the left and the package on the top:
|
* on the left and the package on the top:
|
||||||
@@ -367,11 +210,12 @@ static int extract_single_file(struct archive *archive,
|
|||||||
if(_alpm_lstat(filename, &lsbuf) != 0 || stat(filename, &sbuf) != 0) {
|
if(_alpm_lstat(filename, &lsbuf) != 0 || stat(filename, &sbuf) != 0) {
|
||||||
/* cases 1,2,3: couldn't stat an existing file, skip all backup checks */
|
/* cases 1,2,3: couldn't stat an existing file, skip all backup checks */
|
||||||
} else {
|
} else {
|
||||||
if(S_ISDIR(lsbuf.st_mode) && S_ISDIR(entrymode)) {
|
if(S_ISDIR(lsbuf.st_mode)) {
|
||||||
|
if(S_ISDIR(entrymode)) {
|
||||||
/* case 12: existing dir, ignore it */
|
/* case 12: existing dir, ignore it */
|
||||||
if(lsbuf.st_mode != entrymode) {
|
if(lsbuf.st_mode != entrymode) {
|
||||||
/* if filesystem perms are different than pkg perms, warn user */
|
/* if filesystem perms are different than pkg perms, warn user */
|
||||||
int mask = 07777;
|
mode_t mask = 07777;
|
||||||
_alpm_log(PM_LOG_WARNING, _("directory permissions differ on %s\n"
|
_alpm_log(PM_LOG_WARNING, _("directory permissions differ on %s\n"
|
||||||
"filesystem: %o package: %o\n"), entryname, lsbuf.st_mode & mask,
|
"filesystem: %o package: %o\n"), entryname, lsbuf.st_mode & mask,
|
||||||
entrymode & mask);
|
entrymode & mask);
|
||||||
@@ -383,12 +227,13 @@ static int extract_single_file(struct archive *archive,
|
|||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(0);
|
return(0);
|
||||||
} else if(S_ISDIR(lsbuf.st_mode) && S_ISLNK(entrymode)) {
|
} else {
|
||||||
/* case 11: existing dir, symlink in package, ignore it */
|
/* case 10/11: trying to overwrite dir with file/symlink, don't allow it */
|
||||||
_alpm_log(PM_LOG_DEBUG, "extract: skipping symlink extraction of %s\n",
|
_alpm_log(PM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
|
||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(0);
|
return(1);
|
||||||
|
}
|
||||||
} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(entrymode)) {
|
} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(entrymode)) {
|
||||||
/* case 9: existing symlink, dir in package */
|
/* case 9: existing symlink, dir in package */
|
||||||
if(S_ISDIR(sbuf.st_mode)) {
|
if(S_ISDIR(sbuf.st_mode)) {
|
||||||
@@ -404,12 +249,6 @@ static int extract_single_file(struct archive *archive,
|
|||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
} else if(S_ISDIR(lsbuf.st_mode) && S_ISREG(entrymode)) {
|
|
||||||
/* case 10: trying to overwrite dir tree with file, don't allow it */
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
|
|
||||||
entryname);
|
|
||||||
archive_read_data_skip(archive);
|
|
||||||
return(1);
|
|
||||||
} else if(S_ISREG(lsbuf.st_mode) && S_ISDIR(entrymode)) {
|
} else if(S_ISREG(lsbuf.st_mode) && S_ISDIR(entrymode)) {
|
||||||
/* case 6: trying to overwrite file with dir */
|
/* case 6: trying to overwrite file with dir */
|
||||||
_alpm_log(PM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
|
_alpm_log(PM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
|
||||||
@@ -436,7 +275,7 @@ static int extract_single_file(struct archive *archive,
|
|||||||
|
|
||||||
/* if we force hash_orig to be non-NULL retroactive backup works */
|
/* if we force hash_orig to be non-NULL retroactive backup works */
|
||||||
if(needbackup && !hash_orig) {
|
if(needbackup && !hash_orig) {
|
||||||
hash_orig = strdup("");
|
STRDUP(hash_orig, "", RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,35 +283,27 @@ static int extract_single_file(struct archive *archive,
|
|||||||
/* case 5,8: don't need to do anything special */
|
/* case 5,8: don't need to do anything special */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we need access to the original entryname later after calls to
|
||||||
|
* archive_entry_set_pathname(), so we need to dupe it and free() later */
|
||||||
|
STRDUP(entryname_orig, entryname, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
|
||||||
if(needbackup) {
|
if(needbackup) {
|
||||||
char *tempfile = NULL;
|
char checkfile[PATH_MAX];
|
||||||
char *hash_local = NULL, *hash_pkg = NULL;
|
char *hash_local = NULL, *hash_pkg = NULL;
|
||||||
int fd;
|
int ret;
|
||||||
|
|
||||||
/* extract the package's version to a temporary file and checksum it */
|
snprintf(checkfile, PATH_MAX, "%s.paccheck", filename);
|
||||||
tempfile = strdup("/tmp/alpm_XXXXXX");
|
|
||||||
fd = mkstemp(tempfile);
|
|
||||||
|
|
||||||
archive_entry_set_pathname(entry, tempfile);
|
ret = perform_extraction(archive, entry, checkfile, entryname_orig);
|
||||||
|
if(ret == 1) {
|
||||||
int ret = archive_read_extract(archive, entry, archive_flags);
|
/* error */
|
||||||
if(ret == ARCHIVE_WARN) {
|
|
||||||
/* operation succeeded but a non-critical error was encountered */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
|
|
||||||
entryname, archive_error_string(archive));
|
|
||||||
} else if(ret != ARCHIVE_OK) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
|
||||||
entryname, archive_error_string(archive));
|
|
||||||
alpm_logaction("error: could not extract %s (%s)\n",
|
|
||||||
entryname, archive_error_string(archive));
|
|
||||||
unlink(tempfile);
|
|
||||||
FREE(hash_orig);
|
FREE(hash_orig);
|
||||||
close(fd);
|
FREE(entryname_orig);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_local = alpm_get_md5sum(filename);
|
hash_local = alpm_compute_md5sum(filename);
|
||||||
hash_pkg = alpm_get_md5sum(tempfile);
|
hash_pkg = alpm_compute_md5sum(checkfile);
|
||||||
|
|
||||||
/* append the new md5 hash to it's respective entry
|
/* append the new md5 hash to it's respective entry
|
||||||
* in newpkg's backup (it will be the new orginal) */
|
* in newpkg's backup (it will be the new orginal) */
|
||||||
@@ -480,16 +311,13 @@ static int extract_single_file(struct archive *archive,
|
|||||||
for(backups = alpm_pkg_get_backup(newpkg); backups;
|
for(backups = alpm_pkg_get_backup(newpkg); backups;
|
||||||
backups = alpm_list_next(backups)) {
|
backups = alpm_list_next(backups)) {
|
||||||
char *oldbackup = alpm_list_getdata(backups);
|
char *oldbackup = alpm_list_getdata(backups);
|
||||||
if(!oldbackup || strcmp(oldbackup, entryname) != 0) {
|
if(!oldbackup || strcmp(oldbackup, entryname_orig) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
char *backup = NULL;
|
char *backup = NULL;
|
||||||
/* length is tab char, null byte and MD5 (32 char) */
|
/* length is tab char, null byte and MD5 (32 char) */
|
||||||
int backup_len = strlen(oldbackup) + 34;
|
size_t backup_len = strlen(oldbackup) + 34;
|
||||||
backup = malloc(backup_len);
|
MALLOC(backup, backup_len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
if(!backup) {
|
|
||||||
RET_ERR(PM_ERR_MEMORY, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(backup, "%s\t%s", oldbackup, hash_pkg);
|
sprintf(backup, "%s\t%s", oldbackup, hash_pkg);
|
||||||
backup[backup_len-1] = '\0';
|
backup[backup_len-1] = '\0';
|
||||||
@@ -497,37 +325,41 @@ static int extract_single_file(struct archive *archive,
|
|||||||
backups->data = backup;
|
backups->data = backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "checking hashes for %s\n", entryname);
|
_alpm_log(PM_LOG_DEBUG, "checking hashes for %s\n", entryname_orig);
|
||||||
_alpm_log(PM_LOG_DEBUG, "current: %s\n", hash_local);
|
_alpm_log(PM_LOG_DEBUG, "current: %s\n", hash_local);
|
||||||
_alpm_log(PM_LOG_DEBUG, "new: %s\n", hash_pkg);
|
_alpm_log(PM_LOG_DEBUG, "new: %s\n", hash_pkg);
|
||||||
_alpm_log(PM_LOG_DEBUG, "original: %s\n", hash_orig);
|
_alpm_log(PM_LOG_DEBUG, "original: %s\n", hash_orig);
|
||||||
|
|
||||||
if(!oldpkg) {
|
if(!oldpkg) {
|
||||||
|
if(strcmp(hash_local, hash_pkg) != 0) {
|
||||||
/* looks like we have a local file that has a different hash as the
|
/* looks like we have a local file that has a different hash as the
|
||||||
* file in the package, move it to a .pacorig */
|
* file in the package, move it to a .pacorig */
|
||||||
if(strcmp(hash_local, hash_pkg) != 0) {
|
|
||||||
char newpath[PATH_MAX];
|
char newpath[PATH_MAX];
|
||||||
snprintf(newpath, PATH_MAX, "%s.pacorig", filename);
|
snprintf(newpath, PATH_MAX, "%s.pacorig", filename);
|
||||||
|
|
||||||
/* move the existing file to the "pacorig" */
|
/* move the existing file to the "pacorig" */
|
||||||
if(rename(filename, newpath)) {
|
if(rename(filename, newpath)) {
|
||||||
archive_entry_set_pathname(entry, filename);
|
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not rename %s (%s)\n"), filename, strerror(errno));
|
filename, newpath, strerror(errno));
|
||||||
alpm_logaction("error: could not rename %s (%s)\n", filename, strerror(errno));
|
alpm_logaction("error: could not rename %s to %s (%s)\n",
|
||||||
|
filename, newpath, strerror(errno));
|
||||||
errors++;
|
errors++;
|
||||||
} else {
|
} else {
|
||||||
/* copy the tempfile we extracted to the real path */
|
/* rename the file we extracted to the real name */
|
||||||
if(_alpm_copyfile(tempfile, filename)) {
|
if(rename(checkfile, filename)) {
|
||||||
archive_entry_set_pathname(entry, filename);
|
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), filename, strerror(errno));
|
checkfile, filename, strerror(errno));
|
||||||
alpm_logaction("error: could not copy tempfile to %s (%s)\n", filename, strerror(errno));
|
alpm_logaction("error: could not rename %s to %s (%s)\n",
|
||||||
|
checkfile, filename, strerror(errno));
|
||||||
errors++;
|
errors++;
|
||||||
} else {
|
} else {
|
||||||
archive_entry_set_pathname(entry, filename);
|
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
|
_alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
|
||||||
alpm_logaction("warning: %s saved as %s\n", filename, newpath);
|
alpm_logaction("warning: %s saved as %s\n", filename, newpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* local file is identical to pkg one, so just remove pkg one */
|
||||||
|
unlink(checkfile);
|
||||||
}
|
}
|
||||||
} else if(hash_orig) {
|
} else if(hash_orig) {
|
||||||
/* the fun part */
|
/* the fun part */
|
||||||
@@ -536,38 +368,48 @@ static int extract_single_file(struct archive *archive,
|
|||||||
/* installed file has NOT been changed by user */
|
/* installed file has NOT been changed by user */
|
||||||
if(strcmp(hash_orig, hash_pkg) != 0) {
|
if(strcmp(hash_orig, hash_pkg) != 0) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: installing new file: %s\n",
|
_alpm_log(PM_LOG_DEBUG, "action: installing new file: %s\n",
|
||||||
entryname);
|
entryname_orig);
|
||||||
|
|
||||||
if(_alpm_copyfile(tempfile, filename)) {
|
if(rename(checkfile, filename)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), filename, strerror(errno));
|
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
|
checkfile, filename, strerror(errno));
|
||||||
|
alpm_logaction("error: could not rename %s to %s (%s)\n",
|
||||||
|
checkfile, filename, strerror(errno));
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
archive_entry_set_pathname(entry, filename);
|
|
||||||
} else {
|
} else {
|
||||||
/* there's no sense in installing the same file twice, install
|
/* there's no sense in installing the same file twice, install
|
||||||
* ONLY is the original and package hashes differ */
|
* ONLY is the original and package hashes differ */
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
||||||
|
unlink(checkfile);
|
||||||
}
|
}
|
||||||
} else if(strcmp(hash_orig, hash_pkg) == 0) {
|
} else if(strcmp(hash_orig, hash_pkg) == 0) {
|
||||||
/* originally installed file and new file are the same - this
|
/* originally installed file and new file are the same - this
|
||||||
* implies the case above failed - i.e. the file was changed by a
|
* implies the case above failed - i.e. the file was changed by a
|
||||||
* user */
|
* user */
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
||||||
|
unlink(checkfile);
|
||||||
} else if(strcmp(hash_local, hash_pkg) == 0) {
|
} else if(strcmp(hash_local, hash_pkg) == 0) {
|
||||||
/* this would be magical. The above two cases failed, but the
|
/* this would be magical. The above two cases failed, but the
|
||||||
* user changes just so happened to make the new file exactly the
|
* user changes just so happened to make the new file exactly the
|
||||||
* same as the one in the package... skip it */
|
* same as the one in the package... skip it */
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
||||||
|
unlink(checkfile);
|
||||||
} else {
|
} else {
|
||||||
char newpath[PATH_MAX];
|
char newpath[PATH_MAX];
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: keeping current file and installing new one with .pacnew ending\n");
|
_alpm_log(PM_LOG_DEBUG, "action: keeping current file and installing"
|
||||||
|
" new one with .pacnew ending\n");
|
||||||
snprintf(newpath, PATH_MAX, "%s.pacnew", filename);
|
snprintf(newpath, PATH_MAX, "%s.pacnew", filename);
|
||||||
if(_alpm_copyfile(tempfile, newpath)) {
|
if(rename(checkfile, newpath)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not install %s as %s: %s\n"), filename, newpath, strerror(errno));
|
_alpm_log(PM_LOG_ERROR, _("could not install %s as %s (%s)\n"),
|
||||||
alpm_logaction("error: could not install %s as %s: %s\n", filename, newpath, strerror(errno));
|
filename, newpath, strerror(errno));
|
||||||
|
alpm_logaction("error: could not install %s as %s (%s)\n",
|
||||||
|
filename, newpath, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s installed as %s\n"), filename, newpath);
|
_alpm_log(PM_LOG_WARNING, _("%s installed as %s\n"),
|
||||||
alpm_logaction("warning: %s installed as %s\n", filename, newpath);
|
filename, newpath);
|
||||||
|
alpm_logaction("warning: %s installed as %s\n",
|
||||||
|
filename, newpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -575,10 +417,9 @@ static int extract_single_file(struct archive *archive,
|
|||||||
FREE(hash_local);
|
FREE(hash_local);
|
||||||
FREE(hash_pkg);
|
FREE(hash_pkg);
|
||||||
FREE(hash_orig);
|
FREE(hash_orig);
|
||||||
unlink(tempfile);
|
|
||||||
FREE(tempfile);
|
|
||||||
close(fd);
|
|
||||||
} else {
|
} else {
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* we didn't need a backup */
|
/* we didn't need a backup */
|
||||||
if(notouch) {
|
if(notouch) {
|
||||||
/* change the path to a .pacnew extension */
|
/* change the path to a .pacnew extension */
|
||||||
@@ -597,18 +438,10 @@ static int extract_single_file(struct archive *archive,
|
|||||||
unlink(filename);
|
unlink(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_entry_set_pathname(entry, filename);
|
ret = perform_extraction(archive, entry, filename, entryname_orig);
|
||||||
|
if(ret == 1) {
|
||||||
int ret = archive_read_extract(archive, entry, archive_flags);
|
/* error */
|
||||||
if(ret == ARCHIVE_WARN) {
|
FREE(entryname_orig);
|
||||||
/* operation succeeded but a non-critical error was encountered */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
|
|
||||||
entryname, archive_error_string(archive));
|
|
||||||
} else if(ret != ARCHIVE_OK) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
|
||||||
entryname, archive_error_string(archive));
|
|
||||||
alpm_logaction("error: could not extract %s (%s)\n",
|
|
||||||
entryname, archive_error_string(archive));
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,18 +451,15 @@ static int extract_single_file(struct archive *archive,
|
|||||||
char *backup = NULL, *hash = NULL;
|
char *backup = NULL, *hash = NULL;
|
||||||
char *oldbackup = alpm_list_getdata(b);
|
char *oldbackup = alpm_list_getdata(b);
|
||||||
/* length is tab char, null byte and MD5 (32 char) */
|
/* length is tab char, null byte and MD5 (32 char) */
|
||||||
int backup_len = strlen(oldbackup) + 34;
|
size_t backup_len = strlen(oldbackup) + 34;
|
||||||
|
|
||||||
if(!oldbackup || strcmp(oldbackup, entryname) != 0) {
|
if(!oldbackup || strcmp(oldbackup, entryname_orig) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "appending backup entry for %s\n", filename);
|
_alpm_log(PM_LOG_DEBUG, "appending backup entry for %s\n", filename);
|
||||||
|
|
||||||
hash = alpm_get_md5sum(filename);
|
hash = alpm_compute_md5sum(filename);
|
||||||
backup = malloc(backup_len);
|
MALLOC(backup, backup_len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
if(!backup) {
|
|
||||||
RET_ERR(PM_ERR_MEMORY, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(backup, "%s\t%s", oldbackup, hash);
|
sprintf(backup, "%s\t%s", oldbackup, hash);
|
||||||
backup[backup_len-1] = '\0';
|
backup[backup_len-1] = '\0';
|
||||||
@@ -638,41 +468,43 @@ static int extract_single_file(struct archive *archive,
|
|||||||
b->data = backup;
|
b->data = backup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FREE(entryname_orig);
|
||||||
return(errors);
|
return(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
static int commit_single_pkg(pmpkg_t *newpkg, size_t pkg_current,
|
||||||
pmtrans_t *trans, pmdb_t *db)
|
size_t pkg_count, pmtrans_t *trans, pmdb_t *db)
|
||||||
{
|
{
|
||||||
int i, ret = 0, errors = 0;
|
int i, ret = 0, errors = 0;
|
||||||
struct archive *archive;
|
|
||||||
struct archive_entry *entry;
|
|
||||||
char cwd[PATH_MAX] = "";
|
|
||||||
char scriptlet[PATH_MAX+1];
|
char scriptlet[PATH_MAX+1];
|
||||||
int is_upgrade = 0;
|
int is_upgrade = 0;
|
||||||
double percent = 0.0;
|
|
||||||
pmpkg_t *oldpkg = NULL;
|
pmpkg_t *oldpkg = NULL;
|
||||||
|
|
||||||
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", db->path,
|
ALPM_LOG_FUNC;
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
|
||||||
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||||
|
|
||||||
|
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install",
|
||||||
|
_alpm_db_path(db), alpm_pkg_get_name(newpkg),
|
||||||
|
alpm_pkg_get_version(newpkg));
|
||||||
|
|
||||||
/* see if this is an upgrade. if so, remove the old package first */
|
/* see if this is an upgrade. if so, remove the old package first */
|
||||||
pmpkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
|
pmpkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
|
||||||
if(local) {
|
if(local) {
|
||||||
is_upgrade = 1;
|
is_upgrade = 1;
|
||||||
|
|
||||||
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, NULL);
|
/* we'll need to save some record for backup checks later */
|
||||||
|
oldpkg = _alpm_pkg_dup(local);
|
||||||
|
/* make sure all infos are loaded because the database entry
|
||||||
|
* will be removed soon */
|
||||||
|
_alpm_local_db_read(oldpkg->origin_data.db, oldpkg, INFRQ_ALL);
|
||||||
|
|
||||||
|
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, oldpkg);
|
||||||
_alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s\n",
|
_alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s\n",
|
||||||
newpkg->name, newpkg->version);
|
newpkg->name, newpkg->version);
|
||||||
|
|
||||||
/* we'll need to save some record for backup checks later */
|
/* copy over the install reason */
|
||||||
oldpkg = _alpm_pkg_dup(local);
|
newpkg->reason = alpm_pkg_get_reason(oldpkg);
|
||||||
/* copy over the install reason (unless alldeps is set) */
|
|
||||||
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
|
|
||||||
newpkg->reason = PM_PKG_REASON_DEPEND;
|
|
||||||
} else {
|
|
||||||
newpkg->reason = alpm_pkg_get_reason(local);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pre_upgrade scriptlet */
|
/* pre_upgrade scriptlet */
|
||||||
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
||||||
@@ -693,37 +525,70 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we override any pre-set reason if we have alldeps or allexplicit set */
|
||||||
|
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
|
||||||
|
newpkg->reason = PM_PKG_REASON_DEPEND;
|
||||||
|
} else if(trans->flags & PM_TRANS_FLAG_ALLEXPLICIT) {
|
||||||
|
newpkg->reason = PM_PKG_REASON_EXPLICIT;
|
||||||
|
}
|
||||||
|
|
||||||
if(oldpkg) {
|
if(oldpkg) {
|
||||||
/* set up fake remove transaction */
|
/* set up fake remove transaction */
|
||||||
int ret = upgrade_remove(oldpkg, newpkg, trans, db);
|
if(_alpm_upgraderemove_package(oldpkg, newpkg, trans) == -1) {
|
||||||
if(ret != 0) {
|
pm_errno = PM_ERR_TRANS_ABORT;
|
||||||
return(ret);
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* prepare directory for database entries so permission are correct after
|
||||||
|
changelog/install script installation (FS#12263) */
|
||||||
|
if(_alpm_local_db_prepare(db, newpkg)) {
|
||||||
|
alpm_logaction("error: could not create database entry %s-%s\n",
|
||||||
|
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
||||||
|
pm_errno = PM_ERR_DB_WRITE;
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
||||||
|
struct archive *archive;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
char cwd[PATH_MAX] = "";
|
||||||
|
int restore_cwd = 0;
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
|
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
|
||||||
|
|
||||||
if ((archive = archive_read_new()) == NULL) {
|
if ((archive = archive_read_new()) == NULL) {
|
||||||
RET_ERR(PM_ERR_LIBARCHIVE_ERROR, -1);
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_support_compression_all(archive);
|
archive_read_support_compression_all(archive);
|
||||||
archive_read_support_format_all(archive);
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "archive: %s\n", newpkg->origin_data.file);
|
||||||
if(archive_read_open_filename(archive, newpkg->origin_data.file,
|
if(archive_read_open_filename(archive, newpkg->origin_data.file,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
RET_ERR(PM_ERR_PKG_OPEN, -1);
|
pm_errno = PM_ERR_PKG_OPEN;
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the cwd so we can restore it later */
|
/* save the cwd so we can restore it later */
|
||||||
if(getcwd(cwd, PATH_MAX) == NULL) {
|
if(getcwd(cwd, PATH_MAX) == NULL) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not get current working directory\n"));
|
_alpm_log(PM_LOG_ERROR, _("could not get current working directory\n"));
|
||||||
cwd[0] = 0;
|
} else {
|
||||||
|
restore_cwd = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* libarchive requires this for extracting hard links */
|
/* libarchive requires this for extracting hard links */
|
||||||
chdir(handle->root);
|
if(chdir(handle->root) != 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), handle->root, strerror(errno));
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
|
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
|
||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
@@ -735,26 +600,31 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
|
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
|
||||||
|
int percent;
|
||||||
|
|
||||||
if(newpkg->size != 0) {
|
if(newpkg->size != 0) {
|
||||||
/* Using compressed size for calculations here, as newpkg->isize is not
|
/* Using compressed size for calculations here, as newpkg->isize is not
|
||||||
* exact when it comes to comparing to the ACTUAL uncompressed size
|
* exact when it comes to comparing to the ACTUAL uncompressed size
|
||||||
* (missing metadata sizes) */
|
* (missing metadata sizes) */
|
||||||
unsigned long pos = archive_position_compressed(archive);
|
int64_t pos = archive_position_compressed(archive);
|
||||||
percent = (double)pos / (double)newpkg->size;
|
percent = (pos * 100) / newpkg->size;
|
||||||
_alpm_log(PM_LOG_DEBUG, "decompression progress: %f%% (%ld / %ld)\n",
|
_alpm_log(PM_LOG_DEBUG, "decompression progress: "
|
||||||
percent*100.0, pos, newpkg->size);
|
"%d%% (%"PRId64" / %jd)\n",
|
||||||
if(percent >= 1.0) {
|
percent, pos, (intmax_t)newpkg->size);
|
||||||
percent = 1.0;
|
if(percent >= 100) {
|
||||||
|
percent = 100;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
percent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_UPGRADE_START,
|
PROGRESS(trans, PM_TRANS_PROGRESS_UPGRADE_START,
|
||||||
alpm_pkg_get_name(newpkg), (int)(percent * 100), pkg_count,
|
alpm_pkg_get_name(newpkg), percent, pkg_count,
|
||||||
pkg_current);
|
pkg_current);
|
||||||
} else {
|
} else {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
||||||
alpm_pkg_get_name(newpkg), (int)(percent * 100), pkg_count,
|
alpm_pkg_get_name(newpkg), percent, pkg_count,
|
||||||
pkg_current);
|
pkg_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,13 +634,13 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
}
|
}
|
||||||
archive_read_finish(archive);
|
archive_read_finish(archive);
|
||||||
|
|
||||||
/* restore the old cwd is we have it */
|
/* restore the old cwd if we have it */
|
||||||
if(strlen(cwd)) {
|
if(restore_cwd && chdir(cwd) != 0) {
|
||||||
chdir(cwd);
|
_alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(errors) {
|
if(errors) {
|
||||||
ret = 1;
|
ret = -1;
|
||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("problem occurred while upgrading %s\n"),
|
_alpm_log(PM_LOG_ERROR, _("problem occurred while upgrading %s\n"),
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
@@ -791,12 +661,14 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
_alpm_log(PM_LOG_DEBUG, "updating database\n");
|
_alpm_log(PM_LOG_DEBUG, "updating database\n");
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name);
|
_alpm_log(PM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name);
|
||||||
|
|
||||||
if(_alpm_db_write(db, newpkg, INFRQ_ALL)) {
|
if(_alpm_local_db_write(db, newpkg, INFRQ_ALL)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s\n"),
|
_alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s\n"),
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
||||||
alpm_logaction("error: could not update database entry %s-%s\n",
|
alpm_logaction("error: could not update database entry %s-%s\n",
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
||||||
RET_ERR(PM_ERR_DB_WRITE, -1);
|
pm_errno = PM_ERR_DB_WRITE;
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
|
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
|
||||||
@@ -811,7 +683,6 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
||||||
alpm_pkg_get_name(newpkg), 100, pkg_count, pkg_current);
|
alpm_pkg_get_name(newpkg), 100, pkg_count, pkg_current);
|
||||||
}
|
}
|
||||||
EVENT(trans, PM_TRANS_EVT_EXTRACT_DONE, NULL, NULL);
|
|
||||||
|
|
||||||
/* run the post-install script if it exists */
|
/* run the post-install script if it exists */
|
||||||
if(alpm_pkg_has_scriptlet(newpkg)
|
if(alpm_pkg_has_scriptlet(newpkg)
|
||||||
@@ -832,14 +703,15 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
EVENT(trans, PM_TRANS_EVT_ADD_DONE, newpkg, oldpkg);
|
EVENT(trans, PM_TRANS_EVT_ADD_DONE, newpkg, oldpkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
_alpm_pkg_free(oldpkg);
|
_alpm_pkg_free(oldpkg);
|
||||||
|
return(ret);
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
|
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db)
|
||||||
{
|
{
|
||||||
int pkg_count, pkg_current;
|
size_t pkg_count, pkg_current;
|
||||||
|
int skip_ldconfig = 0, ret = 0;
|
||||||
alpm_list_t *targ;
|
alpm_list_t *targ;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -847,29 +719,38 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
|
|||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
||||||
|
|
||||||
if(trans->packages == NULL) {
|
if(trans->add == NULL) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_count = alpm_list_count(trans->targets);
|
pkg_count = alpm_list_count(trans->add);
|
||||||
pkg_current = 1;
|
pkg_current = 1;
|
||||||
|
|
||||||
/* loop through our package list adding/upgrading one at a time */
|
/* loop through our package list adding/upgrading one at a time */
|
||||||
for(targ = trans->packages; targ; targ = targ->next) {
|
for(targ = trans->add; targ; targ = targ->next) {
|
||||||
if(handle->trans->state == STATE_INTERRUPTED) {
|
if(handle->trans->state == STATE_INTERRUPTED) {
|
||||||
return(0);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkg_t *newpkg = (pmpkg_t *)targ->data;
|
pmpkg_t *newpkg = (pmpkg_t *)targ->data;
|
||||||
commit_single_pkg(newpkg, pkg_current, pkg_count, trans, db);
|
if(commit_single_pkg(newpkg, pkg_current, pkg_count, trans, db)) {
|
||||||
|
/* something screwed up on the commit, abort the trans */
|
||||||
|
trans->state = STATE_INTERRUPTED;
|
||||||
|
pm_errno = PM_ERR_TRANS_ABORT;
|
||||||
|
/* running ldconfig at this point could possibly screw system */
|
||||||
|
skip_ldconfig = 1;
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
pkg_current++;
|
pkg_current++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!skip_ldconfig) {
|
||||||
/* run ldconfig if it exists */
|
/* run ldconfig if it exists */
|
||||||
_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"\n", handle->root);
|
|
||||||
_alpm_ldconfig(handle->root);
|
_alpm_ldconfig(handle->root);
|
||||||
|
}
|
||||||
|
|
||||||
return(0);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* add.h
|
* add.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,9 +24,7 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
|
|
||||||
int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
|
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db);
|
||||||
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data);
|
|
||||||
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db);
|
|
||||||
|
|
||||||
#endif /* _ALPM_ADD_H */
|
#endif /* _ALPM_ADD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* alpm.c
|
* alpm.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||||
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||||
@@ -22,10 +23,14 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
/* connection caching setup */
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
#include <fetch.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "error.h"
|
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@@ -49,11 +54,21 @@ int SYMEXPORT alpm_initialize(void)
|
|||||||
if(handle == NULL) {
|
if(handle == NULL) {
|
||||||
RET_ERR(PM_ERR_MEMORY, -1);
|
RET_ERR(PM_ERR_MEMORY, -1);
|
||||||
}
|
}
|
||||||
|
if(_alpm_db_register_local() == NULL) {
|
||||||
|
/* error code should be set */
|
||||||
|
_alpm_handle_free(handle);
|
||||||
|
handle = NULL;
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
bindtextdomain("libalpm", LOCALEDIR);
|
bindtextdomain("libalpm", LOCALEDIR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
fetchConnectionCacheInit(5, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,15 +77,29 @@ int SYMEXPORT alpm_initialize(void)
|
|||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_release(void)
|
int SYMEXPORT alpm_release(void)
|
||||||
{
|
{
|
||||||
|
pmdb_t *db;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
|
||||||
|
/* close local database */
|
||||||
|
db = handle->db_local;
|
||||||
|
if(db) {
|
||||||
|
db->ops->unregister(db);
|
||||||
|
handle->db_local = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(alpm_db_unregister_all() == -1) {
|
if(alpm_db_unregister_all() == -1) {
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_handle_free(handle);
|
_alpm_handle_free(handle);
|
||||||
|
handle = NULL;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
fetchConnectionCacheClose();
|
||||||
|
#endif
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* alpm_list.c
|
* alpm_list.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,15 +18,16 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h"
|
|
||||||
|
/* check exported library symbols with: nm -C -D <lib> */
|
||||||
|
#define SYMEXPORT __attribute__((visibility("default")))
|
||||||
|
#define SYMHIDDEN __attribute__((visibility("internal")))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup alpm_list List Functions
|
* @addtogroup alpm_list List Functions
|
||||||
@@ -39,25 +41,6 @@
|
|||||||
|
|
||||||
/* Allocation */
|
/* Allocation */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Allocate a new alpm_list_t.
|
|
||||||
*
|
|
||||||
* @return a new alpm_list_t item, or NULL on failure
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_list_new()
|
|
||||||
{
|
|
||||||
alpm_list_t *list = NULL;
|
|
||||||
|
|
||||||
list = malloc(sizeof(alpm_list_t));
|
|
||||||
if(list) {
|
|
||||||
list->data = NULL;
|
|
||||||
list->prev = list; /* maintain a back reference to the tail pointer */
|
|
||||||
list->next = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Free a list, but not the contained data.
|
* @brief Free a list, but not the contained data.
|
||||||
*
|
*
|
||||||
@@ -107,32 +90,28 @@ alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
{
|
{
|
||||||
alpm_list_t *ptr, *lp;
|
alpm_list_t *ptr, *lp;
|
||||||
|
|
||||||
ptr = list;
|
ptr = calloc(1, sizeof(alpm_list_t));
|
||||||
if(ptr == NULL) {
|
if(ptr == NULL) {
|
||||||
ptr = alpm_list_new();
|
return(list);
|
||||||
if(ptr == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lp = alpm_list_last(ptr);
|
ptr->data = data;
|
||||||
if(lp == ptr && lp->data == NULL) {
|
ptr->next = NULL;
|
||||||
/* nada */
|
|
||||||
} else {
|
|
||||||
lp->next = alpm_list_new();
|
|
||||||
if(lp->next == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
lp->next->prev = lp;
|
|
||||||
lp = lp->next;
|
|
||||||
list->prev = lp;
|
|
||||||
}
|
|
||||||
|
|
||||||
lp->data = data;
|
|
||||||
|
|
||||||
|
/* Special case: the input list is empty */
|
||||||
|
if(list == NULL) {
|
||||||
|
ptr->prev = ptr;
|
||||||
return(ptr);
|
return(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lp = alpm_list_last(list);
|
||||||
|
lp->next = ptr;
|
||||||
|
ptr->prev = lp;
|
||||||
|
list->prev = ptr;
|
||||||
|
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add items to a list in sorted order.
|
* @brief Add items to a list in sorted order.
|
||||||
*
|
*
|
||||||
@@ -144,12 +123,15 @@ alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn)
|
alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn)
|
||||||
{
|
{
|
||||||
if(!fn) {
|
if(!fn || !list) {
|
||||||
return alpm_list_add(list, data);
|
return(alpm_list_add(list, data));
|
||||||
} else {
|
} else {
|
||||||
alpm_list_t *add = NULL, *prev = NULL, *next = list;
|
alpm_list_t *add = NULL, *prev = NULL, *next = list;
|
||||||
|
|
||||||
add = alpm_list_new();
|
add = calloc(1, sizeof(alpm_list_t));
|
||||||
|
if(add == NULL) {
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
add->data = data;
|
add->data = data;
|
||||||
|
|
||||||
/* Find insertion point. */
|
/* Find insertion point. */
|
||||||
@@ -159,28 +141,27 @@ alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_
|
|||||||
next = next->next;
|
next = next->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert node before insertion point. */
|
/* Insert the add node to the list */
|
||||||
|
if(prev == NULL) { /* special case: we insert add as the first element */
|
||||||
|
add->prev = list->prev; /* list != NULL */
|
||||||
|
add->next = list;
|
||||||
|
list->prev = add;
|
||||||
|
return(add);
|
||||||
|
} else if(next == NULL) { /* another special case: add last element */
|
||||||
|
add->prev = prev;
|
||||||
|
add->next = NULL;
|
||||||
|
prev->next = add;
|
||||||
|
list->prev = add;
|
||||||
|
return(list);
|
||||||
|
} else {
|
||||||
add->prev = prev;
|
add->prev = prev;
|
||||||
add->next = next;
|
add->next = next;
|
||||||
|
next->prev = add;
|
||||||
if(next != NULL) {
|
prev->next = add;
|
||||||
next->prev = add; /* Not at end. */
|
|
||||||
}
|
|
||||||
|
|
||||||
if(prev != NULL) {
|
|
||||||
prev->next = add; /* In middle. */
|
|
||||||
} else {
|
|
||||||
list = add; /* At beginning, or new list */
|
|
||||||
}
|
|
||||||
|
|
||||||
if(next == NULL) {
|
|
||||||
/* At end, adjust tail pointer on head node */
|
|
||||||
list->prev = add;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(list);
|
return(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Join two lists.
|
* @brief Join two lists.
|
||||||
@@ -198,10 +179,10 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
|
|||||||
alpm_list_t *tmp;
|
alpm_list_t *tmp;
|
||||||
|
|
||||||
if (first == NULL) {
|
if (first == NULL) {
|
||||||
return second;
|
return(second);
|
||||||
}
|
}
|
||||||
if (second == NULL) {
|
if (second == NULL) {
|
||||||
return first;
|
return(first);
|
||||||
}
|
}
|
||||||
/* tmp is the last element of the first list */
|
/* tmp is the last element of the first list */
|
||||||
tmp = first->prev;
|
tmp = first->prev;
|
||||||
@@ -288,7 +269,7 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
*
|
*
|
||||||
* @return the resultant list
|
* @return the resultant list
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn)
|
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)
|
||||||
{
|
{
|
||||||
if (n > 1) {
|
if (n > 1) {
|
||||||
alpm_list_t *left = list;
|
alpm_list_t *left = list;
|
||||||
@@ -304,6 +285,53 @@ alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cm
|
|||||||
return(list);
|
return(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove an item from the list.
|
||||||
|
* item is not freed; this is the responsiblity of the caller.
|
||||||
|
*
|
||||||
|
* @param haystack the list to remove the item from
|
||||||
|
* @param item the item to remove from the list
|
||||||
|
*
|
||||||
|
* @return the resultant list
|
||||||
|
*/
|
||||||
|
alpm_list_t SYMEXPORT *alpm_list_remove_item(alpm_list_t *haystack,
|
||||||
|
alpm_list_t *item)
|
||||||
|
{
|
||||||
|
if(haystack == NULL || item == NULL) {
|
||||||
|
return(haystack);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(item == haystack) {
|
||||||
|
/* Special case: removing the head node which has a back reference to
|
||||||
|
* the tail node */
|
||||||
|
haystack = item->next;
|
||||||
|
if(haystack) {
|
||||||
|
haystack->prev = item->prev;
|
||||||
|
}
|
||||||
|
item->prev = NULL;
|
||||||
|
} else if(item == haystack->prev) {
|
||||||
|
/* Special case: removing the tail node, so we need to fix the back
|
||||||
|
* reference on the head node. We also know tail != head. */
|
||||||
|
if(item->prev) {
|
||||||
|
/* i->next should always be null */
|
||||||
|
item->prev->next = item->next;
|
||||||
|
haystack->prev = item->prev;
|
||||||
|
item->prev = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Normal case, non-head and non-tail node */
|
||||||
|
if(item->next) {
|
||||||
|
item->next->prev = item->prev;
|
||||||
|
}
|
||||||
|
if(item->prev) {
|
||||||
|
item->prev->next = item->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(haystack);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove an item from the list.
|
* @brief Remove an item from the list.
|
||||||
*
|
*
|
||||||
@@ -314,62 +342,56 @@ alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cm
|
|||||||
*
|
*
|
||||||
* @return the resultant list
|
* @return the resultant list
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data)
|
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack,
|
||||||
|
const void *needle, alpm_list_fn_cmp fn, void **data)
|
||||||
{
|
{
|
||||||
alpm_list_t *i = haystack, *tmp = NULL;
|
alpm_list_t *i = haystack;
|
||||||
|
|
||||||
if(data) {
|
if(data) {
|
||||||
*data = NULL;
|
*data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(needle == NULL) {
|
||||||
|
return(haystack);
|
||||||
|
}
|
||||||
|
|
||||||
while(i) {
|
while(i) {
|
||||||
if(i->data == NULL) {
|
if(i->data == NULL) {
|
||||||
|
i = i->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmp = i->next;
|
if(fn(i->data, needle) == 0) {
|
||||||
if(fn(needle, i->data) == 0) {
|
haystack = alpm_list_remove_item(haystack, i);
|
||||||
/* we found a matching item */
|
|
||||||
if(i == haystack) {
|
|
||||||
/* Special case: removing the head node which has a back reference to
|
|
||||||
* the tail node */
|
|
||||||
haystack = i->next;
|
|
||||||
if(haystack) {
|
|
||||||
haystack->prev = i->prev;
|
|
||||||
}
|
|
||||||
i->prev = NULL;
|
|
||||||
} else if(i == haystack->prev) {
|
|
||||||
/* Special case: removing the tail node, so we need to fix the back
|
|
||||||
* reference on the head node. We also know tail != head. */
|
|
||||||
if(i->prev) {
|
|
||||||
/* i->next should always be null */
|
|
||||||
i->prev->next = i->next;
|
|
||||||
haystack->prev = i->prev;
|
|
||||||
i->prev = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Normal case, non-head and non-tail node */
|
|
||||||
if(i->next) {
|
|
||||||
i->next->prev = i->prev;
|
|
||||||
}
|
|
||||||
if(i->prev) {
|
|
||||||
i->prev->next = i->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(data) {
|
if(data) {
|
||||||
*data = i->data;
|
*data = i->data;
|
||||||
}
|
}
|
||||||
i->data = NULL;
|
|
||||||
free(i);
|
free(i);
|
||||||
i = NULL;
|
break;
|
||||||
} else {
|
} else {
|
||||||
i = tmp;
|
i = i->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(haystack);
|
return(haystack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove a string from a list.
|
||||||
|
*
|
||||||
|
* @param haystack the list to remove the item from
|
||||||
|
* @param needle the data member of the item we're removing
|
||||||
|
* @param data output parameter containing data of the removed item
|
||||||
|
*
|
||||||
|
* @return the resultant list
|
||||||
|
*/
|
||||||
|
alpm_list_t SYMEXPORT *alpm_list_remove_str(alpm_list_t *haystack,
|
||||||
|
const char *needle, char **data)
|
||||||
|
{
|
||||||
|
return(alpm_list_remove(haystack, (const void *)needle,
|
||||||
|
(alpm_list_fn_cmp)strcmp, (void **)data));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a new list without any duplicates.
|
* @brief Create a new list without any duplicates.
|
||||||
*
|
*
|
||||||
@@ -464,18 +486,22 @@ alpm_list_t SYMEXPORT *alpm_list_copy_data(const alpm_list_t *list,
|
|||||||
alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
||||||
{
|
{
|
||||||
const alpm_list_t *lp;
|
const alpm_list_t *lp;
|
||||||
alpm_list_t *newlist = NULL;
|
alpm_list_t *newlist = NULL, *backup;
|
||||||
|
|
||||||
|
if(list == NULL) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
lp = alpm_list_last(list);
|
lp = alpm_list_last(list);
|
||||||
if(list) {
|
|
||||||
/* break our reverse circular list */
|
/* break our reverse circular list */
|
||||||
|
backup = list->prev;
|
||||||
list->prev = NULL;
|
list->prev = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
while(lp) {
|
while(lp) {
|
||||||
newlist = alpm_list_add(newlist, lp->data);
|
newlist = alpm_list_add(newlist, lp->data);
|
||||||
lp = lp->prev;
|
lp = lp->prev;
|
||||||
}
|
}
|
||||||
|
list->prev = backup; /* restore tail pointer */
|
||||||
return(newlist);
|
return(newlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,18 +516,22 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
|||||||
*/
|
*/
|
||||||
inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
|
inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
|
||||||
{
|
{
|
||||||
|
if(list) {
|
||||||
return((alpm_list_t*)list);
|
return((alpm_list_t*)list);
|
||||||
|
} else {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return nth element from list (starting from 0).
|
* @brief Return nth element from list (starting from 0).
|
||||||
*
|
*
|
||||||
* @param list the list
|
* @param list the list
|
||||||
* @param n the index of the item to find
|
* @param n the index of the item to find (n < alpm_list_count(list) IS needed)
|
||||||
*
|
*
|
||||||
* @return an alpm_list_t node for index `n`
|
* @return an alpm_list_t node for index `n`
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, int n)
|
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, size_t n)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i = list;
|
const alpm_list_t *i = list;
|
||||||
while(n--) {
|
while(n--) {
|
||||||
@@ -519,7 +549,11 @@ alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, int n)
|
|||||||
*/
|
*/
|
||||||
inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
|
inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
|
||||||
{
|
{
|
||||||
|
if(node) {
|
||||||
return(node->next);
|
return(node->next);
|
||||||
|
} else {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -560,9 +594,9 @@ void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
|
|||||||
*
|
*
|
||||||
* @return the number of list items
|
* @return the number of list items
|
||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_list_count(const alpm_list_t *list)
|
size_t SYMEXPORT alpm_list_count(const alpm_list_t *list)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
size_t i = 0;
|
||||||
const alpm_list_t *lp = list;
|
const alpm_list_t *lp = list;
|
||||||
while(lp) {
|
while(lp) {
|
||||||
++i;
|
++i;
|
||||||
@@ -594,7 +628,7 @@ void SYMEXPORT *alpm_list_find(const alpm_list_t *haystack, const void *needle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* trivial helper function for alpm_list_find_ptr */
|
/* trivial helper function for alpm_list_find_ptr */
|
||||||
static int ptrcmp(const void *p, const void *q)
|
static int ptr_cmp(const void *p, const void *q)
|
||||||
{
|
{
|
||||||
return(p != q);
|
return(p != q);
|
||||||
}
|
}
|
||||||
@@ -602,7 +636,7 @@ static int ptrcmp(const void *p, const void *q)
|
|||||||
/**
|
/**
|
||||||
* @brief Find an item in a list.
|
* @brief Find an item in a list.
|
||||||
*
|
*
|
||||||
* Search for the item whos data matches that of the `needle`.
|
* Search for the item whose data matches that of the `needle`.
|
||||||
*
|
*
|
||||||
* @param needle the data to search for (== comparison)
|
* @param needle the data to search for (== comparison)
|
||||||
* @param haystack the list
|
* @param haystack the list
|
||||||
@@ -611,7 +645,7 @@ static int ptrcmp(const void *p, const void *q)
|
|||||||
*/
|
*/
|
||||||
void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle)
|
void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle)
|
||||||
{
|
{
|
||||||
return(alpm_list_find(haystack, needle, ptrcmp));
|
return(alpm_list_find(haystack, needle, ptr_cmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -622,17 +656,73 @@ void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack, const void *need
|
|||||||
*
|
*
|
||||||
* @return `needle` if found, NULL otherwise
|
* @return `needle` if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack, const char *needle)
|
char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
|
||||||
|
const char *needle)
|
||||||
{
|
{
|
||||||
return((char *)alpm_list_find(haystack, (const void*)needle, (alpm_list_fn_cmp)strcmp));
|
return((char *)alpm_list_find(haystack, (const void*)needle,
|
||||||
|
(alpm_list_fn_cmp)strcmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Find the items in list `lhs` that are not present in list `rhs`.
|
* @brief Find the differences between list `left` and list `right`
|
||||||
*
|
*
|
||||||
* Entries are not duplicated. Operation is O(m*n). The first list is stepped
|
* The two lists must be sorted. Items only in list `left` are added to the
|
||||||
* through one node at a time, and for each node in the first list, each node
|
* `onlyleft` list. Items only in list `right` are added to the `onlyright`
|
||||||
* in the second list is compared to it.
|
* list.
|
||||||
|
*
|
||||||
|
* @param left the first list
|
||||||
|
* @param right the second list
|
||||||
|
* @param fn the comparison function
|
||||||
|
* @param onlyleft pointer to the first result list
|
||||||
|
* @param onlyright pointer to the second result list
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
|
||||||
|
const alpm_list_t *right, alpm_list_fn_cmp fn,
|
||||||
|
alpm_list_t **onlyleft, alpm_list_t **onlyright)
|
||||||
|
{
|
||||||
|
const alpm_list_t *l = left;
|
||||||
|
const alpm_list_t *r = right;
|
||||||
|
|
||||||
|
if(!onlyleft && !onlyright) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (l != NULL && r != NULL) {
|
||||||
|
int cmp = fn(l->data, r->data);
|
||||||
|
if(cmp < 0) {
|
||||||
|
if(onlyleft) {
|
||||||
|
*onlyleft = alpm_list_add(*onlyleft, l->data);
|
||||||
|
}
|
||||||
|
l = l->next;
|
||||||
|
}
|
||||||
|
else if(cmp > 0) {
|
||||||
|
if(onlyright) {
|
||||||
|
*onlyright = alpm_list_add(*onlyright, r->data);
|
||||||
|
}
|
||||||
|
r = r->next;
|
||||||
|
} else {
|
||||||
|
l = l->next;
|
||||||
|
r = r->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (l != NULL) {
|
||||||
|
if(onlyleft) {
|
||||||
|
*onlyleft = alpm_list_add(*onlyleft, l->data);
|
||||||
|
}
|
||||||
|
l = l->next;
|
||||||
|
}
|
||||||
|
while (r != NULL) {
|
||||||
|
if(onlyright) {
|
||||||
|
*onlyright = alpm_list_add(*onlyright, r->data);
|
||||||
|
}
|
||||||
|
r = r->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Find the items in list `lhs` that are not present in list `rhs`.
|
||||||
*
|
*
|
||||||
* @param lhs the first list
|
* @param lhs the first list
|
||||||
* @param rhs the second list
|
* @param rhs the second list
|
||||||
@@ -643,21 +733,18 @@ char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack, const char *need
|
|||||||
alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
|
alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
|
||||||
const alpm_list_t *rhs, alpm_list_fn_cmp fn)
|
const alpm_list_t *rhs, alpm_list_fn_cmp fn)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i, *j;
|
alpm_list_t *left, *right;
|
||||||
alpm_list_t *ret = NULL;
|
alpm_list_t *ret = NULL;
|
||||||
for(i = lhs; i; i = i->next) {
|
|
||||||
int found = 0;
|
|
||||||
for(j = rhs; j; j = j->next) {
|
|
||||||
if(fn(i->data, j->data) == 0) {
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!found) {
|
|
||||||
ret = alpm_list_add(ret, i->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
left = alpm_list_copy(lhs);
|
||||||
|
left = alpm_list_msort(left, alpm_list_count(left), fn);
|
||||||
|
right = alpm_list_copy(rhs);
|
||||||
|
right = alpm_list_msort(right, alpm_list_count(right), fn);
|
||||||
|
|
||||||
|
alpm_list_diff_sorted(left, right, fn, &ret, NULL);
|
||||||
|
|
||||||
|
alpm_list_free(left);
|
||||||
|
alpm_list_free(right);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* alpm_list.h
|
* alpm_list.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +20,8 @@
|
|||||||
#ifndef _ALPM_LIST_H
|
#ifndef _ALPM_LIST_H
|
||||||
#define _ALPM_LIST_H
|
#define _ALPM_LIST_H
|
||||||
|
|
||||||
|
#include <stdlib.h> /* size_t */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -45,7 +48,6 @@ typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */
|
|||||||
typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */
|
typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */
|
||||||
|
|
||||||
/* allocation */
|
/* allocation */
|
||||||
alpm_list_t *alpm_list_new(void);
|
|
||||||
void alpm_list_free(alpm_list_t *list);
|
void alpm_list_free(alpm_list_t *list);
|
||||||
void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
|
void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
|
||||||
|
|
||||||
@@ -54,8 +56,10 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
|
|||||||
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
|
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
|
||||||
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
|
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
|
||||||
alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
|
alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
|
||||||
alpm_list_t *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
|
alpm_list_t *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn);
|
||||||
|
alpm_list_t *alpm_list_remove_item(alpm_list_t *haystack, alpm_list_t *item);
|
||||||
alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data);
|
alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data);
|
||||||
|
alpm_list_t *alpm_list_remove_str(alpm_list_t *haystack, const char *needle, char **data);
|
||||||
alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list);
|
alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list);
|
||||||
alpm_list_t *alpm_list_strdup(const alpm_list_t *list);
|
alpm_list_t *alpm_list_strdup(const alpm_list_t *list);
|
||||||
alpm_list_t *alpm_list_copy(const alpm_list_t *list);
|
alpm_list_t *alpm_list_copy(const alpm_list_t *list);
|
||||||
@@ -64,17 +68,19 @@ alpm_list_t *alpm_list_reverse(alpm_list_t *list);
|
|||||||
|
|
||||||
/* item accessors */
|
/* item accessors */
|
||||||
alpm_list_t *alpm_list_first(const alpm_list_t *list);
|
alpm_list_t *alpm_list_first(const alpm_list_t *list);
|
||||||
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n);
|
alpm_list_t *alpm_list_nth(const alpm_list_t *list, size_t n);
|
||||||
alpm_list_t *alpm_list_next(const alpm_list_t *list);
|
alpm_list_t *alpm_list_next(const alpm_list_t *list);
|
||||||
alpm_list_t *alpm_list_last(const alpm_list_t *list);
|
alpm_list_t *alpm_list_last(const alpm_list_t *list);
|
||||||
void *alpm_list_getdata(const alpm_list_t *entry);
|
void *alpm_list_getdata(const alpm_list_t *entry);
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
int alpm_list_count(const alpm_list_t *list);
|
size_t alpm_list_count(const alpm_list_t *list);
|
||||||
void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
|
void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
|
||||||
void *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle);
|
void *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle);
|
||||||
char *alpm_list_find_str(const alpm_list_t *haystack, const char *needle);
|
char *alpm_list_find_str(const alpm_list_t *haystack, const char *needle);
|
||||||
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
|
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
|
||||||
|
void alpm_list_diff_sorted(const alpm_list_t *left, const alpm_list_t *right,
|
||||||
|
alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* backup.c
|
* backup.c
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* split a backup string "file\thash" into two strings : file and hash */
|
/* split a backup string "file\thash" into two strings : file and hash */
|
||||||
int _alpm_backup_split(const char *string, char **file, char **hash)
|
static int backup_split(const char *string, char **file, char **hash)
|
||||||
{
|
{
|
||||||
char *str = strdup(string);
|
char *str = strdup(string);
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@@ -42,6 +43,9 @@ int _alpm_backup_split(const char *string, char **file, char **hash)
|
|||||||
if(ptr == NULL) {
|
if(ptr == NULL) {
|
||||||
if(file) {
|
if(file) {
|
||||||
*file = str;
|
*file = str;
|
||||||
|
} else {
|
||||||
|
/* don't need our dup as the fname wasn't requested, so free it */
|
||||||
|
FREE(str);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -61,14 +65,14 @@ int _alpm_backup_split(const char *string, char **file, char **hash)
|
|||||||
char *_alpm_backup_file(const char *string)
|
char *_alpm_backup_file(const char *string)
|
||||||
{
|
{
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
_alpm_backup_split(string, &file, NULL);
|
backup_split(string, &file, NULL);
|
||||||
return(file);
|
return(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_alpm_backup_hash(const char *string)
|
char *_alpm_backup_hash(const char *string)
|
||||||
{
|
{
|
||||||
char *hash = NULL;
|
char *hash = NULL;
|
||||||
_alpm_backup_split(string, NULL, &hash);
|
backup_split(string, NULL, &hash);
|
||||||
return(hash);
|
return(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +95,7 @@ char *_alpm_needbackup(const char *file, const alpm_list_t *backup)
|
|||||||
char *hash = NULL;
|
char *hash = NULL;
|
||||||
|
|
||||||
/* no hash found */
|
/* no hash found */
|
||||||
if(!_alpm_backup_split((char *)lp->data, &filename, &hash)) {
|
if(!backup_split((char *)lp->data, &filename, &hash)) {
|
||||||
FREE(filename);
|
FREE(filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* backup.h
|
* backup.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,805 +0,0 @@
|
|||||||
/*
|
|
||||||
* be_files.c
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 by Christian Hamar <krics@linuxforum.hu>
|
|
||||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
|
||||||
*
|
|
||||||
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdint.h> /* uintmax_t */
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <limits.h> /* PATH_MAX */
|
|
||||||
#include <locale.h> /* setlocale */
|
|
||||||
|
|
||||||
/* libalpm */
|
|
||||||
#include "db.h"
|
|
||||||
#include "alpm_list.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "alpm.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "handle.h"
|
|
||||||
#include "package.h"
|
|
||||||
#include "delta.h"
|
|
||||||
#include "deps.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* This function is used to convert the downloaded db file to the proper backend
|
|
||||||
* format
|
|
||||||
*/
|
|
||||||
int _alpm_db_install(pmdb_t *db, const char *dbfile)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* TODO we should not simply unpack the archive, but better parse it and
|
|
||||||
* db_write each entry (see sync_load_dbarchive to get archive content) */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "unpacking database '%s'\n", dbfile);
|
|
||||||
|
|
||||||
if(_alpm_unpack(dbfile, db->path, NULL)) {
|
|
||||||
RET_ERR(PM_ERR_SYSTEM, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return unlink(dbfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_open(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_NULL, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "opening database from path '%s'\n", db->path);
|
|
||||||
db->handle = opendir(db->path);
|
|
||||||
if(db->handle == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_OPEN, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _alpm_db_close(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(db->handle) {
|
|
||||||
closedir(db->handle);
|
|
||||||
db->handle = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _alpm_db_rewind(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || db->handle == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rewinddir(db->handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _alpm_db_splitname(const char *target, char *name, char *version)
|
|
||||||
{
|
|
||||||
/* the format of a db entry is as follows:
|
|
||||||
* package-version-rel/
|
|
||||||
* package name can contain hyphens, so parse from the back- go back
|
|
||||||
* two hyphens and we have split the version from the name.
|
|
||||||
*/
|
|
||||||
char *tmp, *p, *q;
|
|
||||||
|
|
||||||
if(target == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
tmp = strdup(target);
|
|
||||||
p = tmp + strlen(tmp);
|
|
||||||
|
|
||||||
/* do the magic parsing- find the beginning of the version string
|
|
||||||
* by doing two iterations of same loop to lop off two hyphens */
|
|
||||||
for(q = --p; *q && *q != '-'; q--);
|
|
||||||
for(p = --q; *p && *p != '-'; p--);
|
|
||||||
if(*p != '-' || p == tmp) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy into fields and return */
|
|
||||||
if(version) {
|
|
||||||
strncpy(version, p+1, PKG_VERSION_LEN);
|
|
||||||
}
|
|
||||||
/* insert a terminator at the end of the name (on hyphen)- then copy it */
|
|
||||||
*p = '\0';
|
|
||||||
if(name) {
|
|
||||||
strncpy(name, tmp, PKG_NAME_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(tmp);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target)
|
|
||||||
{
|
|
||||||
struct dirent *ent = NULL;
|
|
||||||
struct stat sbuf;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
char name[PKG_FULLNAME_LEN];
|
|
||||||
char *ptr = NULL;
|
|
||||||
int found = 0;
|
|
||||||
pmpkg_t *pkg = NULL;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We loop here until we read a valid package. When an iteration of this loop
|
|
||||||
* fails, it means alpm_db_read failed to read a valid package, so we'll read
|
|
||||||
* the next so as not to abort whole-db operations early
|
|
||||||
*/
|
|
||||||
while(!pkg) {
|
|
||||||
if(target != NULL) {
|
|
||||||
/* search for a specific package (by name only) */
|
|
||||||
rewinddir(db->handle);
|
|
||||||
while(!found && (ent = readdir(db->handle)) != NULL) {
|
|
||||||
if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* stat the entry, make sure it's a directory */
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s", db->path, ent->d_name);
|
|
||||||
if(stat(path, &sbuf) || !S_ISDIR(sbuf.st_mode)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
strncpy(name, ent->d_name, PKG_FULLNAME_LEN);
|
|
||||||
/* truncate the string at the second-to-last hyphen, */
|
|
||||||
/* which will give us the package name */
|
|
||||||
if((ptr = rindex(name, '-'))) {
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
if((ptr = rindex(name, '-'))) {
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
if(!strcmp(name, target)) {
|
|
||||||
found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!found) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
} else { /* target == NULL, full scan */
|
|
||||||
int isdir = 0;
|
|
||||||
while(!isdir) {
|
|
||||||
ent = readdir(db->handle);
|
|
||||||
if(ent == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) {
|
|
||||||
isdir = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* stat the entry, make sure it's a directory */
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s", db->path, ent->d_name);
|
|
||||||
if(!stat(path, &sbuf) && S_ISDIR(sbuf.st_mode)) {
|
|
||||||
isdir = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg = _alpm_pkg_new(NULL, NULL);
|
|
||||||
if(pkg == NULL) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "db scan could not find package: %s\n", target);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
/* split the db entry name */
|
|
||||||
if(_alpm_db_splitname(ent->d_name, pkg->name, pkg->version) != 0) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
|
|
||||||
ent->d_name);
|
|
||||||
alpm_pkg_free(pkg);
|
|
||||||
pkg = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* explicitly read with only 'BASE' data, accessors will handle the rest */
|
|
||||||
if(_alpm_db_read(db, pkg, INFRQ_BASE) == -1) {
|
|
||||||
/* TODO removed corrupt entry from the FS here */
|
|
||||||
_alpm_pkg_free(pkg);
|
|
||||||
} else {
|
|
||||||
pkg->origin = PKG_FROM_CACHE;
|
|
||||||
pkg->origin_data.db = db;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(pkg);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
|
||||||
{
|
|
||||||
FILE *fp = NULL;
|
|
||||||
struct stat buf;
|
|
||||||
char path[PATH_MAX+1];
|
|
||||||
char line[513];
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_NULL, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(info == NULL || info->name[0] == 0 || info->version[0] == 0) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_db_read, skipping\n");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(info->origin == PKG_FROM_FILE) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "request to read database info for a file-based package '%s', skipping...\n", info->name);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bitmask logic here:
|
|
||||||
* infolevel: 00001111
|
|
||||||
* inforeq: 00010100
|
|
||||||
* & result: 00000100
|
|
||||||
* == to inforeq? nope, we need to load more info. */
|
|
||||||
if((info->infolevel & inforeq) == inforeq) {
|
|
||||||
/* already loaded this info, do nothing */
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
_alpm_log(PM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
|
|
||||||
info->name, inforeq);
|
|
||||||
|
|
||||||
/* clear out 'line', to be certain - and to make valgrind happy */
|
|
||||||
memset(line, 0, 513);
|
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s", db->path, info->name, info->version);
|
|
||||||
if(stat(path, &buf)) {
|
|
||||||
/* directory doesn't exist or can't be opened */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
|
|
||||||
info->name, info->version, db->treename);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DESC */
|
|
||||||
if(inforeq & INFRQ_DESC) {
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "r")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
while(!feof(fp)) {
|
|
||||||
if(fgets(line, 256, fp) == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
if(!strcmp(line, "%FILENAME%")) {
|
|
||||||
if(fgets(info->filename, sizeof(info->filename), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(info->filename);
|
|
||||||
} else if(!strcmp(line, "%DESC%")) {
|
|
||||||
if(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(info->desc);
|
|
||||||
} else if(!strcmp(line, "%GROUPS%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->groups = alpm_list_add(info->groups, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%URL%")) {
|
|
||||||
if(fgets(info->url, sizeof(info->url), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(info->url);
|
|
||||||
} else if(!strcmp(line, "%LICENSE%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->licenses = alpm_list_add(info->licenses, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%ARCH%")) {
|
|
||||||
if(fgets(info->arch, sizeof(info->arch), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(info->arch);
|
|
||||||
} else if(!strcmp(line, "%BUILDDATE%")) {
|
|
||||||
char tmp[32];
|
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(tmp);
|
|
||||||
|
|
||||||
char first = tolower(tmp[0]);
|
|
||||||
if(first > 'a' && first < 'z') {
|
|
||||||
struct tm tmp_tm = {0}; //initialize to null incase of failure
|
|
||||||
setlocale(LC_TIME, "C");
|
|
||||||
strptime(tmp, "%a %b %e %H:%M:%S %Y", &tmp_tm);
|
|
||||||
info->builddate = mktime(&tmp_tm);
|
|
||||||
setlocale(LC_TIME, "");
|
|
||||||
} else {
|
|
||||||
info->builddate = atol(tmp);
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%INSTALLDATE%")) {
|
|
||||||
char tmp[32];
|
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(tmp);
|
|
||||||
|
|
||||||
char first = tolower(tmp[0]);
|
|
||||||
if(first > 'a' && first < 'z') {
|
|
||||||
struct tm tmp_tm = {0}; //initialize to null incase of failure
|
|
||||||
setlocale(LC_TIME, "C");
|
|
||||||
strptime(tmp, "%a %b %e %H:%M:%S %Y", &tmp_tm);
|
|
||||||
info->installdate = mktime(&tmp_tm);
|
|
||||||
setlocale(LC_TIME, "");
|
|
||||||
} else {
|
|
||||||
info->installdate = atol(tmp);
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%PACKAGER%")) {
|
|
||||||
if(fgets(info->packager, sizeof(info->packager), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(info->packager);
|
|
||||||
} else if(!strcmp(line, "%REASON%")) {
|
|
||||||
char tmp[32];
|
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(tmp);
|
|
||||||
info->reason = atol(tmp);
|
|
||||||
} else if(!strcmp(line, "%SIZE%") || !strcmp(line, "%CSIZE%")) {
|
|
||||||
/* NOTE: the CSIZE and SIZE fields both share the "size" field
|
|
||||||
* in the pkginfo_t struct. This can be done b/c CSIZE
|
|
||||||
* is currently only used in sync databases, and SIZE is
|
|
||||||
* only used in local databases.
|
|
||||||
*/
|
|
||||||
char tmp[32];
|
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(tmp);
|
|
||||||
info->size = atol(tmp);
|
|
||||||
/* also store this value to isize if isize is unset */
|
|
||||||
if(info->isize == 0) {
|
|
||||||
info->isize = atol(tmp);
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%ISIZE%")) {
|
|
||||||
/* ISIZE (installed size) tag only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
char tmp[32];
|
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(tmp);
|
|
||||||
info->isize = atol(tmp);
|
|
||||||
} else if(!strcmp(line, "%MD5SUM%")) {
|
|
||||||
/* MD5SUM tag only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
if(fgets(info->md5sum, sizeof(info->md5sum), fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%REPLACES%")) {
|
|
||||||
/* the REPLACES tag is special -- it only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->replaces = alpm_list_add(info->replaces, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%FORCE%")) {
|
|
||||||
/* FORCE tag only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
info->force = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FILES */
|
|
||||||
if(inforeq & INFRQ_FILES) {
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "r")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
while(fgets(line, 256, fp)) {
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
if(!strcmp(line, "%FILES%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->files = alpm_list_add(info->files, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%BACKUP%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->backup = alpm_list_add(info->backup, strdup(line));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DEPENDS */
|
|
||||||
if(inforeq & INFRQ_DEPENDS) {
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "r")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
while(!feof(fp)) {
|
|
||||||
fgets(line, 255, fp);
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
if(!strcmp(line, "%DEPENDS%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
pmdepend_t *dep = alpm_splitdep(line);
|
|
||||||
info->depends = alpm_list_add(info->depends, dep);
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%OPTDEPENDS%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->optdepends = alpm_list_add(info->optdepends, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%CONFLICTS%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->conflicts = alpm_list_add(info->conflicts, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%PROVIDES%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->provides = alpm_list_add(info->provides, strdup(line));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO: we were going to move these things here, but it should wait.
|
|
||||||
* A better change would be to figure out how to restructure the DB. */
|
|
||||||
/* else if(!strcmp(line, "%REPLACES%")) {
|
|
||||||
* the REPLACES tag is special -- it only appears in sync repositories,
|
|
||||||
* not the local one. *
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->replaces = alpm_list_add(info->replaces, strdup(line));
|
|
||||||
}
|
|
||||||
} else if(!strcmp(line, "%FORCE%")) {
|
|
||||||
* FORCE tag only appears in sync repositories,
|
|
||||||
* not the local one. *
|
|
||||||
info->force = 1;
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DELTAS */
|
|
||||||
if(inforeq & INFRQ_DELTAS) {
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/deltas", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "r"))) {
|
|
||||||
while(!feof(fp)) {
|
|
||||||
fgets(line, 255, fp);
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
if(!strcmp(line, "%DELTAS%")) {
|
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
info->deltas = alpm_list_add(info->deltas, _alpm_delta_parse(line));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* INSTALL */
|
|
||||||
if(inforeq & INFRQ_SCRIPTLET) {
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/install", db->path, info->name, info->version);
|
|
||||||
if(!stat(path, &buf)) {
|
|
||||||
info->scriptlet = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal */
|
|
||||||
info->infolevel |= inforeq;
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
error:
|
|
||||||
if(fp) {
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
|
||||||
{
|
|
||||||
FILE *fp = NULL;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
mode_t oldmask;
|
|
||||||
alpm_list_t *lp = NULL;
|
|
||||||
int retval = 0;
|
|
||||||
int local = 0;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || info == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s", db->path, info->name, info->version);
|
|
||||||
oldmask = umask(0000);
|
|
||||||
mkdir(path, 0755);
|
|
||||||
/* make sure we have a sane umask */
|
|
||||||
umask(0022);
|
|
||||||
|
|
||||||
if(strcmp(db->treename, "local") == 0) {
|
|
||||||
local = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DESC */
|
|
||||||
if(inforeq & INFRQ_DESC) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
|
|
||||||
info->name, info->version);
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "w")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
|
||||||
retval = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
fprintf(fp, "%%NAME%%\n%s\n\n"
|
|
||||||
"%%VERSION%%\n%s\n\n", info->name, info->version);
|
|
||||||
if(info->desc[0]) {
|
|
||||||
fprintf(fp, "%%DESC%%\n"
|
|
||||||
"%s\n\n", info->desc);
|
|
||||||
}
|
|
||||||
if(info->groups) {
|
|
||||||
fputs("%GROUPS%\n", fp);
|
|
||||||
for(lp = info->groups; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(local) {
|
|
||||||
if(info->url[0]) {
|
|
||||||
fprintf(fp, "%%URL%%\n"
|
|
||||||
"%s\n\n", info->url);
|
|
||||||
}
|
|
||||||
if(info->licenses) {
|
|
||||||
fputs("%LICENSE%\n", fp);
|
|
||||||
for(lp = info->licenses; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(info->arch[0]) {
|
|
||||||
fprintf(fp, "%%ARCH%%\n"
|
|
||||||
"%s\n\n", info->arch);
|
|
||||||
}
|
|
||||||
if(info->builddate) {
|
|
||||||
fprintf(fp, "%%BUILDDATE%%\n"
|
|
||||||
"%ju\n\n", (uintmax_t)info->builddate);
|
|
||||||
}
|
|
||||||
if(info->installdate) {
|
|
||||||
fprintf(fp, "%%INSTALLDATE%%\n"
|
|
||||||
"%ju\n\n", (uintmax_t)info->installdate);
|
|
||||||
}
|
|
||||||
if(info->packager[0]) {
|
|
||||||
fprintf(fp, "%%PACKAGER%%\n"
|
|
||||||
"%s\n\n", info->packager);
|
|
||||||
}
|
|
||||||
if(info->size) {
|
|
||||||
/* only write installed size, csize is irrelevant once installed */
|
|
||||||
fprintf(fp, "%%SIZE%%\n"
|
|
||||||
"%lu\n\n", info->isize);
|
|
||||||
}
|
|
||||||
if(info->reason) {
|
|
||||||
fprintf(fp, "%%REASON%%\n"
|
|
||||||
"%u\n\n", info->reason);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(info->size) {
|
|
||||||
fprintf(fp, "%%CSIZE%%\n"
|
|
||||||
"%lu\n\n", info->size);
|
|
||||||
}
|
|
||||||
if(info->isize) {
|
|
||||||
fprintf(fp, "%%ISIZE%%\n"
|
|
||||||
"%lu\n\n", info->isize);
|
|
||||||
}
|
|
||||||
if(info->md5sum) {
|
|
||||||
fprintf(fp, "%%MD5SUM%%\n"
|
|
||||||
"%s\n\n", info->md5sum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FILES */
|
|
||||||
if(local && (inforeq & INFRQ_FILES)) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
|
|
||||||
info->name, info->version);
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "w")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
|
||||||
retval = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
if(info->files) {
|
|
||||||
fprintf(fp, "%%FILES%%\n");
|
|
||||||
for(lp = info->files; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(info->backup) {
|
|
||||||
fprintf(fp, "%%BACKUP%%\n");
|
|
||||||
for(lp = info->backup; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DEPENDS */
|
|
||||||
if(inforeq & INFRQ_DEPENDS) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DEPENDS information back to db\n",
|
|
||||||
info->name, info->version);
|
|
||||||
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
|
|
||||||
if((fp = fopen(path, "w")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
|
||||||
retval = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
if(info->depends) {
|
|
||||||
fputs("%DEPENDS%\n", fp);
|
|
||||||
for(lp = info->depends; lp; lp = lp->next) {
|
|
||||||
char *depstring = alpm_dep_get_string(lp->data);
|
|
||||||
fprintf(fp, "%s\n", depstring);
|
|
||||||
free(depstring);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(info->optdepends) {
|
|
||||||
fputs("%OPTDEPENDS%\n", fp);
|
|
||||||
for(lp = info->optdepends; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(info->conflicts) {
|
|
||||||
fputs("%CONFLICTS%\n", fp);
|
|
||||||
for(lp = info->conflicts; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(info->provides) {
|
|
||||||
fputs("%PROVIDES%\n", fp);
|
|
||||||
for(lp = info->provides; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(!local) {
|
|
||||||
if(info->replaces) {
|
|
||||||
fputs("%REPLACES%\n", fp);
|
|
||||||
for(lp = info->replaces; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
}
|
|
||||||
if(info->force) {
|
|
||||||
fprintf(fp, "%%FORCE%%\n"
|
|
||||||
"\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* INSTALL */
|
|
||||||
/* nothing needed here (script is automatically extracted) */
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
umask(oldmask);
|
|
||||||
|
|
||||||
if(fp) {
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info)
|
|
||||||
{
|
|
||||||
char path[PATH_MAX];
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || info == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_NULL, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s-%s", db->path, info->name, info->version);
|
|
||||||
if(_alpm_rmrf(path) == -1) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the last update time as number of seconds from the epoch.
|
|
||||||
* Returns 0 if the value is unknown or can't be read.
|
|
||||||
*/
|
|
||||||
time_t _alpm_db_getlastupdate(const pmdb_t *db)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char file[PATH_MAX];
|
|
||||||
time_t ret = 0;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(file, PATH_MAX, "%s.lastupdate", db->path);
|
|
||||||
|
|
||||||
/* get the last update time, if it's there */
|
|
||||||
if((fp = fopen(file, "r")) == NULL) {
|
|
||||||
return(ret);
|
|
||||||
} else {
|
|
||||||
char line[64];
|
|
||||||
if(fgets(line, sizeof(line), fp)) {
|
|
||||||
ret = atol(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* writes the dbpath/.lastupdate file with the value in time
|
|
||||||
*/
|
|
||||||
int _alpm_db_setlastupdate(const pmdb_t *db, time_t time)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char file[PATH_MAX];
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || time == 0) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(file, PATH_MAX, "%s.lastupdate", db->path);
|
|
||||||
|
|
||||||
if((fp = fopen(file, "w")) == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if(fprintf(fp, "%ju", (uintmax_t)time) <= 0) {
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
|
||||||
1007
lib/libalpm/be_local.c
Normal file
1007
lib/libalpm/be_local.c
Normal file
File diff suppressed because it is too large
Load Diff
388
lib/libalpm/be_package.c
Normal file
388
lib/libalpm/be_package.c
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
/*
|
||||||
|
* be_package.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "package.h"
|
||||||
|
#include "deps.h" /* _alpm_splitdep */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a package changelog for reading. Similar to fopen in functionality,
|
||||||
|
* except that the returned 'file stream' is from an archive.
|
||||||
|
* @param pkg the package (file) to read the changelog
|
||||||
|
* @return a 'file stream' to the package changelog
|
||||||
|
*/
|
||||||
|
static void *_package_changelog_open(pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
ASSERT(pkg != NULL, return(NULL));
|
||||||
|
|
||||||
|
struct archive *archive = NULL;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
const char *pkgfile = pkg->origin_data.file;
|
||||||
|
|
||||||
|
if((archive = archive_read_new()) == NULL) {
|
||||||
|
RET_ERR(PM_ERR_LIBARCHIVE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
archive_read_support_compression_all(archive);
|
||||||
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
|
if (archive_read_open_filename(archive, pkgfile,
|
||||||
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
|
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
|
const char *entry_name = archive_entry_pathname(entry);
|
||||||
|
|
||||||
|
if(strcmp(entry_name, ".CHANGELOG") == 0) {
|
||||||
|
return(archive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* we didn't find a changelog */
|
||||||
|
archive_read_finish(archive);
|
||||||
|
errno = ENOENT;
|
||||||
|
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data from an open changelog 'file stream'. Similar to fread in
|
||||||
|
* functionality, this function takes a buffer and amount of data to read.
|
||||||
|
* @param ptr a buffer to fill with raw changelog data
|
||||||
|
* @param size the size of the buffer
|
||||||
|
* @param pkg the package that the changelog is being read from
|
||||||
|
* @param fp a 'file stream' to the package changelog
|
||||||
|
* @return the number of characters read, or 0 if there is no more data
|
||||||
|
*/
|
||||||
|
static size_t _package_changelog_read(void *ptr, size_t size,
|
||||||
|
const pmpkg_t *pkg, const void *fp)
|
||||||
|
{
|
||||||
|
ssize_t sret = archive_read_data((struct archive*)fp, ptr, size);
|
||||||
|
/* Report error (negative values) */
|
||||||
|
if(sret < 0) {
|
||||||
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
|
return(0);
|
||||||
|
} else {
|
||||||
|
return((size_t)sret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static int _package_changelog_feof(const pmpkg_t *pkg, void *fp)
|
||||||
|
{
|
||||||
|
// note: this doesn't quite work, no feof in libarchive
|
||||||
|
return( archive_read_data((struct archive*)fp, NULL, 0) );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close a package changelog for reading. Similar to fclose in functionality,
|
||||||
|
* except that the 'file stream' is from an archive.
|
||||||
|
* @param pkg the package (file) that the changelog was read from
|
||||||
|
* @param fp a 'file stream' to the package changelog
|
||||||
|
* @return whether closing the package changelog stream was successful
|
||||||
|
*/
|
||||||
|
static int _package_changelog_close(const pmpkg_t *pkg, void *fp)
|
||||||
|
{
|
||||||
|
return( archive_read_finish((struct archive *)fp) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Package file operations struct accessor. We implement this as a method
|
||||||
|
* rather than a static struct as in be_files because we want to reuse the
|
||||||
|
* majority of the default_pkg_ops struct and add only a few operations of
|
||||||
|
* our own on top.
|
||||||
|
*/
|
||||||
|
static struct pkg_operations *get_file_pkg_ops(void)
|
||||||
|
{
|
||||||
|
static struct pkg_operations file_pkg_ops;
|
||||||
|
static int file_pkg_ops_initialized = 0;
|
||||||
|
if(!file_pkg_ops_initialized) {
|
||||||
|
file_pkg_ops = default_pkg_ops;
|
||||||
|
file_pkg_ops.changelog_open = _package_changelog_open;
|
||||||
|
file_pkg_ops.changelog_read = _package_changelog_read;
|
||||||
|
file_pkg_ops.changelog_close = _package_changelog_close;
|
||||||
|
file_pkg_ops_initialized = 1;
|
||||||
|
}
|
||||||
|
return(&file_pkg_ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the package description file for a package into a pmpkg_t struct.
|
||||||
|
* @param archive the archive to read from, pointed at the .PKGINFO entry
|
||||||
|
* @param newpkg an empty pmpkg_t struct to fill with package info
|
||||||
|
*
|
||||||
|
* @return 0 on success, 1 on error
|
||||||
|
*/
|
||||||
|
static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
|
||||||
|
{
|
||||||
|
char *ptr = NULL;
|
||||||
|
char *key = NULL;
|
||||||
|
int linenum = 0;
|
||||||
|
struct archive_read_buffer buf;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
memset(&buf, 0, sizeof(buf));
|
||||||
|
/* 512K for a line length seems reasonable */
|
||||||
|
buf.max_line_size = 512 * 1024;
|
||||||
|
|
||||||
|
/* loop until we reach EOF or other error */
|
||||||
|
while(_alpm_archive_fgets(a, &buf) == ARCHIVE_OK) {
|
||||||
|
char *line = _alpm_strtrim(buf.line);
|
||||||
|
|
||||||
|
linenum++;
|
||||||
|
if(strlen(line) == 0 || line[0] == '#') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ptr = line;
|
||||||
|
key = strsep(&ptr, "=");
|
||||||
|
if(key == NULL || ptr == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
|
||||||
|
newpkg->name ? newpkg->name : "error", linenum);
|
||||||
|
} else {
|
||||||
|
key = _alpm_strtrim(key);
|
||||||
|
while(*ptr == ' ') ptr++;
|
||||||
|
ptr = _alpm_strtrim(ptr);
|
||||||
|
if(strcmp(key, "pkgname") == 0) {
|
||||||
|
STRDUP(newpkg->name, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
newpkg->name_hash = _alpm_hash_sdbm(newpkg->name);
|
||||||
|
} else if(strcmp(key, "pkgbase") == 0) {
|
||||||
|
/* not used atm */
|
||||||
|
} else if(strcmp(key, "pkgver") == 0) {
|
||||||
|
STRDUP(newpkg->version, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
} else if(strcmp(key, "pkgdesc") == 0) {
|
||||||
|
STRDUP(newpkg->desc, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
} else if(strcmp(key, "group") == 0) {
|
||||||
|
newpkg->groups = alpm_list_add(newpkg->groups, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "url") == 0) {
|
||||||
|
STRDUP(newpkg->url, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
} else if(strcmp(key, "license") == 0) {
|
||||||
|
newpkg->licenses = alpm_list_add(newpkg->licenses, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "builddate") == 0) {
|
||||||
|
newpkg->builddate = _alpm_parsedate(ptr);
|
||||||
|
} else if(strcmp(key, "packager") == 0) {
|
||||||
|
STRDUP(newpkg->packager, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
} else if(strcmp(key, "arch") == 0) {
|
||||||
|
STRDUP(newpkg->arch, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
} else if(strcmp(key, "size") == 0) {
|
||||||
|
/* size in the raw package is uncompressed (installed) size */
|
||||||
|
newpkg->isize = atol(ptr);
|
||||||
|
} else if(strcmp(key, "depend") == 0) {
|
||||||
|
pmdepend_t *dep = _alpm_splitdep(ptr);
|
||||||
|
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
||||||
|
} else if(strcmp(key, "optdepend") == 0) {
|
||||||
|
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "conflict") == 0) {
|
||||||
|
newpkg->conflicts = alpm_list_add(newpkg->conflicts, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "replaces") == 0) {
|
||||||
|
newpkg->replaces = alpm_list_add(newpkg->replaces, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "provides") == 0) {
|
||||||
|
newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "backup") == 0) {
|
||||||
|
newpkg->backup = alpm_list_add(newpkg->backup, strdup(ptr));
|
||||||
|
} else if(strcmp(key, "force") == 0) {
|
||||||
|
/* deprecated, skip it */
|
||||||
|
} else if(strcmp(key, "makepkgopt") == 0) {
|
||||||
|
/* not used atm */
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
|
||||||
|
newpkg->name ? newpkg->name : "error", key, linenum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
line[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a package and create the corresponding pmpkg_t struct.
|
||||||
|
* @param pkgfile path to the package file
|
||||||
|
* @param full whether to stop the load after metadata is read or continue
|
||||||
|
* through the full archive
|
||||||
|
* @return An information filled pmpkg_t struct
|
||||||
|
*/
|
||||||
|
static pmpkg_t *pkg_load(const char *pkgfile, int full)
|
||||||
|
{
|
||||||
|
int ret = ARCHIVE_OK;
|
||||||
|
int config = 0;
|
||||||
|
struct archive *archive;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
pmpkg_t *newpkg = NULL;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(pkgfile == NULL || strlen(pkgfile) == 0) {
|
||||||
|
RET_ERR(PM_ERR_WRONG_ARGS, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stat(pkgfile, &st) != 0) {
|
||||||
|
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((archive = archive_read_new()) == NULL) {
|
||||||
|
RET_ERR(PM_ERR_LIBARCHIVE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
archive_read_support_compression_all(archive);
|
||||||
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
|
if (archive_read_open_filename(archive, pkgfile,
|
||||||
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
|
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
newpkg = _alpm_pkg_new();
|
||||||
|
if(newpkg == NULL) {
|
||||||
|
archive_read_finish(archive);
|
||||||
|
RET_ERR(PM_ERR_MEMORY, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
newpkg->filename = strdup(pkgfile);
|
||||||
|
newpkg->size = st.st_size;
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
|
||||||
|
|
||||||
|
/* If full is false, only read through the archive until we find our needed
|
||||||
|
* metadata. If it is true, read through the entire archive, which serves
|
||||||
|
* as a verfication of integrity and allows us to create the filelist. */
|
||||||
|
while((ret = archive_read_next_header(archive, &entry)) == ARCHIVE_OK) {
|
||||||
|
const char *entry_name = archive_entry_pathname(entry);
|
||||||
|
|
||||||
|
if(strcmp(entry_name, ".PKGINFO") == 0) {
|
||||||
|
/* parse the info file */
|
||||||
|
if(parse_descfile(archive, newpkg) != 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not parse package description file in %s\n"),
|
||||||
|
pkgfile);
|
||||||
|
goto pkg_invalid;
|
||||||
|
}
|
||||||
|
if(newpkg->name == NULL || strlen(newpkg->name) == 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("missing package name in %s\n"), pkgfile);
|
||||||
|
goto pkg_invalid;
|
||||||
|
}
|
||||||
|
if(newpkg->version == NULL || strlen(newpkg->version) == 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
|
||||||
|
goto pkg_invalid;
|
||||||
|
}
|
||||||
|
config = 1;
|
||||||
|
continue;
|
||||||
|
} else if(strcmp(entry_name, ".INSTALL") == 0) {
|
||||||
|
newpkg->scriptlet = 1;
|
||||||
|
} else if(*entry_name == '.') {
|
||||||
|
/* for now, ignore all files starting with '.' that haven't
|
||||||
|
* already been handled (for future possibilities) */
|
||||||
|
} else if(full) {
|
||||||
|
/* Keep track of all files for filelist generation */
|
||||||
|
newpkg->files = alpm_list_add(newpkg->files, strdup(entry_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(archive_read_data_skip(archive)) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
|
pkgfile, archive_error_string(archive));
|
||||||
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we are not doing a full read, see if we have all we need */
|
||||||
|
if(!full && config) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
|
pkgfile, archive_error_string(archive));
|
||||||
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!config) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("missing package metadata in %s\n"), pkgfile);
|
||||||
|
goto pkg_invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
archive_read_finish(archive);
|
||||||
|
|
||||||
|
/* internal fields for package struct */
|
||||||
|
newpkg->origin = PKG_FROM_FILE;
|
||||||
|
/* TODO eventually kill/move this? */
|
||||||
|
newpkg->origin_data.file = strdup(pkgfile);
|
||||||
|
newpkg->ops = get_file_pkg_ops();
|
||||||
|
|
||||||
|
if(full) {
|
||||||
|
/* "checking for conflicts" requires a sorted list, ensure that here */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
|
||||||
|
newpkg->files = alpm_list_msort(newpkg->files, alpm_list_count(newpkg->files),
|
||||||
|
_alpm_str_cmp);
|
||||||
|
newpkg->infolevel = INFRQ_ALL;
|
||||||
|
} else {
|
||||||
|
/* get rid of any partial filelist we may have collected, it is invalid */
|
||||||
|
FREELIST(newpkg->files);
|
||||||
|
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(newpkg);
|
||||||
|
|
||||||
|
pkg_invalid:
|
||||||
|
pm_errno = PM_ERR_PKG_INVALID;
|
||||||
|
error:
|
||||||
|
_alpm_pkg_free(newpkg);
|
||||||
|
archive_read_finish(archive);
|
||||||
|
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_pkg_load(const char *filename, int full, pmpkg_t **pkg)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(filename != NULL && strlen(filename) != 0,
|
||||||
|
RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
*pkg = pkg_load(filename, full);
|
||||||
|
if(*pkg == NULL) {
|
||||||
|
/* pm_errno is set by pkg_load */
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
514
lib/libalpm/be_sync.c
Normal file
514
lib/libalpm/be_sync.c
Normal file
@@ -0,0 +1,514 @@
|
|||||||
|
/*
|
||||||
|
* be_sync.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "package.h"
|
||||||
|
#include "handle.h"
|
||||||
|
#include "delta.h"
|
||||||
|
#include "deps.h"
|
||||||
|
#include "dload.h"
|
||||||
|
|
||||||
|
/** Update a package database
|
||||||
|
*
|
||||||
|
* An update of the package database \a db will be attempted. Unless
|
||||||
|
* \a force is true, the update will only be performed if the remote
|
||||||
|
* database was modified since the last update.
|
||||||
|
*
|
||||||
|
* A transaction is necessary for this operation, in order to obtain a
|
||||||
|
* database lock. During this transaction the front-end will be informed
|
||||||
|
* of the download progress of the database via the download callback.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* alpm_list_t *syncs = alpm_option_get_syncdbs();
|
||||||
|
* if(alpm_trans_init(0, NULL, NULL, NULL) == 0) {
|
||||||
|
* for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
|
* pmdb_t *db = alpm_list_getdata(i);
|
||||||
|
* result = alpm_db_update(0, db);
|
||||||
|
* alpm_trans_release();
|
||||||
|
*
|
||||||
|
* if(result < 0) {
|
||||||
|
* printf("Unable to update database: %s\n", alpm_strerrorlast());
|
||||||
|
* } else if(result == 1) {
|
||||||
|
* printf("Database already up to date\n");
|
||||||
|
* } else {
|
||||||
|
* printf("Database updated\n");
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @ingroup alpm_databases
|
||||||
|
* @note After a successful update, the \link alpm_db_get_pkgcache()
|
||||||
|
* package cache \endlink will be invalidated
|
||||||
|
* @param force if true, then forces the update, otherwise update only in case
|
||||||
|
* the database isn't up to date
|
||||||
|
* @param db pointer to the package database to update
|
||||||
|
* @return 0 on success, -1 on error (pm_errno is set accordingly), 1 if up to
|
||||||
|
* to date
|
||||||
|
*/
|
||||||
|
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
|
{
|
||||||
|
char *dbfile, *syncpath;
|
||||||
|
const char *dbpath;
|
||||||
|
struct stat buf;
|
||||||
|
size_t len;
|
||||||
|
int ret;
|
||||||
|
mode_t oldmask;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
|
||||||
|
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
len = strlen(db->treename) + 4;
|
||||||
|
MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
sprintf(dbfile, "%s.db", db->treename);
|
||||||
|
|
||||||
|
dbpath = alpm_option_get_dbpath();
|
||||||
|
len = strlen(dbpath) + 6;
|
||||||
|
MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
sprintf(syncpath, "%s%s", dbpath, "sync/");
|
||||||
|
|
||||||
|
/* make sure we have a sane umask */
|
||||||
|
oldmask = umask(0022);
|
||||||
|
|
||||||
|
if(stat(syncpath, &buf) != 0) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
||||||
|
syncpath);
|
||||||
|
if(_alpm_makepath(syncpath) != 0) {
|
||||||
|
free(dbfile);
|
||||||
|
free(syncpath);
|
||||||
|
RET_ERR(PM_ERR_SYSTEM, -1);
|
||||||
|
}
|
||||||
|
} else if(!S_ISDIR(buf.st_mode)) {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath);
|
||||||
|
if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
|
||||||
|
free(dbfile);
|
||||||
|
free(syncpath);
|
||||||
|
RET_ERR(PM_ERR_SYSTEM, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
|
||||||
|
free(dbfile);
|
||||||
|
free(syncpath);
|
||||||
|
umask(oldmask);
|
||||||
|
|
||||||
|
if(ret == 1) {
|
||||||
|
/* files match, do nothing */
|
||||||
|
pm_errno = 0;
|
||||||
|
return(1);
|
||||||
|
} else if(ret == -1) {
|
||||||
|
/* pm_errno was set by the download code */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerrorlast());
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cache needs to be rebuilt */
|
||||||
|
_alpm_db_free_pkgcache(db);
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Forward decl so I don't reorganize the whole file right now */
|
||||||
|
static int sync_db_read(pmdb_t *db, struct archive *archive,
|
||||||
|
struct archive_entry *entry, pmpkg_t *likely_pkg);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the data table used to generate the estimating function below.
|
||||||
|
* "Weighted Avg" means averaging the bottom table values; thus each repo, big
|
||||||
|
* or small, will have equal influence. "Unweighted Avg" means averaging the
|
||||||
|
* sums of the top table columns, thus each package has equal influence. The
|
||||||
|
* final values are calculated by (surprise) averaging the averages, because
|
||||||
|
* why the hell not.
|
||||||
|
*
|
||||||
|
* Database Pkgs tar bz2 gz xz
|
||||||
|
* community 2096 5294080 256391 421227 301296
|
||||||
|
* core 180 460800 25257 36850 29356
|
||||||
|
* extra 2606 6635520 294647 470818 339392
|
||||||
|
* multilib 126 327680 16120 23261 18732
|
||||||
|
* testing 76 204800 10902 14348 12100
|
||||||
|
*
|
||||||
|
* Bytes Per Package
|
||||||
|
* community 2096 2525.80 122.32 200.97 143.75
|
||||||
|
* core 180 2560.00 140.32 204.72 163.09
|
||||||
|
* extra 2606 2546.25 113.06 180.67 130.23
|
||||||
|
* multilib 126 2600.63 127.94 184.61 148.67
|
||||||
|
* testing 76 2694.74 143.45 188.79 159.21
|
||||||
|
|
||||||
|
* Weighted Avg 2585.48 129.42 191.95 148.99
|
||||||
|
* Unweighted Avg 2543.39 118.74 190.16 137.93
|
||||||
|
* Average of Avgs 2564.44 124.08 191.06 143.46
|
||||||
|
*/
|
||||||
|
static size_t estimate_package_count(struct stat *st, struct archive *archive)
|
||||||
|
{
|
||||||
|
unsigned int per_package;
|
||||||
|
|
||||||
|
switch(archive_compression(archive)) {
|
||||||
|
case ARCHIVE_COMPRESSION_NONE:
|
||||||
|
per_package = 2564;
|
||||||
|
break;
|
||||||
|
case ARCHIVE_COMPRESSION_GZIP:
|
||||||
|
per_package = 191;
|
||||||
|
break;
|
||||||
|
case ARCHIVE_COMPRESSION_BZIP2:
|
||||||
|
per_package = 124;
|
||||||
|
break;
|
||||||
|
case ARCHIVE_COMPRESSION_COMPRESS:
|
||||||
|
per_package = 193;
|
||||||
|
break;
|
||||||
|
case ARCHIVE_COMPRESSION_LZMA:
|
||||||
|
case ARCHIVE_COMPRESSION_XZ:
|
||||||
|
per_package = 143;
|
||||||
|
break;
|
||||||
|
#ifdef ARCHIVE_COMPRESSION_UU
|
||||||
|
case ARCHIVE_COMPRESSION_UU:
|
||||||
|
per_package = 3543;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
/* assume it is at least somewhat compressed */
|
||||||
|
per_package = 200;
|
||||||
|
}
|
||||||
|
return((size_t)(st->st_size / per_package) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sync_db_populate(pmdb_t *db)
|
||||||
|
{
|
||||||
|
const char *dbpath;
|
||||||
|
size_t est_count;
|
||||||
|
int count = 0;
|
||||||
|
struct stat buf;
|
||||||
|
struct archive *archive;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
pmpkg_t *pkg = NULL;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
||||||
|
|
||||||
|
if((archive = archive_read_new()) == NULL)
|
||||||
|
RET_ERR(PM_ERR_LIBARCHIVE, 1);
|
||||||
|
|
||||||
|
archive_read_support_compression_all(archive);
|
||||||
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
|
dbpath = _alpm_db_path(db);
|
||||||
|
if(!dbpath) {
|
||||||
|
/* pm_errno set in _alpm_db_path() */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "opening database archive %s\n", dbpath);
|
||||||
|
|
||||||
|
if(archive_read_open_filename(archive, dbpath,
|
||||||
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), dbpath,
|
||||||
|
archive_error_string(archive));
|
||||||
|
archive_read_finish(archive);
|
||||||
|
RET_ERR(PM_ERR_DB_OPEN, 1);
|
||||||
|
}
|
||||||
|
if(stat(dbpath, &buf) != 0) {
|
||||||
|
RET_ERR(PM_ERR_DB_OPEN, 1);
|
||||||
|
}
|
||||||
|
est_count = estimate_package_count(&buf, archive);
|
||||||
|
|
||||||
|
/* initialize hash at 66% full */
|
||||||
|
db->pkgcache = _alpm_pkghash_create(est_count * 3 / 2);
|
||||||
|
if(db->pkgcache == NULL) {
|
||||||
|
RET_ERR(PM_ERR_MEMORY, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
|
const struct stat *st;
|
||||||
|
|
||||||
|
st = archive_entry_stat(entry);
|
||||||
|
|
||||||
|
if(S_ISDIR(st->st_mode)) {
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
pkg = _alpm_pkg_new();
|
||||||
|
if(pkg == NULL) {
|
||||||
|
archive_read_finish(archive);
|
||||||
|
RET_ERR(PM_ERR_MEMORY, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
name = archive_entry_pathname(entry);
|
||||||
|
|
||||||
|
if(_alpm_splitname(name, pkg) != 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
|
||||||
|
name);
|
||||||
|
_alpm_pkg_free(pkg);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* duplicated database entries are not allowed */
|
||||||
|
if(_alpm_pkghash_find(db->pkgcache, pkg->name)) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("duplicated database entry '%s'\n"), pkg->name);
|
||||||
|
_alpm_pkg_free(pkg);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg->origin = PKG_FROM_SYNCDB;
|
||||||
|
pkg->ops = &default_pkg_ops;
|
||||||
|
pkg->origin_data.db = db;
|
||||||
|
|
||||||
|
/* add to the collection */
|
||||||
|
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
|
||||||
|
pkg->name, db->treename);
|
||||||
|
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
|
||||||
|
count++;
|
||||||
|
} else {
|
||||||
|
/* we have desc, depends or deltas - parse it */
|
||||||
|
sync_db_read(db, archive, entry, pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count > 0) {
|
||||||
|
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
|
||||||
|
}
|
||||||
|
archive_read_finish(archive);
|
||||||
|
|
||||||
|
return(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define READ_NEXT(s) do { \
|
||||||
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
|
s = _alpm_strtrim(buf.line); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define READ_AND_STORE(f) do { \
|
||||||
|
READ_NEXT(line); \
|
||||||
|
STRDUP(f, line, goto error); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define READ_AND_STORE_ALL(f) do { \
|
||||||
|
char *linedup; \
|
||||||
|
READ_NEXT(line); \
|
||||||
|
if(strlen(line) == 0) break; \
|
||||||
|
STRDUP(linedup, line, goto error); \
|
||||||
|
f = alpm_list_add(f, linedup); \
|
||||||
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
|
static int sync_db_read(pmdb_t *db, struct archive *archive,
|
||||||
|
struct archive_entry *entry, pmpkg_t *likely_pkg)
|
||||||
|
{
|
||||||
|
const char *entryname = NULL, *filename;
|
||||||
|
char *pkgname, *p, *q;
|
||||||
|
pmpkg_t *pkg;
|
||||||
|
struct archive_read_buffer buf;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(db == NULL) {
|
||||||
|
RET_ERR(PM_ERR_DB_NULL, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(entry != NULL) {
|
||||||
|
entryname = archive_entry_pathname(entry);
|
||||||
|
}
|
||||||
|
if(entryname == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "invalid archive entry provided to _alpm_sync_db_read, skipping\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_FUNCTION, "loading package data from archive entry %s\n",
|
||||||
|
entryname);
|
||||||
|
|
||||||
|
memset(&buf, 0, sizeof(buf));
|
||||||
|
/* 512K for a line length seems reasonable */
|
||||||
|
buf.max_line_size = 512 * 1024;
|
||||||
|
|
||||||
|
/* get package and db file names */
|
||||||
|
STRDUP(pkgname, entryname, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
p = pkgname + strlen(pkgname);
|
||||||
|
for(q = --p; *q && *q != '/'; q--);
|
||||||
|
filename = q + 1;
|
||||||
|
for(p = --q; *p && *p != '-'; p--);
|
||||||
|
for(q = --p; *q && *q != '-'; q--);
|
||||||
|
*q = '\0';
|
||||||
|
|
||||||
|
/* package is already in db due to parsing of directory name */
|
||||||
|
if(likely_pkg && strcmp(likely_pkg->name, pkgname) == 0) {
|
||||||
|
pkg = likely_pkg;
|
||||||
|
} else {
|
||||||
|
if(db->pkgcache == NULL) {
|
||||||
|
RET_ERR(PM_ERR_MEMORY, -1);
|
||||||
|
}
|
||||||
|
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);
|
||||||
|
}
|
||||||
|
if(pkg == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "package %s not found in %s sync database",
|
||||||
|
pkgname, db->treename);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
|
||||||
|
|| strcmp(filename, "deltas") == 0) {
|
||||||
|
while(_alpm_archive_fgets(archive, &buf) == ARCHIVE_OK) {
|
||||||
|
char *line = _alpm_strtrim(buf.line);
|
||||||
|
|
||||||
|
if(strcmp(line, "%NAME%") == 0) {
|
||||||
|
READ_NEXT(line);
|
||||||
|
if(strcmp(line, pkg->name) != 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
|
||||||
|
"mismatch on package %s\n"), db->treename, pkg->name);
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%VERSION%") == 0) {
|
||||||
|
READ_NEXT(line);
|
||||||
|
if(strcmp(line, pkg->version) != 0) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
|
||||||
|
"mismatch on package %s\n"), db->treename, pkg->name);
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%FILENAME%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->filename);
|
||||||
|
} else if(strcmp(line, "%DESC%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->desc);
|
||||||
|
} else if(strcmp(line, "%GROUPS%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->groups);
|
||||||
|
} else if(strcmp(line, "%URL%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->url);
|
||||||
|
} else if(strcmp(line, "%LICENSE%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->licenses);
|
||||||
|
} else if(strcmp(line, "%ARCH%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->arch);
|
||||||
|
} else if(strcmp(line, "%BUILDDATE%") == 0) {
|
||||||
|
READ_NEXT(line);
|
||||||
|
pkg->builddate = _alpm_parsedate(line);
|
||||||
|
} else if(strcmp(line, "%PACKAGER%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->packager);
|
||||||
|
} else if(strcmp(line, "%CSIZE%") == 0) {
|
||||||
|
/* Note: the CSIZE and SIZE fields both share the "size" field in the
|
||||||
|
* pkginfo_t struct. This can be done b/c CSIZE is currently only used
|
||||||
|
* in sync databases, and SIZE is only used in local databases.
|
||||||
|
*/
|
||||||
|
READ_NEXT(line);
|
||||||
|
pkg->size = atol(line);
|
||||||
|
/* also store this value to isize if isize is unset */
|
||||||
|
if(pkg->isize == 0) {
|
||||||
|
pkg->isize = pkg->size;
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%ISIZE%") == 0) {
|
||||||
|
READ_NEXT(line);
|
||||||
|
pkg->isize = atol(line);
|
||||||
|
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->md5sum);
|
||||||
|
} else if(strcmp(line, "%SHA256SUM%") == 0) {
|
||||||
|
/* we don't do anything with this value right now */
|
||||||
|
READ_NEXT(line);
|
||||||
|
} else if(strcmp(line, "%PGPSIG%") == 0) {
|
||||||
|
/* we don't do anything with this value right now */
|
||||||
|
READ_NEXT(line);
|
||||||
|
} else if(strcmp(line, "%REPLACES%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->replaces);
|
||||||
|
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
||||||
|
/* Different than the rest because of the _alpm_splitdep call. */
|
||||||
|
while(1) {
|
||||||
|
READ_NEXT(line);
|
||||||
|
if(strlen(line) == 0) break;
|
||||||
|
pkg->depends = alpm_list_add(pkg->depends, _alpm_splitdep(line));
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->optdepends);
|
||||||
|
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->conflicts);
|
||||||
|
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->provides);
|
||||||
|
} else if(strcmp(line, "%DELTAS%") == 0) {
|
||||||
|
/* Different than the rest because of the _alpm_delta_parse call. */
|
||||||
|
while(1) {
|
||||||
|
READ_NEXT(line);
|
||||||
|
if(strlen(line) == 0) break;
|
||||||
|
pkg->deltas = alpm_list_add(pkg->deltas, _alpm_delta_parse(line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(strcmp(filename, "files") == 0) {
|
||||||
|
/* currently do nothing with this file */
|
||||||
|
} else {
|
||||||
|
/* unknown database file */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "unknown database file: %s\n", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
FREE(pkgname);
|
||||||
|
/* TODO: return 0 always? */
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sync_db_version(pmdb_t *db)
|
||||||
|
{
|
||||||
|
return(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct db_operations sync_db_ops = {
|
||||||
|
.populate = sync_db_populate,
|
||||||
|
.unregister = _alpm_db_unregister,
|
||||||
|
.version = sync_db_version,
|
||||||
|
};
|
||||||
|
|
||||||
|
pmdb_t *_alpm_db_register_sync(const char *treename)
|
||||||
|
{
|
||||||
|
pmdb_t *db;
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
for(i = handle->dbs_sync; i; i = i->next) {
|
||||||
|
pmdb_t *sdb = i->data;
|
||||||
|
if(strcmp(treename, sdb->treename) == 0) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "attempt to re-register the '%s' database, using existing\n", sdb->treename);
|
||||||
|
return sdb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
||||||
|
|
||||||
|
db = _alpm_db_new(treename, 0);
|
||||||
|
if(db == NULL) {
|
||||||
|
RET_ERR(PM_ERR_DB_CREATE, NULL);
|
||||||
|
}
|
||||||
|
db->ops = &sync_db_ops;
|
||||||
|
|
||||||
|
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
|
||||||
|
return(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,301 +0,0 @@
|
|||||||
/*
|
|
||||||
* cache.c
|
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
|
||||||
*
|
|
||||||
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* libalpm */
|
|
||||||
#include "cache.h"
|
|
||||||
#include "alpm_list.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "alpm.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "package.h"
|
|
||||||
#include "group.h"
|
|
||||||
#include "db.h"
|
|
||||||
|
|
||||||
/* Returns a new package cache from db.
|
|
||||||
* It frees the cache if it already exists.
|
|
||||||
*/
|
|
||||||
int _alpm_db_load_pkgcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
pmpkg_t *info;
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_db_free_pkgcache(db);
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'\n",
|
|
||||||
db->treename);
|
|
||||||
|
|
||||||
_alpm_db_rewind(db);
|
|
||||||
while((info = _alpm_db_scan(db, NULL)) != NULL) {
|
|
||||||
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
|
|
||||||
alpm_pkg_get_name(info), db->treename);
|
|
||||||
info->origin = PKG_FROM_CACHE;
|
|
||||||
info->origin_data.db = db;
|
|
||||||
/* add to the collection */
|
|
||||||
db->pkgcache = alpm_list_add(db->pkgcache, info);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _alpm_db_free_pkgcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || db->pkgcache == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'\n",
|
|
||||||
db->treename);
|
|
||||||
|
|
||||||
alpm_list_t *tmp;
|
|
||||||
for(tmp = db->pkgcache; tmp; tmp = alpm_list_next(tmp)) {
|
|
||||||
_alpm_pkg_free(tmp->data);
|
|
||||||
}
|
|
||||||
alpm_list_free(db->pkgcache);
|
|
||||||
db->pkgcache = NULL;
|
|
||||||
|
|
||||||
if(db->grpcache) {
|
|
||||||
_alpm_db_free_grpcache(db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!db->pkgcache) {
|
|
||||||
_alpm_db_load_pkgcache(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* hmmm, still NULL ?*/
|
|
||||||
if(!db->pkgcache) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "error: pkgcache is NULL for db '%s'\n", db->treename);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(db->pkgcache);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
|
|
||||||
{
|
|
||||||
pmpkg_t *newpkg;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || pkg == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
newpkg = _alpm_pkg_dup(pkg);
|
|
||||||
if(newpkg == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
|
|
||||||
alpm_pkg_get_name(newpkg), db->treename);
|
|
||||||
db->pkgcache = alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
|
|
||||||
|
|
||||||
_alpm_db_free_grpcache(db);
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
|
|
||||||
{
|
|
||||||
void *vdata;
|
|
||||||
pmpkg_t *data;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || pkg == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
|
|
||||||
alpm_pkg_get_name(pkg), db->treename);
|
|
||||||
|
|
||||||
db->pkgcache = alpm_list_remove(db->pkgcache, pkg, _alpm_pkg_cmp, &vdata);
|
|
||||||
data = vdata;
|
|
||||||
if(data == NULL) {
|
|
||||||
/* package not found */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
|
|
||||||
alpm_pkg_get_name(pkg), db->treename);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_pkg_free(data);
|
|
||||||
|
|
||||||
_alpm_db_free_grpcache(db);
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_t *pkgcache = _alpm_db_get_pkgcache(db);
|
|
||||||
if(!pkgcache) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "error: failed to get '%s' from NULL pkgcache\n",
|
|
||||||
target);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(_alpm_pkg_find(target, pkgcache));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns a new group cache from db.
|
|
||||||
*/
|
|
||||||
int _alpm_db_load_grpcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
alpm_list_t *lp;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(db->pkgcache == NULL) {
|
|
||||||
_alpm_db_load_pkgcache(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'\n",
|
|
||||||
db->treename);
|
|
||||||
|
|
||||||
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
|
|
||||||
const alpm_list_t *i;
|
|
||||||
pmpkg_t *pkg = lp->data;
|
|
||||||
|
|
||||||
for(i = alpm_pkg_get_groups(pkg); i; i = i->next) {
|
|
||||||
if(!alpm_list_find_str(db->grpcache, i->data)) {
|
|
||||||
pmgrp_t *grp = _alpm_grp_new();
|
|
||||||
|
|
||||||
strncpy(grp->name, i->data, GRP_NAME_LEN);
|
|
||||||
grp->name[GRP_NAME_LEN-1] = '\0';
|
|
||||||
grp->packages = alpm_list_add_sorted(grp->packages,
|
|
||||||
/* gross signature forces us to
|
|
||||||
* discard const */
|
|
||||||
(void*)alpm_pkg_get_name(pkg),
|
|
||||||
_alpm_str_cmp);
|
|
||||||
db->grpcache = alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp);
|
|
||||||
} else {
|
|
||||||
alpm_list_t *j;
|
|
||||||
|
|
||||||
for(j = db->grpcache; j; j = j->next) {
|
|
||||||
pmgrp_t *grp = j->data;
|
|
||||||
|
|
||||||
if(strcmp(grp->name, i->data) == 0) {
|
|
||||||
const char *pkgname = alpm_pkg_get_name(pkg);
|
|
||||||
if(!alpm_list_find_str(grp->packages, pkgname)) {
|
|
||||||
grp->packages = alpm_list_add_sorted(grp->packages,
|
|
||||||
(void*)pkgname,
|
|
||||||
_alpm_str_cmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _alpm_db_free_grpcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
alpm_list_t *lg;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || db->grpcache == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(lg = db->grpcache; lg; lg = lg->next) {
|
|
||||||
pmgrp_t *grp = lg->data;
|
|
||||||
|
|
||||||
alpm_list_free(grp->packages);
|
|
||||||
grp->packages = NULL;
|
|
||||||
_alpm_grp_free(lg->data);
|
|
||||||
lg->data = NULL;
|
|
||||||
}
|
|
||||||
FREELIST(db->grpcache);
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(db->grpcache == NULL) {
|
|
||||||
_alpm_db_load_grpcache(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(db->grpcache);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target)
|
|
||||||
{
|
|
||||||
alpm_list_t *i;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || target == NULL || strlen(target) == 0) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = _alpm_db_get_grpcache(db); i; i = i->next) {
|
|
||||||
pmgrp_t *info = i->data;
|
|
||||||
|
|
||||||
if(strcmp(info->name, target) == 0) {
|
|
||||||
return(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* cache.h
|
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
|
||||||
*
|
|
||||||
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef _ALPM_CACHE_H
|
|
||||||
#define _ALPM_CACHE_H
|
|
||||||
|
|
||||||
#include "db.h"
|
|
||||||
#include "alpm_list.h"
|
|
||||||
#include "group.h"
|
|
||||||
#include "package.h"
|
|
||||||
|
|
||||||
/* packages */
|
|
||||||
int _alpm_db_load_pkgcache(pmdb_t *db);
|
|
||||||
void _alpm_db_free_pkgcache(pmdb_t *db);
|
|
||||||
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
|
|
||||||
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
|
|
||||||
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db);
|
|
||||||
int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
|
|
||||||
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
|
|
||||||
/* groups */
|
|
||||||
int _alpm_db_load_grpcache(pmdb_t *db);
|
|
||||||
void _alpm_db_free_grpcache(pmdb_t *db);
|
|
||||||
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
|
|
||||||
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
|
|
||||||
|
|
||||||
#endif /* _ALPM_CACHE_H */
|
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* conflict.c
|
* conflict.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
||||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||||
@@ -25,10 +26,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "conflict.h"
|
#include "conflict.h"
|
||||||
@@ -36,12 +37,11 @@
|
|||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "error.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "cache.h"
|
|
||||||
#include "deps.h"
|
#include "deps.h"
|
||||||
|
|
||||||
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2)
|
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2,
|
||||||
|
const char *reason)
|
||||||
{
|
{
|
||||||
pmconflict_t *conflict;
|
pmconflict_t *conflict;
|
||||||
|
|
||||||
@@ -49,26 +49,47 @@ pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2)
|
|||||||
|
|
||||||
MALLOC(conflict, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(conflict, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
strncpy(conflict->package1, package1, PKG_NAME_LEN);
|
STRDUP(conflict->package1, package1, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
strncpy(conflict->package2, package2, PKG_NAME_LEN);
|
STRDUP(conflict->package2, package2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
STRDUP(conflict->reason, reason, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
return(conflict);
|
return(conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
|
void _alpm_conflict_free(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
FREE(conflict->package2);
|
||||||
|
FREE(conflict->package1);
|
||||||
|
FREE(conflict->reason);
|
||||||
|
FREE(conflict);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
pmconflict_t *newconflict;
|
||||||
|
CALLOC(newconflict, 1, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
STRDUP(newconflict->package1, conflict->package1, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
STRDUP(newconflict->package2, conflict->package2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
STRDUP(newconflict->reason, conflict->reason, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
return(newconflict);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
const char *npkg1 = needle->package1;
|
||||||
|
const char *npkg2 = needle->package2;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
for(i = haystack; i; i = i->next) {
|
for(i = haystack; i; i = i->next) {
|
||||||
pmconflict_t *conflict = i->data;
|
pmconflict_t *conflict = i->data;
|
||||||
char *cpkg1 = conflict->package1;
|
const char *cpkg1 = conflict->package1;
|
||||||
char *cpkg2 = conflict->package2;
|
const char *cpkg2 = conflict->package2;
|
||||||
char *npkg1 = needle->package1;
|
if((strcmp(cpkg1, npkg1) == 0 && strcmp(cpkg2, npkg2) == 0)
|
||||||
char *npkg2 = needle->package2;
|
|| (strcmp(cpkg1, npkg2) == 0 && strcmp(cpkg2, npkg1) == 0)) {
|
||||||
if((!strcmp(cpkg1, npkg1) && !strcmp(cpkg2, npkg2))
|
|
||||||
|| (!strcmp(cpkg1, npkg2) && !strcmp(cpkg2, npkg1))) {
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,41 +97,21 @@ int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if pkg1 conflicts with pkg2
|
|
||||||
* @param pkg1 package we are looking at
|
|
||||||
* @param conflict name of the possible conflict
|
|
||||||
* @param pkg2 package to check
|
|
||||||
* @return 0 for no conflict, non-zero otherwise
|
|
||||||
*/
|
|
||||||
static int does_conflict(pmpkg_t *pkg1, const char *conflict, pmpkg_t *pkg2)
|
|
||||||
{
|
|
||||||
const char *pkg1name = alpm_pkg_get_name(pkg1);
|
|
||||||
const char *pkg2name = alpm_pkg_get_name(pkg2);
|
|
||||||
pmdepend_t *conf = alpm_splitdep(conflict);
|
|
||||||
int match = 0;
|
|
||||||
|
|
||||||
match = alpm_depcmp(pkg2, conf);
|
|
||||||
if(match) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
|
|
||||||
pkg1name, pkg2name, conflict);
|
|
||||||
}
|
|
||||||
FREE(conf);
|
|
||||||
return(match);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Adds the pkg1/pkg2 conflict to the baddeps list
|
/** Adds the pkg1/pkg2 conflict to the baddeps list
|
||||||
* @param *baddeps list to add conflict to
|
* @param *baddeps list to add conflict to
|
||||||
* @param pkg1 first package
|
* @param pkg1 first package
|
||||||
* @param pkg2 package causing conflict
|
* @param pkg2 package causing conflict
|
||||||
*/
|
*/
|
||||||
static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
|
static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
|
||||||
const char *pkg2)
|
const char *pkg2, const char *reason)
|
||||||
{
|
{
|
||||||
pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2);
|
pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2, reason);
|
||||||
if(conflict && !_alpm_conflict_isin(conflict, *baddeps)) {
|
_alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
|
||||||
|
pkg1, pkg2, reason);
|
||||||
|
if(conflict && !conflict_isin(conflict, *baddeps)) {
|
||||||
*baddeps = alpm_list_add(*baddeps, conflict);
|
*baddeps = alpm_list_add(*baddeps, conflict);
|
||||||
} else {
|
} else {
|
||||||
FREE(conflict);
|
_alpm_conflict_free(conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +139,7 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
|
|||||||
|
|
||||||
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
|
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
|
||||||
const char *conflict = j->data;
|
const char *conflict = j->data;
|
||||||
|
pmdepend_t *parsed_conflict = _alpm_splitdep(conflict);
|
||||||
|
|
||||||
for(k = list2; k; k = k->next) {
|
for(k = list2; k; k = k->next) {
|
||||||
pmpkg_t *pkg2 = k->data;
|
pmpkg_t *pkg2 = k->data;
|
||||||
@@ -148,14 +150,15 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(does_conflict(pkg1, conflict, pkg2)) {
|
if(_alpm_depcmp(pkg2, parsed_conflict)) {
|
||||||
if(order >= 0) {
|
if(order >= 0) {
|
||||||
add_conflict(baddeps, pkg1name, pkg2name);
|
add_conflict(baddeps, pkg1name, pkg2name, conflict);
|
||||||
} else {
|
} else {
|
||||||
add_conflict(baddeps, pkg2name, pkg1name);
|
add_conflict(baddeps, pkg2name, pkg1name, conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_alpm_dep_free(parsed_conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,8 +190,8 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t *dblist = alpm_list_diff(_alpm_db_get_pkgcache(db), packages,
|
alpm_list_t *dblist = alpm_list_diff(_alpm_db_get_pkgcache(db),
|
||||||
_alpm_pkg_cmp);
|
packages, _alpm_pkg_cmp);
|
||||||
|
|
||||||
/* two checks to be done here for conflicts */
|
/* two checks to be done here for conflicts */
|
||||||
_alpm_log(PM_LOG_DEBUG, "check targets vs db\n");
|
_alpm_log(PM_LOG_DEBUG, "check targets vs db\n");
|
||||||
@@ -200,9 +203,13 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
|
|||||||
return(baddeps);
|
return(baddeps);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for transaction conflicts */
|
/** Check the package conflicts in a database
|
||||||
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages) {
|
*
|
||||||
return(alpm_list_join(_alpm_innerconflicts(packages), _alpm_outerconflicts(db, packages)));
|
* @param pkglist the list of packages to check
|
||||||
|
* @return an alpm_list_t of pmconflict_t
|
||||||
|
*/
|
||||||
|
alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_list_t *pkglist) {
|
||||||
|
return(_alpm_innerconflicts(pkglist));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a alpm_list_t* of file conflicts.
|
/* Returns a alpm_list_t* of file conflicts.
|
||||||
@@ -299,15 +306,15 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
|
|||||||
const char* name1, const char* name2)
|
const char* name1, const char* name2)
|
||||||
{
|
{
|
||||||
pmfileconflict_t *conflict;
|
pmfileconflict_t *conflict;
|
||||||
MALLOC(conflict, sizeof(pmfileconflict_t), return(conflicts));
|
MALLOC(conflict, sizeof(pmfileconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
conflict->type = type;
|
conflict->type = type;
|
||||||
strncpy(conflict->target, name1, PKG_NAME_LEN);
|
STRDUP(conflict->target, name1, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
strncpy(conflict->file, filestr, CONFLICT_FILE_LEN);
|
STRDUP(conflict->file, filestr, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
if(name2) {
|
if(name2) {
|
||||||
strncpy(conflict->ctarget, name2, PKG_NAME_LEN);
|
STRDUP(conflict->ctarget, name2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
} else {
|
} else {
|
||||||
conflict->ctarget[0] = '\0';
|
conflict->ctarget = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
conflicts = alpm_list_add(conflicts, conflict);
|
conflicts = alpm_list_add(conflicts, conflict);
|
||||||
@@ -317,19 +324,73 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
|
|||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _alpm_fileconflict_free(pmfileconflict_t *conflict)
|
||||||
|
{
|
||||||
|
if(strlen(conflict->ctarget) > 0) {
|
||||||
|
FREE(conflict->ctarget);
|
||||||
|
}
|
||||||
|
FREE(conflict->file);;
|
||||||
|
FREE(conflict->target);
|
||||||
|
FREE(conflict);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dir_belongsto_pkg(char *dirpath, pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
struct dirent *ent = NULL;
|
||||||
|
struct stat sbuf;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
char abspath[PATH_MAX];
|
||||||
|
DIR *dir;
|
||||||
|
|
||||||
|
snprintf(abspath, PATH_MAX, "%s%s", handle->root, dirpath);
|
||||||
|
dir = opendir(abspath);
|
||||||
|
if(dir == NULL) {
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
while((ent = readdir(dir)) != NULL) {
|
||||||
|
const char *name = ent->d_name;
|
||||||
|
|
||||||
|
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
snprintf(path, PATH_MAX, "%s/%s", dirpath, name);
|
||||||
|
snprintf(abspath, PATH_MAX, "%s%s", handle->root, path);
|
||||||
|
if(stat(abspath, &sbuf) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(S_ISDIR(sbuf.st_mode)) {
|
||||||
|
if(dir_belongsto_pkg(path, pkg)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
closedir(dir);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(alpm_list_find_str(alpm_pkg_get_files(pkg), path)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
closedir(dir);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Find file conflicts that may occur during the transaction with two checks:
|
/* Find file conflicts that may occur during the transaction with two checks:
|
||||||
* 1: check every target against every target
|
* 1: check every target against every target
|
||||||
* 2: check every target against the filesystem */
|
* 2: check every target against the filesystem */
|
||||||
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
|
||||||
|
alpm_list_t *upgrade, alpm_list_t *remove)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *conflicts = NULL;
|
alpm_list_t *i, *j, *conflicts = NULL;
|
||||||
alpm_list_t *targets = trans->packages;
|
size_t numtargs = alpm_list_count(upgrade);
|
||||||
int numtargs = alpm_list_count(targets);
|
size_t current;
|
||||||
int current;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(db == NULL || targets == NULL || root == NULL) {
|
if(db == NULL || upgrade == NULL || trans == NULL) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,8 +398,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *roo
|
|||||||
* be possible with real transactions. Right now we only do half as much
|
* be possible with real transactions. Right now we only do half as much
|
||||||
* here as we do when we actually extract files in add.c with our 12
|
* here as we do when we actually extract files in add.c with our 12
|
||||||
* different cases. */
|
* different cases. */
|
||||||
for(current = 1, i = targets; i; i = i->next, current++) {
|
for(current = 0, i = upgrade; i; i = i->next, current++) {
|
||||||
alpm_list_t *j, *k, *tmpfiles = NULL;
|
alpm_list_t *k, *tmpfiles = NULL;
|
||||||
pmpkg_t *p1, *p2, *dbpkg;
|
pmpkg_t *p1, *p2, *dbpkg;
|
||||||
char path[PATH_MAX+1];
|
char path[PATH_MAX+1];
|
||||||
|
|
||||||
@@ -347,22 +408,22 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *roo
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double percent = (double)current / numtargs;
|
int percent = (current * 100) / numtargs;
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100),
|
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", percent,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
/* CHECK 1: check every target against every target */
|
/* CHECK 1: check every target against every target */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s\n",
|
||||||
|
alpm_pkg_get_name(p1));
|
||||||
for(j = i->next; j; j = j->next) {
|
for(j = i->next; j; j = j->next) {
|
||||||
p2 = j->data;
|
p2 = j->data;
|
||||||
if(!p2) {
|
if(!p2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s and %s\n",
|
|
||||||
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
|
||||||
tmpfiles = chk_fileconflicts(alpm_pkg_get_files(p1), alpm_pkg_get_files(p2));
|
tmpfiles = chk_fileconflicts(alpm_pkg_get_files(p1), alpm_pkg_get_files(p2));
|
||||||
|
|
||||||
if(tmpfiles) {
|
if(tmpfiles) {
|
||||||
for(k = tmpfiles; k; k = k->next) {
|
for(k = tmpfiles; k; k = k->next) {
|
||||||
snprintf(path, PATH_MAX, "%s%s", root, (char *)k->data);
|
snprintf(path, PATH_MAX, "%s%s", handle->root, (char *)k->data);
|
||||||
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_TARGET, path,
|
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_TARGET, path,
|
||||||
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
||||||
}
|
}
|
||||||
@@ -378,7 +439,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *roo
|
|||||||
_alpm_log(PM_LOG_DEBUG, "searching for filesystem conflicts: %s\n", p1->name);
|
_alpm_log(PM_LOG_DEBUG, "searching for filesystem conflicts: %s\n", p1->name);
|
||||||
dbpkg = _alpm_db_get_pkgfromcache(db, p1->name);
|
dbpkg = _alpm_db_get_pkgfromcache(db, p1->name);
|
||||||
|
|
||||||
/* Do two different checks here. f the package is currently installed,
|
/* Do two different checks here. If the package is currently installed,
|
||||||
* then only check files that are new in the new package. If the package
|
* then only check files that are new in the new package. If the package
|
||||||
* is not currently installed, then simply stat the whole filelist */
|
* is not currently installed, then simply stat the whole filelist */
|
||||||
if(dbpkg) {
|
if(dbpkg) {
|
||||||
@@ -390,12 +451,10 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *roo
|
|||||||
tmpfiles = alpm_list_strdup(alpm_pkg_get_files(p1));
|
tmpfiles = alpm_list_strdup(alpm_pkg_get_files(p1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loop over each file to be installed */
|
|
||||||
for(j = tmpfiles; j; j = j->next) {
|
for(j = tmpfiles; j; j = j->next) {
|
||||||
int skip_conflict = 0;
|
|
||||||
filestr = j->data;
|
filestr = j->data;
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", root, filestr);
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
|
||||||
|
|
||||||
/* stat the file - if it exists, do some checks */
|
/* stat the file - if it exists, do some checks */
|
||||||
if(_alpm_lstat(path, &lsbuf) != 0) {
|
if(_alpm_lstat(path, &lsbuf) != 0) {
|
||||||
@@ -406,71 +465,80 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *roo
|
|||||||
if(path[strlen(path)-1] == '/') {
|
if(path[strlen(path)-1] == '/') {
|
||||||
if(S_ISDIR(lsbuf.st_mode)) {
|
if(S_ISDIR(lsbuf.st_mode)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict\n", path);
|
_alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict\n", path);
|
||||||
skip_conflict = 1;
|
continue;
|
||||||
} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
||||||
_alpm_log(PM_LOG_DEBUG,
|
_alpm_log(PM_LOG_DEBUG,
|
||||||
"%s is a symlink to a dir, hopefully not a conflict\n", path);
|
"%s is a symlink to a dir, hopefully not a conflict\n", path);
|
||||||
skip_conflict = 1;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!skip_conflict) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
||||||
|
|
||||||
/* Make sure the possible conflict is not a symlink that points to a
|
int resolved_conflict = 0; /* have we acted on this conflict? */
|
||||||
* path in the old package. This is kind of dirty with inode usage */
|
|
||||||
/* TODO this seems ripe for a cleanup */
|
/* Check remove list (will we remove the conflicting local file?) */
|
||||||
if(dbpkg) {
|
for(k = remove; k && !resolved_conflict; k = k->next) {
|
||||||
struct stat pkgbuf;
|
pmpkg_t *rempkg = k->data;
|
||||||
char str[PATH_MAX+1];
|
if(rempkg && alpm_list_find_str(alpm_pkg_get_files(rempkg), filestr)) {
|
||||||
unsigned ok = 0;
|
_alpm_log(PM_LOG_DEBUG, "local file will be removed, not a conflict: %s\n", filestr);
|
||||||
for(k = dbpkg->files; k; k = k->next) {
|
resolved_conflict = 1;
|
||||||
snprintf(str, PATH_MAX, "%s%s", root, (char*)k->data);
|
|
||||||
if(!_alpm_lstat(str, &pkgbuf) && lsbuf.st_ino == pkgbuf.st_ino) {
|
|
||||||
ok = 1;
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "conflict was a symlink: %s\n", path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(ok == 1) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look at all the targets to see if file has changed hands */
|
/* Look at all the targets to see if file has changed hands */
|
||||||
int resolved_conflict = 0; /* have we acted on this conflict? */
|
for(k = upgrade; k && !resolved_conflict; k = k->next) {
|
||||||
for(k = targets; k; k = k->next) {
|
|
||||||
p2 = k->data;
|
p2 = k->data;
|
||||||
if(!p2 || strcmp(p1->name, p2->name) == 0) {
|
if(!p2 || strcmp(p1->name, p2->name) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkg_t *localp2 = _alpm_db_get_pkgfromcache(db, p2->name);
|
pmpkg_t *localp2 = _alpm_db_get_pkgfromcache(db, p2->name);
|
||||||
|
|
||||||
/* Check if it used to exist in a package, but doesn't anymore */
|
/* localp2->files will be removed (target conflicts are handled by CHECK 1) */
|
||||||
alpm_list_t *pkgfiles, *localfiles; /* added for readability */
|
if(localp2 && alpm_list_find_str(alpm_pkg_get_files(localp2), filestr)) {
|
||||||
pkgfiles = alpm_pkg_get_files(p2);
|
|
||||||
localfiles = alpm_pkg_get_files(localp2);
|
|
||||||
|
|
||||||
if(localp2 && !alpm_list_find_str(pkgfiles, filestr)
|
|
||||||
&& alpm_list_find_str(localfiles, filestr)) {
|
|
||||||
/* skip removal of file, but not add. this will prevent a second
|
/* skip removal of file, but not add. this will prevent a second
|
||||||
* package from removing the file when it was already installed
|
* package from removing the file when it was already installed
|
||||||
* by its new owner (whether the file is in backup array or not */
|
* by its new owner (whether the file is in backup array or not */
|
||||||
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(path));
|
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(filestr));
|
||||||
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s\n", filestr);
|
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s\n", filestr);
|
||||||
resolved_conflict = 1;
|
resolved_conflict = 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check if all files of the dir belong to the installed pkg */
|
||||||
|
if(!resolved_conflict && S_ISDIR(lsbuf.st_mode) && dbpkg) {
|
||||||
|
char *dir = malloc(strlen(filestr) + 2);
|
||||||
|
sprintf(dir, "%s/", filestr);
|
||||||
|
if(alpm_list_find_str(alpm_pkg_get_files(dbpkg),dir)) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "check if all files in %s belongs to %s\n",
|
||||||
|
dir, dbpkg->name);
|
||||||
|
resolved_conflict = dir_belongsto_pkg(filestr, dbpkg);
|
||||||
|
}
|
||||||
|
free(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!resolved_conflict && dbpkg) {
|
||||||
|
char *rpath = calloc(PATH_MAX+1, sizeof(char));
|
||||||
|
if(!realpath(path, rpath)) {
|
||||||
|
FREE(rpath);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
char *filestr = rpath + strlen(handle->root);
|
||||||
|
if(alpm_list_find_str(alpm_pkg_get_files(dbpkg),filestr)) {
|
||||||
|
resolved_conflict = 1;
|
||||||
|
}
|
||||||
|
free(rpath);
|
||||||
|
}
|
||||||
|
|
||||||
if(!resolved_conflict) {
|
if(!resolved_conflict) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s\n", path);
|
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s\n", path);
|
||||||
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_FILESYSTEM,
|
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_FILESYSTEM,
|
||||||
path, p1->name, NULL);
|
path, p1->name, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
FREELIST(tmpfiles);
|
FREELIST(tmpfiles);
|
||||||
}
|
}
|
||||||
|
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", 100,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
@@ -497,6 +565,17 @@ const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
|
|||||||
return conflict->package2;
|
return conflict->package2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_conflict_get_reason(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(conflict != NULL, return(NULL));
|
||||||
|
|
||||||
|
return conflict->reason;
|
||||||
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
|
const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* conflict.h
|
* conflict.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,26 +24,28 @@
|
|||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
|
|
||||||
#define CONFLICT_FILE_LEN 512
|
|
||||||
|
|
||||||
struct __pmconflict_t {
|
struct __pmconflict_t {
|
||||||
char package1[PKG_NAME_LEN];
|
char *package1;
|
||||||
char package2[PKG_NAME_LEN];
|
char *package2;
|
||||||
|
char *reason;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __pmfileconflict_t {
|
struct __pmfileconflict_t {
|
||||||
char target[PKG_NAME_LEN];
|
char *target;
|
||||||
pmfileconflicttype_t type;
|
pmfileconflicttype_t type;
|
||||||
char file[CONFLICT_FILE_LEN];
|
char *file;
|
||||||
char ctarget[PKG_NAME_LEN];
|
char *ctarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2);
|
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2, const char *reason);
|
||||||
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack);
|
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict);
|
||||||
|
void _alpm_conflict_free(pmconflict_t *conflict);
|
||||||
alpm_list_t *_alpm_innerconflicts(alpm_list_t *packages);
|
alpm_list_t *_alpm_innerconflicts(alpm_list_t *packages);
|
||||||
alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages);
|
alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages);
|
||||||
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
|
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
|
||||||
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root);
|
alpm_list_t *upgrade, alpm_list_t *remove);
|
||||||
|
|
||||||
|
void _alpm_fileconflict_free(pmfileconflict_t *conflict);
|
||||||
|
|
||||||
#endif /* _ALPM_CONFLICT_H */
|
#endif /* _ALPM_CONFLICT_H */
|
||||||
|
|
||||||
|
|||||||
694
lib/libalpm/db.c
694
lib/libalpm/db.c
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* db.c
|
* db.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||||
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
||||||
@@ -23,14 +24,11 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h> /* uintmax_t */
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -39,21 +37,17 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "error.h"
|
|
||||||
#include "server.h"
|
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "cache.h"
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
#include "package.h"
|
||||||
|
#include "group.h"
|
||||||
|
|
||||||
/** \addtogroup alpm_databases Database Functions
|
/** \addtogroup alpm_databases Database Functions
|
||||||
* @brief Functions to query and manipulate the database of libalpm
|
* @brief Functions to query and manipulate the database of libalpm
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Register a sync database of packages.
|
/** Register a sync database of packages. */
|
||||||
* @param treename the name of the sync repository
|
|
||||||
* @return a pmdb_t* on success (the value), NULL on error
|
|
||||||
*/
|
|
||||||
pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename)
|
pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -67,41 +61,22 @@ pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename)
|
|||||||
return(_alpm_db_register_sync(treename));
|
return(_alpm_db_register_sync(treename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Register the local package database.
|
|
||||||
* @return a pmdb_t* representing the local database, or NULL on error
|
|
||||||
*/
|
|
||||||
pmdb_t SYMEXPORT *alpm_db_register_local(void)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL));
|
|
||||||
/* Do not register a database if a transaction is on-going */
|
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, NULL));
|
|
||||||
|
|
||||||
return(_alpm_db_register_local());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Helper function for alpm_db_unregister{_all} */
|
/* Helper function for alpm_db_unregister{_all} */
|
||||||
static void _alpm_db_unregister(pmdb_t *db)
|
void _alpm_db_unregister(pmdb_t *db)
|
||||||
{
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "closing database '%s'\n", db->treename);
|
|
||||||
_alpm_db_close(db);
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "unregistering database '%s'\n", db->treename);
|
_alpm_log(PM_LOG_DEBUG, "unregistering database '%s'\n", db->treename);
|
||||||
_alpm_db_free(db);
|
_alpm_db_free(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Unregister all package databases
|
/** Unregister all package databases. */
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_unregister_all(void)
|
int SYMEXPORT alpm_db_unregister_all(void)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
pmdb_t *db;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
@@ -110,24 +85,17 @@ int SYMEXPORT alpm_db_unregister_all(void)
|
|||||||
/* Do not unregister a database if a transaction is on-going */
|
/* Do not unregister a database if a transaction is on-going */
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
|
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
/* close local database */
|
/* unregister all sync dbs */
|
||||||
_alpm_db_unregister(handle->db_local);
|
|
||||||
handle->db_local = NULL;
|
|
||||||
|
|
||||||
/* and also sync ones */
|
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
for(i = handle->dbs_sync; i; i = i->next) {
|
||||||
pmdb_t *db = i->data;
|
db = i->data;
|
||||||
_alpm_db_unregister(db);
|
db->ops->unregister(db);
|
||||||
i->data = NULL;
|
i->data = NULL;
|
||||||
}
|
}
|
||||||
FREELIST(handle->dbs_sync);
|
FREELIST(handle->dbs_sync);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Unregister a package database
|
/** Unregister a package database. */
|
||||||
* @param db pointer to the package database to unregister
|
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
@@ -160,19 +128,17 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
|||||||
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_db_unregister(db);
|
db->ops->unregister(db);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the serverlist of a database.
|
/** Set the serverlist of a database. */
|
||||||
* @param db database pointer
|
|
||||||
* @param url url of the server
|
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
|
int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
char *newurl;
|
||||||
|
size_t len = 0;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
@@ -189,15 +155,18 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
|
|||||||
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(url && strlen(url)) {
|
if(url) {
|
||||||
pmserver_t *server;
|
len = strlen(url);
|
||||||
if((server = _alpm_server_new(url)) == NULL) {
|
|
||||||
/* pm_errno is set by _alpm_server_new */
|
|
||||||
return(-1);
|
|
||||||
}
|
}
|
||||||
db->servers = alpm_list_add(db->servers, server);
|
if(len) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding new server to database '%s': protocol '%s', server '%s', path '%s'\n",
|
newurl = strdup(url);
|
||||||
db->treename, server->s_url->scheme, server->s_url->host, server->s_url->doc);
|
/* strip the trailing slash if one exists */
|
||||||
|
if(newurl[len - 1] == '/') {
|
||||||
|
newurl[len - 1] = '\0';
|
||||||
|
}
|
||||||
|
db->servers = alpm_list_add(db->servers, newurl);
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
||||||
|
db->treename, newurl);
|
||||||
} else {
|
} else {
|
||||||
FREELIST(db->servers);
|
FREELIST(db->servers);
|
||||||
_alpm_log(PM_LOG_DEBUG, "serverlist flushed for '%s'\n", db->treename);
|
_alpm_log(PM_LOG_DEBUG, "serverlist flushed for '%s'\n", db->treename);
|
||||||
@@ -206,102 +175,7 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update a package database
|
/** Get the name of a package database. */
|
||||||
* @param force if true, then forces the update, otherwise update only in case
|
|
||||||
* the database isn't up to date
|
|
||||||
* @param db pointer to the package database to update
|
|
||||||
* @return 0 on success, > 0 on error (pm_errno is set accordingly), < 0 if up
|
|
||||||
* to date
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
|
||||||
{
|
|
||||||
alpm_list_t *lp;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
alpm_list_t *files = NULL;
|
|
||||||
time_t newmtime = 0, lastupdate = 0;
|
|
||||||
const char *dbpath;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
|
||||||
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
|
||||||
/* Verify we are in a transaction. This is done _mainly_ because we need a DB
|
|
||||||
* lock - if we update without a db lock, we may kludge some other pacman
|
|
||||||
* process that _has_ a lock.
|
|
||||||
*/
|
|
||||||
ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
|
||||||
ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
|
|
||||||
ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
|
|
||||||
|
|
||||||
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
|
|
||||||
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!force) {
|
|
||||||
/* get the lastupdate time */
|
|
||||||
lastupdate = _alpm_db_getlastupdate(db);
|
|
||||||
if(lastupdate == 0) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "failed to get lastupdate time for %s\n",
|
|
||||||
db->treename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* build a one-element list */
|
|
||||||
snprintf(path, PATH_MAX, "%s" DBEXT, db->treename);
|
|
||||||
files = alpm_list_add(files, strdup(path));
|
|
||||||
|
|
||||||
dbpath = alpm_option_get_dbpath();
|
|
||||||
|
|
||||||
ret = _alpm_downloadfiles_forreal(db->servers, dbpath, files, lastupdate,
|
|
||||||
&newmtime, NULL, 0);
|
|
||||||
FREELIST(files);
|
|
||||||
if(ret == 1) {
|
|
||||||
/* mtimes match, do nothing */
|
|
||||||
pm_errno = 0;
|
|
||||||
return(1);
|
|
||||||
} else if(ret == -1) {
|
|
||||||
/* we use downloadLastErrString and downloadLastErrCode here, error returns from
|
|
||||||
* libdownload */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s [%d]\n",
|
|
||||||
downloadLastErrString, downloadLastErrCode);
|
|
||||||
RET_ERR(PM_ERR_DB_SYNC, -1);
|
|
||||||
} else {
|
|
||||||
if(newmtime != 0) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "sync: new mtime for %s: %ju\n",
|
|
||||||
db->treename, (uintmax_t)newmtime);
|
|
||||||
_alpm_db_setlastupdate(db, newmtime);
|
|
||||||
}
|
|
||||||
snprintf(path, PATH_MAX, "%s%s" DBEXT, dbpath, db->treename);
|
|
||||||
|
|
||||||
/* remove the old dir */
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "flushing database %s\n", db->path);
|
|
||||||
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
|
|
||||||
pmpkg_t *pkg = lp->data;
|
|
||||||
if(pkg && _alpm_db_remove(db, pkg) == -1) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s%s\n"), db->treename,
|
|
||||||
alpm_pkg_get_name(pkg));
|
|
||||||
RET_ERR(PM_ERR_DB_REMOVE, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cache needs to be rebuild */
|
|
||||||
_alpm_db_free_pkgcache(db);
|
|
||||||
|
|
||||||
/* uncompress the sync database */
|
|
||||||
if(_alpm_db_install(db, path) == -1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the name of a package database
|
|
||||||
* @param db pointer to the package database
|
|
||||||
* @return the name of the package database, NULL on error
|
|
||||||
*/
|
|
||||||
const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
|
const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -313,33 +187,25 @@ const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
|
|||||||
return db->treename;
|
return db->treename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a download URL for the package database
|
/** Get a download URL for the package database. */
|
||||||
* @param db pointer to the package database
|
|
||||||
* @return a fully-specified download URL, NULL on error
|
|
||||||
*/
|
|
||||||
const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
|
const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
char *url;
|
||||||
pmserver_t *s;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return(NULL));
|
ASSERT(handle != NULL, return(NULL));
|
||||||
ASSERT(db != NULL, return(NULL));
|
ASSERT(db != NULL, return(NULL));
|
||||||
|
ASSERT(db->servers != NULL, return(NULL));
|
||||||
|
|
||||||
s = (pmserver_t*)db->servers->data;
|
url = (char*)db->servers->data;
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s://%s%s", s->s_url->scheme, s->s_url->host, s->s_url->doc);
|
return(url);
|
||||||
return strdup(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Get a package entry from a package database
|
/** Get a package entry from a package database. */
|
||||||
* @param db pointer to the package database to get the package from
|
|
||||||
* @param name of the package
|
|
||||||
* @return the package entry on success, NULL on error
|
|
||||||
*/
|
|
||||||
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -352,11 +218,8 @@ pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
|||||||
return(_alpm_db_get_pkgfromcache(db, name));
|
return(_alpm_db_get_pkgfromcache(db, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the package cache of a package database
|
/** Get the package cache of a package database. */
|
||||||
* @param db pointer to the package database to get the package from
|
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
|
||||||
* @return the list of packages on success, NULL on error
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_db_getpkgcache(pmdb_t *db)
|
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
@@ -367,28 +230,7 @@ alpm_list_t SYMEXPORT *alpm_db_getpkgcache(pmdb_t *db)
|
|||||||
return(_alpm_db_get_pkgcache(db));
|
return(_alpm_db_get_pkgcache(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the list of packages that a package provides
|
/** Get a group entry from a package database. */
|
||||||
* @param db pointer to the package database to get the package from
|
|
||||||
* @param name name of the package
|
|
||||||
* @return the list of packages on success, NULL on error
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_db_whatprovides(pmdb_t *db, const char *name)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(db != NULL, return(NULL));
|
|
||||||
ASSERT(name != NULL && strlen(name) != 0, return(NULL));
|
|
||||||
|
|
||||||
return(_alpm_db_whatprovides(db, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get a group entry from a package database
|
|
||||||
* @param db pointer to the package database to get the group from
|
|
||||||
* @param name of the group
|
|
||||||
* @return the groups entry on success, NULL on error
|
|
||||||
*/
|
|
||||||
pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -401,11 +243,8 @@ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
|||||||
return(_alpm_db_get_grpfromcache(db, name));
|
return(_alpm_db_get_grpfromcache(db, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the group cache of a package database
|
/** Get the group cache of a package database. */
|
||||||
* @param db pointer to the package database to get the group from
|
alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
|
||||||
* @return the list of groups on success, NULL on error
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_db_getgrpcache(pmdb_t *db)
|
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
@@ -416,11 +255,7 @@ alpm_list_t SYMEXPORT *alpm_db_getgrpcache(pmdb_t *db)
|
|||||||
return(_alpm_db_get_grpcache(db));
|
return(_alpm_db_get_grpcache(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Searches a database
|
/** Searches a database. */
|
||||||
* @param db pointer to the package database to search in
|
|
||||||
* @param needles the list of strings to search for
|
|
||||||
* @return the list of packages on success, NULL on error
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -432,54 +267,117 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
|||||||
return(_alpm_db_search(db, needles));
|
return(_alpm_db_search(db, needles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set install reason for a package in db. */
|
||||||
|
int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
ASSERT(db != NULL && name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(db, name);
|
||||||
|
if(pkg == NULL) {
|
||||||
|
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "setting install reason %u for %s/%s\n", reason, db->treename, name);
|
||||||
|
if(alpm_pkg_get_reason(pkg) == reason) {
|
||||||
|
/* we are done */
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
/* set reason (in pkgcache) */
|
||||||
|
pkg->reason = reason;
|
||||||
|
/* write DESC */
|
||||||
|
if(_alpm_local_db_write(db, pkg, INFRQ_DESC)) {
|
||||||
|
RET_ERR(PM_ERR_DB_WRITE, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
pmdb_t *_alpm_db_new(const char *dbpath, const char *treename)
|
pmdb_t *_alpm_db_new(const char *treename, int is_local)
|
||||||
{
|
{
|
||||||
pmdb_t *db;
|
pmdb_t *db;
|
||||||
const size_t pathsize = strlen(dbpath) + strlen(treename) + 2;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
CALLOC(db, 1, sizeof(pmdb_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(db, 1, sizeof(pmdb_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
CALLOC(db->path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(db->treename, treename, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
db->is_local = is_local;
|
||||||
sprintf(db->path, "%s%s/", dbpath, treename);
|
|
||||||
|
|
||||||
strncpy(db->treename, treename, PATH_MAX);
|
|
||||||
|
|
||||||
return(db);
|
return(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_db_free(pmdb_t *db)
|
void _alpm_db_free(pmdb_t *db)
|
||||||
{
|
{
|
||||||
alpm_list_t *tmp;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
/* cleanup pkgcache */
|
/* cleanup pkgcache */
|
||||||
_alpm_db_free_pkgcache(db);
|
_alpm_db_free_pkgcache(db);
|
||||||
/* cleanup server list */
|
/* cleanup server list */
|
||||||
for(tmp = db->servers; tmp; tmp = alpm_list_next(tmp)) {
|
FREELIST(db->servers);
|
||||||
_alpm_server_free(tmp->data);
|
FREE(db->_path);
|
||||||
}
|
FREE(db->treename);
|
||||||
alpm_list_free(db->servers);
|
|
||||||
FREE(db->path);
|
|
||||||
FREE(db);
|
FREE(db);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_db_cmp(const void *db1, const void *db2)
|
const char *_alpm_db_path(pmdb_t *db)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
if(!db) {
|
||||||
return(strcmp(((pmdb_t *)db1)->treename, ((pmdb_t *)db2)->treename));
|
return(NULL);
|
||||||
|
}
|
||||||
|
if(!db->_path) {
|
||||||
|
const char *dbpath;
|
||||||
|
size_t pathsize;
|
||||||
|
|
||||||
|
dbpath = alpm_option_get_dbpath();
|
||||||
|
if(!dbpath) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
|
||||||
|
RET_ERR(PM_ERR_DB_OPEN, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(db->is_local) {
|
||||||
|
pathsize = strlen(dbpath) + strlen(db->treename) + 2;
|
||||||
|
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
sprintf(db->_path, "%s%s/", dbpath, db->treename);
|
||||||
|
} else {
|
||||||
|
pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
|
||||||
|
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
/* all sync DBs now reside in the sync/ subdir of the dbpath */
|
||||||
|
sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
|
||||||
|
}
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "database path for tree %s set to %s\n",
|
||||||
|
db->treename, db->_path);
|
||||||
|
}
|
||||||
|
return(db->_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_db_version(pmdb_t *db)
|
||||||
|
{
|
||||||
|
if(!db) {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
return(db->ops->version(db));
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_db_cmp(const void *d1, const void *d2)
|
||||||
|
{
|
||||||
|
pmdb_t *db1 = (pmdb_t *)d1;
|
||||||
|
pmdb_t *db2 = (pmdb_t *)d2;
|
||||||
|
return(strcmp(db1->treename, db2->treename));
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i, *j, *k;
|
const alpm_list_t *i, *j, *k;
|
||||||
alpm_list_t *ret = NULL;
|
alpm_list_t *ret = NULL;
|
||||||
|
/* copy the pkgcache- we will free the list var after each needle */
|
||||||
|
alpm_list_t *list = alpm_list_copy(_alpm_db_get_pkgcache(db));
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
@@ -490,6 +388,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
if(i->data == NULL) {
|
if(i->data == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ret = NULL;
|
||||||
targ = i->data;
|
targ = i->data;
|
||||||
_alpm_log(PM_LOG_DEBUG, "searching for target '%s'\n", targ);
|
_alpm_log(PM_LOG_DEBUG, "searching for target '%s'\n", targ);
|
||||||
|
|
||||||
@@ -497,26 +396,24 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
|
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
|
for(j = list; j; j = j->next) {
|
||||||
pmpkg_t *pkg = j->data;
|
pmpkg_t *pkg = j->data;
|
||||||
const char *matched = NULL;
|
const char *matched = NULL;
|
||||||
|
const char *name = alpm_pkg_get_name(pkg);
|
||||||
|
const char *desc = alpm_pkg_get_desc(pkg);
|
||||||
|
|
||||||
/* check name */
|
/* check name as regex AND as plain text */
|
||||||
if (regexec(®, alpm_pkg_get_name(pkg), 0, 0, 0) == 0) {
|
if(name && (regexec(®, name, 0, 0, 0) == 0 || strstr(name, targ))) {
|
||||||
matched = alpm_pkg_get_name(pkg);
|
matched = name;
|
||||||
}
|
|
||||||
/* check plain text name */
|
|
||||||
else if (strstr(alpm_pkg_get_name(pkg), targ)) {
|
|
||||||
matched = alpm_pkg_get_name(pkg);
|
|
||||||
}
|
}
|
||||||
/* check desc */
|
/* check desc */
|
||||||
else if (regexec(®, alpm_pkg_get_desc(pkg), 0, 0, 0) == 0) {
|
else if (desc && regexec(®, desc, 0, 0, 0) == 0) {
|
||||||
matched = alpm_pkg_get_desc(pkg);
|
matched = desc;
|
||||||
}
|
}
|
||||||
/* check provides */
|
|
||||||
/* TODO: should we be doing this, and should we print something
|
/* TODO: should we be doing this, and should we print something
|
||||||
* differently when we do match it since it isn't currently printed? */
|
* differently when we do match it since it isn't currently printed? */
|
||||||
else {
|
if(!matched) {
|
||||||
|
/* check provides */
|
||||||
for(k = alpm_pkg_get_provides(pkg); k; k = k->next) {
|
for(k = alpm_pkg_get_provides(pkg); k; k = k->next) {
|
||||||
if (regexec(®, k->data, 0, 0, 0) == 0) {
|
if (regexec(®, k->data, 0, 0, 0) == 0) {
|
||||||
matched = k->data;
|
matched = k->data;
|
||||||
@@ -524,6 +421,15 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!matched) {
|
||||||
|
/* check groups */
|
||||||
|
for(k = alpm_pkg_get_groups(pkg); k; k = k->next) {
|
||||||
|
if (regexec(®, k->data, 0, 0, 0) == 0) {
|
||||||
|
matched = k->data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(matched != NULL) {
|
if(matched != NULL) {
|
||||||
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n",
|
||||||
@@ -532,156 +438,268 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free the existing search list, and use the returned list for the
|
||||||
|
* next needle. This allows for AND-based package searching. */
|
||||||
|
alpm_list_free(list);
|
||||||
|
list = ret;
|
||||||
regfree(®);
|
regfree(®);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t *_alpm_db_register_local(void)
|
/* Returns a new package cache from db.
|
||||||
|
* It frees the cache if it already exists.
|
||||||
|
*/
|
||||||
|
int _alpm_db_load_pkgcache(pmdb_t *db)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
ALPM_LOG_FUNC;
|
||||||
pmdb_t *db;
|
|
||||||
const char *dbpath;
|
if(db == NULL) {
|
||||||
char path[PATH_MAX];
|
return(-1);
|
||||||
|
}
|
||||||
|
_alpm_db_free_pkgcache(db);
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'\n",
|
||||||
|
db->treename);
|
||||||
|
if(db->ops->populate(db) == -1) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG,
|
||||||
|
"failed to load package cache for repository '%s'\n", db->treename);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
db->pkgcache_loaded = 1;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _alpm_db_free_pkgcache(pmdb_t *db)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(db == NULL || !db->pkgcache_loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'\n",
|
||||||
|
db->treename);
|
||||||
|
|
||||||
|
alpm_list_free_inner(_alpm_db_get_pkgcache(db),
|
||||||
|
(alpm_list_fn_free)_alpm_pkg_free);
|
||||||
|
_alpm_pkghash_free(db->pkgcache);
|
||||||
|
db->pkgcache_loaded = 0;
|
||||||
|
|
||||||
|
_alpm_db_free_grpcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(db == NULL) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!db->pkgcache_loaded) {
|
||||||
|
_alpm_db_load_pkgcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* hmmm, still NULL ?*/
|
||||||
|
if(!db->pkgcache) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "warning: pkgcache is NULL for db '%s'\n", db->treename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(db->pkgcache);
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
pmpkghash_t *hash = _alpm_db_get_pkgcache_hash(db);
|
||||||
|
|
||||||
|
if(hash == NULL) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(hash->list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "duplicate" pkg then add it to pkgcache */
|
||||||
|
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
pmpkg_t *newpkg;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(handle->db_local != NULL) {
|
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
|
||||||
_alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB\n"));
|
return(-1);
|
||||||
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "registering local database\n");
|
newpkg = _alpm_pkg_dup(pkg);
|
||||||
|
if(newpkg == NULL) {
|
||||||
/* make sure the database directory exists */
|
return(-1);
|
||||||
dbpath = alpm_option_get_dbpath();
|
|
||||||
if(!dbpath) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
|
|
||||||
RET_ERR(PM_ERR_DB_OPEN, NULL);
|
|
||||||
}
|
|
||||||
snprintf(path, PATH_MAX, "%slocal", dbpath);
|
|
||||||
/* TODO this is rediculous, we try to do this even if we can't */
|
|
||||||
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
|
||||||
path);
|
|
||||||
if(_alpm_makepath(path) != 0) {
|
|
||||||
RET_ERR(PM_ERR_SYSTEM, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
db = _alpm_db_new(dbpath, "local");
|
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
|
||||||
if(db == NULL) {
|
alpm_pkg_get_name(newpkg), db->treename);
|
||||||
RET_ERR(PM_ERR_DB_CREATE, NULL);
|
db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
|
||||||
|
|
||||||
|
_alpm_db_free_grpcache(db);
|
||||||
|
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "opening database '%s'\n", db->treename);
|
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
|
||||||
if(_alpm_db_open(db) == -1) {
|
|
||||||
_alpm_db_free(db);
|
|
||||||
RET_ERR(PM_ERR_DB_OPEN, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
handle->db_local = db;
|
|
||||||
return(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmdb_t *_alpm_db_register_sync(const char *treename)
|
|
||||||
{
|
{
|
||||||
struct stat buf;
|
pmpkg_t *data = NULL;
|
||||||
pmdb_t *db;
|
|
||||||
const char *dbpath;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
alpm_list_t *i;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
|
||||||
pmdb_t *sdb = i->data;
|
return(-1);
|
||||||
if(strcmp(treename, sdb->treename) == 0) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "attempt to re-register the '%s' database, using existing\n", sdb->treename);
|
|
||||||
return sdb;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
_alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
|
||||||
|
alpm_pkg_get_name(pkg), db->treename);
|
||||||
|
|
||||||
/* make sure the database directory exists */
|
db->pkgcache = _alpm_pkghash_remove(db->pkgcache, pkg, &data);
|
||||||
dbpath = alpm_option_get_dbpath();
|
if(data == NULL) {
|
||||||
if(!dbpath) {
|
/* package not found */
|
||||||
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
|
_alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
|
||||||
RET_ERR(PM_ERR_DB_OPEN, NULL);
|
alpm_pkg_get_name(pkg), db->treename);
|
||||||
}
|
return(-1);
|
||||||
/* all sync DBs now reside in the sync/ subdir of the dbpath */
|
|
||||||
snprintf(path, PATH_MAX, "%ssync/%s", dbpath, treename);
|
|
||||||
/* TODO this is rediculous, we try to do this even if we can't */
|
|
||||||
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
|
||||||
path);
|
|
||||||
if(_alpm_makepath(path) != 0) {
|
|
||||||
RET_ERR(PM_ERR_SYSTEM, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the db gets the real path. */
|
_alpm_pkg_free(data);
|
||||||
path[0] = '\0';
|
|
||||||
snprintf(path, PATH_MAX, "%ssync/", dbpath);
|
_alpm_db_free_grpcache(db);
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
db = _alpm_db_new(path, treename);
|
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
RET_ERR(PM_ERR_DB_CREATE, NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "opening database '%s'\n", db->treename);
|
pmpkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db);
|
||||||
if(_alpm_db_open(db) == -1) {
|
if(!pkgcache) {
|
||||||
_alpm_db_free(db);
|
_alpm_log(PM_LOG_DEBUG, "warning: failed to get '%s' from NULL pkgcache\n",
|
||||||
RET_ERR(PM_ERR_DB_OPEN, NULL);
|
target);
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
|
return(_alpm_pkghash_find(pkgcache, target));
|
||||||
return(db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper function for alpm_list_find and _alpm_db_whatprovides
|
/* Returns a new group cache from db.
|
||||||
*
|
|
||||||
* @return "provision.name" == needle (as string)
|
|
||||||
*/
|
*/
|
||||||
int _alpm_prov_cmp(const void *provision, const void *needle)
|
int _alpm_db_load_grpcache(pmdb_t *db)
|
||||||
{
|
{
|
||||||
char *tmpptr;
|
|
||||||
char *provname = strdup(provision);
|
|
||||||
int retval = 0;
|
|
||||||
tmpptr = strchr(provname, '=');
|
|
||||||
|
|
||||||
if(tmpptr != NULL) { /* provision-version */
|
|
||||||
*tmpptr='\0';
|
|
||||||
}
|
|
||||||
retval = strcmp(provname, needle);
|
|
||||||
free(provname);
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return a alpm_list_t of packages in "db" that provide "package"
|
|
||||||
*/
|
|
||||||
alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package)
|
|
||||||
{
|
|
||||||
alpm_list_t *pkgs = NULL;
|
|
||||||
alpm_list_t *lp;
|
alpm_list_t *lp;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(db == NULL || package == NULL || strlen(package) == 0) {
|
if(db == NULL) {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'\n",
|
||||||
|
db->treename);
|
||||||
|
|
||||||
|
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
|
||||||
|
const alpm_list_t *i;
|
||||||
|
pmpkg_t *pkg = lp->data;
|
||||||
|
|
||||||
|
for(i = alpm_pkg_get_groups(pkg); i; i = i->next) {
|
||||||
|
const char *grpname = i->data;
|
||||||
|
alpm_list_t *j;
|
||||||
|
pmgrp_t *grp = NULL;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
/* first look through the group cache for a group with this name */
|
||||||
|
for(j = db->grpcache; j; j = j->next) {
|
||||||
|
grp = j->data;
|
||||||
|
|
||||||
|
if(strcmp(grp->name, grpname) == 0
|
||||||
|
&& !alpm_list_find_ptr(grp->packages, pkg)) {
|
||||||
|
grp->packages = alpm_list_add(grp->packages, pkg);
|
||||||
|
found = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(found) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* we didn't find the group, so create a new one with this name */
|
||||||
|
grp = _alpm_grp_new(grpname);
|
||||||
|
grp->packages = alpm_list_add(grp->packages, pkg);
|
||||||
|
db->grpcache = alpm_list_add(db->grpcache, grp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
db->grpcache_loaded = 1;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _alpm_db_free_grpcache(pmdb_t *db)
|
||||||
|
{
|
||||||
|
alpm_list_t *lg;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(db == NULL || !db->grpcache_loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "freeing group cache for repository '%s'\n",
|
||||||
|
db->treename);
|
||||||
|
|
||||||
|
for(lg = db->grpcache; lg; lg = lg->next) {
|
||||||
|
_alpm_grp_free(lg->data);
|
||||||
|
lg->data = NULL;
|
||||||
|
}
|
||||||
|
FREELIST(db->grpcache);
|
||||||
|
db->grpcache_loaded = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(db == NULL) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
|
if(!db->grpcache_loaded) {
|
||||||
pmpkg_t *info = lp->data;
|
_alpm_db_load_grpcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
if(alpm_list_find(alpm_pkg_get_provides(info), (const void *)package, _alpm_prov_cmp)) {
|
return(db->grpcache);
|
||||||
pkgs = alpm_list_add(pkgs, info);
|
}
|
||||||
|
|
||||||
|
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(db == NULL || target == NULL || strlen(target) == 0) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = _alpm_db_get_grpcache(db); i; i = i->next) {
|
||||||
|
pmgrp_t *info = i->data;
|
||||||
|
|
||||||
|
if(strcmp(info->name, target) == 0) {
|
||||||
|
return(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(pkgs);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* db.h
|
* db.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||||
*
|
*
|
||||||
@@ -22,54 +23,80 @@
|
|||||||
#define _ALPM_DB_H
|
#define _ALPM_DB_H
|
||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include <limits.h>
|
#include "pkghash.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
/* Database entries */
|
/* Database entries */
|
||||||
typedef enum _pmdbinfrq_t {
|
typedef enum _pmdbinfrq_t {
|
||||||
INFRQ_BASE = 0x01,
|
INFRQ_BASE = 1,
|
||||||
INFRQ_DESC = 0x02,
|
INFRQ_DESC = (1 << 1),
|
||||||
INFRQ_DEPENDS = 0x04,
|
INFRQ_FILES = (1 << 2),
|
||||||
INFRQ_FILES = 0x08,
|
INFRQ_SCRIPTLET = (1 << 3),
|
||||||
INFRQ_SCRIPTLET = 0x10,
|
INFRQ_DSIZE = (1 << 4),
|
||||||
INFRQ_DELTAS = 0x20,
|
/* ALL should be info stored in the package or database */
|
||||||
/* ALL should be sum of all above */
|
INFRQ_ALL = 0x1F
|
||||||
INFRQ_ALL = 0x3F
|
|
||||||
} pmdbinfrq_t;
|
} pmdbinfrq_t;
|
||||||
|
|
||||||
|
struct db_operations {
|
||||||
|
int (*populate) (pmdb_t *);
|
||||||
|
void (*unregister) (pmdb_t *);
|
||||||
|
int (*version) (pmdb_t *);
|
||||||
|
};
|
||||||
|
|
||||||
/* Database */
|
/* Database */
|
||||||
struct __pmdb_t {
|
struct __pmdb_t {
|
||||||
char *path;
|
char *treename;
|
||||||
char treename[PATH_MAX];
|
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
||||||
void *handle;
|
char *_path;
|
||||||
alpm_list_t *pkgcache;
|
int pkgcache_loaded;
|
||||||
|
int grpcache_loaded;
|
||||||
|
/* also indicates whether we are RO or RW */
|
||||||
|
int is_local;
|
||||||
|
pmpkghash_t *pkgcache;
|
||||||
alpm_list_t *grpcache;
|
alpm_list_t *grpcache;
|
||||||
alpm_list_t *servers;
|
alpm_list_t *servers;
|
||||||
|
|
||||||
|
struct db_operations *ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* db.c, database general calls */
|
/* db.c, database general calls */
|
||||||
pmdb_t *_alpm_db_new(const char *dbpath, const char *treename);
|
pmdb_t *_alpm_db_new(const char *treename, int is_local);
|
||||||
void _alpm_db_free(pmdb_t *db);
|
void _alpm_db_free(pmdb_t *db);
|
||||||
int _alpm_db_cmp(const void *db1, const void *db2);
|
const char *_alpm_db_path(pmdb_t *db);
|
||||||
|
int _alpm_db_version(pmdb_t *db);
|
||||||
|
int _alpm_db_cmp(const void *d1, const void *d2);
|
||||||
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
|
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
|
||||||
pmdb_t *_alpm_db_register_local(void);
|
pmdb_t *_alpm_db_register_local(void);
|
||||||
pmdb_t *_alpm_db_register_sync(const char *treename);
|
pmdb_t *_alpm_db_register_sync(const char *treename);
|
||||||
|
void _alpm_db_unregister(pmdb_t *db);
|
||||||
|
|
||||||
/* Provision */
|
/* be_*.c, backend specific calls */
|
||||||
int _alpm_prov_cmp(const void *provision, const void *needle);
|
int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
||||||
alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package);
|
int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info);
|
||||||
|
int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
||||||
|
int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info);
|
||||||
|
|
||||||
/* be.c, backend specific calls */
|
/* cache bullshit */
|
||||||
int _alpm_db_install(pmdb_t *db, const char *dbfile);
|
/* packages */
|
||||||
int _alpm_db_open(pmdb_t *db);
|
int _alpm_db_load_pkgcache(pmdb_t *db);
|
||||||
void _alpm_db_close(pmdb_t *db);
|
void _alpm_db_free_pkgcache(pmdb_t *db);
|
||||||
void _alpm_db_rewind(pmdb_t *db);
|
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
|
||||||
pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target);
|
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
|
||||||
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db);
|
||||||
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db);
|
||||||
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
|
int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
|
||||||
time_t _alpm_db_getlastupdate(const pmdb_t *db);
|
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
|
||||||
int _alpm_db_setlastupdate(const pmdb_t *db, time_t time);
|
/* groups */
|
||||||
|
int _alpm_db_load_grpcache(pmdb_t *db);
|
||||||
|
void _alpm_db_free_grpcache(pmdb_t *db);
|
||||||
|
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
|
||||||
|
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
|
||||||
|
|
||||||
#endif /* _ALPM_DB_H */
|
#endif /* _ALPM_DB_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* delta.c
|
* delta.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,14 +22,17 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h> /* intmax_t */
|
||||||
|
#include <limits.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "delta.h"
|
#include "delta.h"
|
||||||
#include "error.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "alpm_list.h"
|
#include "graph.h"
|
||||||
#include "alpm.h"
|
|
||||||
|
|
||||||
/** \addtogroup alpm_deltas Delta Functions
|
/** \addtogroup alpm_deltas Delta Functions
|
||||||
* @brief Functions to manipulate libalpm deltas
|
* @brief Functions to manipulate libalpm deltas
|
||||||
@@ -37,230 +41,314 @@
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_from(pmdelta_t *delta)
|
const char SYMEXPORT *alpm_delta_get_from(pmdelta_t *delta)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
ASSERT(delta != NULL, return(NULL));
|
||||||
|
|
||||||
return(delta->from);
|
return(delta->from);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_to(pmdelta_t *delta)
|
const char SYMEXPORT *alpm_delta_get_to(pmdelta_t *delta)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
ASSERT(delta != NULL, return(NULL));
|
||||||
|
|
||||||
return(delta->to);
|
return(delta->to);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(delta != NULL, return(-1));
|
|
||||||
|
|
||||||
return(delta->size);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_filename(pmdelta_t *delta)
|
const char SYMEXPORT *alpm_delta_get_filename(pmdelta_t *delta)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
ASSERT(delta != NULL, return(NULL));
|
||||||
|
return(delta->delta);
|
||||||
return(delta->filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
|
const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
ASSERT(delta != NULL, return(NULL));
|
||||||
|
return(delta->delta_md5);
|
||||||
|
}
|
||||||
|
|
||||||
return(delta->md5sum);
|
off_t SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
|
||||||
|
{
|
||||||
|
ASSERT(delta != NULL, return(-1));
|
||||||
|
return(delta->delta_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** Calculates the combined size of a list of delta files.
|
static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
||||||
*
|
|
||||||
* @param deltas the list of pmdelta_t * objects
|
|
||||||
*
|
|
||||||
* @return the combined size
|
|
||||||
*/
|
|
||||||
unsigned long _alpm_delta_path_size(alpm_list_t *deltas)
|
|
||||||
{
|
{
|
||||||
unsigned long sum = 0;
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *dlts = deltas;
|
alpm_list_t *vertices = NULL;
|
||||||
|
/* create the vertices */
|
||||||
while(dlts) {
|
for(i = deltas; i; i = i->next) {
|
||||||
pmdelta_t *d = (pmdelta_t *)alpm_list_getdata(dlts);
|
pmgraph_t *v = _alpm_graph_new();
|
||||||
sum += d->size;
|
pmdelta_t *vdelta = i->data;
|
||||||
|
vdelta->download_size = vdelta->delta_size;
|
||||||
dlts = alpm_list_next(dlts);
|
v->weight = LONG_MAX;
|
||||||
|
v->data = vdelta;
|
||||||
|
vertices = alpm_list_add(vertices, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(sum);
|
/* compute the edges */
|
||||||
|
for(i = vertices; i; i = i->next) {
|
||||||
|
pmgraph_t *v_i = i->data;
|
||||||
|
pmdelta_t *d_i = v_i->data;
|
||||||
|
/* loop a second time so we make all possible comparisons */
|
||||||
|
for(j = vertices; j; j = j->next) {
|
||||||
|
pmgraph_t *v_j = j->data;
|
||||||
|
pmdelta_t *d_j = v_j->data;
|
||||||
|
/* We want to create a delta tree like the following:
|
||||||
|
* 1_to_2
|
||||||
|
* |
|
||||||
|
* 1_to_3 2_to_3
|
||||||
|
* \ /
|
||||||
|
* 3_to_4
|
||||||
|
* If J 'from' is equal to I 'to', then J is a child of I.
|
||||||
|
* */
|
||||||
|
if((!reverse && strcmp(d_j->from, d_i->to) == 0) ||
|
||||||
|
(reverse && strcmp(d_j->to, d_i->from) == 0)) {
|
||||||
|
v_i->children = alpm_list_add(v_i->children, v_j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v_i->childptr = v_i->children;
|
||||||
|
}
|
||||||
|
return(vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculates the combined size of a list of delta files that are not
|
static void graph_init_size(alpm_list_t *vertices)
|
||||||
* in the cache.
|
|
||||||
*
|
|
||||||
* @param deltas the list of pmdelta_t * objects
|
|
||||||
*
|
|
||||||
* @return the combined size
|
|
||||||
*/
|
|
||||||
unsigned long _alpm_delta_path_size_uncached(alpm_list_t *deltas)
|
|
||||||
{
|
{
|
||||||
unsigned long sum = 0;
|
alpm_list_t *i;
|
||||||
alpm_list_t *dlts = deltas;
|
|
||||||
|
|
||||||
while(dlts) {
|
for(i = vertices; i; i = i->next) {
|
||||||
pmdelta_t *d = (pmdelta_t *)alpm_list_getdata(dlts);
|
char *fpath, *md5sum;
|
||||||
char *fname = _alpm_filecache_find(d->filename);
|
pmgraph_t *v = i->data;
|
||||||
|
pmdelta_t *vdelta = v->data;
|
||||||
|
|
||||||
if(!fname) {
|
/* determine whether the delta file already exists */
|
||||||
sum += d->size;
|
fpath = _alpm_filecache_find(vdelta->delta);
|
||||||
|
md5sum = alpm_compute_md5sum(fpath);
|
||||||
|
if(fpath && md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
|
||||||
|
vdelta->download_size = 0;
|
||||||
|
}
|
||||||
|
FREE(fpath);
|
||||||
|
FREE(md5sum);
|
||||||
|
|
||||||
|
/* determine whether a base 'from' file exists */
|
||||||
|
fpath = _alpm_filecache_find(vdelta->from);
|
||||||
|
if(fpath) {
|
||||||
|
v->weight = vdelta->download_size;
|
||||||
|
}
|
||||||
|
FREE(fpath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(fname);
|
|
||||||
|
|
||||||
dlts = alpm_list_next(dlts);
|
static void dijkstra(alpm_list_t *vertices)
|
||||||
}
|
|
||||||
|
|
||||||
return(sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Calculates the shortest path from one version to another.
|
|
||||||
*
|
|
||||||
* The shortest path is defined as the path with the smallest combined
|
|
||||||
* size, not the length of the path.
|
|
||||||
*
|
|
||||||
* The algorithm is based on Dijkstra's shortest path algorithm.
|
|
||||||
*
|
|
||||||
* @param deltas the list of pmdelta_t * objects that a package has
|
|
||||||
* @param from the version to start from
|
|
||||||
* @param to the version to end at
|
|
||||||
* @param path the current path
|
|
||||||
*
|
|
||||||
* @return the list of pmdelta_t * objects that has the smallest size.
|
|
||||||
* NULL (the empty list) is returned if there is no path between the
|
|
||||||
* versions.
|
|
||||||
*/
|
|
||||||
static alpm_list_t *shortest_delta_path(alpm_list_t *deltas,
|
|
||||||
const char *from, const char *to, alpm_list_t *path)
|
|
||||||
{
|
{
|
||||||
alpm_list_t *d;
|
alpm_list_t *i;
|
||||||
alpm_list_t *shortest = NULL;
|
pmgraph_t *v;
|
||||||
|
while(1) {
|
||||||
|
v = NULL;
|
||||||
|
/* find the smallest vertice not visited yet */
|
||||||
|
for(i = vertices; i; i = i->next) {
|
||||||
|
pmgraph_t *v_i = i->data;
|
||||||
|
|
||||||
/* Found the 'to' version, this is a good path so return it. */
|
if(v_i->state == -1) {
|
||||||
if(strcmp(from, to) == 0) {
|
|
||||||
return(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(d = deltas; d; d = alpm_list_next(d)) {
|
|
||||||
pmdelta_t *v = alpm_list_getdata(d);
|
|
||||||
|
|
||||||
/* If this vertex has already been visited in the path, go to the
|
|
||||||
* next vertex. */
|
|
||||||
if(alpm_list_find_ptr(path, v)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Once we find a vertex that starts at the 'from' version,
|
if(v == NULL || v_i->weight < v->weight) {
|
||||||
* recursively find the shortest path using the 'to' version of this
|
v = v_i;
|
||||||
* current vertex as the 'from' version in the function call. */
|
|
||||||
if(strcmp(v->from, from) == 0) {
|
|
||||||
alpm_list_t *newpath = alpm_list_copy(path);
|
|
||||||
newpath = alpm_list_add(newpath, v);
|
|
||||||
newpath = shortest_delta_path(deltas, v->to, to, newpath);
|
|
||||||
|
|
||||||
if(newpath != NULL) {
|
|
||||||
/* The path returned works, now use it unless there is already a
|
|
||||||
* shorter path found. */
|
|
||||||
if(shortest == NULL) {
|
|
||||||
shortest = newpath;
|
|
||||||
} else if(_alpm_delta_path_size(shortest) > _alpm_delta_path_size(newpath)) {
|
|
||||||
alpm_list_free(shortest);
|
|
||||||
shortest = newpath;
|
|
||||||
} else {
|
|
||||||
alpm_list_free(newpath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(v == NULL || v->weight == LONG_MAX) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
v->state = -1;
|
||||||
|
|
||||||
|
v->childptr = v->children;
|
||||||
|
while(v->childptr) {
|
||||||
|
pmgraph_t *v_c = v->childptr->data;
|
||||||
|
pmdelta_t *d_c = v_c->data;
|
||||||
|
if(v_c->weight > v->weight + d_c->download_size) {
|
||||||
|
v_c->weight = v->weight + d_c->download_size;
|
||||||
|
v_c->parent = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
v->childptr = (v->childptr)->next;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_free(path);
|
static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **path)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
pmgraph_t *v = NULL;
|
||||||
|
off_t bestsize = 0;
|
||||||
|
alpm_list_t *rpath = NULL;
|
||||||
|
|
||||||
return(shortest);
|
for(i = vertices; i; i = i->next) {
|
||||||
|
pmgraph_t *v_i = i->data;
|
||||||
|
pmdelta_t *d_i = v_i->data;
|
||||||
|
|
||||||
|
if(strcmp(d_i->to, to) == 0) {
|
||||||
|
if(v == NULL || v_i->weight < v->weight) {
|
||||||
|
v = v_i;
|
||||||
|
bestsize = v->weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while(v != NULL) {
|
||||||
|
pmdelta_t *vdelta = v->data;
|
||||||
|
rpath = alpm_list_add(rpath, vdelta);
|
||||||
|
v = v->parent;
|
||||||
|
}
|
||||||
|
*path = alpm_list_reverse(rpath);
|
||||||
|
alpm_list_free(rpath);
|
||||||
|
|
||||||
|
return(bestsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculates the shortest path from one version to another.
|
/** Calculates the shortest path from one version to another.
|
||||||
*
|
|
||||||
* The shortest path is defined as the path with the smallest combined
|
* The shortest path is defined as the path with the smallest combined
|
||||||
* size, not the length of the path.
|
* size, not the length of the path.
|
||||||
*
|
* @param deltas the list of pmdelta_t * objects that a file has
|
||||||
* @param deltas the list of pmdelta_t * objects that a package has
|
* @param to the file to start the search at
|
||||||
* @param from the version to start from
|
* @param path the pointer to a list location where pmdelta_t * objects that
|
||||||
* @param to the version to end at
|
* have the smallest size are placed. NULL is set if there is no path
|
||||||
*
|
* possible with the files available.
|
||||||
* @return the list of pmdelta_t * objects that has the smallest size.
|
* @return the size of the path stored, or LONG_MAX if path is unfindable
|
||||||
* NULL (the empty list) is returned if there is no path between the
|
|
||||||
* versions.
|
|
||||||
*/
|
*/
|
||||||
alpm_list_t *_alpm_shortest_delta_path(alpm_list_t *deltas, const char *from,
|
off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
|
||||||
const char *to)
|
const char *to, alpm_list_t **path)
|
||||||
{
|
{
|
||||||
alpm_list_t *path = NULL;
|
alpm_list_t *bestpath = NULL;
|
||||||
|
alpm_list_t *vertices;
|
||||||
|
off_t bestsize = LONG_MAX;
|
||||||
|
|
||||||
path = shortest_delta_path(deltas, from, to, path);
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
return(path);
|
if(deltas == NULL) {
|
||||||
|
*path = NULL;
|
||||||
|
return(bestsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "started delta shortest-path search for '%s'\n", to);
|
||||||
|
|
||||||
|
vertices = graph_init(deltas, 0);
|
||||||
|
graph_init_size(vertices);
|
||||||
|
dijkstra(vertices);
|
||||||
|
bestsize = shortest_path(vertices, to, &bestpath);
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "delta shortest-path search complete : '%jd'\n", (intmax_t)bestsize);
|
||||||
|
|
||||||
|
alpm_list_free_inner(vertices, _alpm_graph_free);
|
||||||
|
alpm_list_free(vertices);
|
||||||
|
|
||||||
|
*path = bestpath;
|
||||||
|
return(bestsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota)
|
||||||
|
{
|
||||||
|
alpm_list_t *unused = NULL;
|
||||||
|
alpm_list_t *vertices;
|
||||||
|
alpm_list_t *i;
|
||||||
|
vertices = graph_init(deltas, 1);
|
||||||
|
|
||||||
|
for(i = vertices; i; i = i->next) {
|
||||||
|
pmgraph_t *v = i->data;
|
||||||
|
pmdelta_t *vdelta = v->data;
|
||||||
|
if(strcmp(vdelta->to, to) == 0)
|
||||||
|
{
|
||||||
|
v->weight = vdelta->download_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dijkstra(vertices);
|
||||||
|
for(i = vertices; i; i = i->next) {
|
||||||
|
pmgraph_t *v = i->data;
|
||||||
|
pmdelta_t *vdelta = v->data;
|
||||||
|
if(v->weight > quota) {
|
||||||
|
unused = alpm_list_add(unused, vdelta->delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alpm_list_free_inner(vertices, _alpm_graph_free);
|
||||||
|
alpm_list_free(vertices);
|
||||||
|
return(unused);
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
off_t pkgsize = alpm_pkg_get_size(pkg);
|
||||||
|
alpm_list_t *unused = find_unused(
|
||||||
|
alpm_pkg_get_deltas(pkg),
|
||||||
|
alpm_pkg_get_filename(pkg),
|
||||||
|
pkgsize * MAX_DELTA_RATIO);
|
||||||
|
return(unused);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Parses the string representation of a pmdelta_t object.
|
/** Parses the string representation of a pmdelta_t object.
|
||||||
*
|
|
||||||
* This function assumes that the string is in the correct format.
|
* This function assumes that the string is in the correct format.
|
||||||
*
|
* This format is as follows:
|
||||||
|
* $deltafile $deltamd5 $deltasize $oldfile $newfile
|
||||||
* @param line the string to parse
|
* @param line the string to parse
|
||||||
*
|
|
||||||
* @return A pointer to the new pmdelta_t object
|
* @return A pointer to the new pmdelta_t object
|
||||||
*/
|
*/
|
||||||
|
/* TODO this does not really belong here, but in a parsing lib */
|
||||||
pmdelta_t *_alpm_delta_parse(char *line)
|
pmdelta_t *_alpm_delta_parse(char *line)
|
||||||
{
|
{
|
||||||
pmdelta_t *delta;
|
pmdelta_t *delta;
|
||||||
char *tmp = line, *tmp2;
|
char *tmp = line, *tmp2;
|
||||||
|
regex_t reg;
|
||||||
|
|
||||||
|
regcomp(®,
|
||||||
|
"^[^[:space:]]* [[:xdigit:]]{32} [[:digit:]]*"
|
||||||
|
" [^[:space:]]* [^[:space:]]*$",
|
||||||
|
REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
|
||||||
|
if(regexec(®, line, 0, 0, 0) != 0) {
|
||||||
|
/* delta line is invalid, return NULL */
|
||||||
|
regfree(®);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
regfree(®);
|
||||||
|
|
||||||
CALLOC(delta, 1, sizeof(pmdelta_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(delta, 1, sizeof(pmdelta_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
strncpy(delta->from, tmp2, DLT_VERSION_LEN);
|
STRDUP(delta->delta, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
strncpy(delta->to, tmp2, DLT_VERSION_LEN);
|
STRDUP(delta->delta_md5, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
delta->size = atol(tmp2);
|
delta->delta_size = atol(tmp2);
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
strncpy(delta->filename, tmp2, DLT_FILENAME_LEN);
|
STRDUP(delta->from, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
strncpy(delta->md5sum, tmp, DLT_MD5SUM_LEN);
|
tmp2 = tmp;
|
||||||
|
STRDUP(delta->to, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "delta : %s %s '%jd'\n", delta->from, delta->to, (intmax_t)delta->delta_size);
|
||||||
|
|
||||||
return(delta);
|
return(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _alpm_delta_free(pmdelta_t *delta)
|
||||||
|
{
|
||||||
|
FREE(delta->from);
|
||||||
|
FREE(delta->to);
|
||||||
|
FREE(delta->delta);
|
||||||
|
FREE(delta->delta_md5);
|
||||||
|
FREE(delta);
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* delta.h
|
* delta.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,24 +20,32 @@
|
|||||||
#ifndef _ALPM_DELTA_H
|
#ifndef _ALPM_DELTA_H
|
||||||
#define _ALPM_DELTA_H
|
#define _ALPM_DELTA_H
|
||||||
|
|
||||||
|
#include <sys/types.h> /* off_t */
|
||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
#define DLT_FILENAME_LEN 512
|
|
||||||
#define DLT_VERSION_LEN 64
|
|
||||||
#define DLT_MD5SUM_LEN 33
|
|
||||||
|
|
||||||
struct __pmdelta_t {
|
struct __pmdelta_t {
|
||||||
char from[DLT_VERSION_LEN];
|
/** filename of the delta patch */
|
||||||
char to[DLT_VERSION_LEN];
|
char *delta;
|
||||||
unsigned long size;
|
/** md5sum of the delta file */
|
||||||
char filename[DLT_FILENAME_LEN];
|
char *delta_md5;
|
||||||
char md5sum[DLT_MD5SUM_LEN];
|
/** filesize of the delta file */
|
||||||
|
off_t delta_size;
|
||||||
|
/** filename of the 'before' file */
|
||||||
|
char *from;
|
||||||
|
/** filename of the 'after' file */
|
||||||
|
char *to;
|
||||||
|
/** download filesize of the delta file */
|
||||||
|
off_t download_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned long _alpm_delta_path_size(alpm_list_t *deltas);
|
|
||||||
unsigned long _alpm_delta_path_size_uncached(alpm_list_t *deltas);
|
|
||||||
pmdelta_t *_alpm_delta_parse(char *line);
|
pmdelta_t *_alpm_delta_parse(char *line);
|
||||||
alpm_list_t *_alpm_shortest_delta_path(alpm_list_t *deltas, const char *from, const char *to);
|
void _alpm_delta_free(pmdelta_t *delta);
|
||||||
|
off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
|
||||||
|
const char *to, alpm_list_t **path);
|
||||||
|
|
||||||
|
/* max percent of package size to download deltas */
|
||||||
|
#define MAX_DELTA_RATIO 0.7
|
||||||
|
|
||||||
#endif /* _ALPM_DELTA_H */
|
#endif /* _ALPM_DELTA_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* deps.c
|
* deps.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||||
*
|
*
|
||||||
@@ -30,37 +31,20 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "error.h"
|
#include "graph.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "cache.h"
|
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
|
||||||
static pmgraph_t *_alpm_graph_new(void)
|
void _alpm_dep_free(pmdepend_t *dep)
|
||||||
{
|
{
|
||||||
pmgraph_t *graph = NULL;
|
FREE(dep->name);
|
||||||
|
FREE(dep->version);
|
||||||
MALLOC(graph, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
FREE(dep);
|
||||||
|
|
||||||
if(graph) {
|
|
||||||
graph->state = 0;
|
|
||||||
graph->data = NULL;
|
|
||||||
graph->parent = NULL;
|
|
||||||
graph->children = NULL;
|
|
||||||
graph->childptr = NULL;
|
|
||||||
}
|
|
||||||
return(graph);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _alpm_graph_free(void *data)
|
static pmdepmissing_t *depmiss_new(const char *target, pmdepend_t *dep,
|
||||||
{
|
const char *causingpkg)
|
||||||
pmgraph_t *graph = data;
|
|
||||||
alpm_list_free(graph->children);
|
|
||||||
free(graph);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod,
|
|
||||||
const char *depname, const char *depversion)
|
|
||||||
{
|
{
|
||||||
pmdepmissing_t *miss;
|
pmdepmissing_t *miss;
|
||||||
|
|
||||||
@@ -68,26 +52,41 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod,
|
|||||||
|
|
||||||
MALLOC(miss, sizeof(pmdepmissing_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(miss, sizeof(pmdepmissing_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
strncpy(miss->target, target, PKG_NAME_LEN);
|
STRDUP(miss->target, target, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
miss->depend.mod = depmod;
|
miss->depend = _alpm_dep_dup(dep);
|
||||||
strncpy(miss->depend.name, depname, PKG_NAME_LEN);
|
STRDUP(miss->causingpkg, causingpkg, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
if(depversion) {
|
|
||||||
strncpy(miss->depend.version, depversion, PKG_VERSION_LEN);
|
|
||||||
} else {
|
|
||||||
miss->depend.version[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(miss);
|
return(miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _alpm_depmiss_free(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
_alpm_dep_free(miss->depend);
|
||||||
|
FREE(miss->target);
|
||||||
|
FREE(miss->causingpkg);
|
||||||
|
FREE(miss);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */
|
||||||
|
static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) {
|
||||||
|
if(_alpm_depcmp(pkg2, i->data)) {
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert a list of pmpkg_t * to a graph structure,
|
/* Convert a list of pmpkg_t * to a graph structure,
|
||||||
* with a edge for each dependency.
|
* with a edge for each dependency.
|
||||||
* Returns a list of vertices (one vertex = one package)
|
* Returns a list of vertices (one vertex = one package)
|
||||||
* (used by alpm_sortbydeps)
|
* (used by alpm_sortbydeps)
|
||||||
*/
|
*/
|
||||||
static alpm_list_t *_alpm_graph_init(alpm_list_t *targets)
|
static alpm_list_t *dep_graph_init(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k;
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *vertices = NULL;
|
alpm_list_t *vertices = NULL;
|
||||||
/* We create the vertices */
|
/* We create the vertices */
|
||||||
for(i = targets; i; i = i->next) {
|
for(i = targets; i; i = i->next) {
|
||||||
@@ -104,12 +103,7 @@ static alpm_list_t *_alpm_graph_init(alpm_list_t *targets)
|
|||||||
for(j = vertices; j; j = j->next) {
|
for(j = vertices; j; j = j->next) {
|
||||||
pmgraph_t *vertex_j = j->data;
|
pmgraph_t *vertex_j = j->data;
|
||||||
pmpkg_t *p_j = vertex_j->data;
|
pmpkg_t *p_j = vertex_j->data;
|
||||||
int child = 0;
|
if(_alpm_dep_edge(p_i, p_j)) {
|
||||||
for(k = alpm_pkg_get_depends(p_i); k && !child; k = k->next) {
|
|
||||||
pmdepend_t *depend = k->data;
|
|
||||||
child = alpm_depcmp(p_j, depend);
|
|
||||||
}
|
|
||||||
if(child) {
|
|
||||||
vertex_i->children =
|
vertex_i->children =
|
||||||
alpm_list_add(vertex_i->children, vertex_j);
|
alpm_list_add(vertex_i->children, vertex_j);
|
||||||
}
|
}
|
||||||
@@ -121,20 +115,19 @@ static alpm_list_t *_alpm_graph_init(alpm_list_t *targets)
|
|||||||
|
|
||||||
/* Re-order a list of target packages with respect to their dependencies.
|
/* Re-order a list of target packages with respect to their dependencies.
|
||||||
*
|
*
|
||||||
* Example (PM_TRANS_TYPE_ADD):
|
* Example (reverse == 0):
|
||||||
* A depends on C
|
* A depends on C
|
||||||
* B depends on A
|
* B depends on A
|
||||||
* Target order is A,B,C,D
|
* Target order is A,B,C,D
|
||||||
*
|
*
|
||||||
* Should be re-ordered to C,A,B,D
|
* Should be re-ordered to C,A,B,D
|
||||||
*
|
*
|
||||||
* mode should be either PM_TRANS_TYPE_ADD or PM_TRANS_TYPE_REMOVE. This
|
* if reverse is > 0, the dependency order will be reversed.
|
||||||
* affects the dependency order sortbydeps() will use.
|
|
||||||
*
|
*
|
||||||
* This function returns the new alpm_list_t* target list.
|
* This function returns the new alpm_list_t* target list.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
|
||||||
{
|
{
|
||||||
alpm_list_t *newtargs = NULL;
|
alpm_list_t *newtargs = NULL;
|
||||||
alpm_list_t *vertices = NULL;
|
alpm_list_t *vertices = NULL;
|
||||||
@@ -149,7 +142,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
|||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "started sorting dependencies\n");
|
_alpm_log(PM_LOG_DEBUG, "started sorting dependencies\n");
|
||||||
|
|
||||||
vertices = _alpm_graph_init(targets);
|
vertices = dep_graph_init(targets);
|
||||||
|
|
||||||
vptr = vertices;
|
vptr = vertices;
|
||||||
vertex = vertices->data;
|
vertex = vertices->data;
|
||||||
@@ -158,8 +151,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
|||||||
vertex->state = -1;
|
vertex->state = -1;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
while(vertex->childptr && !found) {
|
while(vertex->childptr && !found) {
|
||||||
pmgraph_t *nextchild = (vertex->childptr)->data;
|
pmgraph_t *nextchild = vertex->childptr->data;
|
||||||
vertex->childptr = (vertex->childptr)->next;
|
vertex->childptr = vertex->childptr->next;
|
||||||
if (nextchild->state == 0) {
|
if (nextchild->state == 0) {
|
||||||
found = 1;
|
found = 1;
|
||||||
nextchild->parent = vertex;
|
nextchild->parent = vertex;
|
||||||
@@ -168,12 +161,15 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
|||||||
else if(nextchild->state == -1) {
|
else if(nextchild->state == -1) {
|
||||||
pmpkg_t *vertexpkg = vertex->data;
|
pmpkg_t *vertexpkg = vertex->data;
|
||||||
pmpkg_t *childpkg = nextchild->data;
|
pmpkg_t *childpkg = nextchild->data;
|
||||||
|
const char *message;
|
||||||
|
|
||||||
_alpm_log(PM_LOG_WARNING, _("dependency cycle detected:\n"));
|
_alpm_log(PM_LOG_WARNING, _("dependency cycle detected:\n"));
|
||||||
if(mode == PM_TRANS_TYPE_REMOVE) {
|
if(reverse) {
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s will be removed after its %s dependency\n"), vertexpkg->name, childpkg->name);
|
message =_("%s will be removed after its %s dependency\n");
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s will be installed before its %s dependency\n"), vertexpkg->name, childpkg->name);
|
message =_("%s will be installed before its %s dependency\n");
|
||||||
}
|
}
|
||||||
|
_alpm_log(PM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) {
|
if(!found) {
|
||||||
@@ -194,8 +190,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
|||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "sorting dependencies finished\n");
|
_alpm_log(PM_LOG_DEBUG, "sorting dependencies finished\n");
|
||||||
|
|
||||||
if(mode == PM_TRANS_TYPE_REMOVE) {
|
if(reverse) {
|
||||||
/* we're removing packages, so reverse the order */
|
/* reverse the order */
|
||||||
alpm_list_t *tmptargs = alpm_list_reverse(newtargs);
|
alpm_list_t *tmptargs = alpm_list_reverse(newtargs);
|
||||||
/* free the old one */
|
/* free the old one */
|
||||||
alpm_list_free(newtargs);
|
alpm_list_free(newtargs);
|
||||||
@@ -208,38 +204,79 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
|||||||
return(newtargs);
|
return(newtargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Little helper function for alpm_list_find */
|
static int no_dep_version(void)
|
||||||
static int satisfycmp(const void *pkg, const void *depend)
|
|
||||||
{
|
{
|
||||||
return(!alpm_depcmp((pmpkg_t*) pkg, (pmdepend_t*) depend));
|
int flags = alpm_trans_get_flags();
|
||||||
|
return flags != -1 && (flags & PM_TRANS_FLAG_NODEPVERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion)
|
||||||
|
{
|
||||||
|
if(nodepversion) {
|
||||||
|
pmdepend_t *newdep = _alpm_dep_dup(dep);
|
||||||
|
ASSERT(newdep, return(dep));
|
||||||
|
newdep->mod = PM_DEP_MOD_ANY;
|
||||||
|
dep = newdep;
|
||||||
|
}
|
||||||
|
return dep;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void release_filtered_depend(pmdepend_t *dep, int nodepversion)
|
||||||
|
{
|
||||||
|
if(nodepversion) {
|
||||||
|
free(dep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
for(i = pkgs; i; i = alpm_list_next(i)) {
|
||||||
|
pmpkg_t *pkg = i->data;
|
||||||
|
if(_alpm_depcmp(pkg, dep)) {
|
||||||
|
return(pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Find a package satisfying a specified dependency.
|
||||||
|
* The dependency can include versions with depmod operators.
|
||||||
|
* @param pkgs an alpm_list_t* of pmpkg_t where the satisfier will be searched
|
||||||
|
* @param depstring package or provision name, versioned or not
|
||||||
|
* @return a pmpkg_t* satisfying depstring
|
||||||
|
*/
|
||||||
|
pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
|
||||||
|
{
|
||||||
|
pmdepend_t *dep = _alpm_splitdep(depstring);
|
||||||
|
pmpkg_t *pkg = find_dep_satisfier(pkgs, dep);
|
||||||
|
_alpm_dep_free(dep);
|
||||||
|
return(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks dependencies and returns missing ones in a list.
|
/** Checks dependencies and returns missing ones in a list.
|
||||||
* Dependencies can include versions with depmod operators.
|
* Dependencies can include versions with depmod operators.
|
||||||
* @param db pointer to the local package database
|
* @param pkglist the list of local packages
|
||||||
* @param reversedeps handles the backward dependencies
|
* @param reversedeps handles the backward dependencies
|
||||||
* @param remove an alpm_list_t* of packages to be removed
|
* @param remove an alpm_list_t* of packages to be removed
|
||||||
* @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade)
|
* @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade)
|
||||||
* @return an alpm_list_t* of pmpkg_t* of missing_t pointers.
|
* @return an alpm_list_t* of pmdepmissing_t pointers.
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int reversedeps,
|
alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
alpm_list_t *remove, alpm_list_t *upgrade)
|
alpm_list_t *remove, alpm_list_t *upgrade)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *targets, *dblist = NULL, *modified = NULL;
|
alpm_list_t *targets, *dblist = NULL, *modified = NULL;
|
||||||
alpm_list_t *baddeps = NULL;
|
alpm_list_t *baddeps = NULL;
|
||||||
pmdepmissing_t *miss = NULL;
|
int nodepversion;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade));
|
targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade));
|
||||||
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
for(i = pkglist; i; i = i->next) {
|
||||||
void *pkg = i->data;
|
pmpkg_t *pkg = i->data;
|
||||||
if(alpm_list_find(targets, pkg, _alpm_pkg_cmp)) {
|
if(_alpm_pkg_find(targets, pkg->name)) {
|
||||||
modified = alpm_list_add(modified, pkg);
|
modified = alpm_list_add(modified, pkg);
|
||||||
} else {
|
} else {
|
||||||
dblist = alpm_list_add(dblist, pkg);
|
dblist = alpm_list_add(dblist, pkg);
|
||||||
@@ -247,6 +284,8 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int reversedeps,
|
|||||||
}
|
}
|
||||||
alpm_list_free(targets);
|
alpm_list_free(targets);
|
||||||
|
|
||||||
|
nodepversion = no_dep_version();
|
||||||
|
|
||||||
/* look for unsatisfied dependencies of the upgrade list */
|
/* look for unsatisfied dependencies of the upgrade list */
|
||||||
for(i = upgrade; i; i = i->next) {
|
for(i = upgrade; i; i = i->next) {
|
||||||
pmpkg_t *tp = i->data;
|
pmpkg_t *tp = i->data;
|
||||||
@@ -255,19 +294,21 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int reversedeps,
|
|||||||
|
|
||||||
for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
|
for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
|
||||||
pmdepend_t *depend = j->data;
|
pmdepend_t *depend = j->data;
|
||||||
|
depend = filtered_depend(depend, nodepversion);
|
||||||
/* 1. we check the upgrade list */
|
/* 1. we check the upgrade list */
|
||||||
/* 2. we check database for untouched satisfying packages */
|
/* 2. we check database for untouched satisfying packages */
|
||||||
if(!alpm_list_find(upgrade, depend, satisfycmp) &&
|
if(!find_dep_satisfier(upgrade, depend) &&
|
||||||
!alpm_list_find(dblist, depend, satisfycmp)) {
|
!find_dep_satisfier(dblist, depend)) {
|
||||||
/* Unsatisfied dependency in the upgrade list */
|
/* Unsatisfied dependency in the upgrade list */
|
||||||
char *missdepstring = alpm_dep_get_string(depend);
|
pmdepmissing_t *miss;
|
||||||
|
char *missdepstring = alpm_dep_compute_string(depend);
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
|
||||||
missdepstring, alpm_pkg_get_name(tp));
|
missdepstring, alpm_pkg_get_name(tp));
|
||||||
free(missdepstring);
|
free(missdepstring);
|
||||||
miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), depend->mod,
|
miss = depmiss_new(alpm_pkg_get_name(tp), depend, NULL);
|
||||||
depend->name, depend->version);
|
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
}
|
}
|
||||||
|
release_filtered_depend(depend, nodepversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,23 +319,27 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int reversedeps,
|
|||||||
pmpkg_t *lp = i->data;
|
pmpkg_t *lp = i->data;
|
||||||
for(j = alpm_pkg_get_depends(lp); j; j = j->next) {
|
for(j = alpm_pkg_get_depends(lp); j; j = j->next) {
|
||||||
pmdepend_t *depend = j->data;
|
pmdepend_t *depend = j->data;
|
||||||
|
depend = filtered_depend(depend, nodepversion);
|
||||||
|
pmpkg_t *causingpkg = find_dep_satisfier(modified, depend);
|
||||||
/* we won't break this depend, if it is already broken, we ignore it */
|
/* we won't break this depend, if it is already broken, we ignore it */
|
||||||
/* 1. check upgrade list for satisfiers */
|
/* 1. check upgrade list for satisfiers */
|
||||||
/* 2. check dblist for satisfiers */
|
/* 2. check dblist for satisfiers */
|
||||||
if(alpm_list_find(modified, depend, satisfycmp) &&
|
if(causingpkg &&
|
||||||
!alpm_list_find(upgrade, depend, satisfycmp) &&
|
!find_dep_satisfier(upgrade, depend) &&
|
||||||
!alpm_list_find(dblist, depend, satisfycmp)) {
|
!find_dep_satisfier(dblist, depend)) {
|
||||||
char *missdepstring = alpm_dep_get_string(depend);
|
pmdepmissing_t *miss;
|
||||||
|
char *missdepstring = alpm_dep_compute_string(depend);
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
|
||||||
missdepstring, alpm_pkg_get_name(lp));
|
missdepstring, alpm_pkg_get_name(lp));
|
||||||
free(missdepstring);
|
free(missdepstring);
|
||||||
miss = _alpm_depmiss_new(lp->name, depend->mod,
|
miss = depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg));
|
||||||
depend->name, depend->version);
|
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
}
|
}
|
||||||
|
release_filtered_depend(depend, nodepversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_free(modified);
|
alpm_list_free(modified);
|
||||||
alpm_list_free(dblist);
|
alpm_list_free(dblist);
|
||||||
|
|
||||||
@@ -309,7 +354,7 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod,
|
|||||||
if(mod == PM_DEP_MOD_ANY) {
|
if(mod == PM_DEP_MOD_ANY) {
|
||||||
equal = 1;
|
equal = 1;
|
||||||
} else {
|
} else {
|
||||||
int cmp = _alpm_versioncmp(version1, version2);
|
int cmp = alpm_pkg_vercmp(version1, version2);
|
||||||
switch(mod) {
|
switch(mod) {
|
||||||
case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
|
case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
|
||||||
case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
|
case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
|
||||||
@@ -322,92 +367,104 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod,
|
|||||||
return(equal);
|
return(equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
|
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
const char *pkgname = alpm_pkg_get_name(pkg);
|
|
||||||
const char *pkgversion = alpm_pkg_get_version(pkg);
|
|
||||||
int satisfy = 0;
|
int satisfy = 0;
|
||||||
|
|
||||||
/* check (pkg->name, pkg->version) */
|
/* check (pkg->name, pkg->version) */
|
||||||
satisfy = (strcmp(pkgname, dep->name) == 0
|
if(pkg->name_hash && dep->name_hash
|
||||||
&& dep_vercmp(pkgversion, dep->mod, dep->version));
|
&& pkg->name_hash != dep->name_hash) {
|
||||||
|
/* skip more expensive checks */
|
||||||
|
} else {
|
||||||
|
satisfy = (strcmp(pkg->name, dep->name) == 0
|
||||||
|
&& dep_vercmp(pkg->version, dep->mod, dep->version));
|
||||||
|
if(satisfy) {
|
||||||
|
return(satisfy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* check provisions, format : "name=version" */
|
/* check provisions, format : "name=version" */
|
||||||
for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) {
|
for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) {
|
||||||
char *provname = strdup(i->data);
|
const char *provision = i->data;
|
||||||
char *provver = strchr(provname, '=');
|
const char *provver = strchr(provision, '=');
|
||||||
|
|
||||||
if(provver == NULL) { /* no provision version */
|
if(provver == NULL) { /* no provision version */
|
||||||
satisfy = (dep->mod == PM_DEP_MOD_ANY
|
satisfy = (dep->mod == PM_DEP_MOD_ANY
|
||||||
&& strcmp(provname, dep->name) == 0);
|
&& strcmp(provision, dep->name) == 0);
|
||||||
} else {
|
} else {
|
||||||
*provver = '\0';
|
/* This is a bit tricker than the old code for performance reasons. To
|
||||||
|
* prevent the need to copy and duplicate strings, strncmp only the name
|
||||||
|
* portion if they are the same length, since there is a version and
|
||||||
|
* operator in play here. Cast is to silence sign conversion warning;
|
||||||
|
* we know provver >= provision if we are here. */
|
||||||
|
size_t namelen = (size_t)(provver - provision);
|
||||||
provver += 1;
|
provver += 1;
|
||||||
satisfy = (strcmp(provname, dep->name) == 0
|
satisfy = (strlen(dep->name) == namelen
|
||||||
|
&& strncmp(provision, dep->name, namelen) == 0
|
||||||
&& dep_vercmp(provver, dep->mod, dep->version));
|
&& dep_vercmp(provver, dep->mod, dep->version));
|
||||||
}
|
}
|
||||||
free(provname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(satisfy);
|
return(satisfy);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepend_t SYMEXPORT *alpm_splitdep(const char *depstring)
|
pmdepend_t *_alpm_splitdep(const char *depstring)
|
||||||
{
|
{
|
||||||
pmdepend_t *depend;
|
pmdepend_t *depend;
|
||||||
char *ptr = NULL;
|
const char *ptr, *version = NULL;
|
||||||
char *newstr = NULL;
|
|
||||||
|
|
||||||
if(depstring == NULL) {
|
if(depstring == NULL) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
newstr = strdup(depstring);
|
|
||||||
|
|
||||||
MALLOC(depend, sizeof(pmdepend_t), return(NULL));
|
CALLOC(depend, 1, sizeof(pmdepend_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
/* Find a version comparator if one exists. If it does, set the type and
|
/* Find a version comparator if one exists. If it does, set the type and
|
||||||
* increment the ptr accordingly so we can copy the right strings. */
|
* increment the ptr accordingly so we can copy the right strings. */
|
||||||
if((ptr = strstr(newstr, ">="))) {
|
if((ptr = strstr(depstring, ">="))) {
|
||||||
depend->mod = PM_DEP_MOD_GE;
|
depend->mod = PM_DEP_MOD_GE;
|
||||||
*ptr = '\0';
|
version = ptr + 2;
|
||||||
ptr += 2;
|
} else if((ptr = strstr(depstring, "<="))) {
|
||||||
} else if((ptr = strstr(newstr, "<="))) {
|
|
||||||
depend->mod = PM_DEP_MOD_LE;
|
depend->mod = PM_DEP_MOD_LE;
|
||||||
*ptr = '\0';
|
version = ptr + 2;
|
||||||
ptr += 2;
|
} else if((ptr = strstr(depstring, "="))) {
|
||||||
} else if((ptr = strstr(newstr, "="))) { /* Note: we must do =,<,> checks after <=, >= checks */
|
/* Note: we must do =,<,> checks after <=, >= checks */
|
||||||
depend->mod = PM_DEP_MOD_EQ;
|
depend->mod = PM_DEP_MOD_EQ;
|
||||||
*ptr = '\0';
|
version = ptr + 1;
|
||||||
ptr += 1;
|
} else if((ptr = strstr(depstring, "<"))) {
|
||||||
} else if((ptr = strstr(newstr, "<"))) {
|
|
||||||
depend->mod = PM_DEP_MOD_LT;
|
depend->mod = PM_DEP_MOD_LT;
|
||||||
*ptr = '\0';
|
version = ptr + 1;
|
||||||
ptr += 1;
|
} else if((ptr = strstr(depstring, ">"))) {
|
||||||
} else if((ptr = strstr(newstr, ">"))) {
|
|
||||||
depend->mod = PM_DEP_MOD_GT;
|
depend->mod = PM_DEP_MOD_GT;
|
||||||
*ptr = '\0';
|
version = ptr + 1;
|
||||||
ptr += 1;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* no version specified - copy in the name and return it */
|
/* no version specified, leave version and ptr NULL */
|
||||||
depend->mod = PM_DEP_MOD_ANY;
|
depend->mod = PM_DEP_MOD_ANY;
|
||||||
strncpy(depend->name, newstr, PKG_NAME_LEN);
|
}
|
||||||
depend->version[0] = '\0';
|
|
||||||
free(newstr);
|
/* copy the right parts to the right places */
|
||||||
|
STRNDUP(depend->name, depstring, ptr - depstring,
|
||||||
|
RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
depend->name_hash = _alpm_hash_sdbm(depend->name);
|
||||||
|
if(version) {
|
||||||
|
STRDUP(depend->version, version, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
return(depend);
|
return(depend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we get here, we have a version comparator, copy the right parts
|
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep)
|
||||||
* to the right places */
|
{
|
||||||
strncpy(depend->name, newstr, PKG_NAME_LEN);
|
pmdepend_t *newdep;
|
||||||
strncpy(depend->version, ptr, PKG_VERSION_LEN);
|
CALLOC(newdep, 1, sizeof(pmdepend_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
free(newstr);
|
|
||||||
|
|
||||||
return(depend);
|
STRDUP(newdep->name, dep->name, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
newdep->name_hash = dep->name_hash;
|
||||||
|
STRDUP(newdep->version, dep->version, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
newdep->mod = dep->mod;
|
||||||
|
|
||||||
|
return(newdep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These parameters are messy. We check if this package, given a list of
|
/* These parameters are messy. We check if this package, given a list of
|
||||||
@@ -417,9 +474,9 @@ pmdepend_t SYMEXPORT *alpm_splitdep(const char *depstring)
|
|||||||
static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
|
static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
|
||||||
int include_explicit)
|
int include_explicit)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *requiredby;
|
alpm_list_t *i;
|
||||||
|
|
||||||
if(_alpm_pkg_find(alpm_pkg_get_name(pkg), targets)) {
|
if(_alpm_pkg_find(targets, alpm_pkg_get_name(pkg))) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,15 +496,12 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
|
|||||||
* if checkdeps detected it would break something */
|
* if checkdeps detected it would break something */
|
||||||
|
|
||||||
/* see if other packages need it */
|
/* see if other packages need it */
|
||||||
requiredby = alpm_pkg_compute_requiredby(pkg);
|
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
||||||
for(i = requiredby; i; i = i->next) {
|
pmpkg_t *lpkg = i->data;
|
||||||
pmpkg_t *reqpkg = _alpm_db_get_pkgfromcache(db, i->data);
|
if(_alpm_dep_edge(lpkg, pkg) && !_alpm_pkg_find(targets, lpkg->name)) {
|
||||||
if(reqpkg && !_alpm_pkg_find(alpm_pkg_get_name(reqpkg), targets)) {
|
|
||||||
FREELIST(requiredby);
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREELIST(requiredby);
|
|
||||||
|
|
||||||
/* it's ok to remove */
|
/* it's ok to remove */
|
||||||
return(1);
|
return(1);
|
||||||
@@ -465,7 +519,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
|
|||||||
*/
|
*/
|
||||||
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
|
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k;
|
alpm_list_t *i, *j;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
@@ -475,12 +529,9 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
|
|||||||
|
|
||||||
for(i = targs; i; i = i->next) {
|
for(i = targs; i; i = i->next) {
|
||||||
pmpkg_t *pkg = i->data;
|
pmpkg_t *pkg = i->data;
|
||||||
for(j = alpm_pkg_get_depends(pkg); j; j = j->next) {
|
for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
|
||||||
pmdepend_t *depend = j->data;
|
pmpkg_t *deppkg = j->data;
|
||||||
|
if(_alpm_dep_edge(pkg, deppkg)
|
||||||
for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
|
|
||||||
pmpkg_t *deppkg = k->data;
|
|
||||||
if(alpm_depcmp(deppkg,depend)
|
|
||||||
&& can_remove_package(db, deppkg, targs, include_explicit)) {
|
&& can_remove_package(db, deppkg, targs, include_explicit)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets\n",
|
_alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets\n",
|
||||||
alpm_pkg_get_name(deppkg));
|
alpm_pkg_get_name(deppkg));
|
||||||
@@ -490,134 +541,226 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* helper function for resolvedeps: search for dep satisfier in dbs
|
||||||
|
*
|
||||||
|
* @param dep is the dependency to search for
|
||||||
|
* @param dbs are the databases to search
|
||||||
|
* @param excluding are the packages to exclude from the search
|
||||||
|
* @param prompt if true, will cause an unresolvable dependency to issue an
|
||||||
|
* interactive prompt asking whether the package should be removed from
|
||||||
|
* the transaction or the transaction aborted; if false, simply returns
|
||||||
|
* an error code without prompting
|
||||||
|
* @return the resolved package
|
||||||
|
**/
|
||||||
|
static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
||||||
|
alpm_list_t *excluding, int prompt)
|
||||||
|
{
|
||||||
|
alpm_list_t *i, *j;
|
||||||
|
int ignored = 0;
|
||||||
|
|
||||||
|
alpm_list_t *providers = NULL;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
/* 1. literals */
|
||||||
|
for(i = dbs; i; i = i->next) {
|
||||||
|
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
||||||
|
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
|
if(_alpm_pkg_should_ignore(pkg)) {
|
||||||
|
int install = 0;
|
||||||
|
if (prompt) {
|
||||||
|
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||||
|
NULL, NULL, &install);
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
|
||||||
|
}
|
||||||
|
if(!install) {
|
||||||
|
ignored = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 2. satisfiers (skip literals here) */
|
||||||
|
for(i = dbs; i; i = i->next) {
|
||||||
|
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
|
||||||
|
pmpkg_t *pkg = j->data;
|
||||||
|
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
||||||
|
!_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
|
if(_alpm_pkg_should_ignore(pkg)) {
|
||||||
|
int install = 0;
|
||||||
|
if (prompt) {
|
||||||
|
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
|
||||||
|
pkg, NULL, NULL, &install);
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
|
||||||
|
}
|
||||||
|
if(!install) {
|
||||||
|
ignored = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "provider found (%s provides %s)\n",
|
||||||
|
pkg->name, dep->name);
|
||||||
|
providers = alpm_list_add(providers, pkg);
|
||||||
|
/* keep looking for other providers in the all dbs */
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* populates *list with packages that need to be installed to satisfy all
|
/* first check if one provider is already installed locally */
|
||||||
* dependencies (recursive) for syncpkg
|
for(i = providers; i; i = i->next) {
|
||||||
*
|
pmpkg_t *pkg = i->data;
|
||||||
* @param remove contains packages elected for removal
|
if (_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) {
|
||||||
* make sure **list is already initialized
|
alpm_list_free(providers);
|
||||||
|
return(pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count = alpm_list_count(providers);
|
||||||
|
if (count >= 1) {
|
||||||
|
/* default to first provider if there is no QUESTION callback */
|
||||||
|
int index = 0;
|
||||||
|
if(count > 1) {
|
||||||
|
/* if there is more than one provider, we ask the user */
|
||||||
|
QUESTION(handle->trans, PM_TRANS_CONV_SELECT_PROVIDER,
|
||||||
|
providers, dep, NULL, &index);
|
||||||
|
}
|
||||||
|
if(index >= 0 && index < count) {
|
||||||
|
pmpkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index));
|
||||||
|
alpm_list_free(providers);
|
||||||
|
return(pkg);
|
||||||
|
}
|
||||||
|
alpm_list_free(providers);
|
||||||
|
providers = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ignored) { /* resolvedeps will override these */
|
||||||
|
pm_errno = PM_ERR_PKG_IGNORED;
|
||||||
|
} else {
|
||||||
|
pm_errno = PM_ERR_PKG_NOT_FOUND;
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Find a package satisfying a specified dependency.
|
||||||
|
* First look for a literal, going through each db one by one. Then look for
|
||||||
|
* providers. The first satisfier found is returned.
|
||||||
|
* The dependency can include versions with depmod operators.
|
||||||
|
* @param dbs an alpm_list_t* of pmdb_t where the satisfier will be searched
|
||||||
|
* @param depstring package or provision name, versioned or not
|
||||||
|
* @return a pmpkg_t* satisfying depstring
|
||||||
*/
|
*/
|
||||||
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
|
pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring)
|
||||||
alpm_list_t **list, alpm_list_t *remove, pmtrans_t *trans, alpm_list_t **data)
|
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k;
|
pmdepend_t *dep;
|
||||||
|
pmpkg_t *pkg;
|
||||||
|
|
||||||
|
ASSERT(dbs, return(NULL));
|
||||||
|
|
||||||
|
dep = _alpm_splitdep(depstring);
|
||||||
|
ASSERT(dep, return(NULL));
|
||||||
|
pkg = resolvedep(dep, dbs, NULL, 1);
|
||||||
|
_alpm_dep_free(dep);
|
||||||
|
return(pkg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes resolvable dependencies for a given package and adds that package
|
||||||
|
* and those resolvable dependencies to a list.
|
||||||
|
*
|
||||||
|
* @param localpkgs is the list of local packages
|
||||||
|
* @param dbs_sync are the sync databases
|
||||||
|
* @param pkg is the package to resolve
|
||||||
|
* @param packages is a pointer to a list of packages which will be
|
||||||
|
* searched first for any dependency packages needed to complete the
|
||||||
|
* resolve, and to which will be added any [pkg] and all of its
|
||||||
|
* dependencies not already on the list
|
||||||
|
* @param remove is the set of packages which will be removed in this
|
||||||
|
* transaction
|
||||||
|
* @param data returns the dependency which could not be satisfied in the
|
||||||
|
* event of an error
|
||||||
|
* @return 0 on success, with [pkg] and all of its dependencies not already on
|
||||||
|
* the [*packages] list added to that list, or -1 on failure due to an
|
||||||
|
* unresolvable dependency, in which case the [*packages] list will be
|
||||||
|
* unmodified by this function
|
||||||
|
*/
|
||||||
|
int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg,
|
||||||
|
alpm_list_t *preferred, alpm_list_t **packages,
|
||||||
|
alpm_list_t *remove, alpm_list_t **data)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *targ;
|
alpm_list_t *targ;
|
||||||
alpm_list_t *deps = NULL;
|
alpm_list_t *deps = NULL;
|
||||||
|
alpm_list_t *packages_copy;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(local == NULL || dbs_sync == NULL || syncpkg == NULL || list == NULL) {
|
if(_alpm_pkg_find(*packages, pkg->name) != NULL) {
|
||||||
return(-1);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create a copy of the packages list, so that it can be restored
|
||||||
|
on error */
|
||||||
|
packages_copy = alpm_list_copy(*packages);
|
||||||
|
/* [pkg] has not already been resolved into the packages list, so put it
|
||||||
|
on that list */
|
||||||
|
*packages = alpm_list_add(*packages, pkg);
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "started resolving dependencies\n");
|
_alpm_log(PM_LOG_DEBUG, "started resolving dependencies\n");
|
||||||
targ = alpm_list_add(NULL, syncpkg);
|
for(i = alpm_list_last(*packages); i; i = i->next) {
|
||||||
deps = alpm_checkdeps(local, 0, remove, targ);
|
pmpkg_t *tpkg = i->data;
|
||||||
|
targ = alpm_list_add(NULL, tpkg);
|
||||||
|
deps = alpm_checkdeps(localpkgs, 0, remove, targ);
|
||||||
alpm_list_free(targ);
|
alpm_list_free(targ);
|
||||||
|
|
||||||
if(deps == NULL) {
|
for(j = deps; j; j = j->next) {
|
||||||
return(0);
|
pmdepmissing_t *miss = j->data;
|
||||||
}
|
pmdepend_t *missdep = alpm_miss_get_dep(miss);
|
||||||
|
/* check if one of the packages in the [*packages] list already satisfies
|
||||||
for(i = deps; i; i = i->next) {
|
* this dependency */
|
||||||
int found = 0;
|
if(find_dep_satisfier(*packages, missdep)) {
|
||||||
pmdepmissing_t *miss = i->data;
|
_alpm_depmiss_free(miss);
|
||||||
pmdepend_t *missdep = &(miss->depend);
|
|
||||||
pmpkg_t *sync = NULL;
|
|
||||||
|
|
||||||
/* check if one of the packages in *list already satisfies this dependency */
|
|
||||||
for(j = *list; j && !found; j = j->next) {
|
|
||||||
pmpkg_t *sp = j->data;
|
|
||||||
if(alpm_depcmp(sp, missdep)) {
|
|
||||||
char *missdepstring = alpm_dep_get_string(missdep);
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "%s satisfies dependency %s -- skipping\n",
|
|
||||||
alpm_pkg_get_name(sp), missdepstring);
|
|
||||||
free(missdepstring);
|
|
||||||
found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(found) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/* check if one of the packages in the [preferred] list already satisfies
|
||||||
/* find the package in one of the repositories */
|
* this dependency */
|
||||||
/* check literals */
|
pmpkg_t *spkg = find_dep_satisfier(preferred, missdep);
|
||||||
for(j = dbs_sync; j && !found; j = j->next) {
|
if(!spkg) {
|
||||||
sync = _alpm_db_get_pkgfromcache(j->data, missdep->name);
|
/* find a satisfier package in the given repositories */
|
||||||
if(!sync) {
|
spkg = resolvedep(missdep, dbs_sync, *packages, 0);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove);
|
if(!spkg) {
|
||||||
if(!found) {
|
pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
||||||
continue;
|
char *missdepstring = alpm_dep_compute_string(missdep);
|
||||||
}
|
_alpm_log(PM_LOG_WARNING,
|
||||||
/* If package is in the ignorepkg list, ask before we pull it */
|
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
||||||
if(_alpm_pkg_should_ignore(sync)) {
|
missdepstring, tpkg->name);
|
||||||
pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
|
|
||||||
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &found);
|
|
||||||
_alpm_pkg_free(dummypkg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*TODO this autoresolves the first 'satisfier' package... we should fix this
|
|
||||||
* somehow */
|
|
||||||
/* check provides */
|
|
||||||
/* we don't check literals again to avoid duplicated PM_TRANS_CONV_INSTALL_IGNOREPKG messages */
|
|
||||||
for(j = dbs_sync; j && !found; j = j->next) {
|
|
||||||
for(k = _alpm_db_get_pkgcache(j->data); k && !found; k = k->next) {
|
|
||||||
sync = k->data;
|
|
||||||
if(!sync) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
found = alpm_depcmp(sync, missdep) && strcmp(sync->name, missdep->name)
|
|
||||||
&& !_alpm_pkg_find(alpm_pkg_get_name(sync), remove);
|
|
||||||
if(!found) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(_alpm_pkg_should_ignore(sync)) {
|
|
||||||
pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
|
|
||||||
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &found);
|
|
||||||
_alpm_pkg_free(dummypkg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!found) {
|
|
||||||
char *missdepstring = alpm_dep_get_string(missdep);
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
|
||||||
missdepstring, miss->target);
|
|
||||||
free(missdepstring);
|
free(missdepstring);
|
||||||
if(data) {
|
if(data) {
|
||||||
MALLOC(miss, sizeof(pmdepmissing_t),/*nothing*/);
|
|
||||||
if(!miss) {
|
|
||||||
pm_errno = PM_ERR_MEMORY;
|
|
||||||
FREELIST(*data);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
*miss = *(pmdepmissing_t *)i->data;
|
|
||||||
*data = alpm_list_add(*data, miss);
|
*data = alpm_list_add(*data, miss);
|
||||||
}
|
}
|
||||||
pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
ret = -1;
|
||||||
goto error;
|
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
|
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
|
||||||
alpm_pkg_get_name(sync), alpm_pkg_get_name(syncpkg));
|
alpm_pkg_get_name(spkg), alpm_pkg_get_name(tpkg));
|
||||||
*list = alpm_list_add(*list, sync);
|
*packages = alpm_list_add(*packages, spkg);
|
||||||
if(_alpm_resolvedeps(local, dbs_sync, sync, list, remove, trans, data)) {
|
_alpm_depmiss_free(miss);
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
alpm_list_free(deps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ret != 0) {
|
||||||
|
alpm_list_free(*packages);
|
||||||
|
*packages = packages_copy;
|
||||||
|
} else {
|
||||||
|
alpm_list_free(packages_copy);
|
||||||
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "finished resolving dependencies\n");
|
_alpm_log(PM_LOG_DEBUG, "finished resolving dependencies\n");
|
||||||
|
return(ret);
|
||||||
FREELIST(deps);
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
error:
|
|
||||||
FREELIST(deps);
|
|
||||||
return(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
|
const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
|
||||||
@@ -627,7 +770,17 @@ const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
|
|||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(miss != NULL, return(NULL));
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
return miss->target;
|
return(miss->target);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_miss_get_causingpkg(const pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
|
return miss->causingpkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
|
pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
|
||||||
@@ -637,7 +790,7 @@ pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
|
|||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(miss != NULL, return(NULL));
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
return &(miss->depend);
|
return(miss->depend);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepmod_t SYMEXPORT alpm_dep_get_mod(const pmdepend_t *dep)
|
pmdepmod_t SYMEXPORT alpm_dep_get_mod(const pmdepend_t *dep)
|
||||||
@@ -647,7 +800,7 @@ pmdepmod_t SYMEXPORT alpm_dep_get_mod(const pmdepend_t *dep)
|
|||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(dep != NULL, return(-1));
|
ASSERT(dep != NULL, return(-1));
|
||||||
|
|
||||||
return dep->mod;
|
return(dep->mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_dep_get_name(const pmdepend_t *dep)
|
const char SYMEXPORT *alpm_dep_get_name(const pmdepend_t *dep)
|
||||||
@@ -657,7 +810,7 @@ const char SYMEXPORT *alpm_dep_get_name(const pmdepend_t *dep)
|
|||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(dep != NULL, return(NULL));
|
ASSERT(dep != NULL, return(NULL));
|
||||||
|
|
||||||
return dep->name;
|
return(dep->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
|
const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
|
||||||
@@ -667,7 +820,7 @@ const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
|
|||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(dep != NULL, return(NULL));
|
ASSERT(dep != NULL, return(NULL));
|
||||||
|
|
||||||
return dep->version;
|
return(dep->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Reverse of splitdep; make a dep string from a pmdepend_t struct.
|
/** Reverse of splitdep; make a dep string from a pmdepend_t struct.
|
||||||
@@ -675,9 +828,10 @@ const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
|
|||||||
* @param dep the depend to turn into a string
|
* @param dep the depend to turn into a string
|
||||||
* @return a string-formatted dependency with operator if necessary
|
* @return a string-formatted dependency with operator if necessary
|
||||||
*/
|
*/
|
||||||
char SYMEXPORT *alpm_dep_get_string(const pmdepend_t *dep)
|
char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
|
||||||
{
|
{
|
||||||
char *opr, *str = NULL;
|
const char *name, *opr, *ver;
|
||||||
|
char *str;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -685,6 +839,12 @@ char SYMEXPORT *alpm_dep_get_string(const pmdepend_t *dep)
|
|||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(dep != NULL, return(NULL));
|
ASSERT(dep != NULL, return(NULL));
|
||||||
|
|
||||||
|
if(dep->name) {
|
||||||
|
name = dep->name;
|
||||||
|
} else {
|
||||||
|
name = "";
|
||||||
|
}
|
||||||
|
|
||||||
switch(dep->mod) {
|
switch(dep->mod) {
|
||||||
case PM_DEP_MOD_ANY:
|
case PM_DEP_MOD_ANY:
|
||||||
opr = "";
|
opr = "";
|
||||||
@@ -709,11 +869,18 @@ char SYMEXPORT *alpm_dep_get_string(const pmdepend_t *dep)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(dep->mod != PM_DEP_MOD_ANY && dep->version) {
|
||||||
|
ver = dep->version;
|
||||||
|
} else {
|
||||||
|
ver = "";
|
||||||
|
}
|
||||||
|
|
||||||
/* we can always compute len and print the string like this because opr
|
/* we can always compute len and print the string like this because opr
|
||||||
* and ver will be empty when PM_DEP_MOD_ANY is the depend type */
|
* and ver will be empty when PM_DEP_MOD_ANY is the depend type. the
|
||||||
len = strlen(dep->name) + strlen(opr) + strlen(dep->version) + 1;
|
* reassignments above also ensure we do not do a strlen(NULL). */
|
||||||
|
len = strlen(name) + strlen(opr) + strlen(ver) + 1;
|
||||||
MALLOC(str, len, RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(str, len, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
snprintf(str, len, "%s%s%s", dep->name, opr, dep->version);
|
snprintf(str, len, "%s%s%s", name, opr, ver);
|
||||||
|
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* deps.h
|
* deps.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||||
*
|
*
|
||||||
@@ -28,32 +29,29 @@
|
|||||||
|
|
||||||
/* Dependency */
|
/* Dependency */
|
||||||
struct __pmdepend_t {
|
struct __pmdepend_t {
|
||||||
|
char *name;
|
||||||
|
char *version;
|
||||||
|
unsigned long name_hash;
|
||||||
pmdepmod_t mod;
|
pmdepmod_t mod;
|
||||||
char name[PKG_NAME_LEN];
|
|
||||||
char version[PKG_VERSION_LEN];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Missing dependency */
|
/* Missing dependency */
|
||||||
struct __pmdepmissing_t {
|
struct __pmdepmissing_t {
|
||||||
char target[PKG_NAME_LEN];
|
char *target;
|
||||||
pmdepend_t depend;
|
pmdepend_t *depend;
|
||||||
|
char *causingpkg; /* this is used in case of remove dependency error only */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Graphs */
|
void _alpm_dep_free(pmdepend_t *dep);
|
||||||
struct __pmgraph_t {
|
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
||||||
int state; /* 0: untouched, -1: entered, other: leaving time */
|
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
||||||
void *data;
|
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
|
||||||
struct __pmgraph_t *parent; /* where did we come from? */
|
|
||||||
alpm_list_t *children;
|
|
||||||
alpm_list_t *childptr; /* points to a child in children list */
|
|
||||||
};
|
|
||||||
|
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod,
|
|
||||||
const char *depname, const char *depversion);
|
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode);
|
|
||||||
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
||||||
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
|
int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg,
|
||||||
alpm_list_t **list, alpm_list_t *remove, pmtrans_t *trans, alpm_list_t **data);
|
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
||||||
|
alpm_list_t **data);
|
||||||
|
pmdepend_t *_alpm_splitdep(const char *depstring);
|
||||||
|
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
||||||
|
|
||||||
#endif /* _ALPM_DEPS_H */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
|
||||||
|
|||||||
358
lib/libalpm/diskspace.c
Normal file
358
lib/libalpm/diskspace.c
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
/*
|
||||||
|
* diskspace.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#if defined(HAVE_MNTENT_H)
|
||||||
|
#include <mntent.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_STATVFS_H)
|
||||||
|
#include <sys/statvfs.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_PARAM_H)
|
||||||
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_MOUNT_H)
|
||||||
|
#include <sys/mount.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_UCRED_H)
|
||||||
|
#include <sys/ucred.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TYPES_H)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "diskspace.h"
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "trans.h"
|
||||||
|
#include "handle.h"
|
||||||
|
|
||||||
|
static int mount_point_cmp(const void *p1, const void *p2)
|
||||||
|
{
|
||||||
|
const alpm_mountpoint_t *mp1 = p1;
|
||||||
|
const alpm_mountpoint_t *mp2 = p2;
|
||||||
|
/* the negation will sort all mountpoints before their parent */
|
||||||
|
return(-strcmp(mp1->mount_dir, mp2->mount_dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *mount_point_list(void)
|
||||||
|
{
|
||||||
|
alpm_list_t *mount_points = NULL, *ptr;
|
||||||
|
alpm_mountpoint_t *mp;
|
||||||
|
|
||||||
|
#if defined HAVE_GETMNTENT
|
||||||
|
struct mntent *mnt;
|
||||||
|
FILE *fp;
|
||||||
|
struct statvfs fsp;
|
||||||
|
|
||||||
|
fp = setmntent(MOUNTED, "r");
|
||||||
|
|
||||||
|
if (fp == NULL) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
while((mnt = getmntent(fp))) {
|
||||||
|
if(!mnt) {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("could not get filesystem information\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(statvfs(mnt->mnt_dir, &fsp) != 0) {
|
||||||
|
_alpm_log(PM_LOG_WARNING,
|
||||||
|
_("could not get filesystem information for %s: %s\n"),
|
||||||
|
mnt->mnt_dir, strerror(errno));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
mp->mount_dir = strdup(mnt->mnt_dir);
|
||||||
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
|
memcpy(&(mp->fsp), &fsp, sizeof(struct statvfs));
|
||||||
|
mp->read_only = fsp.f_flag & ST_RDONLY;
|
||||||
|
|
||||||
|
mount_points = alpm_list_add(mount_points, mp);
|
||||||
|
}
|
||||||
|
|
||||||
|
endmntent(fp);
|
||||||
|
#elif defined HAVE_GETMNTINFO
|
||||||
|
int entries;
|
||||||
|
FSSTATSTYPE *fsp;
|
||||||
|
|
||||||
|
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
||||||
|
|
||||||
|
if (entries < 0) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(; entries-- > 0; fsp++) {
|
||||||
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
mp->mount_dir = strdup(fsp->f_mntonname);
|
||||||
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
|
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
||||||
|
#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG)
|
||||||
|
mp->read_only = fsp->f_flag & ST_RDONLY;
|
||||||
|
#elif defined(HAVE_GETMNTINFO_STATFS) && defined(HAVE_STRUCT_STATFS_F_FLAGS)
|
||||||
|
mp->read_only = fsp->f_flags & MNT_RDONLY;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mount_points = alpm_list_add(mount_points, mp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mount_points = alpm_list_msort(mount_points, alpm_list_count(mount_points),
|
||||||
|
mount_point_cmp);
|
||||||
|
for(ptr = mount_points; ptr != NULL; ptr = ptr->next) {
|
||||||
|
mp = ptr->data;
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "mountpoint: %s\n", mp->mount_dir);
|
||||||
|
}
|
||||||
|
return(mount_points);
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points,
|
||||||
|
const char *real_path)
|
||||||
|
{
|
||||||
|
const alpm_list_t *mp;
|
||||||
|
|
||||||
|
for(mp = mount_points; mp != NULL; mp = mp->next) {
|
||||||
|
alpm_mountpoint_t *data = mp->data;
|
||||||
|
|
||||||
|
if(strncmp(data->mount_dir, real_path, data->mount_dir_len) == 0) {
|
||||||
|
return(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* should not get here... */
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int calculate_removed_size(const alpm_list_t *mount_points,
|
||||||
|
pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
alpm_list_t *file;
|
||||||
|
|
||||||
|
alpm_list_t *files = alpm_pkg_get_files(pkg);
|
||||||
|
for(file = files; file; file = file->next) {
|
||||||
|
alpm_mountpoint_t *mp;
|
||||||
|
struct stat st;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
const char *filename = file->data;
|
||||||
|
|
||||||
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
||||||
|
_alpm_lstat(path, &st);
|
||||||
|
|
||||||
|
/* skip directories and symlinks to be consistent with libarchive that
|
||||||
|
* reports them to be zero size */
|
||||||
|
if(S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp = match_mount_point(mount_points, path);
|
||||||
|
if(mp == NULL) {
|
||||||
|
_alpm_log(PM_LOG_WARNING,
|
||||||
|
_("could not determine mount point for file %s\n"), filename);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the addition of (divisor - 1) performs ceil() with integer division */
|
||||||
|
mp->blocks_needed -=
|
||||||
|
(st.st_size + mp->fsp.f_bsize - 1l) / mp->fsp.f_bsize;
|
||||||
|
mp->used |= USED_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int calculate_installed_size(const alpm_list_t *mount_points,
|
||||||
|
pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
int ret=0;
|
||||||
|
struct archive *archive;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
|
||||||
|
if ((archive = archive_read_new()) == NULL) {
|
||||||
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
archive_read_support_compression_all(archive);
|
||||||
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
|
if(archive_read_open_filename(archive, pkg->origin_data.file,
|
||||||
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
|
pm_errno = PM_ERR_PKG_OPEN;
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
|
alpm_mountpoint_t *mp;
|
||||||
|
const char *filename;
|
||||||
|
mode_t mode;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
|
filename = archive_entry_pathname(entry);
|
||||||
|
mode = archive_entry_mode(entry);
|
||||||
|
|
||||||
|
/* libarchive reports these as zero size anyways */
|
||||||
|
/* NOTE: if we do start accounting for directory size, a dir matching a
|
||||||
|
* mountpoint needs to be attributed to the parent, not the mountpoint. */
|
||||||
|
if(S_ISDIR(mode) || S_ISLNK(mode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* approximate space requirements for db entries */
|
||||||
|
if(filename[0] == '.') {
|
||||||
|
filename = alpm_option_get_dbpath();
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
||||||
|
|
||||||
|
mp = match_mount_point(mount_points, path);
|
||||||
|
if(mp == NULL) {
|
||||||
|
_alpm_log(PM_LOG_WARNING,
|
||||||
|
_("could not determine mount point for file %s\n"), filename);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the addition of (divisor - 1) performs ceil() with integer division */
|
||||||
|
mp->blocks_needed +=
|
||||||
|
(archive_entry_size(entry) + mp->fsp.f_bsize - 1l) / mp->fsp.f_bsize;
|
||||||
|
mp->used |= USED_INSTALL;
|
||||||
|
|
||||||
|
if(archive_read_data_skip(archive)) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
|
pkg->name, archive_error_string(archive));
|
||||||
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
archive_read_finish(archive);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
|
||||||
|
{
|
||||||
|
alpm_list_t *mount_points, *i;
|
||||||
|
alpm_mountpoint_t *root_mp;
|
||||||
|
size_t replaces = 0, current = 0, numtargs;
|
||||||
|
int abort = 0;
|
||||||
|
alpm_list_t *targ;
|
||||||
|
|
||||||
|
numtargs = alpm_list_count(trans->add);
|
||||||
|
mount_points = mount_point_list();
|
||||||
|
if(mount_points == NULL) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not determine filesystem mount points\n"));
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
root_mp = match_mount_point(mount_points, handle->root);
|
||||||
|
if(root_mp == NULL) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not determine root mount point %s\n"),
|
||||||
|
handle->root);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
replaces = alpm_list_count(trans->remove);
|
||||||
|
if(replaces) {
|
||||||
|
numtargs += replaces;
|
||||||
|
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
||||||
|
pmpkg_t *local_pkg;
|
||||||
|
int percent = (current * 100) / numtargs;
|
||||||
|
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
|
local_pkg = targ->data;
|
||||||
|
calculate_removed_size(mount_points, local_pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(targ = trans->add; targ; targ = targ->next, current++) {
|
||||||
|
pmpkg_t *pkg, *local_pkg;
|
||||||
|
int percent = (current * 100) / numtargs;
|
||||||
|
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
|
pkg = targ->data;
|
||||||
|
/* is this package already installed? */
|
||||||
|
local_pkg = _alpm_db_get_pkgfromcache(db_local, pkg->name);
|
||||||
|
if(local_pkg) {
|
||||||
|
calculate_removed_size(mount_points, local_pkg);
|
||||||
|
}
|
||||||
|
calculate_installed_size(mount_points, pkg);
|
||||||
|
|
||||||
|
for(i = mount_points; i; i = alpm_list_next(i)) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
if(data->blocks_needed > data->max_blocks_needed) {
|
||||||
|
data->max_blocks_needed = data->blocks_needed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", 100,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
|
for(i = mount_points; i; i = alpm_list_next(i)) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
if(data->used && data->read_only) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("Partition %s is mounted read only\n"),
|
||||||
|
data->mount_dir);
|
||||||
|
abort = 1;
|
||||||
|
} else if(data->used & USED_INSTALL) {
|
||||||
|
/* cushion is roughly min(5% capacity, 20MiB) */
|
||||||
|
long fivepc = ((long)data->fsp.f_blocks / 20) + 1;
|
||||||
|
long twentymb = (20 * 1024 * 1024 / (long)data->fsp.f_bsize) + 1;
|
||||||
|
long cushion = fivepc < twentymb ? fivepc : twentymb;
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n",
|
||||||
|
data->mount_dir, data->max_blocks_needed, cushion,
|
||||||
|
(unsigned long)data->fsp.f_bfree);
|
||||||
|
if(data->max_blocks_needed + cushion >= 0 &&
|
||||||
|
(unsigned long)(data->max_blocks_needed + cushion) > data->fsp.f_bfree) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("Partition %s too full: %ld blocks needed, %ld blocks free\n"),
|
||||||
|
data->mount_dir, data->max_blocks_needed + cushion,
|
||||||
|
(unsigned long)data->fsp.f_bfree);
|
||||||
|
abort = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = mount_points; i; i = alpm_list_next(i)) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
FREE(data->mount_dir);
|
||||||
|
}
|
||||||
|
FREELIST(mount_points);
|
||||||
|
|
||||||
|
if(abort) {
|
||||||
|
RET_ERR(PM_ERR_DISK_SPACE, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
53
lib/libalpm/diskspace.h
Normal file
53
lib/libalpm/diskspace.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* diskspace.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ALPM_DISKSPACE_H
|
||||||
|
#define _ALPM_DISKSPACE_H
|
||||||
|
|
||||||
|
#if defined(HAVE_SYS_MOUNT_H)
|
||||||
|
#include <sys/mount.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_STATVFS_H)
|
||||||
|
#include <sys/statvfs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "alpm.h"
|
||||||
|
|
||||||
|
enum mount_used_level {
|
||||||
|
USED_REMOVE = 1,
|
||||||
|
USED_INSTALL = (1 << 1),
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct __alpm_mountpoint_t {
|
||||||
|
/* mount point information */
|
||||||
|
char *mount_dir;
|
||||||
|
size_t mount_dir_len;
|
||||||
|
/* storage for additional disk usage calculations */
|
||||||
|
long blocks_needed;
|
||||||
|
long max_blocks_needed;
|
||||||
|
enum mount_used_level used;
|
||||||
|
int read_only;
|
||||||
|
FSSTATSTYPE fsp;
|
||||||
|
} alpm_mountpoint_t;
|
||||||
|
|
||||||
|
int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local);
|
||||||
|
|
||||||
|
#endif /* _ALPM_DISKSPACE_H */
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
445
lib/libalpm/dload.c
Normal file
445
lib/libalpm/dload.c
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
/*
|
||||||
|
* download.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <signal.h>
|
||||||
|
/* the following two are needed for FreeBSD's libfetch */
|
||||||
|
#include <limits.h> /* PATH_MAX */
|
||||||
|
#if defined(HAVE_SYS_PARAM_H)
|
||||||
|
#include <sys/param.h> /* MAXHOSTNAMELEN */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
#include <fetch.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "dload.h"
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "handle.h"
|
||||||
|
|
||||||
|
static char *get_filename(const char *url) {
|
||||||
|
char *filename = strrchr(url, '/');
|
||||||
|
if(filename != NULL) {
|
||||||
|
filename++;
|
||||||
|
}
|
||||||
|
return(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
static char *get_destfile(const char *path, const char *filename) {
|
||||||
|
char *destfile;
|
||||||
|
/* len = localpath len + filename len + null */
|
||||||
|
size_t len = strlen(path) + strlen(filename) + 1;
|
||||||
|
CALLOC(destfile, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
snprintf(destfile, len, "%s%s", path, filename);
|
||||||
|
|
||||||
|
return(destfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *get_tempfile(const char *path, const char *filename) {
|
||||||
|
char *tempfile;
|
||||||
|
/* len = localpath len + filename len + '.part' len + null */
|
||||||
|
size_t len = strlen(path) + strlen(filename) + 6;
|
||||||
|
CALLOC(tempfile, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
snprintf(tempfile, len, "%s%s.part", path, filename);
|
||||||
|
|
||||||
|
return(tempfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *gethost(struct url *fileurl)
|
||||||
|
{
|
||||||
|
const char *host = _("disk");
|
||||||
|
if(strcmp(SCHEME_FILE, fileurl->scheme) != 0) {
|
||||||
|
host = fileurl->host;
|
||||||
|
}
|
||||||
|
return(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
int dload_interrupted;
|
||||||
|
static void inthandler(int signum)
|
||||||
|
{
|
||||||
|
dload_interrupted = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define check_stop() if(dload_interrupted) { ret = -1; goto cleanup; }
|
||||||
|
enum sighandlers { OLD = 0, NEW = 1 };
|
||||||
|
|
||||||
|
static int download_internal(const char *url, const char *localpath,
|
||||||
|
int force) {
|
||||||
|
FILE *localf = NULL;
|
||||||
|
struct stat st;
|
||||||
|
int ret = 0;
|
||||||
|
off_t dl_thisfile = 0;
|
||||||
|
ssize_t nread = 0;
|
||||||
|
char *tempfile, *destfile, *filename;
|
||||||
|
struct sigaction sig_pipe[2], sig_int[2];
|
||||||
|
|
||||||
|
off_t local_size = 0;
|
||||||
|
time_t local_time = 0;
|
||||||
|
|
||||||
|
struct url *fileurl;
|
||||||
|
struct url_stat ust;
|
||||||
|
fetchIO *dlf = NULL;
|
||||||
|
|
||||||
|
char buffer[PM_DLBUF_LEN];
|
||||||
|
|
||||||
|
filename = get_filename(url);
|
||||||
|
if(!filename) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
|
||||||
|
RET_ERR(PM_ERR_SERVER_BAD_URL, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileurl = fetchParseURL(url);
|
||||||
|
if(!fileurl) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
|
||||||
|
RET_ERR(PM_ERR_LIBFETCH, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
destfile = get_destfile(localpath, filename);
|
||||||
|
tempfile = get_tempfile(localpath, filename);
|
||||||
|
|
||||||
|
if(stat(tempfile, &st) == 0 && S_ISREG(st.st_mode) && st.st_size > 0) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "tempfile found, attempting continuation\n");
|
||||||
|
local_time = fileurl->last_modified = st.st_mtime;
|
||||||
|
local_size = fileurl->offset = (off_t)st.st_size;
|
||||||
|
dl_thisfile = st.st_size;
|
||||||
|
localf = fopen(tempfile, "ab");
|
||||||
|
} else if(!force && stat(destfile, &st) == 0 && S_ISREG(st.st_mode) && st.st_size > 0) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "destfile found, using mtime only\n");
|
||||||
|
local_time = fileurl->last_modified = st.st_mtime;
|
||||||
|
local_size = /* no fu->off here */ (off_t)st.st_size;
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "no file found matching criteria, starting from scratch\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* pass the raw filename for passing to the callback function */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "using '%s' for download progress\n", filename);
|
||||||
|
|
||||||
|
/* print proxy info for debug purposes */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "HTTP_PROXY: %s\n", getenv("HTTP_PROXY"));
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "http_proxy: %s\n", getenv("http_proxy"));
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "FTP_PROXY: %s\n", getenv("FTP_PROXY"));
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "ftp_proxy: %s\n", getenv("ftp_proxy"));
|
||||||
|
|
||||||
|
/* 10s timeout */
|
||||||
|
fetchTimeout = 10;
|
||||||
|
|
||||||
|
/* ignore any SIGPIPE signals- these may occur if our FTP socket dies or
|
||||||
|
* something along those lines. Store the old signal handler first. */
|
||||||
|
sig_pipe[NEW].sa_handler = SIG_IGN;
|
||||||
|
sigemptyset(&sig_pipe[NEW].sa_mask);
|
||||||
|
sig_pipe[NEW].sa_flags = 0;
|
||||||
|
sigaction(SIGPIPE, NULL, &sig_pipe[OLD]);
|
||||||
|
sigaction(SIGPIPE, &sig_pipe[NEW], NULL);
|
||||||
|
|
||||||
|
dload_interrupted = 0;
|
||||||
|
sig_int[NEW].sa_handler = &inthandler;
|
||||||
|
sigemptyset(&sig_int[NEW].sa_mask);
|
||||||
|
sig_int[NEW].sa_flags = 0;
|
||||||
|
sigaction(SIGINT, NULL, &sig_int[OLD]);
|
||||||
|
sigaction(SIGINT, &sig_int[NEW], NULL);
|
||||||
|
|
||||||
|
/* NOTE: libfetch does not reset the error code, be sure to do it before
|
||||||
|
* calls into the library */
|
||||||
|
|
||||||
|
/* TODO: if we call fetchStat() and get a redirect (disabling automagic
|
||||||
|
* redirect following), we should repeat the file locator stuff and get a new
|
||||||
|
* filename rather than only base if off the first URL, and then verify
|
||||||
|
* get_filename() didn't return ''. Of course, libfetch might not even allow
|
||||||
|
* us to even get that URL...FS#22645. This would allow us to download things
|
||||||
|
* without totally puking like
|
||||||
|
* http://www.archlinux.org/packages/community/x86_64/exim/download/ */
|
||||||
|
|
||||||
|
/* find out the remote size *and* mtime in one go. there is a lot of
|
||||||
|
* trouble in trying to do both size and "if-modified-since" logic in a
|
||||||
|
* non-stat request, so avoid it. */
|
||||||
|
fetchLastErrCode = 0;
|
||||||
|
if(fetchStat(fileurl, &ust, "") == -1) {
|
||||||
|
pm_errno = PM_ERR_LIBFETCH;
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
||||||
|
filename, gethost(fileurl), fetchLastErrString);
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
check_stop();
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "ust.mtime: %ld local_time: %ld compare: %ld\n",
|
||||||
|
ust.mtime, local_time, local_time - ust.mtime);
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "ust.size: %jd local_size: %jd compare: %jd\n",
|
||||||
|
(intmax_t)ust.size, (intmax_t)local_size, (intmax_t)(local_size - ust.size));
|
||||||
|
if(!force && ust.mtime && ust.mtime == local_time
|
||||||
|
&& ust.size && ust.size == local_size) {
|
||||||
|
/* the remote time and size values agreed with what we have, so move on
|
||||||
|
* because there is nothing more to do. */
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "files are identical, skipping %s\n", filename);
|
||||||
|
ret = 1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if(!ust.mtime || ust.mtime != local_time) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "mtimes were different or unavailable, downloading %s from beginning\n", filename);
|
||||||
|
fileurl->offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchLastErrCode = 0;
|
||||||
|
dlf = fetchGet(fileurl, "");
|
||||||
|
check_stop();
|
||||||
|
|
||||||
|
if(fetchLastErrCode != 0 || dlf == NULL) {
|
||||||
|
pm_errno = PM_ERR_LIBFETCH;
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
||||||
|
filename, gethost(fileurl), fetchLastErrString);
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully\n", fileurl->host);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(localf && fileurl->offset == 0) {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("resuming download of %s not possible; starting over\n"), filename);
|
||||||
|
fclose(localf);
|
||||||
|
localf = NULL;
|
||||||
|
} else if(fileurl->offset) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "resuming download at position %jd\n", (intmax_t)fileurl->offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(localf == NULL) {
|
||||||
|
_alpm_rmrf(tempfile);
|
||||||
|
fileurl->offset = (off_t)0;
|
||||||
|
dl_thisfile = 0;
|
||||||
|
localf = fopen(tempfile, "wb");
|
||||||
|
if(localf == NULL) { /* still null? */
|
||||||
|
pm_errno = PM_ERR_RETRIEVE;
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
|
||||||
|
tempfile, strerror(errno));
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Progress 0 - initialize */
|
||||||
|
if(handle->dlcb) {
|
||||||
|
handle->dlcb(filename, 0, ust.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
while((nread = fetchIO_read(dlf, buffer, PM_DLBUF_LEN)) > 0) {
|
||||||
|
check_stop();
|
||||||
|
size_t nwritten = 0;
|
||||||
|
nwritten = fwrite(buffer, 1, (size_t)nread, localf);
|
||||||
|
if((nwritten != (size_t)nread) || ferror(localf)) {
|
||||||
|
pm_errno = PM_ERR_RETRIEVE;
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
|
||||||
|
tempfile, strerror(errno));
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
dl_thisfile += nread;
|
||||||
|
|
||||||
|
if(handle->dlcb) {
|
||||||
|
handle->dlcb(filename, dl_thisfile, ust.size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* did the transfer complete normally? */
|
||||||
|
if (nread == -1) {
|
||||||
|
/* not PM_ERR_LIBFETCH here because libfetch error string might be empty */
|
||||||
|
pm_errno = PM_ERR_RETRIEVE;
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s\n"),
|
||||||
|
filename, gethost(fileurl));
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ust.size != -1 && dl_thisfile < ust.size) {
|
||||||
|
pm_errno = PM_ERR_RETRIEVE;
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
|
||||||
|
filename, (intmax_t)dl_thisfile, (intmax_t)ust.size);
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* probably safer to close the file descriptors now before renaming the file,
|
||||||
|
* for example to make sure the buffers are flushed.
|
||||||
|
*/
|
||||||
|
fclose(localf);
|
||||||
|
localf = NULL;
|
||||||
|
fetchIO_close(dlf);
|
||||||
|
dlf = NULL;
|
||||||
|
|
||||||
|
/* set the times on the file to the same as that of the remote file */
|
||||||
|
if(ust.mtime) {
|
||||||
|
struct timeval tv[2];
|
||||||
|
memset(&tv, 0, sizeof(tv));
|
||||||
|
tv[0].tv_sec = ust.atime;
|
||||||
|
tv[1].tv_sec = ust.mtime;
|
||||||
|
utimes(tempfile, tv);
|
||||||
|
}
|
||||||
|
if(rename(tempfile, destfile)) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
|
tempfile, destfile, strerror(errno));
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
FREE(tempfile);
|
||||||
|
FREE(destfile);
|
||||||
|
if(localf != NULL) {
|
||||||
|
/* if we still had a local file open, we got interrupted. set the mtimes on
|
||||||
|
* the file accordingly. */
|
||||||
|
fflush(localf);
|
||||||
|
if(ust.mtime) {
|
||||||
|
struct timeval tv[2];
|
||||||
|
memset(&tv, 0, sizeof(tv));
|
||||||
|
tv[0].tv_sec = ust.atime;
|
||||||
|
tv[1].tv_sec = ust.mtime;
|
||||||
|
futimes(fileno(localf), tv);
|
||||||
|
}
|
||||||
|
fclose(localf);
|
||||||
|
}
|
||||||
|
if(dlf != NULL) {
|
||||||
|
fetchIO_close(dlf);
|
||||||
|
}
|
||||||
|
fetchFreeURL(fileurl);
|
||||||
|
|
||||||
|
/* restore the old signal handlers */
|
||||||
|
sigaction(SIGINT, &sig_int[OLD], NULL);
|
||||||
|
sigaction(SIGPIPE, &sig_pipe[OLD], NULL);
|
||||||
|
/* if we were interrupted, trip the old handler */
|
||||||
|
if(dload_interrupted) {
|
||||||
|
raise(SIGINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int download(const char *url, const char *localpath,
|
||||||
|
int force) {
|
||||||
|
if(handle->fetchcb == NULL) {
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
return(download_internal(url, localpath, force));
|
||||||
|
#else
|
||||||
|
RET_ERR(PM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
int ret = handle->fetchcb(url, localpath, force);
|
||||||
|
if(ret == -1) {
|
||||||
|
RET_ERR(PM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Download a single file
|
||||||
|
* - servers must be a list of urls WITHOUT trailing slashes.
|
||||||
|
*
|
||||||
|
* RETURN: 0 for successful download
|
||||||
|
* 1 if the files are identical
|
||||||
|
* -1 on error
|
||||||
|
*/
|
||||||
|
int _alpm_download_single_file(const char *filename,
|
||||||
|
alpm_list_t *servers, const char *localpath,
|
||||||
|
int force)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
ASSERT(servers != NULL, RET_ERR(PM_ERR_SERVER_NONE, -1));
|
||||||
|
|
||||||
|
for(i = servers; i; i = i->next) {
|
||||||
|
const char *server = i->data;
|
||||||
|
char *fileurl = NULL;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
/* print server + filename into a buffer */
|
||||||
|
len = strlen(server) + strlen(filename) + 2;
|
||||||
|
CALLOC(fileurl, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
snprintf(fileurl, len, "%s/%s", server, filename);
|
||||||
|
|
||||||
|
ret = download(fileurl, localpath, force);
|
||||||
|
FREE(fileurl);
|
||||||
|
if(ret != -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_download_files(alpm_list_t *files,
|
||||||
|
alpm_list_t *servers, const char *localpath)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
alpm_list_t *lp;
|
||||||
|
|
||||||
|
for(lp = files; lp; lp = lp->next) {
|
||||||
|
char *filename = lp->data;
|
||||||
|
if(_alpm_download_single_file(filename, servers,
|
||||||
|
localpath, 0) == -1) {
|
||||||
|
ret++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Fetch a remote pkg. */
|
||||||
|
char SYMEXPORT *alpm_fetch_pkgurl(const char *url)
|
||||||
|
{
|
||||||
|
char *filename, *filepath;
|
||||||
|
const char *cachedir;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
filename = get_filename(url);
|
||||||
|
|
||||||
|
/* find a valid cache dir to download to */
|
||||||
|
cachedir = _alpm_filecache_setup();
|
||||||
|
|
||||||
|
/* download the file */
|
||||||
|
ret = download(url, cachedir, 0);
|
||||||
|
if(ret == -1) {
|
||||||
|
_alpm_log(PM_LOG_WARNING, _("failed to download %s\n"), url);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "successfully downloaded %s\n", url);
|
||||||
|
|
||||||
|
/* we should be able to find the file the second time around */
|
||||||
|
filepath = _alpm_filecache_find(filename);
|
||||||
|
return(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* error.h
|
* dload.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,13 +17,23 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef _ALPM_ERROR_H
|
#ifndef _ALPM_DLOAD_H
|
||||||
#define _ALPM_ERROR_H
|
#define _ALPM_DLOAD_H
|
||||||
|
|
||||||
#define RET_ERR(err, ret) do { pm_errno = (err); \
|
#include "alpm_list.h"
|
||||||
_alpm_log(PM_LOG_DEBUG, "returning error %d from %s : %s\n", err, __func__, alpm_strerrorlast()); \
|
#include "alpm.h"
|
||||||
return(ret); } while(0)
|
|
||||||
|
|
||||||
#endif /* _ALPM_ERROR_H */
|
#include <time.h>
|
||||||
|
|
||||||
|
#define PM_DLBUF_LEN (1024 * 16)
|
||||||
|
|
||||||
|
int _alpm_download_single_file(const char *filename,
|
||||||
|
alpm_list_t *servers, const char *localpath,
|
||||||
|
int force);
|
||||||
|
|
||||||
|
int _alpm_download_files(alpm_list_t *files,
|
||||||
|
alpm_list_t *servers, const char *localpath);
|
||||||
|
|
||||||
|
#endif /* _ALPM_DLOAD_H */
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* error.c
|
* error.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
|
||||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,12 +20,22 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
/* TODO: needed for the libfetch stuff, unfortunately- we should kill it */
|
||||||
|
#include <stdio.h>
|
||||||
|
/* the following two are needed for FreeBSD's libfetch */
|
||||||
|
#include <limits.h> /* PATH_MAX */
|
||||||
|
#if defined(HAVE_SYS_PARAM_H)
|
||||||
|
#include <sys/param.h> /* MAXHOSTNAMELEN */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
#include <fetch.h> /* fetchLastErrString */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "error.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
/* TODO does this really need a file all on its own? */
|
|
||||||
const char SYMEXPORT *alpm_strerrorlast(void)
|
const char SYMEXPORT *alpm_strerrorlast(void)
|
||||||
{
|
{
|
||||||
return alpm_strerror(pm_errno);
|
return alpm_strerror(pm_errno);
|
||||||
@@ -49,6 +57,8 @@ const char SYMEXPORT *alpm_strerror(int err)
|
|||||||
return _("could not find or read directory");
|
return _("could not find or read directory");
|
||||||
case PM_ERR_WRONG_ARGS:
|
case PM_ERR_WRONG_ARGS:
|
||||||
return _("wrong or NULL argument passed");
|
return _("wrong or NULL argument passed");
|
||||||
|
case PM_ERR_DISK_SPACE:
|
||||||
|
return _("not enough free disk space");
|
||||||
/* Interface */
|
/* Interface */
|
||||||
case PM_ERR_HANDLE_NULL:
|
case PM_ERR_HANDLE_NULL:
|
||||||
return _("library not initialized");
|
return _("library not initialized");
|
||||||
@@ -67,6 +77,8 @@ const char SYMEXPORT *alpm_strerror(int err)
|
|||||||
return _("database already registered");
|
return _("database already registered");
|
||||||
case PM_ERR_DB_NOT_FOUND:
|
case PM_ERR_DB_NOT_FOUND:
|
||||||
return _("could not find database");
|
return _("could not find database");
|
||||||
|
case PM_ERR_DB_VERSION:
|
||||||
|
return _("database is incorrect version");
|
||||||
case PM_ERR_DB_WRITE:
|
case PM_ERR_DB_WRITE:
|
||||||
return _("could not update database");
|
return _("could not update database");
|
||||||
case PM_ERR_DB_REMOVE:
|
case PM_ERR_DB_REMOVE:
|
||||||
@@ -74,13 +86,8 @@ const char SYMEXPORT *alpm_strerror(int err)
|
|||||||
/* Servers */
|
/* Servers */
|
||||||
case PM_ERR_SERVER_BAD_URL:
|
case PM_ERR_SERVER_BAD_URL:
|
||||||
return _("invalid url for server");
|
return _("invalid url for server");
|
||||||
/* Configuration */
|
case PM_ERR_SERVER_NONE:
|
||||||
case PM_ERR_OPT_LOGFILE:
|
return _("no servers configured for repository");
|
||||||
case PM_ERR_OPT_DBPATH:
|
|
||||||
case PM_ERR_OPT_LOCALDB:
|
|
||||||
case PM_ERR_OPT_SYNCDB:
|
|
||||||
case PM_ERR_OPT_USESYSLOG:
|
|
||||||
return _("could not set parameter");
|
|
||||||
/* Transactions */
|
/* Transactions */
|
||||||
case PM_ERR_TRANS_NOT_NULL:
|
case PM_ERR_TRANS_NOT_NULL:
|
||||||
return _("transaction already initialized");
|
return _("transaction already initialized");
|
||||||
@@ -96,39 +103,30 @@ const char SYMEXPORT *alpm_strerror(int err)
|
|||||||
return _("transaction aborted");
|
return _("transaction aborted");
|
||||||
case PM_ERR_TRANS_TYPE:
|
case PM_ERR_TRANS_TYPE:
|
||||||
return _("operation not compatible with the transaction type");
|
return _("operation not compatible with the transaction type");
|
||||||
case PM_ERR_TRANS_COMMITING:
|
case PM_ERR_TRANS_NOT_LOCKED:
|
||||||
return _("could not commit transaction");
|
return _("transaction commit attempt when database is not locked");
|
||||||
case PM_ERR_TRANS_DOWNLOADING:
|
|
||||||
return _("could not download all files");
|
|
||||||
/* Packages */
|
/* Packages */
|
||||||
case PM_ERR_PKG_NOT_FOUND:
|
case PM_ERR_PKG_NOT_FOUND:
|
||||||
return _("could not find or read package");
|
return _("could not find or read package");
|
||||||
|
case PM_ERR_PKG_IGNORED:
|
||||||
|
return _("operation cancelled due to ignorepkg");
|
||||||
case PM_ERR_PKG_INVALID:
|
case PM_ERR_PKG_INVALID:
|
||||||
return _("invalid or corrupted package");
|
return _("invalid or corrupted package");
|
||||||
case PM_ERR_PKG_OPEN:
|
case PM_ERR_PKG_OPEN:
|
||||||
return _("cannot open package file");
|
return _("cannot open package file");
|
||||||
case PM_ERR_PKG_LOAD:
|
|
||||||
return _("cannot load package data");
|
|
||||||
case PM_ERR_PKG_INSTALLED:
|
|
||||||
return _("package already installed");
|
|
||||||
case PM_ERR_PKG_CANT_FRESH:
|
|
||||||
return _("package not installed or lesser version");
|
|
||||||
case PM_ERR_PKG_CANT_REMOVE:
|
case PM_ERR_PKG_CANT_REMOVE:
|
||||||
return _("cannot remove all files for package");
|
return _("cannot remove all files for package");
|
||||||
case PM_ERR_PKG_INVALID_NAME:
|
case PM_ERR_PKG_INVALID_NAME:
|
||||||
return _("package name is not valid");
|
return _("package filename is not valid");
|
||||||
case PM_ERR_PKG_CORRUPTED:
|
case PM_ERR_PKG_INVALID_ARCH:
|
||||||
return _("corrupted package");
|
return _("package architecture is not valid");
|
||||||
case PM_ERR_PKG_REPO_NOT_FOUND:
|
case PM_ERR_PKG_REPO_NOT_FOUND:
|
||||||
return _("no such repository");
|
return _("could not find repository for target");
|
||||||
/* Deltas */
|
/* Deltas */
|
||||||
case PM_ERR_DLT_CORRUPTED:
|
case PM_ERR_DLT_INVALID:
|
||||||
return _("corrupted delta");
|
return _("invalid or corrupted delta");
|
||||||
case PM_ERR_DLT_PATCHFAILED:
|
case PM_ERR_DLT_PATCHFAILED:
|
||||||
return _("delta patch failed");
|
return _("delta patch failed");
|
||||||
/* Groups */
|
|
||||||
case PM_ERR_GRP_NOT_FOUND:
|
|
||||||
return _("group not found");
|
|
||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
return _("could not satisfy dependencies");
|
return _("could not satisfy dependencies");
|
||||||
@@ -137,20 +135,27 @@ const char SYMEXPORT *alpm_strerror(int err)
|
|||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
return _("conflicting files");
|
return _("conflicting files");
|
||||||
/* Miscellaenous */
|
/* Miscellaenous */
|
||||||
case PM_ERR_USER_ABORT:
|
case PM_ERR_RETRIEVE:
|
||||||
return _("user aborted the operation");
|
return _("failed to retrieve some files");
|
||||||
case PM_ERR_INTERNAL_ERROR:
|
case PM_ERR_WRITE:
|
||||||
return _("internal error");
|
return _("failed to copy some file");
|
||||||
case PM_ERR_LIBARCHIVE_ERROR:
|
|
||||||
return _("libarchive error");
|
|
||||||
case PM_ERR_PKG_HOLD:
|
|
||||||
/* TODO wow this is not descriptive at all... what does this mean? */
|
|
||||||
return _("not confirmed");
|
|
||||||
case PM_ERR_INVALID_REGEX:
|
case PM_ERR_INVALID_REGEX:
|
||||||
return _("invalid regular expression");
|
return _("invalid regular expression");
|
||||||
/* Downloading */
|
/* Errors from external libraries- our own wrapper error */
|
||||||
case PM_ERR_CONNECT_FAILED:
|
case PM_ERR_LIBARCHIVE:
|
||||||
return _("connection to remote host failed");
|
/* it would be nice to use archive_error_string() here, but that
|
||||||
|
* requires the archive struct, so we can't. Just use a generic
|
||||||
|
* error string instead. */
|
||||||
|
return _("libarchive error");
|
||||||
|
case PM_ERR_LIBFETCH:
|
||||||
|
#ifdef HAVE_LIBFETCH
|
||||||
|
return fetchLastErrString;
|
||||||
|
#else
|
||||||
|
/* obviously shouldn't get here... */
|
||||||
|
return _("download library error");
|
||||||
|
#endif
|
||||||
|
case PM_ERR_EXTERNAL_DOWNLOAD:
|
||||||
|
return _("error invoking external downloader");
|
||||||
/* Unknown error! */
|
/* Unknown error! */
|
||||||
default:
|
default:
|
||||||
return _("unexpected error");
|
return _("unexpected error");
|
||||||
|
|||||||
50
lib/libalpm/graph.h
Normal file
50
lib/libalpm/graph.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* graph.h - helpful graph structure and setup/teardown methods
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h> /* off_t */
|
||||||
|
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "util.h" /* CALLOC() */
|
||||||
|
|
||||||
|
struct __pmgraph_t {
|
||||||
|
char state; /* 0: untouched, -1: entered, other: leaving time */
|
||||||
|
void *data;
|
||||||
|
off_t weight; /* weight of the node */
|
||||||
|
struct __pmgraph_t *parent; /* where did we come from? */
|
||||||
|
alpm_list_t *children;
|
||||||
|
alpm_list_t *childptr; /* points to a child in children list */
|
||||||
|
};
|
||||||
|
typedef struct __pmgraph_t pmgraph_t;
|
||||||
|
|
||||||
|
static pmgraph_t *_alpm_graph_new(void)
|
||||||
|
{
|
||||||
|
pmgraph_t *graph = NULL;
|
||||||
|
|
||||||
|
CALLOC(graph, 1, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
return(graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _alpm_graph_free(void *data)
|
||||||
|
{
|
||||||
|
pmgraph_t *graph = data;
|
||||||
|
alpm_list_free(graph->children);
|
||||||
|
free(graph);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* group.c
|
* group.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,17 +28,17 @@
|
|||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "error.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
pmgrp_t *_alpm_grp_new()
|
pmgrp_t *_alpm_grp_new(const char *name)
|
||||||
{
|
{
|
||||||
pmgrp_t* grp;
|
pmgrp_t* grp;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
CALLOC(grp, 1, sizeof(pmgrp_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(grp, 1, sizeof(pmgrp_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
STRDUP(grp->name, name, RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
return(grp);
|
return(grp);
|
||||||
}
|
}
|
||||||
@@ -50,20 +51,12 @@ void _alpm_grp_free(pmgrp_t *grp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FREELIST(grp->packages);
|
FREE(grp->name);
|
||||||
|
/* do NOT free the contents of the list, just the nodes */
|
||||||
|
alpm_list_free(grp->packages);
|
||||||
FREE(grp);
|
FREE(grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function for sorting groups
|
|
||||||
*/
|
|
||||||
int _alpm_grp_cmp(const void *g1, const void *g2)
|
|
||||||
{
|
|
||||||
pmgrp_t *grp1 = (pmgrp_t *)g1;
|
|
||||||
pmgrp_t *grp2 = (pmgrp_t *)g2;
|
|
||||||
|
|
||||||
return(strcmp(grp1->name, grp2->name));
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
|
const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
@@ -74,7 +67,7 @@ const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
|
|||||||
return grp->name;
|
return grp->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(const pmgrp_t *grp)
|
alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(const pmgrp_t *grp)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* group.h
|
* group.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,19 +20,17 @@
|
|||||||
#ifndef _ALPM_GROUP_H
|
#ifndef _ALPM_GROUP_H
|
||||||
#define _ALPM_GROUP_H
|
#define _ALPM_GROUP_H
|
||||||
|
|
||||||
/* Groups */
|
|
||||||
#define GRP_NAME_LEN 256
|
|
||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
struct __pmgrp_t {
|
struct __pmgrp_t {
|
||||||
char name[GRP_NAME_LEN];
|
/** group name */
|
||||||
alpm_list_t *packages; /* List of strings */
|
char *name;
|
||||||
|
/** list of pmpkg_t packages */
|
||||||
|
alpm_list_t *packages;
|
||||||
};
|
};
|
||||||
|
|
||||||
pmgrp_t *_alpm_grp_new(void);
|
pmgrp_t *_alpm_grp_new(const char *name);
|
||||||
void _alpm_grp_free(pmgrp_t *grp);
|
void _alpm_grp_free(pmgrp_t *grp);
|
||||||
int _alpm_grp_cmp(const void *g1, const void *g2);
|
|
||||||
|
|
||||||
#endif /* _ALPM_GROUP_H */
|
#endif /* _ALPM_GROUP_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* handle.c
|
* handle.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||||
*
|
*
|
||||||
@@ -23,7 +24,6 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
@@ -36,10 +36,8 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "error.h"
|
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "server.h"
|
|
||||||
|
|
||||||
/* global var for handle (private to libalpm) */
|
/* global var for handle (private to libalpm) */
|
||||||
pmhandle_t *handle = NULL;
|
pmhandle_t *handle = NULL;
|
||||||
@@ -52,18 +50,6 @@ pmhandle_t *_alpm_handle_new()
|
|||||||
|
|
||||||
CALLOC(handle, 1, sizeof(pmhandle_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(handle, 1, sizeof(pmhandle_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
handle->lckfd = -1;
|
|
||||||
handle->logstream = NULL;
|
|
||||||
|
|
||||||
/* see if we're root or not */
|
|
||||||
handle->uid = geteuid();
|
|
||||||
handle->root = NULL;
|
|
||||||
handle->dbpath = NULL;
|
|
||||||
handle->cachedirs = NULL;
|
|
||||||
handle->lockfile = NULL;
|
|
||||||
handle->logfile = NULL;
|
|
||||||
handle->usedelta = 0;
|
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,12 +78,11 @@ void _alpm_handle_free(pmhandle_t *handle)
|
|||||||
FREELIST(handle->cachedirs);
|
FREELIST(handle->cachedirs);
|
||||||
FREE(handle->logfile);
|
FREE(handle->logfile);
|
||||||
FREE(handle->lockfile);
|
FREE(handle->lockfile);
|
||||||
FREE(handle->xfercommand);
|
FREE(handle->arch);
|
||||||
FREELIST(handle->dbs_sync);
|
FREELIST(handle->dbs_sync);
|
||||||
FREELIST(handle->noupgrade);
|
FREELIST(handle->noupgrade);
|
||||||
FREELIST(handle->noextract);
|
FREELIST(handle->noextract);
|
||||||
FREELIST(handle->ignorepkg);
|
FREELIST(handle->ignorepkg);
|
||||||
FREELIST(handle->holdpkg);
|
|
||||||
FREELIST(handle->ignoregrp);
|
FREELIST(handle->ignoregrp);
|
||||||
FREE(handle);
|
FREE(handle);
|
||||||
}
|
}
|
||||||
@@ -120,6 +105,24 @@ alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
|
|||||||
return handle->dlcb;
|
return handle->dlcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb()
|
||||||
|
{
|
||||||
|
if (handle == NULL) {
|
||||||
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return handle->fetchcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
|
||||||
|
{
|
||||||
|
if (handle == NULL) {
|
||||||
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return handle->totaldlcb;
|
||||||
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_root()
|
const char SYMEXPORT *alpm_option_get_root()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
@@ -165,7 +168,7 @@ const char SYMEXPORT *alpm_option_get_lockfile()
|
|||||||
return handle->lockfile;
|
return handle->lockfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short SYMEXPORT alpm_option_get_usesyslog()
|
int SYMEXPORT alpm_option_get_usesyslog()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
@@ -201,15 +204,6 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs()
|
|||||||
return handle->ignorepkg;
|
return handle->ignorepkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_holdpkgs()
|
|
||||||
{
|
|
||||||
if (handle == NULL) {
|
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->holdpkg;
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
@@ -219,22 +213,31 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
|||||||
return handle->ignoregrp;
|
return handle->ignoregrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_xfercommand()
|
const char SYMEXPORT *alpm_option_get_arch()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return handle->xfercommand;
|
return handle->arch;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short SYMEXPORT alpm_option_get_nopassiveftp()
|
int SYMEXPORT alpm_option_get_usedelta()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return handle->nopassiveftp;
|
return handle->usedelta;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_get_checkspace()
|
||||||
|
{
|
||||||
|
if (handle == NULL) {
|
||||||
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return handle->checkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
||||||
@@ -273,6 +276,24 @@ void SYMEXPORT alpm_option_set_dlcb(alpm_cb_download cb)
|
|||||||
handle->dlcb = cb;
|
handle->dlcb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SYMEXPORT alpm_option_set_fetchcb(alpm_cb_fetch cb)
|
||||||
|
{
|
||||||
|
if (handle == NULL) {
|
||||||
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handle->fetchcb = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SYMEXPORT alpm_option_set_totaldlcb(alpm_cb_totaldl cb)
|
||||||
|
{
|
||||||
|
if (handle == NULL) {
|
||||||
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handle->totaldlcb = cb;
|
||||||
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_root(const char *root)
|
int SYMEXPORT alpm_option_set_root(const char *root)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@@ -281,6 +302,8 @@ int SYMEXPORT alpm_option_set_root(const char *root)
|
|||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
|
||||||
if(!root) {
|
if(!root) {
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -292,6 +315,7 @@ int SYMEXPORT alpm_option_set_root(const char *root)
|
|||||||
|
|
||||||
realroot = calloc(PATH_MAX+1, sizeof(char));
|
realroot = calloc(PATH_MAX+1, sizeof(char));
|
||||||
if(!realpath(root, realroot)) {
|
if(!realpath(root, realroot)) {
|
||||||
|
FREE(realroot);
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
pm_errno = PM_ERR_NOT_A_DIR;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@@ -320,6 +344,7 @@ int SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
|
|||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
if(!dbpath) {
|
if(!dbpath) {
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -358,6 +383,7 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
|
|||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
if(!cachedir) {
|
if(!cachedir) {
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -380,15 +406,17 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
|
|||||||
|
|
||||||
void SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
|
void SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
if(handle->cachedirs) FREELIST(handle->cachedirs);
|
if(handle->cachedirs) FREELIST(handle->cachedirs);
|
||||||
if(cachedirs) handle->cachedirs = cachedirs;
|
if(cachedirs) handle->cachedirs = cachedirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
|
int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
|
||||||
{
|
{
|
||||||
void *vdata = NULL;
|
char *vdata = NULL;
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
size_t cachedirlen;
|
size_t cachedirlen;
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
/* verify cachedir ends in a '/' */
|
/* verify cachedir ends in a '/' */
|
||||||
cachedirlen = strlen(cachedir);
|
cachedirlen = strlen(cachedir);
|
||||||
if(cachedir[cachedirlen-1] != '/') {
|
if(cachedir[cachedirlen-1] != '/') {
|
||||||
@@ -397,8 +425,7 @@ int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
|
|||||||
newcachedir = calloc(cachedirlen + 1, sizeof(char));
|
newcachedir = calloc(cachedirlen + 1, sizeof(char));
|
||||||
strncpy(newcachedir, cachedir, cachedirlen);
|
strncpy(newcachedir, cachedir, cachedirlen);
|
||||||
newcachedir[cachedirlen-1] = '/';
|
newcachedir[cachedirlen-1] = '/';
|
||||||
handle->cachedirs = alpm_list_remove(handle->cachedirs, newcachedir,
|
handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata);
|
||||||
_alpm_str_cmp, &vdata);
|
|
||||||
FREE(newcachedir);
|
FREE(newcachedir);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
@@ -413,6 +440,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
|
|||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
if(!logfile) {
|
if(!logfile) {
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -427,32 +455,36 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
|
|||||||
}
|
}
|
||||||
if(handle->logstream) {
|
if(handle->logstream) {
|
||||||
fclose(handle->logstream);
|
fclose(handle->logstream);
|
||||||
|
handle->logstream = NULL;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "option 'logfile' = %s\n", handle->logfile);
|
_alpm_log(PM_LOG_DEBUG, "option 'logfile' = %s\n", handle->logfile);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_usesyslog(unsigned short usesyslog)
|
void SYMEXPORT alpm_option_set_usesyslog(int usesyslog)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
handle->usesyslog = usesyslog;
|
handle->usesyslog = usesyslog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_noupgrade(const char *pkg)
|
void SYMEXPORT alpm_option_add_noupgrade(const char *pkg)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade)
|
void SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
if(handle->noupgrade) FREELIST(handle->noupgrade);
|
if(handle->noupgrade) FREELIST(handle->noupgrade);
|
||||||
if(noupgrade) handle->noupgrade = noupgrade;
|
if(noupgrade) handle->noupgrade = noupgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg)
|
int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg)
|
||||||
{
|
{
|
||||||
void *vdata = NULL;
|
char *vdata = NULL;
|
||||||
handle->noupgrade = alpm_list_remove(handle->noupgrade, pkg,
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
_alpm_str_cmp, &vdata);
|
handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return(1);
|
||||||
@@ -462,20 +494,22 @@ int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg)
|
|||||||
|
|
||||||
void SYMEXPORT alpm_option_add_noextract(const char *pkg)
|
void SYMEXPORT alpm_option_add_noextract(const char *pkg)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract)
|
void SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
if(handle->noextract) FREELIST(handle->noextract);
|
if(handle->noextract) FREELIST(handle->noextract);
|
||||||
if(noextract) handle->noextract = noextract;
|
if(noextract) handle->noextract = noextract;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_noextract(const char *pkg)
|
int SYMEXPORT alpm_option_remove_noextract(const char *pkg)
|
||||||
{
|
{
|
||||||
void *vdata = NULL;
|
char *vdata = NULL;
|
||||||
handle->noextract = alpm_list_remove(handle->noextract, pkg,
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
_alpm_str_cmp, &vdata);
|
handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return(1);
|
||||||
@@ -485,43 +519,22 @@ int SYMEXPORT alpm_option_remove_noextract(const char *pkg)
|
|||||||
|
|
||||||
void SYMEXPORT alpm_option_add_ignorepkg(const char *pkg)
|
void SYMEXPORT alpm_option_add_ignorepkg(const char *pkg)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
|
void SYMEXPORT alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
|
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
|
||||||
if(ignorepkgs) handle->ignorepkg = ignorepkgs;
|
if(ignorepkgs) handle->ignorepkg = ignorepkgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_ignorepkg(const char *pkg)
|
int SYMEXPORT alpm_option_remove_ignorepkg(const char *pkg)
|
||||||
{
|
{
|
||||||
void *vdata = NULL;
|
char *vdata = NULL;
|
||||||
handle->ignorepkg = alpm_list_remove(handle->ignorepkg, pkg,
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
_alpm_str_cmp, &vdata);
|
handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
|
||||||
FREE(vdata);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_holdpkg(const char *pkg)
|
|
||||||
{
|
|
||||||
handle->holdpkg = alpm_list_add(handle->holdpkg, strdup(pkg));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
|
|
||||||
{
|
|
||||||
if(handle->holdpkg) FREELIST(handle->holdpkg);
|
|
||||||
if(holdpkgs) handle->holdpkg = holdpkgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_holdpkg(const char *pkg)
|
|
||||||
{
|
|
||||||
void *vdata = NULL;
|
|
||||||
handle->holdpkg = alpm_list_remove(handle->holdpkg, pkg,
|
|
||||||
_alpm_str_cmp, &vdata);
|
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return(1);
|
||||||
@@ -531,20 +544,22 @@ int SYMEXPORT alpm_option_remove_holdpkg(const char *pkg)
|
|||||||
|
|
||||||
void SYMEXPORT alpm_option_add_ignoregrp(const char *grp)
|
void SYMEXPORT alpm_option_add_ignoregrp(const char *grp)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
|
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
|
void SYMEXPORT alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
|
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
|
||||||
if(ignoregrps) handle->ignoregrp = ignoregrps;
|
if(ignoregrps) handle->ignoregrp = ignoregrps;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
|
int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
|
||||||
{
|
{
|
||||||
void *vdata = NULL;
|
char *vdata = NULL;
|
||||||
handle->ignoregrp = alpm_list_remove(handle->ignoregrp, grp,
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
_alpm_str_cmp, &vdata);
|
handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return(1);
|
||||||
@@ -552,20 +567,23 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_xfercommand(const char *cmd)
|
void SYMEXPORT alpm_option_set_arch(const char *arch)
|
||||||
{
|
{
|
||||||
if(handle->xfercommand) FREE(handle->xfercommand);
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
if(cmd) handle->xfercommand = strdup(cmd);
|
if(handle->arch) FREE(handle->arch);
|
||||||
|
if(arch) handle->arch = strdup(arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_nopassiveftp(unsigned short nopasv)
|
void SYMEXPORT alpm_option_set_usedelta(int usedelta)
|
||||||
{
|
|
||||||
handle->nopassiveftp = nopasv;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_usedelta(unsigned short usedelta)
|
|
||||||
{
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
handle->usedelta = usedelta;
|
handle->usedelta = usedelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SYMEXPORT alpm_option_set_checkspace(int checkspace)
|
||||||
|
{
|
||||||
|
ASSERT(handle != NULL, RET_ERR_VOID(PM_ERR_HANDLE_NULL));
|
||||||
|
handle->checkspace = checkspace;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* handle.h
|
* handle.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,16 +31,17 @@
|
|||||||
|
|
||||||
typedef struct _pmhandle_t {
|
typedef struct _pmhandle_t {
|
||||||
/* internal usage */
|
/* internal usage */
|
||||||
uid_t uid; /* current UID */ /* TODO is this used? */
|
|
||||||
pmdb_t *db_local; /* local db pointer */
|
pmdb_t *db_local; /* local db pointer */
|
||||||
alpm_list_t *dbs_sync; /* List of (pmdb_t *) */
|
alpm_list_t *dbs_sync; /* List of (pmdb_t *) */
|
||||||
FILE *logstream; /* log file stream pointer */
|
FILE *logstream; /* log file stream pointer */
|
||||||
int lckfd; /* lock file descriptor if one exists */
|
FILE *lckstream; /* lock file stream pointer if one exists */
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
||||||
/* callback functions */
|
/* callback functions */
|
||||||
alpm_cb_log logcb; /* Log callback function */
|
alpm_cb_log logcb; /* Log callback function */
|
||||||
alpm_cb_download dlcb; /* Download callback function */
|
alpm_cb_download dlcb; /* Download callback function */
|
||||||
|
alpm_cb_totaldl totaldlcb; /* Total download callback function */
|
||||||
|
alpm_cb_fetch fetchcb; /* Download file callback function */
|
||||||
|
|
||||||
/* filesystem paths */
|
/* filesystem paths */
|
||||||
char *root; /* Root path, default '/' */
|
char *root; /* Root path, default '/' */
|
||||||
@@ -50,22 +52,21 @@ typedef struct _pmhandle_t {
|
|||||||
|
|
||||||
/* package lists */
|
/* package lists */
|
||||||
alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
|
alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
|
||||||
alpm_list_t *noextract; /* List of packages NOT to extract */ /*TODO is this used?*/
|
alpm_list_t *noextract; /* List of files NOT to extract */
|
||||||
alpm_list_t *ignorepkg; /* List of packages to ignore */
|
alpm_list_t *ignorepkg; /* List of packages to ignore */
|
||||||
alpm_list_t *holdpkg; /* List of packages which 'hold' pacman */
|
|
||||||
alpm_list_t *ignoregrp; /* List of groups to ignore */
|
alpm_list_t *ignoregrp; /* List of groups to ignore */
|
||||||
|
|
||||||
/* options */
|
/* options */
|
||||||
unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
||||||
unsigned short nopassiveftp; /* Don't use PASV ftp connections */
|
char *arch; /* Architecture of packages we should allow */
|
||||||
char *xfercommand; /* External download command */
|
int usedelta; /* Download deltas if possible */
|
||||||
unsigned short usedelta; /* Download deltas if possible */
|
int checkspace; /* Check disk space before installing */
|
||||||
} pmhandle_t;
|
} pmhandle_t;
|
||||||
|
|
||||||
/* global handle variable */
|
/* global handle variable */
|
||||||
extern pmhandle_t *handle;
|
extern pmhandle_t *handle;
|
||||||
|
|
||||||
pmhandle_t *_alpm_handle_new();
|
pmhandle_t *_alpm_handle_new(void);
|
||||||
void _alpm_handle_free(pmhandle_t *handle);
|
void _alpm_handle_free(pmhandle_t *handle);
|
||||||
|
|
||||||
#endif /* _ALPM_HANDLE_H */
|
#endif /* _ALPM_HANDLE_H */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* log.c
|
* log.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,7 +31,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "error.h"
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
/** \addtogroup alpm_log Logging Functions
|
/** \addtogroup alpm_log Logging Functions
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* @param fmt output format
|
* @param fmt output format
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_logaction(char *fmt, ...)
|
int SYMEXPORT alpm_logaction(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -88,7 +88,7 @@ int SYMEXPORT alpm_logaction(char *fmt, ...)
|
|||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
void _alpm_log(pmloglevel_t flag, char *fmt, ...)
|
void _alpm_log(pmloglevel_t flag, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
alpm_cb_log logcb = alpm_option_get_logcb();
|
alpm_cb_log logcb = alpm_option_get_logcb();
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* log.h
|
* log.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
#define ALPM_LOG_FUNC
|
#define ALPM_LOG_FUNC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void _alpm_log(pmloglevel_t flag, char *fmt, ...) __attribute__((format(printf,2,3)));
|
void _alpm_log(pmloglevel_t flag, const char *fmt, ...) __attribute__((format(printf,2,3)));
|
||||||
|
|
||||||
#endif /* _ALPM_LOG_H */
|
#endif /* _ALPM_LOG_H */
|
||||||
|
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2006-2007 Christophe Devine
|
* Copyright (C) 2006-2007 Christophe Devine
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* it under the terms of the GNU General Public License as published by
|
||||||
* License, version 2.1 as published by the Free Software Foundation.
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* Lesser General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library. If not, see
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* The MD5 algorithm was designed by Ron Rivest in 1991.
|
* The MD5 algorithm was designed by Ron Rivest in 1991.
|
||||||
@@ -25,8 +25,9 @@
|
|||||||
* Pacman Notes:
|
* Pacman Notes:
|
||||||
*
|
*
|
||||||
* Taken from the XySSL project at www.xyssl.org under terms of the
|
* Taken from the XySSL project at www.xyssl.org under terms of the
|
||||||
* LGPL. This is from version 0.7 of the library, and has been modified
|
* GPL. This is from version 0.9 of the library, and has been modified
|
||||||
* as following, which may be helpful for future updates:
|
* as following, which may be helpful for future updates:
|
||||||
|
* * remove "xyssl/config.h" include
|
||||||
* * change include from "xyssl/md5.h" to "md5.h"
|
* * change include from "xyssl/md5.h" to "md5.h"
|
||||||
* * removal of HMAC code
|
* * removal of HMAC code
|
||||||
* * removal of SELF_TEST code
|
* * removal of SELF_TEST code
|
||||||
@@ -35,22 +36,25 @@
|
|||||||
* int md5_file( char *path, unsigned char *output )
|
* int md5_file( char *path, unsigned char *output )
|
||||||
* to
|
* to
|
||||||
* int md5_file( const char *path, unsigned char *output )
|
* int md5_file( const char *path, unsigned char *output )
|
||||||
|
* * use a dynamically-allocated buffer in md5_file, and increase the size
|
||||||
|
* for performance reasons
|
||||||
|
* * various static/inline changes
|
||||||
|
*
|
||||||
|
* NOTE: XySSL has been renamed to PolarSSL, which is available at
|
||||||
|
* www.polarssl.org. If we update, we should get it from there.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
|
||||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
*/
|
*/
|
||||||
#ifndef GET_UINT32_LE
|
#ifndef GET_ULONG_LE
|
||||||
#define GET_UINT32_LE(n,b,i) \
|
#define GET_ULONG_LE(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(n) = ( (unsigned long) (b)[(i) ] ) \
|
(n) = ( (unsigned long) (b)[(i) ] ) \
|
||||||
| ( (unsigned long) (b)[(i) + 1] << 8 ) \
|
| ( (unsigned long) (b)[(i) + 1] << 8 ) \
|
||||||
@@ -59,8 +63,8 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PUT_UINT32_LE
|
#ifndef PUT_ULONG_LE
|
||||||
#define PUT_UINT32_LE(n,b,i) \
|
#define PUT_ULONG_LE(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(b)[(i) ] = (unsigned char) ( (n) ); \
|
(b)[(i) ] = (unsigned char) ( (n) ); \
|
||||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
||||||
@@ -87,22 +91,22 @@ static inline void md5_process( md5_context *ctx, unsigned char data[64] )
|
|||||||
{
|
{
|
||||||
unsigned long X[16], A, B, C, D;
|
unsigned long X[16], A, B, C, D;
|
||||||
|
|
||||||
GET_UINT32_LE( X[ 0], data, 0 );
|
GET_ULONG_LE( X[ 0], data, 0 );
|
||||||
GET_UINT32_LE( X[ 1], data, 4 );
|
GET_ULONG_LE( X[ 1], data, 4 );
|
||||||
GET_UINT32_LE( X[ 2], data, 8 );
|
GET_ULONG_LE( X[ 2], data, 8 );
|
||||||
GET_UINT32_LE( X[ 3], data, 12 );
|
GET_ULONG_LE( X[ 3], data, 12 );
|
||||||
GET_UINT32_LE( X[ 4], data, 16 );
|
GET_ULONG_LE( X[ 4], data, 16 );
|
||||||
GET_UINT32_LE( X[ 5], data, 20 );
|
GET_ULONG_LE( X[ 5], data, 20 );
|
||||||
GET_UINT32_LE( X[ 6], data, 24 );
|
GET_ULONG_LE( X[ 6], data, 24 );
|
||||||
GET_UINT32_LE( X[ 7], data, 28 );
|
GET_ULONG_LE( X[ 7], data, 28 );
|
||||||
GET_UINT32_LE( X[ 8], data, 32 );
|
GET_ULONG_LE( X[ 8], data, 32 );
|
||||||
GET_UINT32_LE( X[ 9], data, 36 );
|
GET_ULONG_LE( X[ 9], data, 36 );
|
||||||
GET_UINT32_LE( X[10], data, 40 );
|
GET_ULONG_LE( X[10], data, 40 );
|
||||||
GET_UINT32_LE( X[11], data, 44 );
|
GET_ULONG_LE( X[11], data, 44 );
|
||||||
GET_UINT32_LE( X[12], data, 48 );
|
GET_ULONG_LE( X[12], data, 48 );
|
||||||
GET_UINT32_LE( X[13], data, 52 );
|
GET_ULONG_LE( X[13], data, 52 );
|
||||||
GET_UINT32_LE( X[14], data, 56 );
|
GET_ULONG_LE( X[14], data, 56 );
|
||||||
GET_UINT32_LE( X[15], data, 60 );
|
GET_ULONG_LE( X[15], data, 60 );
|
||||||
|
|
||||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||||
|
|
||||||
@@ -261,7 +265,7 @@ static unsigned char md5_padding[64] =
|
|||||||
/*
|
/*
|
||||||
* MD5 final digest
|
* MD5 final digest
|
||||||
*/
|
*/
|
||||||
static inline void md5_finish( md5_context *ctx, unsigned char *output )
|
static inline void md5_finish( md5_context *ctx, unsigned char output[16] )
|
||||||
{
|
{
|
||||||
unsigned long last, padn;
|
unsigned long last, padn;
|
||||||
unsigned long high, low;
|
unsigned long high, low;
|
||||||
@@ -271,8 +275,8 @@ static inline void md5_finish( md5_context *ctx, unsigned char *output )
|
|||||||
| ( ctx->total[1] << 3 );
|
| ( ctx->total[1] << 3 );
|
||||||
low = ( ctx->total[0] << 3 );
|
low = ( ctx->total[0] << 3 );
|
||||||
|
|
||||||
PUT_UINT32_LE( low, msglen, 0 );
|
PUT_ULONG_LE( low, msglen, 0 );
|
||||||
PUT_UINT32_LE( high, msglen, 4 );
|
PUT_ULONG_LE( high, msglen, 4 );
|
||||||
|
|
||||||
last = ctx->total[0] & 0x3F;
|
last = ctx->total[0] & 0x3F;
|
||||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
@@ -280,17 +284,16 @@ static inline void md5_finish( md5_context *ctx, unsigned char *output )
|
|||||||
md5_update( ctx, (unsigned char *) md5_padding, padn );
|
md5_update( ctx, (unsigned char *) md5_padding, padn );
|
||||||
md5_update( ctx, msglen, 8 );
|
md5_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
PUT_UINT32_LE( ctx->state[0], output, 0 );
|
PUT_ULONG_LE( ctx->state[0], output, 0 );
|
||||||
PUT_UINT32_LE( ctx->state[1], output, 4 );
|
PUT_ULONG_LE( ctx->state[1], output, 4 );
|
||||||
PUT_UINT32_LE( ctx->state[2], output, 8 );
|
PUT_ULONG_LE( ctx->state[2], output, 8 );
|
||||||
PUT_UINT32_LE( ctx->state[3], output, 12 );
|
PUT_ULONG_LE( ctx->state[3], output, 12 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output = MD5( input buffer )
|
* output = MD5( input buffer )
|
||||||
*/
|
*/
|
||||||
void md5( unsigned char *input, int ilen,
|
void md5( unsigned char *input, int ilen, unsigned char output[16] )
|
||||||
unsigned char *output )
|
|
||||||
{
|
{
|
||||||
md5_context ctx;
|
md5_context ctx;
|
||||||
|
|
||||||
@@ -302,18 +305,23 @@ void md5( unsigned char *input, int ilen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output = MD5( file contents )
|
* output = MD5( file contents )
|
||||||
*/
|
*/
|
||||||
int md5_file( const char *path, unsigned char *output )
|
int md5_file( const char *path, unsigned char output[16] )
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
size_t n;
|
size_t n;
|
||||||
md5_context ctx;
|
md5_context ctx;
|
||||||
unsigned char buf[1024];
|
unsigned char *buf;
|
||||||
|
|
||||||
if( ( f = fopen( path, "rb" ) ) == NULL )
|
if( ( buf = calloc(8192, sizeof(unsigned char)) ) == NULL )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
||||||
|
if( ( f = fopen( path, "rb" ) ) == NULL ) {
|
||||||
|
free( buf );
|
||||||
|
return( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
md5_starts( &ctx );
|
md5_starts( &ctx );
|
||||||
|
|
||||||
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
||||||
@@ -322,6 +330,7 @@ int md5_file( const char *path, unsigned char *output )
|
|||||||
md5_finish( &ctx, output );
|
md5_finish( &ctx, output );
|
||||||
|
|
||||||
memset( &ctx, 0, sizeof( md5_context ) );
|
memset( &ctx, 0, sizeof( md5_context ) );
|
||||||
|
free( buf );
|
||||||
|
|
||||||
if( ferror( f ) != 0 )
|
if( ferror( f ) != 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,29 +3,24 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2006-2007 Christophe Devine
|
* Copyright (C) 2006-2007 Christophe Devine
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* it under the terms of the GNU General Public License as published by
|
||||||
* License, version 2.1 as published by the Free Software Foundation.
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* Lesser General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library. If not, see
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MD5_H
|
#ifndef _MD5_H
|
||||||
#define _MD5_H
|
#define _MD5_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \internal
|
|
||||||
* \brief MD5 context structure
|
* \brief MD5 context structure
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -37,18 +32,15 @@ typedef struct
|
|||||||
md5_context;
|
md5_context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \internal
|
|
||||||
* \brief Output = MD5( input buffer )
|
* \brief Output = MD5( input buffer )
|
||||||
*
|
*
|
||||||
* \param input buffer holding the data
|
* \param input buffer holding the data
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
* \param output MD5 checksum result
|
* \param output MD5 checksum result
|
||||||
*/
|
*/
|
||||||
void md5( unsigned char *input, int ilen,
|
void md5( unsigned char *input, int ilen, unsigned char output[16] );
|
||||||
unsigned char *output );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \internal
|
|
||||||
* \brief Output = MD5( file contents )
|
* \brief Output = MD5( file contents )
|
||||||
*
|
*
|
||||||
* \param path input file name
|
* \param path input file name
|
||||||
@@ -57,10 +49,6 @@ void md5( unsigned char *input, int ilen,
|
|||||||
* \return 0 if successful, 1 if fopen failed,
|
* \return 0 if successful, 1 if fopen failed,
|
||||||
* or 2 if fread failed
|
* or 2 if fread failed
|
||||||
*/
|
*/
|
||||||
int md5_file( const char *path, unsigned char *output );
|
int md5_file( const char *path, unsigned char output[16] );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* md5.h */
|
#endif /* md5.h */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* package.h
|
* package.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||||
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
||||||
* Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
|
* Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
|
||||||
@@ -23,45 +24,99 @@
|
|||||||
#ifndef _ALPM_PACKAGE_H
|
#ifndef _ALPM_PACKAGE_H
|
||||||
#define _ALPM_PACKAGE_H
|
#define _ALPM_PACKAGE_H
|
||||||
|
|
||||||
#include <time.h>
|
#include <sys/types.h> /* off_t */
|
||||||
|
#include <time.h> /* time_t */
|
||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
|
|
||||||
typedef enum _pmpkgfrom_t {
|
typedef enum _pmpkgfrom_t {
|
||||||
PKG_FROM_CACHE = 1,
|
PKG_FROM_FILE = 1,
|
||||||
PKG_FROM_FILE
|
PKG_FROM_LOCALDB,
|
||||||
|
PKG_FROM_SYNCDB
|
||||||
} pmpkgfrom_t;
|
} pmpkgfrom_t;
|
||||||
|
|
||||||
/* Packages */
|
/** Package operations struct. This struct contains function pointers to
|
||||||
#define PKG_FILENAME_LEN 512
|
* all methods used to access data in a package to allow for things such
|
||||||
#define PKG_NAME_LEN 256
|
* as lazy package intialization (such as used by the file backend). Each
|
||||||
#define PKG_VERSION_LEN 64
|
* backend is free to define a stuct containing pointers to a specific
|
||||||
#define PKG_FULLNAME_LEN (PKG_NAME_LEN + PKG_VERSION_LEN)
|
* implementation of these methods. Some backends may find using the
|
||||||
#define PKG_DESC_LEN 512
|
* defined default_pkg_ops struct to work just fine for their needs.
|
||||||
#define PKG_URL_LEN 256
|
*/
|
||||||
#define PKG_DATE_LEN 32
|
struct pkg_operations {
|
||||||
#define PKG_TYPE_LEN 32
|
const char *(*get_filename) (pmpkg_t *);
|
||||||
#define PKG_PACKAGER_LEN 64
|
const char *(*get_name) (pmpkg_t *);
|
||||||
#define PKG_MD5SUM_LEN 33
|
const char *(*get_version) (pmpkg_t *);
|
||||||
#define PKG_ARCH_LEN 32
|
const char *(*get_desc) (pmpkg_t *);
|
||||||
|
const char *(*get_url) (pmpkg_t *);
|
||||||
|
time_t (*get_builddate) (pmpkg_t *);
|
||||||
|
time_t (*get_installdate) (pmpkg_t *);
|
||||||
|
const char *(*get_packager) (pmpkg_t *);
|
||||||
|
const char *(*get_md5sum) (pmpkg_t *);
|
||||||
|
const char *(*get_arch) (pmpkg_t *);
|
||||||
|
off_t (*get_size) (pmpkg_t *);
|
||||||
|
off_t (*get_isize) (pmpkg_t *);
|
||||||
|
pmpkgreason_t (*get_reason) (pmpkg_t *);
|
||||||
|
int (*has_scriptlet) (pmpkg_t *);
|
||||||
|
|
||||||
|
alpm_list_t *(*get_licenses) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_groups) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_depends) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_optdepends) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_conflicts) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_provides) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_replaces) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_deltas) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_files) (pmpkg_t *);
|
||||||
|
alpm_list_t *(*get_backup) (pmpkg_t *);
|
||||||
|
|
||||||
|
void *(*changelog_open) (pmpkg_t *);
|
||||||
|
size_t (*changelog_read) (void *, size_t, const pmpkg_t *, const void *);
|
||||||
|
int (*changelog_close) (const pmpkg_t *, void *);
|
||||||
|
|
||||||
|
/* still to add:
|
||||||
|
* checkmd5sum() ?
|
||||||
|
* compute_requiredby()
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The standard package operations struct. get fields directly from the
|
||||||
|
* struct itself with no abstraction layer or any type of lazy loading.
|
||||||
|
* The actual definition is in package.c so it can have access to the
|
||||||
|
* default accessor functions which are defined there.
|
||||||
|
*/
|
||||||
|
extern struct pkg_operations default_pkg_ops;
|
||||||
|
|
||||||
struct __pmpkg_t {
|
struct __pmpkg_t {
|
||||||
char filename[PKG_FILENAME_LEN];
|
unsigned long name_hash;
|
||||||
char name[PKG_NAME_LEN];
|
char *filename;
|
||||||
char version[PKG_VERSION_LEN];
|
char *name;
|
||||||
char desc[PKG_DESC_LEN];
|
char *version;
|
||||||
char url[PKG_URL_LEN];
|
char *desc;
|
||||||
|
char *url;
|
||||||
|
char *packager;
|
||||||
|
char *md5sum;
|
||||||
|
char *arch;
|
||||||
|
|
||||||
time_t builddate;
|
time_t builddate;
|
||||||
time_t installdate;
|
time_t installdate;
|
||||||
char packager[PKG_PACKAGER_LEN];
|
|
||||||
char md5sum[PKG_MD5SUM_LEN];
|
off_t size;
|
||||||
char arch[PKG_ARCH_LEN];
|
off_t isize;
|
||||||
unsigned long size;
|
off_t download_size;
|
||||||
unsigned long isize;
|
|
||||||
unsigned short scriptlet;
|
int scriptlet;
|
||||||
unsigned short force;
|
|
||||||
pmpkgreason_t reason;
|
pmpkgreason_t reason;
|
||||||
|
pmpkgfrom_t origin;
|
||||||
|
/* origin == PKG_FROM_FILE, use pkg->origin_data.file
|
||||||
|
* origin == PKG_FROM_*DB, use pkg->origin_data.db */
|
||||||
|
union {
|
||||||
|
pmdb_t *db;
|
||||||
|
char *file;
|
||||||
|
} origin_data;
|
||||||
|
pmdbinfrq_t infolevel;
|
||||||
|
|
||||||
alpm_list_t *licenses;
|
alpm_list_t *licenses;
|
||||||
alpm_list_t *replaces;
|
alpm_list_t *replaces;
|
||||||
alpm_list_t *groups;
|
alpm_list_t *groups;
|
||||||
@@ -72,27 +127,19 @@ struct __pmpkg_t {
|
|||||||
alpm_list_t *conflicts;
|
alpm_list_t *conflicts;
|
||||||
alpm_list_t *provides;
|
alpm_list_t *provides;
|
||||||
alpm_list_t *deltas;
|
alpm_list_t *deltas;
|
||||||
/* internal */
|
alpm_list_t *delta_path;
|
||||||
pmpkgfrom_t origin;
|
alpm_list_t *removes; /* in transaction targets only */
|
||||||
/* Replaced 'void *data' with this union as follows:
|
|
||||||
origin == PKG_FROM_CACHE, use pkg->origin_data.db
|
struct pkg_operations *ops;
|
||||||
origin == PKG_FROM_FILE, use pkg->origin_data.file
|
|
||||||
*/
|
|
||||||
union {
|
|
||||||
pmdb_t *db;
|
|
||||||
char *file;
|
|
||||||
} origin_data;
|
|
||||||
pmdbinfrq_t infolevel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int _alpm_versioncmp(const char *a, const char *b);
|
pmpkg_t* _alpm_pkg_new(void);
|
||||||
pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
|
|
||||||
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
|
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
|
||||||
void _alpm_pkg_free(pmpkg_t *pkg);
|
void _alpm_pkg_free(pmpkg_t *pkg);
|
||||||
|
void _alpm_pkg_free_trans(pmpkg_t *pkg);
|
||||||
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
||||||
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
|
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
|
||||||
pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full);
|
pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle);
|
||||||
pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
|
|
||||||
int _alpm_pkg_should_ignore(pmpkg_t *pkg);
|
int _alpm_pkg_should_ignore(pmpkg_t *pkg);
|
||||||
|
|
||||||
#endif /* _ALPM_PACKAGE_H */
|
#endif /* _ALPM_PACKAGE_H */
|
||||||
|
|||||||
330
lib/libalpm/pkghash.c
Normal file
330
lib/libalpm/pkghash.c
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
/*
|
||||||
|
* pkghash.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pkghash.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
/* List of primes for possible sizes of hash tables.
|
||||||
|
*
|
||||||
|
* The maximum table size is the last prime under 1,000,000. That is
|
||||||
|
* more than an order of magnitude greater than the number of packages
|
||||||
|
* in any Linux distribution.
|
||||||
|
*/
|
||||||
|
static const size_t prime_list[] =
|
||||||
|
{
|
||||||
|
11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul, 37ul, 41ul, 43ul, 47ul,
|
||||||
|
53ul, 59ul, 61ul, 67ul, 71ul, 73ul, 79ul, 83ul, 89ul, 97ul, 103ul,
|
||||||
|
109ul, 113ul, 127ul, 137ul, 139ul, 149ul, 157ul, 167ul, 179ul, 193ul,
|
||||||
|
199ul, 211ul, 227ul, 241ul, 257ul, 277ul, 293ul, 313ul, 337ul, 359ul,
|
||||||
|
383ul, 409ul, 439ul, 467ul, 503ul, 541ul, 577ul, 619ul, 661ul, 709ul,
|
||||||
|
761ul, 823ul, 887ul, 953ul, 1031ul, 1109ul, 1193ul, 1289ul, 1381ul,
|
||||||
|
1493ul, 1613ul, 1741ul, 1879ul, 2029ul, 2179ul, 2357ul, 2549ul,
|
||||||
|
2753ul, 2971ul, 3209ul, 3469ul, 3739ul, 4027ul, 4349ul, 4703ul,
|
||||||
|
5087ul, 5503ul, 5953ul, 6427ul, 6949ul, 7517ul, 8123ul, 8783ul,
|
||||||
|
9497ul, 10273ul, 11113ul, 12011ul, 12983ul, 14033ul, 15173ul,
|
||||||
|
16411ul, 17749ul, 19183ul, 20753ul, 22447ul, 24281ul, 26267ul,
|
||||||
|
28411ul, 30727ul, 33223ul, 35933ul, 38873ul, 42043ul, 45481ul,
|
||||||
|
49201ul, 53201ul, 57557ul, 62233ul, 67307ul, 72817ul, 78779ul,
|
||||||
|
85229ul, 92203ul, 99733ul, 107897ul, 116731ul, 126271ul, 136607ul,
|
||||||
|
147793ul, 159871ul, 172933ul, 187091ul, 202409ul, 218971ul, 236897ul,
|
||||||
|
256279ul, 277261ul, 299951ul, 324503ul, 351061ul, 379787ul, 410857ul,
|
||||||
|
444487ul, 480881ul, 520241ul, 562841ul, 608903ul, 658753ul, 712697ul,
|
||||||
|
771049ul, 834181ul, 902483ul, 976369ul
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Allocate a hash table with at least "size" buckets */
|
||||||
|
pmpkghash_t *_alpm_pkghash_create(size_t size)
|
||||||
|
{
|
||||||
|
pmpkghash_t *hash = NULL;
|
||||||
|
size_t i, loopsize;
|
||||||
|
|
||||||
|
MALLOC(hash, sizeof(pmpkghash_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
hash->list = NULL;
|
||||||
|
hash->entries = 0;
|
||||||
|
hash->buckets = 0;
|
||||||
|
|
||||||
|
loopsize = sizeof(prime_list) / sizeof(*prime_list);
|
||||||
|
for(i = 0; i < loopsize; i++) {
|
||||||
|
if(prime_list[i] > size) {
|
||||||
|
hash->buckets = prime_list[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hash->buckets < size) {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("database larger than maximum size\n"));
|
||||||
|
free(hash);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
CALLOC(hash->hash_table, hash->buckets, sizeof(alpm_list_t*), \
|
||||||
|
free(hash); RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash)
|
||||||
|
{
|
||||||
|
size_t position;
|
||||||
|
|
||||||
|
position = name_hash % hash->buckets;
|
||||||
|
|
||||||
|
/* collision resolution using open addressing with linear probing */
|
||||||
|
while(hash->hash_table[position] != NULL) {
|
||||||
|
position = (position + 1) % hash->buckets;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Expand the hash table size to the next increment and rebin the entries */
|
||||||
|
static pmpkghash_t *rehash(pmpkghash_t *oldhash)
|
||||||
|
{
|
||||||
|
pmpkghash_t *newhash;
|
||||||
|
size_t newsize, position, i;
|
||||||
|
|
||||||
|
/* Hash tables will need resized in two cases:
|
||||||
|
* - adding packages to the local database
|
||||||
|
* - poor estimation of the number of packages in sync database
|
||||||
|
*
|
||||||
|
* For small hash tables sizes (<500) the increase in size is by a
|
||||||
|
* minimum of a factor of 2 for optimal rehash efficiency. For
|
||||||
|
* larger database sizes, this increase is reduced to avoid excess
|
||||||
|
* memory allocation as both scenarios requiring a rehash should not
|
||||||
|
* require a table size increase that large. */
|
||||||
|
if(oldhash->buckets < 500) {
|
||||||
|
newsize = oldhash->buckets * 2;
|
||||||
|
} else if(oldhash->buckets < 2000) {
|
||||||
|
newsize = oldhash->buckets * 3 / 2;
|
||||||
|
} else if(oldhash->buckets < 5000) {
|
||||||
|
newsize = oldhash->buckets * 4 / 3;
|
||||||
|
} else {
|
||||||
|
newsize = oldhash->buckets + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
newhash = _alpm_pkghash_create(newsize);
|
||||||
|
if(newhash == NULL) {
|
||||||
|
/* creation of newhash failed, stick with old one... */
|
||||||
|
return(oldhash);
|
||||||
|
}
|
||||||
|
|
||||||
|
newhash->list = oldhash->list;
|
||||||
|
oldhash->list = NULL;
|
||||||
|
|
||||||
|
for(i = 0; i < oldhash->buckets; i++) {
|
||||||
|
if(oldhash->hash_table[i] != NULL) {
|
||||||
|
pmpkg_t *package = oldhash->hash_table[i]->data;
|
||||||
|
|
||||||
|
position = get_hash_position(package->name_hash, newhash);
|
||||||
|
|
||||||
|
newhash->hash_table[position] = oldhash->hash_table[i];
|
||||||
|
oldhash->hash_table[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newhash->entries = oldhash->entries;
|
||||||
|
|
||||||
|
_alpm_pkghash_free(oldhash);
|
||||||
|
|
||||||
|
return(newhash);
|
||||||
|
}
|
||||||
|
|
||||||
|
static pmpkghash_t *pkghash_add_pkg(pmpkghash_t *hash, pmpkg_t *pkg, int sorted)
|
||||||
|
{
|
||||||
|
alpm_list_t *ptr;
|
||||||
|
size_t position;
|
||||||
|
|
||||||
|
if(pkg == NULL || hash == NULL) {
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((hash->entries + 1) / MAX_HASH_LOAD > hash->buckets) {
|
||||||
|
hash = rehash(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
position = get_hash_position(pkg->name_hash, hash);
|
||||||
|
|
||||||
|
ptr = calloc(1, sizeof(alpm_list_t));
|
||||||
|
if(ptr == NULL) {
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr->data = pkg;
|
||||||
|
ptr->next = NULL;
|
||||||
|
ptr->prev = ptr;
|
||||||
|
|
||||||
|
hash->hash_table[position] = ptr;
|
||||||
|
if(!sorted){
|
||||||
|
hash->list = alpm_list_join(hash->list, ptr);
|
||||||
|
}else{
|
||||||
|
hash->list = alpm_list_mmerge(hash->list, ptr, _alpm_pkg_cmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
hash->entries += 1;
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
return(pkghash_add_pkg(hash, pkg, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
return(pkghash_add_pkg(hash, pkg, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end)
|
||||||
|
{
|
||||||
|
/* Iterate backwards from 'end' to 'start', seeing if any of the items
|
||||||
|
* would hash to 'start'. If we find one, we move it there and break. If
|
||||||
|
* we get all the way back to position and find none that hash to it, we
|
||||||
|
* also end iteration. Iterating backwards helps prevent needless shuffles;
|
||||||
|
* we will never need to move more than one item per function call. The
|
||||||
|
* return value is our current iteration location; if this is equal to
|
||||||
|
* 'start' we can stop this madness. */
|
||||||
|
while(end != start) {
|
||||||
|
alpm_list_t *i = hash->hash_table[end];
|
||||||
|
pmpkg_t *info = i->data;
|
||||||
|
size_t new_position = get_hash_position(info->name_hash, hash);
|
||||||
|
|
||||||
|
if(new_position == start) {
|
||||||
|
hash->hash_table[start] = i;
|
||||||
|
hash->hash_table[end] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the odd math ensures we are always positive, e.g.
|
||||||
|
* e.g. (0 - 1) % 47 == -1
|
||||||
|
* e.g. (47 + 0 - 1) % 47 == 46 */
|
||||||
|
end = (hash->buckets + end - 1) % hash->buckets;
|
||||||
|
}
|
||||||
|
return(end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove a package from a pkghash.
|
||||||
|
*
|
||||||
|
* @param hash the hash to remove the package from
|
||||||
|
* @param pkg the package we are removing
|
||||||
|
* @param data output parameter containing the removed item
|
||||||
|
*
|
||||||
|
* @return the resultant hash
|
||||||
|
*/
|
||||||
|
pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg,
|
||||||
|
pmpkg_t **data)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
size_t position;
|
||||||
|
|
||||||
|
if(data) {
|
||||||
|
*data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pkg == NULL || hash == NULL) {
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
position = pkg->name_hash % hash->buckets;
|
||||||
|
while((i = hash->hash_table[position]) != NULL) {
|
||||||
|
pmpkg_t *info = i->data;
|
||||||
|
|
||||||
|
if(info->name_hash == pkg->name_hash &&
|
||||||
|
strcmp(info->name, pkg->name) == 0) {
|
||||||
|
size_t stop, prev;
|
||||||
|
|
||||||
|
/* remove from list and hash */
|
||||||
|
hash->list = alpm_list_remove_item(hash->list, i);
|
||||||
|
if(data) {
|
||||||
|
*data = info;
|
||||||
|
}
|
||||||
|
hash->hash_table[position] = NULL;
|
||||||
|
free(i);
|
||||||
|
hash->entries -= 1;
|
||||||
|
|
||||||
|
/* Potentially move entries following removed entry to keep open
|
||||||
|
* addressing collision resolution working. We start by finding the
|
||||||
|
* next null bucket to know how far we have to look. */
|
||||||
|
stop = (position + 1) % hash->buckets;
|
||||||
|
while(hash->hash_table[stop] != NULL && stop != position) {
|
||||||
|
stop = (stop + 1) % hash->buckets;
|
||||||
|
}
|
||||||
|
stop = (hash->buckets + stop - 1) % hash->buckets;
|
||||||
|
|
||||||
|
/* We now search backwards from stop to position. If we find an
|
||||||
|
* item that now hashes to position, we will move it, and then try
|
||||||
|
* to plug the new hole we just opened up, until we finally don't
|
||||||
|
* move anything. */
|
||||||
|
while((prev = move_one_entry(hash, position, stop)) != position) {
|
||||||
|
position = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
position = (position + 1) % hash->buckets;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _alpm_pkghash_free(pmpkghash_t *hash)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
if(hash != NULL) {
|
||||||
|
for(i = 0; i < hash->buckets; i++) {
|
||||||
|
free(hash->hash_table[i]);
|
||||||
|
}
|
||||||
|
free(hash->hash_table);
|
||||||
|
}
|
||||||
|
free(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name)
|
||||||
|
{
|
||||||
|
alpm_list_t *lp;
|
||||||
|
unsigned long name_hash;
|
||||||
|
size_t position;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
if(name == NULL || hash == NULL) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
name_hash = _alpm_hash_sdbm(name);
|
||||||
|
|
||||||
|
position = name_hash % hash->buckets;
|
||||||
|
|
||||||
|
while((lp = hash->hash_table[position]) != NULL) {
|
||||||
|
pmpkg_t *info = lp->data;
|
||||||
|
|
||||||
|
if(info->name_hash == name_hash && strcmp(info->name, name) == 0) {
|
||||||
|
return(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
position = (position + 1) % hash->buckets;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
60
lib/libalpm/pkghash.h
Normal file
60
lib/libalpm/pkghash.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* pkghash.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
|
*
|
||||||
|
* 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 program 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ALPM_PKGHASH_H
|
||||||
|
#define _ALPM_PKGHASH_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "alpm_list.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A hash table for holding pmpkg_t objects.
|
||||||
|
*
|
||||||
|
* A combination of a hash table and a list, allowing for fast look-up
|
||||||
|
* by package name but also iteration over the packages.
|
||||||
|
*/
|
||||||
|
struct __pmpkghash_t {
|
||||||
|
/** data held by the hash table */
|
||||||
|
alpm_list_t **hash_table;
|
||||||
|
/** number of buckets in hash table */
|
||||||
|
size_t buckets;
|
||||||
|
/** number of entries in hash table */
|
||||||
|
size_t entries;
|
||||||
|
/** head node of the hash table data in normal list format */
|
||||||
|
alpm_list_t *list;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct __pmpkghash_t pmpkghash_t;
|
||||||
|
|
||||||
|
pmpkghash_t *_alpm_pkghash_create(size_t size);
|
||||||
|
|
||||||
|
pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg);
|
||||||
|
pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, pmpkg_t *pkg);
|
||||||
|
pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg, pmpkg_t **data);
|
||||||
|
|
||||||
|
void _alpm_pkghash_free(pmpkghash_t *hash);
|
||||||
|
|
||||||
|
pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name);
|
||||||
|
|
||||||
|
#define MAX_HASH_LOAD 0.7
|
||||||
|
|
||||||
|
#endif /* _ALPM_PKGHASH_H */
|
||||||
@@ -1,12 +1,26 @@
|
|||||||
# Set of available languages.
|
# Set of available languages.
|
||||||
|
ca
|
||||||
cs
|
cs
|
||||||
|
da
|
||||||
de
|
de
|
||||||
|
el
|
||||||
en_GB
|
en_GB
|
||||||
es
|
es
|
||||||
|
fi
|
||||||
fr
|
fr
|
||||||
hu
|
hu
|
||||||
it
|
it
|
||||||
|
kk
|
||||||
|
nb
|
||||||
pl
|
pl
|
||||||
|
pt
|
||||||
pt_BR
|
pt_BR
|
||||||
|
ro
|
||||||
ru
|
ru
|
||||||
|
sk
|
||||||
|
sr
|
||||||
|
sr@latin
|
||||||
|
sv
|
||||||
|
tr
|
||||||
|
uk
|
||||||
zh_CN
|
zh_CN
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user