mirror of
https://gitlab.archlinux.org/pacman/pacman.git
synced 2025-11-10 12:24:39 +01:00
Compare commits
1514 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7bc1e3c9a | ||
|
|
f8ae60bc28 | ||
|
|
294f0fdf4d | ||
|
|
31432edcbe | ||
|
|
9b1ab3d767 | ||
|
|
ea32924c62 | ||
|
|
5945241469 | ||
|
|
b7c06d6d67 | ||
|
|
52afce0a10 | ||
|
|
216db87f99 | ||
|
|
0fdf0b19ce | ||
|
|
17e71fc908 | ||
|
|
090ea28942 | ||
|
|
e01fdc3dba | ||
|
|
e8db984ce5 | ||
|
|
47313acee4 | ||
|
|
fcbae69fe8 | ||
|
|
9d1e8084df | ||
|
|
7b2f600d71 | ||
|
|
5c2928aa25 | ||
|
|
9e9835f464 | ||
|
|
7ff1b945f6 | ||
|
|
825b4ff35a | ||
|
|
a03c35125e | ||
|
|
44f146f232 | ||
|
|
edd4276bbf | ||
|
|
df47136bcf | ||
|
|
de56874cc9 | ||
|
|
1eb40c8328 | ||
|
|
562109c0e8 | ||
|
|
1b50223f82 | ||
|
|
c77cec2ffc | ||
|
|
c231c9af97 | ||
|
|
24ca6ce1f9 | ||
|
|
430b0df779 | ||
|
|
d9af1a0cf2 | ||
|
|
4e60b9646d | ||
|
|
b426488e2b | ||
|
|
7b1a86b893 | ||
|
|
be229d129e | ||
|
|
e8a2c25456 | ||
|
|
b6209b4ba4 | ||
|
|
73d0d743bd | ||
|
|
2b38f4eab7 | ||
|
|
36413aa856 | ||
|
|
102e6209c7 | ||
|
|
24c166f42a | ||
|
|
a857b9c8e0 | ||
|
|
c6e1d4ddde | ||
|
|
a1437cbf1b | ||
|
|
def9e45aff | ||
|
|
f1d9b0a74a | ||
|
|
6507fd6bf0 | ||
|
|
7113ea4e08 | ||
|
|
5b749eeee9 | ||
|
|
d95c04945f | ||
|
|
67290441b8 | ||
|
|
b75fac5be3 | ||
|
|
6a1d3948a6 | ||
|
|
17e0be9e6a | ||
|
|
d85d0ddcfe | ||
|
|
61ce2ca1bb | ||
|
|
5490cd6eb2 | ||
|
|
a521cea96f | ||
|
|
15aa57d51b | ||
|
|
d7f8838294 | ||
|
|
f5820c8bd6 | ||
|
|
507a2d15e6 | ||
|
|
b8ef22312b | ||
|
|
c79c068fe9 | ||
|
|
ad09db3c55 | ||
|
|
9363e7dc22 | ||
|
|
37ff0f5658 | ||
|
|
c0ce10397a | ||
|
|
fcf0a8b203 | ||
|
|
42e2f8bfbf | ||
|
|
e7b56f48d7 | ||
|
|
601c808b8d | ||
|
|
1953fe4368 | ||
|
|
d98ff04cc9 | ||
|
|
4c259d51f7 | ||
|
|
f4875fab9b | ||
|
|
3343185473 | ||
|
|
1052709921 | ||
|
|
24881034f6 | ||
|
|
8a9ce12a27 | ||
|
|
5c1885b55e | ||
|
|
7a6b01d46c | ||
|
|
2da59e1aa9 | ||
|
|
571f2f7814 | ||
|
|
0d9e7da309 | ||
|
|
5853025137 | ||
|
|
d6e3446e70 | ||
|
|
20a47aba8e | ||
|
|
9e9ecf2183 | ||
|
|
45f86ca1ca | ||
|
|
4bada45464 | ||
|
|
bac670ddc9 | ||
|
|
842c4422ed | ||
|
|
020bdb4298 | ||
|
|
185cbb8a44 | ||
|
|
5b5b250443 | ||
|
|
86bc36412e | ||
|
|
1ebe5dc197 | ||
|
|
43cad9c871 | ||
|
|
04fd320e97 | ||
|
|
241946ccea | ||
|
|
d4c97ea2f6 | ||
|
|
12642a299b | ||
|
|
2a18171afa | ||
|
|
61c6ae01b3 | ||
|
|
d3d3b861ac | ||
|
|
a0d0f3f47f | ||
|
|
e1ae3a6038 | ||
|
|
0c1a0a6d87 | ||
|
|
5a39172835 | ||
|
|
d9c0a08e6d | ||
|
|
8ac7cf6b1b | ||
|
|
4de3d9092e | ||
|
|
8cc4ed0d63 | ||
|
|
abfa8370c0 | ||
|
|
8f414cd040 | ||
|
|
fb401f569e | ||
|
|
36f31dd133 | ||
|
|
cc13f47532 | ||
|
|
9168977b3b | ||
|
|
22abe27bfa | ||
|
|
4928f9edc3 | ||
|
|
273cc66a8a | ||
|
|
7e5bbf0387 | ||
|
|
3f937c8404 | ||
|
|
524847145d | ||
|
|
a8ca9b93f8 | ||
|
|
2df519f807 | ||
|
|
dc7d691b20 | ||
|
|
484d5ec624 | ||
|
|
ab7d2890a4 | ||
|
|
cf0edb92ba | ||
|
|
94bc64ae1b | ||
|
|
c4d6688694 | ||
|
|
b0543440ca | ||
|
|
39b0ac43fc | ||
|
|
73139ccb3c | ||
|
|
6bb5948025 | ||
|
|
e0400fff96 | ||
|
|
938fb2c878 | ||
|
|
07ecd40a1a | ||
|
|
6dfb9d35f8 | ||
|
|
83c05e71bc | ||
|
|
1463a9aa36 | ||
|
|
ad8d3ceb89 | ||
|
|
775b94e649 | ||
|
|
497501d1c7 | ||
|
|
d1af9b70c8 | ||
|
|
e0acf2f144 | ||
|
|
9a58d5c6c5 | ||
|
|
83f99bfb39 | ||
|
|
a8ed39ce05 | ||
|
|
6f3a657f66 | ||
|
|
bcc6a5d72d | ||
|
|
1b8bb7c1cd | ||
|
|
f682cbd433 | ||
|
|
7edeb276b6 | ||
|
|
bd83c8e756 | ||
|
|
40a264478e | ||
|
|
6e081a0c57 | ||
|
|
98e0371ae3 | ||
|
|
f66f9f11cd | ||
|
|
ea3c47825e | ||
|
|
69962184bb | ||
|
|
d8fab9b441 | ||
|
|
bf56fb6eb8 | ||
|
|
619c3629ca | ||
|
|
e70d540501 | ||
|
|
fa929e8258 | ||
|
|
b242b2d050 | ||
|
|
47657107af | ||
|
|
5e13b2b6af | ||
|
|
80b0f27125 | ||
|
|
d1fc3aec4c | ||
|
|
507b01b912 | ||
|
|
b6ccae2d18 | ||
|
|
dd82b8d09f | ||
|
|
6adf502f0d | ||
|
|
d26d50e664 | ||
|
|
2517ba3303 | ||
|
|
c406949226 | ||
|
|
1e0ed133f4 | ||
|
|
907e8af5be | ||
|
|
f1beb050a3 | ||
|
|
43787d0067 | ||
|
|
a78e3e3a23 | ||
|
|
1df9b2aa79 | ||
|
|
067721cbff | ||
|
|
33685b960d | ||
|
|
595e1a437f | ||
|
|
7d961c849b | ||
|
|
6767de5380 | ||
|
|
213950afa3 | ||
|
|
491b656c54 | ||
|
|
03e1b4caa9 | ||
|
|
a7691ba6fd | ||
|
|
4b6a5ae159 | ||
|
|
765178c5ba | ||
|
|
0ef7129a4a | ||
|
|
4849a4596d | ||
|
|
0a4a5cea97 | ||
|
|
3e4749fe3e | ||
|
|
361ed6a600 | ||
|
|
e4690232d6 | ||
|
|
ca58e326dc | ||
|
|
69694edd2c | ||
|
|
d36d70d294 | ||
|
|
33f2518531 | ||
|
|
01f5c9e79a | ||
|
|
5e7875ae6a | ||
|
|
3a460a8be6 | ||
|
|
47dd315609 | ||
|
|
8375ad214a | ||
|
|
b7ebacc576 | ||
|
|
ec790ced7c | ||
|
|
994cb4da4f | ||
|
|
a27f993600 | ||
|
|
afdbfc05f7 | ||
|
|
7eb2f0cd15 | ||
|
|
8e3b39a9e0 | ||
|
|
0f92fc5963 | ||
|
|
79cbce60ac | ||
|
|
70e2c34f0f | ||
|
|
3796164848 | ||
|
|
95119d46d4 | ||
|
|
288a81d847 | ||
|
|
bfe36c2ddf | ||
|
|
e1899cbc64 | ||
|
|
a94ad29740 | ||
|
|
41d8deff88 | ||
|
|
86d9fcbfff | ||
|
|
69a3558b75 | ||
|
|
49dff4c80b | ||
|
|
83ee9708b1 | ||
|
|
07e89c1e5d | ||
|
|
52c65fdfea | ||
|
|
c12fa4ab19 | ||
|
|
b1a09b93ef | ||
|
|
223a92ca9d | ||
|
|
7ad78c2c88 | ||
|
|
a7d7798032 | ||
|
|
f883efe2cb | ||
|
|
e01dbcc068 | ||
|
|
68856755c4 | ||
|
|
a2356d5ae3 | ||
|
|
4a02350ded | ||
|
|
d1e04c1b67 | ||
|
|
0f69e2ec0b | ||
|
|
3905ada993 | ||
|
|
d8eacae7bc | ||
|
|
befddfc3e6 | ||
|
|
c736a12e86 | ||
|
|
7f1235ccbc | ||
|
|
4737a87b84 | ||
|
|
f7653e582b | ||
|
|
db70c9da15 | ||
|
|
a03313f3f6 | ||
|
|
905ae640cf | ||
|
|
4ed12aec30 | ||
|
|
17c3de3e4f | ||
|
|
3d9f961d13 | ||
|
|
8ffa2b24a5 | ||
|
|
b961ebe16f | ||
|
|
6317db8429 | ||
|
|
3e08614fda | ||
|
|
0e79802c0a | ||
|
|
8d0ff3d7dc | ||
|
|
29ad9e0a0a | ||
|
|
7ed54a9940 | ||
|
|
a4e0d3e930 | ||
|
|
6c236277a3 | ||
|
|
7054e37126 | ||
|
|
400942fedf | ||
|
|
7ea1ea88bb | ||
|
|
7c956d5d4b | ||
|
|
98fdfa1968 | ||
|
|
37da18aee8 | ||
|
|
d88e524e7c | ||
|
|
062c391919 | ||
|
|
16fd66f879 | ||
|
|
d9545103b9 | ||
|
|
5a9b07b0e7 | ||
|
|
24f4f9822f | ||
|
|
3c3ee6796a | ||
|
|
83a1e4fee3 | ||
|
|
c51b9ca0ad | ||
|
|
ad051f7328 | ||
|
|
13072ef86c | ||
|
|
11873b70ae | ||
|
|
11ab9aa9f5 | ||
|
|
cf1f014393 | ||
|
|
5bb2d2e0a0 | ||
|
|
35d8cc8bc8 | ||
|
|
50f53b293c | ||
|
|
7479bf21e8 | ||
|
|
06b228b20f | ||
|
|
19c3880ec9 | ||
|
|
2c5f000d5b | ||
|
|
234b6ffc2c | ||
|
|
d74dad79b7 | ||
|
|
515720a6fc | ||
|
|
8129b93afe | ||
|
|
e3676ae7b5 | ||
|
|
499e09734b | ||
|
|
b3c0ae5205 | ||
|
|
7480df68ce | ||
|
|
f46db04f98 | ||
|
|
8973875a1f | ||
|
|
b221af660d | ||
|
|
040083b97f | ||
|
|
3a458783a2 | ||
|
|
12a6c77fdd | ||
|
|
7ceeebf150 | ||
|
|
e1b9f7b300 | ||
|
|
29dede2eb7 | ||
|
|
cab1379a1a | ||
|
|
710e83999b | ||
|
|
d1240f67ea | ||
|
|
2cfcc874b9 | ||
|
|
dc3336c277 | ||
|
|
c7e4005e5c | ||
|
|
de43d00db0 | ||
|
|
12387ca4e5 | ||
|
|
0dad2f6e62 | ||
|
|
a12a4ea396 | ||
|
|
455ca55f4e | ||
|
|
a2002b8f69 | ||
|
|
87fb8f5d57 | ||
|
|
84d6de806b | ||
|
|
5a07b75b22 | ||
|
|
be72e10015 | ||
|
|
c5982a3eb5 | ||
|
|
e1dce078b2 | ||
|
|
6aa9fdce5a | ||
|
|
0ee3ce70a8 | ||
|
|
73fcf17041 | ||
|
|
30cad47fb9 | ||
|
|
f7a3c4c8df | ||
|
|
2e7d002315 | ||
|
|
f0357e415c | ||
|
|
5c48ca3239 | ||
|
|
268d0bbcbe | ||
|
|
30d978a966 | ||
|
|
cc03d6366a | ||
|
|
a8a4395098 | ||
|
|
6731d0a940 | ||
|
|
dddd6a46a0 | ||
|
|
762cbf574b | ||
|
|
f3e2858621 | ||
|
|
c65cea0dcb | ||
|
|
10cbfc956c | ||
|
|
d64c409913 | ||
|
|
592ed13bce | ||
|
|
329a7b7e24 | ||
|
|
c4350d90f1 | ||
|
|
b6914d16cc | ||
|
|
a98babbfef | ||
|
|
343ea81718 | ||
|
|
ffdfc82523 | ||
|
|
e9b8a7693d | ||
|
|
d9e5dab6ac | ||
|
|
d307ed5eb9 | ||
|
|
82fc816d79 | ||
|
|
43940f591e | ||
|
|
eae363c96f | ||
|
|
d3f135af8f | ||
|
|
e07547ee4e | ||
|
|
6d544984f2 | ||
|
|
9934b3bd34 | ||
|
|
24824b54ce | ||
|
|
2ca27ab3a1 | ||
|
|
1723e6dc4f | ||
|
|
16334f778b | ||
|
|
c28052e45b | ||
|
|
2a466c2abc | ||
|
|
6cfc4757b9 | ||
|
|
3752edbff4 | ||
|
|
d008a816f1 | ||
|
|
78b63ce7c3 | ||
|
|
231d6cc1e4 | ||
|
|
5d291d050e | ||
|
|
c4bd476ad1 | ||
|
|
c885a953eb | ||
|
|
4a7f3bbc46 | ||
|
|
d18e600952 | ||
|
|
0745288c14 | ||
|
|
9f139550f8 | ||
|
|
2dbdfe0788 | ||
|
|
b9833838c6 | ||
|
|
9cddc4ad80 | ||
|
|
3ceef97799 | ||
|
|
b2688e9559 | ||
|
|
b952a3b08c | ||
|
|
c5c1a1349a | ||
|
|
b008193c12 | ||
|
|
cea6d7eb13 | ||
|
|
70db027204 | ||
|
|
f41dc7e8fa | ||
|
|
1175702828 | ||
|
|
d4a92cacc6 | ||
|
|
11b9bc443d | ||
|
|
11f4a7a48e | ||
|
|
855bc16a9e | ||
|
|
5fc3ecf7f8 | ||
|
|
796eaaed40 | ||
|
|
88bd1cec77 | ||
|
|
82ffe2cbfd | ||
|
|
1741b5cc30 | ||
|
|
a628feee46 | ||
|
|
bd5ec9cd8e | ||
|
|
f37c501657 | ||
|
|
fa4aad5b50 | ||
|
|
f3f39cef84 | ||
|
|
7de92cb223 | ||
|
|
ebb2e36cc4 | ||
|
|
31f2e0cba3 | ||
|
|
ff88228abd | ||
|
|
31a7b150b0 | ||
|
|
20b5cc96be | ||
|
|
ea79de21d8 | ||
|
|
71f854dde8 | ||
|
|
05f87e0b09 | ||
|
|
8d5018e780 | ||
|
|
ce8f91a71b | ||
|
|
6bf60568f8 | ||
|
|
83f076d3a8 | ||
|
|
835365b817 | ||
|
|
c9cc2332cf | ||
|
|
450bcb5d7b | ||
|
|
fffaba50fb | ||
|
|
c5eccedc63 | ||
|
|
a58dc9283c | ||
|
|
0903452032 | ||
|
|
dd865d2981 | ||
|
|
d0c64c4196 | ||
|
|
0bfefa87c8 | ||
|
|
6e4f695a0f | ||
|
|
725edde73f | ||
|
|
857357f940 | ||
|
|
f3fa77bcf1 | ||
|
|
1f6afe6b0b | ||
|
|
ca41470462 | ||
|
|
f0803f6ece | ||
|
|
edd9ed6a3b | ||
|
|
c4112da8c3 | ||
|
|
c493eef643 | ||
|
|
05608ee57e | ||
|
|
e0f41e0fb4 | ||
|
|
c36dbf9711 | ||
|
|
6b57118c15 | ||
|
|
07996bfac7 | ||
|
|
82d45d66ca | ||
|
|
5c1b83d9b1 | ||
|
|
ce74f76a4c | ||
|
|
76dfea6e83 | ||
|
|
5a6ebec7b2 | ||
|
|
96c4b1c303 | ||
|
|
a42e52a09f | ||
|
|
6803260f26 | ||
|
|
40ea6cd607 | ||
|
|
9d3d647f00 | ||
|
|
5f38660be1 | ||
|
|
9d09c9fdf7 | ||
|
|
1d16875db7 | ||
|
|
4885a7fa3a | ||
|
|
21240d4746 | ||
|
|
9a40927533 | ||
|
|
09f950af07 | ||
|
|
8fa330335f | ||
|
|
ef4757afa5 | ||
|
|
d9f9b87d3f | ||
|
|
1d37c19e04 | ||
|
|
5136df0f39 | ||
|
|
b283a1e065 | ||
|
|
0b57da2a43 | ||
|
|
fab66f157d | ||
|
|
1a919a11b8 | ||
|
|
67445334e7 | ||
|
|
1e16b94a85 | ||
|
|
07a1292721 | ||
|
|
4c37d74ae5 | ||
|
|
f10aea73e4 | ||
|
|
b03b06cfd3 | ||
|
|
6997a738bb | ||
|
|
c55cbfbd5f | ||
|
|
cbaff216b3 | ||
|
|
573260556d | ||
|
|
66d9995711 | ||
|
|
aecd0740cf | ||
|
|
a3def7ac87 | ||
|
|
dffff9659b | ||
|
|
e42d97b737 | ||
|
|
e99b6a131e | ||
|
|
cd8747ba6d | ||
|
|
804e2505cf | ||
|
|
c5d4c92ad4 | ||
|
|
d9875c5e6c | ||
|
|
49d9426b6a | ||
|
|
2b3405e01b | ||
|
|
94f61c5b29 | ||
|
|
9929a34a6d | ||
|
|
ccdb2fa800 | ||
|
|
03447ce39c | ||
|
|
a7940e7419 | ||
|
|
819f675004 | ||
|
|
00949db191 | ||
|
|
06974ebf2f | ||
|
|
88644e181d | ||
|
|
005eab0a08 | ||
|
|
98073afe55 | ||
|
|
768d3589a3 | ||
|
|
2bd1687f51 | ||
|
|
9f500f684d | ||
|
|
bb3dada871 | ||
|
|
058ee17371 | ||
|
|
70d6fe6632 | ||
|
|
61410814c2 | ||
|
|
05f7c0280e | ||
|
|
f1d25ba2dd | ||
|
|
333269482a | ||
|
|
fa3aaa41e3 | ||
|
|
7e5dea5d32 | ||
|
|
31c9a521b4 | ||
|
|
0c9e86bab1 | ||
|
|
0be9e4a4cd | ||
|
|
df7b390514 | ||
|
|
0e85c4989b | ||
|
|
fec10d4a65 | ||
|
|
74f6d717a3 | ||
|
|
74e5a494b0 | ||
|
|
7963c5d000 | ||
|
|
e37adcd664 | ||
|
|
e458606ad2 | ||
|
|
15ca6dca5c | ||
|
|
b300b991a7 | ||
|
|
8ee0724558 | ||
|
|
95d7e16163 | ||
|
|
7d205a70a2 | ||
|
|
d86a60c694 | ||
|
|
dad96ccce2 | ||
|
|
89c070b263 | ||
|
|
29a96bcfe1 | ||
|
|
48e2a1a119 | ||
|
|
297cd7897b | ||
|
|
c0fe1743e5 | ||
|
|
f0e34be990 | ||
|
|
36db8c5047 | ||
|
|
49427d1fb4 | ||
|
|
bf120635a7 | ||
|
|
3934a842b8 | ||
|
|
3294039a00 | ||
|
|
0b92d9ed9c | ||
|
|
1c39e4fbad | ||
|
|
3a04267cdd | ||
|
|
65847fad44 | ||
|
|
e209955606 | ||
|
|
8f72ffbc45 | ||
|
|
0fe93bc34c | ||
|
|
1376ba5b0e | ||
|
|
6907a22b27 | ||
|
|
727e03fe19 | ||
|
|
282be6bf4b | ||
|
|
7f5b24597b | ||
|
|
af357d6ab0 | ||
|
|
36e48573ce | ||
|
|
00628c7268 | ||
|
|
1d53dd716d | ||
|
|
b678e00271 | ||
|
|
57eac093c4 | ||
|
|
3eec745910 | ||
|
|
6dc71926f9 | ||
|
|
6c9b82e72a | ||
|
|
eda741ae93 | ||
|
|
043931ca45 | ||
|
|
e2f00abe26 | ||
|
|
62880d7568 | ||
|
|
36474af463 | ||
|
|
ae7139adcf | ||
|
|
44889da5b7 | ||
|
|
6cce517f1a | ||
|
|
dfc532668d | ||
|
|
77a93328cf | ||
|
|
bfd6d22be2 | ||
|
|
87ee38d8b3 | ||
|
|
ddb8617d96 | ||
|
|
24324ff0e1 | ||
|
|
97103f860d | ||
|
|
c748eadc80 | ||
|
|
07502f2d82 | ||
|
|
e8443b1685 | ||
|
|
7af0ab1cde | ||
|
|
1ce7f39ad7 | ||
|
|
c839415e3f | ||
|
|
26195f8da1 | ||
|
|
6a6fc3107f | ||
|
|
a2995f586e | ||
|
|
06840f14b4 | ||
|
|
a7b02d07f4 | ||
|
|
ab79b13079 | ||
|
|
f612e5ede7 | ||
|
|
925d74f38d | ||
|
|
de8b9a85a5 | ||
|
|
afc96f2ab3 | ||
|
|
bd88a8d551 | ||
|
|
495ba26e63 | ||
|
|
3189d3bc4a | ||
|
|
39262acab6 | ||
|
|
ca43fdd92f | ||
|
|
d796d1cdda | ||
|
|
f818f570c5 | ||
|
|
eb39a9482b | ||
|
|
cf1401a04d | ||
|
|
23a2d2c16a | ||
|
|
68284da0d7 | ||
|
|
6633b8e5c2 | ||
|
|
98a2fc8deb | ||
|
|
35ffe6af2d | ||
|
|
0ed848a9ea | ||
|
|
13235ba65a | ||
|
|
b94e8ecd1f | ||
|
|
9efd10cd2a | ||
|
|
c2cce4f3f5 | ||
|
|
ad577b3cb4 | ||
|
|
0f4aaeee42 | ||
|
|
002d2fda7a | ||
|
|
2860ade2f5 | ||
|
|
84974ed04c | ||
|
|
c2e6a01a28 | ||
|
|
4c80f994c3 | ||
|
|
e92905a2c8 | ||
|
|
fed3e09c94 | ||
|
|
b1894ccf06 | ||
|
|
f1bb56cebf | ||
|
|
9a29888ba7 | ||
|
|
5f6e8c9274 | ||
|
|
452bf71cec | ||
|
|
3bb469d558 | ||
|
|
7633c14bd5 | ||
|
|
028b965e1a | ||
|
|
925f42e460 | ||
|
|
71fa9f912d | ||
|
|
57b9b19b10 | ||
|
|
08fc1db24c | ||
|
|
ddad400900 | ||
|
|
1059df7486 | ||
|
|
565e167356 | ||
|
|
011ef6be0e | ||
|
|
590a8fcb1e | ||
|
|
0aef91bc4f | ||
|
|
cd1e39ba62 | ||
|
|
bfe1771067 | ||
|
|
1fdbe79022 | ||
|
|
37b6cceed4 | ||
|
|
220842b37b | ||
|
|
6d876f9b6b | ||
|
|
9540dfc4d9 | ||
|
|
6b62508c86 | ||
|
|
8a04bc25a1 | ||
|
|
939d5a9511 | ||
|
|
64c1cf7921 | ||
|
|
1c5c7c907c | ||
|
|
0a80cf31cf | ||
|
|
7ce674491b | ||
|
|
9aab1440ca | ||
|
|
97e1dd9318 | ||
|
|
09c803783d | ||
|
|
a12acbc2ff | ||
|
|
db172b09c5 | ||
|
|
399184d68f | ||
|
|
122b4c2187 | ||
|
|
6f5a90edb3 | ||
|
|
865ac0f055 | ||
|
|
f01c6f814a | ||
|
|
77a09c92c6 | ||
|
|
51ed7dff0d | ||
|
|
f5dc5c46e0 | ||
|
|
bdd8ebd631 | ||
|
|
6a413fe72f | ||
|
|
93c77565f6 | ||
|
|
e378170c25 | ||
|
|
f8f4c2a6f3 | ||
|
|
3725998cbc | ||
|
|
777bdc6c50 | ||
|
|
719e0d3ddb | ||
|
|
1187edb38c | ||
|
|
112858ae61 | ||
|
|
7d8e9b8ed6 | ||
|
|
5246fdecf6 | ||
|
|
522c94f168 | ||
|
|
2d32a9a3a3 | ||
|
|
e06586ceb4 | ||
|
|
61cb8e76c3 | ||
|
|
c45cfb1741 | ||
|
|
8581694ceb | ||
|
|
4f8ae2bab6 | ||
|
|
7b8f8f69f1 | ||
|
|
79e98316ea | ||
|
|
1150d9e15a | ||
|
|
db3b86e7f3 | ||
|
|
94d22f9309 | ||
|
|
4bdb868ac8 | ||
|
|
624a878701 | ||
|
|
63335859d1 | ||
|
|
f15cce1d41 | ||
|
|
3ace8ceb23 | ||
|
|
11d8418737 | ||
|
|
763d638ca1 | ||
|
|
a8c3202836 | ||
|
|
f12ead2cf2 | ||
|
|
d589a7b5db | ||
|
|
e27a5c8851 | ||
|
|
ac7d17f88e | ||
|
|
d8d287b4d2 | ||
|
|
d62a429b92 | ||
|
|
c699c0b154 | ||
|
|
963b942bb9 | ||
|
|
a4a7006a13 | ||
|
|
78f297dabe | ||
|
|
fa3aa6441c | ||
|
|
eedd56f320 | ||
|
|
aa89a65a83 | ||
|
|
54ef162a1a | ||
|
|
886a31ef20 | ||
|
|
85902d98e8 | ||
|
|
3d4bf3b3fd | ||
|
|
7468956236 | ||
|
|
e97541c208 | ||
|
|
41f9fa9bed | ||
|
|
3497eb4e2c | ||
|
|
508b360c24 | ||
|
|
b803a33a8f | ||
|
|
b899099327 | ||
|
|
ee638415e3 | ||
|
|
ab53aa3e3c | ||
|
|
3847446603 | ||
|
|
81e6071e0f | ||
|
|
34876e4fe9 | ||
|
|
36d98b3919 | ||
|
|
83071f579c | ||
|
|
d980bd403d | ||
|
|
620cddfc13 | ||
|
|
0f26e3aa5b | ||
|
|
deb5601d8d | ||
|
|
0ee9ced4cb | ||
|
|
eb2d607899 | ||
|
|
36ae77dd49 | ||
|
|
25b7df4dab | ||
|
|
51359e6d33 | ||
|
|
7f6c1a76c6 | ||
|
|
19fcc74016 | ||
|
|
bdf00d3dbd | ||
|
|
1cd6515af0 | ||
|
|
d21f6ca4aa | ||
|
|
06cb713f39 | ||
|
|
e27e658033 | ||
|
|
53f4e43191 | ||
|
|
4272b37d3d | ||
|
|
6f3a2145b0 | ||
|
|
5f404f2cb7 | ||
|
|
e92083798c | ||
|
|
5b33f48389 | ||
|
|
700a5374f1 | ||
|
|
6eee3f6781 | ||
|
|
4664a095a4 | ||
|
|
82a701401c | ||
|
|
ef3ec2603d | ||
|
|
2f5f157274 | ||
|
|
71fd34e596 | ||
|
|
ee015f086f | ||
|
|
be97276735 | ||
|
|
76a991c117 | ||
|
|
ba63e31cc7 | ||
|
|
0074cadb3b | ||
|
|
c206b3a6d5 | ||
|
|
d355376865 | ||
|
|
fbb44a6e0d | ||
|
|
00a1b1deeb | ||
|
|
07e97a5f2c | ||
|
|
8be4db8caf | ||
|
|
f6700d5c98 | ||
|
|
a775530941 | ||
|
|
c730ca5997 | ||
|
|
29ea0fa09f | ||
|
|
4d9278f87f | ||
|
|
52bffd2457 | ||
|
|
e2aa952689 | ||
|
|
8b62d9bc0a | ||
|
|
70a86c14f4 | ||
|
|
d76341297a | ||
|
|
fb3ad7f882 | ||
|
|
01ad3faee9 | ||
|
|
bcd442761b | ||
|
|
c5761bfe41 | ||
|
|
895a888865 | ||
|
|
5689478c68 | ||
|
|
ff7ad5fd73 | ||
|
|
ff8e519d4b | ||
|
|
7d27cf8364 | ||
|
|
24000b83c9 | ||
|
|
17a6ac5675 | ||
|
|
7968d30510 | ||
|
|
e826c143d3 | ||
|
|
9d6568da0f | ||
|
|
451cd2c88d | ||
|
|
dfaeb6bb2c | ||
|
|
11ba7a0e8a | ||
|
|
beffab02c4 | ||
|
|
2668782db2 | ||
|
|
87072ff639 | ||
|
|
361b6a9403 | ||
|
|
80b024d56a | ||
|
|
45fe92bf39 | ||
|
|
b059040011 | ||
|
|
8c6a636cd9 | ||
|
|
c750114894 | ||
|
|
4fdcf50d66 | ||
|
|
19755b648c | ||
|
|
fb4b422fc4 | ||
|
|
992fa50dfd | ||
|
|
c1a5b11f11 | ||
|
|
991b3ff7e6 | ||
|
|
e62566a763 | ||
|
|
67c33fb8ff | ||
|
|
3df88a1a01 | ||
|
|
cc25576f8b | ||
|
|
e68f5d9a30 | ||
|
|
d2f05f72f0 | ||
|
|
307a6de17a | ||
|
|
4015b23e8e | ||
|
|
7fc635fee0 | ||
|
|
de36c5fac4 | ||
|
|
7f98460e37 | ||
|
|
c47d25d74b | ||
|
|
2102d1a2eb | ||
|
|
78cbc045c1 | ||
|
|
9d73b261cf | ||
|
|
8f30e1b110 | ||
|
|
142c2132cf | ||
|
|
1744fe12d4 | ||
|
|
d63599719a | ||
|
|
0d1fcd329f | ||
|
|
8807cac100 | ||
|
|
c1f742d775 | ||
|
|
73d5eb1edf | ||
|
|
8f1c873b5f | ||
|
|
5842dad7e7 | ||
|
|
41da225336 | ||
|
|
fe9804a96d | ||
|
|
aad57cc06a | ||
|
|
ac1726788c | ||
|
|
1855b3073a | ||
|
|
7b26167580 | ||
|
|
79f1a3c4a1 | ||
|
|
e711e5b950 | ||
|
|
65c1880735 | ||
|
|
11fb9c7674 | ||
|
|
f2c4e7e552 | ||
|
|
ba467779bb | ||
|
|
aec60e3782 | ||
|
|
93f02f5793 | ||
|
|
3000b6b473 | ||
|
|
ac6f6b317a | ||
|
|
b9a2318bec | ||
|
|
70cf4546d6 | ||
|
|
2cd79bc853 | ||
|
|
dd95c96b8a | ||
|
|
0fbdfd02dc | ||
|
|
6b308d89f9 | ||
|
|
f2d696cd51 | ||
|
|
42ab639bf7 | ||
|
|
b14c5477e5 | ||
|
|
3045f09ef4 | ||
|
|
73c74355ab | ||
|
|
bda208f823 | ||
|
|
d360153bc6 | ||
|
|
47de7973fd | ||
|
|
500a6f576d | ||
|
|
73553e60ec | ||
|
|
22b1338390 | ||
|
|
991bfb7cbf | ||
|
|
7680f46157 | ||
|
|
c4fccfe3e6 | ||
|
|
e8a40526cb | ||
|
|
c03faa32f3 | ||
|
|
8fd9037cfd | ||
|
|
9a127d8ed4 | ||
|
|
4758cfe33f | ||
|
|
da24324e2d | ||
|
|
3ec723ddc7 | ||
|
|
1b25cb80ba | ||
|
|
9c552272e8 | ||
|
|
97be2f0e0a | ||
|
|
b7b3fc2386 | ||
|
|
1d7ad5d24b | ||
|
|
4d63ebe2fb | ||
|
|
1cf79eb8c8 | ||
|
|
2df1534b78 | ||
|
|
225acbbff1 | ||
|
|
31e55b8049 | ||
|
|
a7d33d0c36 | ||
|
|
1cb1b0a52c | ||
|
|
036f98575c | ||
|
|
fade60088e | ||
|
|
59da64146d | ||
|
|
2eab4ab033 | ||
|
|
8b34aa50b9 | ||
|
|
9579879b1b | ||
|
|
204bbc4714 | ||
|
|
934e8c79af | ||
|
|
e3268d5e88 | ||
|
|
e39c104d13 | ||
|
|
53c749ce0a | ||
|
|
1ff04b980f | ||
|
|
10b8cd75b3 | ||
|
|
dd7b17aa0a | ||
|
|
ada5bc1404 | ||
|
|
908e9f41ed | ||
|
|
fdbcc9847d | ||
|
|
6f19a8c9f7 | ||
|
|
36737aebb7 | ||
|
|
96ad414d73 | ||
|
|
670b315c4d | ||
|
|
442e1420f9 | ||
|
|
3c5661ec3c | ||
|
|
791928dc48 | ||
|
|
74994faee7 | ||
|
|
4af6c72d79 | ||
|
|
6760ec2b77 | ||
|
|
2c8c763723 | ||
|
|
91594a1ef8 | ||
|
|
fdcfcf28a2 | ||
|
|
a6c05458d4 | ||
|
|
4c31bc6e3f | ||
|
|
cb35affd1b | ||
|
|
e95be3379a | ||
|
|
0152266dd3 | ||
|
|
50de7019c0 | ||
|
|
c3f3d0b81a | ||
|
|
ecf15be0a7 | ||
|
|
84cfc13589 | ||
|
|
3c8a448a2f | ||
|
|
dcb6fb224d | ||
|
|
18c73b0002 | ||
|
|
1995561f56 | ||
|
|
efd8ae483f | ||
|
|
202ade1398 | ||
|
|
4ffda3f05b | ||
|
|
dff2d916ba | ||
|
|
dd8cf0c12d | ||
|
|
21a881ec68 | ||
|
|
a93e058b68 | ||
|
|
8e8391e17c | ||
|
|
fa9cd98ecf | ||
|
|
8df7208d7b | ||
|
|
31cb210057 | ||
|
|
dbd7d49d31 | ||
|
|
b750d3e7b0 | ||
|
|
fa47dd9615 | ||
|
|
6ebb6fec8b | ||
|
|
3901ca1a6d | ||
|
|
96432ab4ef | ||
|
|
0c320b5a51 | ||
|
|
aac9e7c280 | ||
|
|
ff6f6027f0 | ||
|
|
a479e0300b | ||
|
|
f888283910 | ||
|
|
c5addd94e3 | ||
|
|
272e9b355b | ||
|
|
ff1974c6e9 | ||
|
|
2f71d1dc00 | ||
|
|
40fd8123a2 | ||
|
|
37df0d4f4f | ||
|
|
fc334b4e77 | ||
|
|
6a8b1c4f84 | ||
|
|
38e5a4a54f | ||
|
|
0458572a6e | ||
|
|
c377107346 | ||
|
|
a461837835 | ||
|
|
0e03c0849d | ||
|
|
d8d89d8d27 | ||
|
|
7f6d986ac9 | ||
|
|
39fd8bc318 | ||
|
|
20c4928ee1 | ||
|
|
a164c8405a | ||
|
|
541c2470b8 | ||
|
|
3089c833ff | ||
|
|
d3d18a42d2 | ||
|
|
287e8d356e | ||
|
|
b6ecb2329b | ||
|
|
1a8c792e8f | ||
|
|
6303d4920c | ||
|
|
db722bb4b1 | ||
|
|
9477abc359 | ||
|
|
e8069cfc3d | ||
|
|
4ef664f485 | ||
|
|
7a9b0e0f06 | ||
|
|
c3ae209246 | ||
|
|
f6c8532fd0 | ||
|
|
c0190798e1 | ||
|
|
86ff381ac2 | ||
|
|
4a3cd364d0 | ||
|
|
3f269503d5 | ||
|
|
630b7b94c3 | ||
|
|
43dacceb6b | ||
|
|
c02556e290 | ||
|
|
a9fb4d9d5b | ||
|
|
98c8ab18ff | ||
|
|
33c08ac91e | ||
|
|
fd64988c80 | ||
|
|
55f790ebe4 | ||
|
|
283bf7e87c | ||
|
|
ea216d3f5a | ||
|
|
68701a98af | ||
|
|
3bc3999bd2 | ||
|
|
5a9a570dda | ||
|
|
c40fc6b80d | ||
|
|
7f480ccc0d | ||
|
|
e214b260ef | ||
|
|
86e7f60756 | ||
|
|
c37c9c5dca | ||
|
|
14474a32c9 | ||
|
|
e68e994eb2 | ||
|
|
cfa2eebdaf | ||
|
|
a8b22e16ef | ||
|
|
38da050f31 | ||
|
|
9a3325a56d | ||
|
|
ed6fda2f98 | ||
|
|
ef26c44524 | ||
|
|
b9263fb4e1 | ||
|
|
351942c71b | ||
|
|
47e41b2023 | ||
|
|
e29301954c | ||
|
|
82fb7a0202 | ||
|
|
768451c5e3 | ||
|
|
db49c4a7f0 | ||
|
|
2f060dec6a | ||
|
|
f9505063f8 | ||
|
|
18c6946961 | ||
|
|
ac88e90557 | ||
|
|
5b962f0d1c | ||
|
|
39c75c7000 | ||
|
|
061948597d | ||
|
|
4ae902ec5f | ||
|
|
39ce9b3afc | ||
|
|
f7b577dc77 | ||
|
|
cedc633757 | ||
|
|
8584c25903 | ||
|
|
88746ec067 | ||
|
|
39da0198cd | ||
|
|
60159c2e77 | ||
|
|
9f2a3023f8 | ||
|
|
0908533127 | ||
|
|
a31d091fb3 | ||
|
|
36747e4a7f | ||
|
|
3df49acb30 | ||
|
|
115bf1bf9f | ||
|
|
87fbbdc649 | ||
|
|
02945ca7ad | ||
|
|
c46f21af0a | ||
|
|
7d899910c5 | ||
|
|
5eca2fbdf1 | ||
|
|
b625d03dd6 | ||
|
|
964e8c5bf2 | ||
|
|
482da2eceb | ||
|
|
5a89a12aa0 | ||
|
|
422925a65e | ||
|
|
ae20f88202 | ||
|
|
93591d428f | ||
|
|
f0f8319769 | ||
|
|
38f94da47d | ||
|
|
a4120f2015 | ||
|
|
8fde399fe6 | ||
|
|
2f2f53ddc9 | ||
|
|
82e22596d8 | ||
|
|
ee34869e89 | ||
|
|
7b60a639d1 | ||
|
|
110eb314f0 | ||
|
|
834ba4da93 | ||
|
|
0ff52b6845 | ||
|
|
c67c864ffd | ||
|
|
488f341f57 | ||
|
|
b0bb4f9024 | ||
|
|
9cab9807e0 | ||
|
|
c3e72e11b6 | ||
|
|
fd3acff5e6 | ||
|
|
d3b32a68fe | ||
|
|
451f9493f5 | ||
|
|
78e55be0e6 | ||
|
|
32e35d4028 | ||
|
|
bdc1508a06 | ||
|
|
0303b26b1e | ||
|
|
0cf05c77ad | ||
|
|
b2fde01c54 | ||
|
|
67c0e9cab3 | ||
|
|
524b338974 | ||
|
|
352b799efc | ||
|
|
b0f9477f01 | ||
|
|
58df372be6 | ||
|
|
f6716ae94a | ||
|
|
b6cada3eed | ||
|
|
b48f718417 | ||
|
|
ff713a51bd | ||
|
|
0da6c591c0 | ||
|
|
e47fc2d7c6 | ||
|
|
e6c9076a74 | ||
|
|
308aa38a40 | ||
|
|
3707d5bc46 | ||
|
|
40a6c5c5ec | ||
|
|
deed0286ef | ||
|
|
e28c47ade3 | ||
|
|
771c002c98 | ||
|
|
f1ea4c8d24 | ||
|
|
cff36093f3 | ||
|
|
92630c6607 | ||
|
|
656b470163 | ||
|
|
9ae6ee0f09 | ||
|
|
f2eac18a6e | ||
|
|
4ad4527d10 | ||
|
|
96e458b705 | ||
|
|
8a58648471 | ||
|
|
a5b6a75787 | ||
|
|
159e1b06a5 | ||
|
|
278c847106 | ||
|
|
75bfe825fc | ||
|
|
67391c2c6c | ||
|
|
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 | ||
|
|
51175f31c4 | ||
|
|
e277e838d7 | ||
|
|
b947db040c | ||
|
|
859bdb5b1d | ||
|
|
01403f423a | ||
|
|
b8ab96a270 | ||
|
|
bf46e04614 | ||
|
|
5c46ba14f7 | ||
|
|
e068b58507 | ||
|
|
50f446886b | ||
|
|
3863e48788 | ||
|
|
c86ff120c8 | ||
|
|
01c8f39ab8 | ||
|
|
aff3e63c45 | ||
|
|
b40c8e2922 | ||
|
|
c49f198042 | ||
|
|
f65edb7f29 | ||
|
|
a88cb03a58 | ||
|
|
665528d7ba | ||
|
|
5615b71688 | ||
|
|
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 | ||
|
|
cb7ba4e4e5 | ||
|
|
619c165d36 | ||
|
|
2052f29cdb | ||
|
|
0c29eb431a | ||
|
|
d227771464 | ||
|
|
81dd9d3ebc | ||
|
|
fcc09bd7e3 | ||
|
|
bd98b93a6e | ||
|
|
eb93955477 | ||
|
|
a7972625e3 | ||
|
|
a58083459b | ||
|
|
735a197fc2 | ||
|
|
34a78d935a | ||
|
|
e3c19569cf | ||
|
|
fbcc427754 | ||
|
|
f2dff08600 | ||
|
|
126f50ab0b | ||
|
|
c78a808c49 | ||
|
|
a611879318 | ||
|
|
5776090055 | ||
|
|
8ac7f7e6e5 | ||
|
|
45146dccbb | ||
|
|
ab9c0814d2 | ||
|
|
6605637b53 | ||
|
|
c7d332a26a | ||
|
|
919bb6c9e0 | ||
|
|
c2a73ba989 | ||
|
|
dbf59a6b14 | ||
|
|
d1d163c5a3 | ||
|
|
a5e43b1605 | ||
|
|
580fe21065 | ||
|
|
c00e05992e | ||
|
|
94d3d665f0 | ||
|
|
5f36523af9 | ||
|
|
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 | ||
|
|
4fb3cfc48f | ||
|
|
0f3957ab48 | ||
|
|
ce96f39ac9 | ||
|
|
8f2eaa51c2 | ||
|
|
9d0b33fd33 | ||
|
|
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 | ||
|
|
53b41afbe8 | ||
|
|
fb79d58109 | ||
|
|
46ffd342a4 | ||
|
|
fa933df65b | ||
|
|
67068b64b9 | ||
|
|
73442a7e03 | ||
|
|
1e0e5b2a02 | ||
|
|
dff73a2a69 | ||
|
|
bef19a266b | ||
|
|
c0f58ea9a2 | ||
|
|
960c2cdcf7 | ||
|
|
f2296aab89 | ||
|
|
022ec3dbb7 | ||
|
|
821ff061b1 | ||
|
|
f7895cc188 | ||
|
|
dff06a8170 | ||
|
|
900605912b | ||
|
|
28c662e7a4 | ||
|
|
879fed5098 | ||
|
|
f489e969f0 | ||
|
|
413508c6fa | ||
|
|
af31fd6494 | ||
|
|
541f183cd6 | ||
|
|
d2ff8f4b96 | ||
|
|
d201d1f312 | ||
|
|
31aed1243e | ||
|
|
e344fab3b1 | ||
|
|
fe788ee4a6 | ||
|
|
881bf5c90f | ||
|
|
3e7b90ff69 | ||
|
|
eba521913d | ||
|
|
24d8a15308 | ||
|
|
5a25f54757 | ||
|
|
38a60f49bd | ||
|
|
693ebbd16b | ||
|
|
0223a028e0 | ||
|
|
d14a98db25 | ||
|
|
a8dcfeccfc | ||
|
|
8d88f0c897 | ||
|
|
a28868eeae | ||
|
|
08e1d4764c | ||
|
|
f04530eb61 | ||
|
|
68d8bfa0b5 | ||
|
|
f27fed14b1 | ||
|
|
298cbf2cb1 | ||
|
|
48589ccc64 | ||
|
|
d896527d21 | ||
|
|
ce3f4e7800 | ||
|
|
8155571183 | ||
|
|
e7d5803f07 | ||
|
|
ddc4130c97 | ||
|
|
a835599496 | ||
|
|
68dcabdfbe | ||
|
|
60de8ec932 | ||
|
|
686b8c1463 | ||
|
|
1a9db4cac7 | ||
|
|
9ebb596805 | ||
|
|
5a3aae02fe | ||
|
|
41724cbcde | ||
|
|
96a1255ead | ||
|
|
c11bf581a3 | ||
|
|
081e6a8360 | ||
|
|
630e7508ee | ||
|
|
71330a4310 | ||
|
|
c6a94a8d22 | ||
|
|
67d71ea932 | ||
|
|
59c47aaf52 | ||
|
|
d7dccd5419 | ||
|
|
3e4d2c3aa6 | ||
|
|
f5f107674b | ||
|
|
1b93a116e7 | ||
|
|
70418e48f6 | ||
|
|
c7a37d039b | ||
|
|
cd042640c6 | ||
|
|
13748ca052 | ||
|
|
34229c5625 | ||
|
|
09aae4b7a5 | ||
|
|
c71fe7db42 | ||
|
|
0e96532096 | ||
|
|
f258ffab25 | ||
|
|
95145d4c52 | ||
|
|
3c8816f74b |
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
|
||||||
|
|||||||
4
.mailmap
4
.mailmap
@@ -6,10 +6,12 @@ Andres P <aepd87@gmail.com> <stderr@mail.com>
|
|||||||
Bryan Ischo <bryan@ischo.com> <bji-keyword-pacman.3644cb@www.ischo.com>
|
Bryan Ischo <bryan@ischo.com> <bji-keyword-pacman.3644cb@www.ischo.com>
|
||||||
Christos Nouskas <nous@archlinux.us> <nouskas@gmail.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+Arch@gmail.com>
|
||||||
Daenyth Blank <Daenyth+Arch@gmail.com> <Daenyth+git@gmail.com>
|
Daenyth Blank <Daenyth+arch@gmail.com> <Daenyth+git@gmail.com>
|
||||||
|
Dave Reisner <dreisner@archlinux.org> <d@falconindy.com>
|
||||||
甘露(Gan Lu) <rhythm.gan@gmail.com>
|
甘露(Gan Lu) <rhythm.gan@gmail.com>
|
||||||
Giovanni Scafora <giovanni@archlinux.org> <linuxmania@gmail.com>
|
Giovanni Scafora <giovanni@archlinux.org> <linuxmania@gmail.com>
|
||||||
Jaroslaw Swierczynski <swiergot@gmail.com> <swiergot@juvepoland.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>
|
||||||
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> <jotapesan@gmail.com>
|
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> <jotapesan@gmail.com>
|
||||||
Manuel Tortosa <manutortosa@chakra-project.org> <manutortosa@gmail.com>
|
Manuel Tortosa <manutortosa@chakra-project.org> <manutortosa@gmail.com>
|
||||||
|
|||||||
18
.tx/config
Normal file
18
.tx/config
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[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 = src/pacman/po/<lang>.po
|
||||||
|
source_file = src/pacman/po/pacman.pot
|
||||||
|
source_lang = en
|
||||||
|
|
||||||
|
[archlinux-pacman.pacman-scripts-pot]
|
||||||
|
file_filter = scripts/po/<lang>.po
|
||||||
|
source_file = scripts/po/pacman-scripts.pot
|
||||||
|
source_lang = en
|
||||||
|
|
||||||
17
AUTHORS
17
AUTHORS
@@ -1,16 +1 @@
|
|||||||
Judd Vinet <jvinet@zeroflux.org>
|
Use `git shortlog -s` for a list of contributors.
|
||||||
Aurelien Foret <aurelien@archlinux.org>
|
|
||||||
Aaron Griffin <aaron@archlinux.org>
|
|
||||||
Dan McGee <dan@archlinux.org>
|
|
||||||
|
|
||||||
Miklós Vajna <vmiklos@frugalware.org>
|
|
||||||
Christian Hamar <krics@linuxforum.hu>
|
|
||||||
Josh Wheeler <deltalima@gmail.com>
|
|
||||||
David Kimpe <DNAku@frugalware.org>
|
|
||||||
James Rosten <seinfeld90@gmail.com>
|
|
||||||
Roman Kyrylych <Roman.Kyrylych@gmail.com>
|
|
||||||
Andrew Fyfe <andrew@neptune-one.net>
|
|
||||||
Chantry Xavier <shiningxc@gmail.com>
|
|
||||||
Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
|
||||||
Nathan Jones <nathanj@insightbb.com>
|
|
||||||
Allan McRae <mcrae_allan@hotmail.com>
|
|
||||||
|
|||||||
10
HACKING
10
HACKING
@@ -35,7 +35,7 @@ while(it) {
|
|||||||
if(fn) {
|
if(fn) {
|
||||||
fn(it->data);
|
fn(it->data);
|
||||||
} else {
|
} else {
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
free(it);
|
free(it);
|
||||||
it = ptr;
|
it = ptr;
|
||||||
@@ -67,11 +67,11 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
NOT
|
NOT
|
||||||
// This is a comment
|
// This is a comment
|
||||||
|
|
||||||
5. Return statements should be written like a function call.
|
5. Return statements should *not* be written like function calls.
|
||||||
|
|
||||||
return(0);
|
|
||||||
NOT
|
|
||||||
return 0;
|
return 0;
|
||||||
|
NOT
|
||||||
|
return(0);
|
||||||
|
|
||||||
6. The sizeof() operator should accept a type, not a value. (TODO: in certain
|
6. The sizeof() operator should accept a type, not a value. (TODO: in certain
|
||||||
cases, it may be better- should this be a set guideline? Read "The Practice
|
cases, it may be better- should this be a set guideline? Read "The Practice
|
||||||
@@ -147,5 +147,5 @@ For example, to run valgrind:
|
|||||||
valgrind --leak-check=full -- src/pacman/.libs/lt-pacman -Syu
|
valgrind --leak-check=full -- src/pacman/.libs/lt-pacman -Syu
|
||||||
|
|
||||||
/////
|
/////
|
||||||
vim: set ts=2 sw=2 syntax=asciidoc et:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
|
|||||||
4
INSTALL
4
INSTALL
@@ -16,8 +16,8 @@ properly build pacman.
|
|||||||
libarchive
|
libarchive
|
||||||
http://code.google.com/p/libarchive/
|
http://code.google.com/p/libarchive/
|
||||||
|
|
||||||
libfetch
|
libcurl
|
||||||
ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/net/libfetch/README.html
|
http://curl.haxx.se/libcurl/
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
20
Makefile.am
20
Makefile.am
@@ -1,8 +1,10 @@
|
|||||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po test/pacman test/util contrib
|
SUBDIRS = lib/libalpm src/util src/pacman scripts etc 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
|
# Make sure we test and build manpages when doing distcheck
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
|
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
|
||||||
|
|
||||||
@@ -12,14 +14,19 @@ EXTRA_DIST = HACKING
|
|||||||
|
|
||||||
# Sample makepkg prototype files
|
# Sample makepkg prototype files
|
||||||
pkgdatadir = ${datadir}/${PACKAGE}
|
pkgdatadir = ${datadir}/${PACKAGE}
|
||||||
dist_pkgdata_DATA = PKGBUILD.proto PKGBUILD-split.proto proto.install ChangeLog.proto
|
dist_pkgdata_DATA = \
|
||||||
|
proto/PKGBUILD.proto \
|
||||||
|
proto/PKGBUILD-split.proto \
|
||||||
|
proto/proto.install \
|
||||||
|
proto/ChangeLog.proto
|
||||||
|
|
||||||
# run the pactest test suite and vercmp tests
|
# run the pactest test suite and vercmp tests
|
||||||
check-local: test/pacman test/util src/pacman src/util
|
check-local: test/pacman test/util src/pacman src/util
|
||||||
$(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
|
LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
|
||||||
--test $(top_srcdir)/test/pacman/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
|
$(SH) $(top_srcdir)/test/util/pacsorttest.sh \
|
||||||
|
$(top_builddir)/src/util/pacsort
|
||||||
$(SH) $(top_srcdir)/test/util/vercmptest.sh \
|
$(SH) $(top_srcdir)/test/util/vercmptest.sh \
|
||||||
$(top_builddir)/src/util/vercmp
|
$(top_builddir)/src/util/vercmp
|
||||||
|
|
||||||
@@ -29,4 +36,9 @@ install-data-local:
|
|||||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
update-po:
|
||||||
|
$(MAKE) -C lib/libalpm/po update-po
|
||||||
|
$(MAKE) -C scripts/po update-po
|
||||||
|
$(MAKE) -C src/pacman/po update-po
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
211
NEWS
211
NEWS
@@ -1,5 +1,210 @@
|
|||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
4.0.2 - allow comments after a repository header in pacman.conf
|
||||||
|
- search for and import PGP subkeys if necessary (FS#27612)
|
||||||
|
- fix rare segfault on removal operations (FS#27805, FS#28195)
|
||||||
|
- skip all unknown files when cleaning package cache
|
||||||
|
- restore looking for files in cache before downloading via -U
|
||||||
|
- ensure '[removal]' is displayed in transaction confirmation (FS#27981)
|
||||||
|
- implement disk space checking code for Illumos
|
||||||
|
- use TCP keepalive in download to prevent dropped connections
|
||||||
|
- round and show -0.00 values as 0.00 (FS#27924)
|
||||||
|
- makepkg:
|
||||||
|
- ensure all source files are included in --source (FS#26580)
|
||||||
|
- fix locale sort/comm related issues (FS#26580)
|
||||||
|
- abort on missing download agent
|
||||||
|
- restrict flags passed to pacman (FS#28012)
|
||||||
|
- work around certain zipman glob/existence issues
|
||||||
|
- fix non-writable SRCPKGDEST error message (FS#28197)
|
||||||
|
- fix printf interpreting gettext string as arg (FS#28069)
|
||||||
|
- don't abort on non-zero hg return codes (FS#28248)
|
||||||
|
- disable extglob when sourcing BUILDSCRIPT (FS#27780)
|
||||||
|
- pacman-key: improve return codes of operations (FS#26730)
|
||||||
|
- repo-add: enforce maximum signature file size (FS#27453)
|
||||||
|
- contrib/paclist: support --help (FS#27258)
|
||||||
|
- contrib/pacsysclean: new script
|
||||||
|
- contrib/*_completion: fix completion for uncompressed packages
|
||||||
|
- translations: extensive updates and corrections
|
||||||
|
4.0.1 - ensure VerbosePkgList table display supports multibyte chars
|
||||||
|
- always use stderr for warning/error messages (FS#26555)
|
||||||
|
- add guidance message for users when public keyring not found
|
||||||
|
- fix edge case in download progress bar rounding (FS#26853)
|
||||||
|
- ensure downloads started as tempfiles have correct umask
|
||||||
|
- ensure unowned symlinks are not overwritten incorrectly
|
||||||
|
- allow -U operation even without sync databases (FS#26899)
|
||||||
|
- update libtool files and update fix for -Wl,-as-needed
|
||||||
|
- fix build when using --disable-static (FS#26652)
|
||||||
|
- pacman-key: add a keyserver timeout value in --init
|
||||||
|
- repo-add: fix race condition around lock file removal
|
||||||
|
- makepkg:
|
||||||
|
- accept changelog= or install= without a value
|
||||||
|
- trim trailing whitespace from sensitive variables
|
||||||
|
- handle PGP signatures with a .sign extension
|
||||||
|
- delay attachment of signal traps (FS#26196)
|
||||||
|
- translations: multiple updates and corrections
|
||||||
|
4.0.0 - well-integrated and powerful signed packages and databases
|
||||||
|
support in pacman, the library, and scripts (FS#5331)
|
||||||
|
- over 800 commits to pacman.git since 3.5.4 release
|
||||||
|
- many code cleanup commits across library/binaries/scripts
|
||||||
|
- many performance improvement commits across library/binaries
|
||||||
|
- add new -S --recursive operation to upgrade a full dep chain
|
||||||
|
- report upgrade size on sync operations (FS#12566)
|
||||||
|
- early terminal input is flushed before question prompts
|
||||||
|
- remove duplicate code shared in sync and upgrade operations
|
||||||
|
- remove ShowSize; replaced with VerbosePkgLists (FS#15772)
|
||||||
|
- print callback (warning, error) messages to stderr (FS#25099)
|
||||||
|
- download progress callback has more room for filenames
|
||||||
|
- fix selection entry for long values (FS#25253)
|
||||||
|
- make config parsing two-pass process, enhance error messages
|
||||||
|
- print helpful tips on -Qi <filename> or -S <filename>
|
||||||
|
- replace libfetch with libcurl for backend download library
|
||||||
|
- timeout when mirror is not responding (FS#15369)
|
||||||
|
- full HTTPS protocol support (FS#22435)
|
||||||
|
- support of non-traditional/redirected URLs (FS#22645)
|
||||||
|
- ensure downloads are only resumed if appropriate (FS#23803)
|
||||||
|
- only remove empty directories if no remaining owner (FS#25141)
|
||||||
|
- better cache directory choosing and honor $TMPDIR (FS#25435)
|
||||||
|
- replaces are parsed as dependency-style strings (FS#23410)
|
||||||
|
- split package verification and load stages
|
||||||
|
- sync database reading refactor for performance
|
||||||
|
- use a larger buffer for package checksum validation
|
||||||
|
- filelists now have a dedicated type with metadata
|
||||||
|
- diskspace check no longer requires iterating package archives
|
||||||
|
- update and add checksum routines from PolarSSL
|
||||||
|
- validate sync database sha256sum if available
|
||||||
|
- correctly parse sizes in database > 2GiB
|
||||||
|
- API: several type renames from pm* to alpm_* prefix
|
||||||
|
- API: several enum constant renames from PM to ALPM_* prefix
|
||||||
|
- API: several types are now public exposed structs
|
||||||
|
- API: handle is no longer a single global variable
|
||||||
|
- API: more changes than can be mentioned here, see README
|
||||||
|
- much improved API documentation for use by Doxygen
|
||||||
|
- pactest: several performance/checking improvements
|
||||||
|
- scripts:
|
||||||
|
- refactor some common components into shared bash library
|
||||||
|
- split translations into pacman-scripts catalog (FS#15148)
|
||||||
|
- makepkg:
|
||||||
|
- allow signing packages after creation
|
||||||
|
- allow verifying source file signatures (FS#20448)
|
||||||
|
- add auto-versioned libdepends/libprovides support
|
||||||
|
- support UPX compression of executables (FS#17213)
|
||||||
|
- allow usage of an alternate build directory (FS#22308)
|
||||||
|
- cleancache option has been removed; use shell instead
|
||||||
|
- improved variable sanity checking (FS#16004)
|
||||||
|
- better handling of package extensions (.tar.Z or invalid)
|
||||||
|
- allow PKGEXT/SRCEXT environment overrides (FS#19860)
|
||||||
|
- only check for writable PKGDEST if necessary (FS#24735)
|
||||||
|
- check_software function exits early if missing req'd binaries
|
||||||
|
- do source packaging in fakeroot (FS#24330)
|
||||||
|
- be more POSIX-compatible in use of `ln` (FS#24893)
|
||||||
|
- handle spaces with filenames in noextract (FS#25100)
|
||||||
|
- allow epoch-versioned optdepends
|
||||||
|
- pacman-key: new keyring management tool for signed data
|
||||||
|
- pacsort: new utility, sort version numbers as pacman does
|
||||||
|
- pactree: support sync databases with -s option
|
||||||
|
- pkgdelta: add a manpage
|
||||||
|
- repo-add:
|
||||||
|
- handle and include package signatures in databases
|
||||||
|
- verify database signature before modification
|
||||||
|
- sign database after creation/modification
|
||||||
|
- general script cleanup and bash-ification
|
||||||
|
- add sha256sums to database (FS#23103)
|
||||||
|
- contrib/bacman: code cleanups and small bug fixes
|
||||||
|
- contrib/bash_completion: updates for new options/commands
|
||||||
|
- contrib/paccache: new, pacman cache cleanup script
|
||||||
|
- contrib/paclist: rewrite using bash
|
||||||
|
- contrib/paclog-pkglist: new, recover from missing local DB
|
||||||
|
- documentation: extensive updates to all manpages
|
||||||
|
- translations: extensive updates, new languages: lt, zh_TW
|
||||||
|
3.5.4 - fix display of lists on non-TTYs and other output fixes
|
||||||
|
- fix group selection entry for large inputs (FS#24253)
|
||||||
|
- fix divide by zero when downloading zero length files
|
||||||
|
- flush terminal input before reading response (FS#20538)
|
||||||
|
- allow files to be replaced by directories (FS#24904)
|
||||||
|
- makepkg: fix filenames with spaces and noextract (FS#25100)
|
||||||
|
- scripts: remove ln -f option for POSIX compliance (FS#24893)
|
||||||
|
- various small documentation updates
|
||||||
|
- minor translation updates: de, fi
|
||||||
|
3.5.3 - segfault when creating lock in non-existent dir (FS#24292)
|
||||||
|
- segfault when uninstalling broken backed-up symlink (FS#24230)
|
||||||
|
- --print should not enable --noconfirm (FS#24287)
|
||||||
|
- fix default path substitution in documentation
|
||||||
|
- makepkg: quote variables that may contain spaces (FS#24002)
|
||||||
|
- makepkg: fix creation of source package with -p (FS#24567)
|
||||||
|
- repo-add: include dotfiles in filelists (FS#24534)
|
||||||
|
- minor translation updates: de, fi, fr, sk, zh_CN
|
||||||
|
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
|
3.4.3 - fix attempted double remove of all files issue during upgrades
|
||||||
- respect IgnorePkg/IgnoreGroup for group members (FS#19854)
|
- respect IgnorePkg/IgnoreGroup for group members (FS#19854)
|
||||||
- back out epoch changes; 3.5.X will handle them differently
|
- back out epoch changes; 3.5.X will handle them differently
|
||||||
@@ -33,7 +238,7 @@ VERSION DESCRIPTION
|
|||||||
- Installing packages with -U can handle installing
|
- Installing packages with -U can handle installing
|
||||||
dependencies, conflict resolution and replacing packages
|
dependencies, conflict resolution and replacing packages
|
||||||
(FS#3492, FS#5798)
|
(FS#3492, FS#5798)
|
||||||
- can upgrade the system and install a new package using
|
- can upgrade the system and install a new package using
|
||||||
"pacman -Syu <pkg>" (FS#15581)
|
"pacman -Syu <pkg>" (FS#15581)
|
||||||
- new -D/--database operation for modifying package install
|
- new -D/--database operation for modifying package install
|
||||||
reasons (FS#12950)
|
reasons (FS#12950)
|
||||||
@@ -45,7 +250,7 @@ VERSION DESCRIPTION
|
|||||||
- allow -Qo to perform a functional 'which' (FS#8798)
|
- allow -Qo to perform a functional 'which' (FS#8798)
|
||||||
- cache cleaning cleans all directories, not just first
|
- cache cleaning cleans all directories, not just first
|
||||||
- cleanupdelta: new utility to help remove unused deltas from
|
- cleanupdelta: new utility to help remove unused deltas from
|
||||||
a repo database
|
a repo database
|
||||||
- bash completion: rewrite for size and performance (FS#16630)
|
- bash completion: rewrite for size and performance (FS#16630)
|
||||||
- repo-add: handle removing the final package from a repo
|
- repo-add: handle removing the final package from a repo
|
||||||
- rankmirrors: rewrite using bash
|
- rankmirrors: rewrite using bash
|
||||||
@@ -491,7 +696,7 @@ VERSION DESCRIPTION
|
|||||||
- Makefile fix for nonstandard lib search paths (Kevin Piche)
|
- Makefile fix for nonstandard lib search paths (Kevin Piche)
|
||||||
- fixed the leftover directories in /tmp
|
- fixed the leftover directories in /tmp
|
||||||
- speed improvement patches from Tommi Rantala
|
- speed improvement patches from Tommi Rantala
|
||||||
2.9.2 - bugfix for 2.9.1
|
2.9.2 - bugfix for 2.9.1
|
||||||
2.9.1 - --refresh now only downloads fresh packages lists if they've
|
2.9.1 - --refresh now only downloads fresh packages lists if they've
|
||||||
been updated (currently only works with FTP)
|
been updated (currently only works with FTP)
|
||||||
2.9 - Improved -Rs functionality -- pacman now tracks why a package
|
2.9 - Improved -Rs functionality -- pacman now tracks why a package
|
||||||
|
|||||||
127
README
127
README
@@ -73,8 +73,8 @@ The following options are read-only, having ONLY alpm_option_get_* functions:
|
|||||||
|
|
||||||
* lockfile: The file used for locking the database
|
* lockfile: The file used for locking the database
|
||||||
(Default: <dbpath>/db.lck)
|
(Default: <dbpath>/db.lck)
|
||||||
* localdb: A pmdb_t structure for the local (installed) database
|
* localdb: A alpm_db_t structure for the local (installed) database
|
||||||
* syncdbs: A list of pmdb_t structures to which pacman can sync from.
|
* syncdbs: A list of alpm_db_t structures to which pacman can sync from.
|
||||||
|
|
||||||
The following options are write-only, having ONLY alpm_option_set_* functions:
|
The following options are write-only, having ONLY alpm_option_set_* functions:
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ specified error code into a more friendly sentence, and alpm_strerrorlast()
|
|||||||
does the same for the last error encountered (represented by pm_errno).
|
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
|
||||||
@@ -192,8 +192,8 @@ remove.c and sync.c).
|
|||||||
|
|
||||||
The frontend is using a configuration file, usually "/etc/pacman.conf". Some
|
The frontend is using a configuration file, usually "/etc/pacman.conf". Some
|
||||||
of these options are only useful for the frontend only (mainly the ones used to
|
of these options are only useful for the frontend only (mainly the ones used to
|
||||||
control the output like showsize or totaldownload, or the behavior with
|
control the output like totaldownload, or the behavior with cleanmethod and
|
||||||
cleanmethod and syncfirst). The rest is used to configure the library.
|
syncfirst). The rest is used to configure the library.
|
||||||
|
|
||||||
|
|
||||||
[UPGRADE/REMOVE/SYNC]
|
[UPGRADE/REMOVE/SYNC]
|
||||||
@@ -328,3 +328,120 @@ API CHANGES BETWEEN 3.3 AND 3.4
|
|||||||
- alpm_pkg_unused_deltas()
|
- alpm_pkg_unused_deltas()
|
||||||
- alpm_conflict_get_reason()
|
- alpm_conflict_get_reason()
|
||||||
- error code: PM_ERR_PKG_INVALID_ARCH
|
- 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
|
||||||
|
|
||||||
|
API CHANGES BETWEEN 3.5 AND 4.0
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[REMOVED]
|
||||||
|
- error codes:
|
||||||
|
PM_ERR_LIBFETCH, PM_ERR_WRITE
|
||||||
|
- alpm_option_set_root(), alpm_option_set_dbpath()
|
||||||
|
- alpm_list_first()
|
||||||
|
- alpm_grp_get_name(), alpm_grp_get_pkgs()
|
||||||
|
- alpm_delta_get_from(), alpm_delta_get_to(), alpm_delta_get_filename(),
|
||||||
|
alpm_delta_get_md5sum(), alpm_delta_get_size()
|
||||||
|
- alpm_miss_get_target(), alpm_miss_get_dep(), alpm_miss_get_causingpkg()
|
||||||
|
- alpm_dep_get_mod(), alpm_dep_get_name(), alpm_dep_get_version()
|
||||||
|
- alpm_conflict_get_package1(), alpm_conflict_get_package2(),
|
||||||
|
alpm_conflict_get_reason()
|
||||||
|
- alpm_fileconflict_get_target(), alpm_fileconflict_get_type(),
|
||||||
|
alpm_fileconflict_get_file(), alpm_fileconflict_get_ctarget()
|
||||||
|
- alpm_db_get_url()
|
||||||
|
|
||||||
|
[CHANGED]
|
||||||
|
- PM_ prefixes for enum values are now ALPM_
|
||||||
|
- pm prefixes for structs and enums are now alpm_
|
||||||
|
- alpm_initialize now has parameters: char *root, char *dbpath,
|
||||||
|
_alpm_errno_t *err and returns an alpm_handle_t struct.
|
||||||
|
- alpm_release now takes an alpm_handle_t *.
|
||||||
|
- alpm_db_register_sync() now requires a extra parameter of a alpm_siglevel_t.
|
||||||
|
- alpm_pkg_load() now requires an extra parameter of an alpm_siglevel_t
|
||||||
|
- alpm_db_setserver() replaced by alpm_db_set_servers(), alpm_db_add_server(),
|
||||||
|
alpm_db_remove_server()
|
||||||
|
- alpm_trans_init() no longer takes callbacks, set those using
|
||||||
|
alpm_option_set_*cb() functions
|
||||||
|
- many functions now require a first parameter of an alpm_handle_t *:
|
||||||
|
- alpm_option_get_*
|
||||||
|
- alpm_option_set_*
|
||||||
|
- alpm_option_add_*
|
||||||
|
- alpm_option_remove_*
|
||||||
|
- alpm_trans_*
|
||||||
|
- alpm_add_pkg
|
||||||
|
- alpm_checkconflicts
|
||||||
|
- alpm_checkdeps
|
||||||
|
- alpm_db_register_sync
|
||||||
|
- alpm_db_set_pkgreason
|
||||||
|
- alpm_db_unregister_all
|
||||||
|
- alpm_fetch_pkgurl
|
||||||
|
- alpm_find_dbs_satisfier
|
||||||
|
- alpm_logaction
|
||||||
|
- alpm_pkg_load
|
||||||
|
- alpm_release
|
||||||
|
- alpm_remove_pkg
|
||||||
|
- alpm_sync_sysupgrade
|
||||||
|
- several structs are no longer opaque
|
||||||
|
- alpm_conflict_t
|
||||||
|
- alpm_delta_t
|
||||||
|
- alpm_depend_t
|
||||||
|
- alpm_depmissing_t
|
||||||
|
- alpm_depmod_t
|
||||||
|
- alpm_fileconflict_t
|
||||||
|
- alpm_group_t
|
||||||
|
- alpm_pkg_reason_t
|
||||||
|
|
||||||
|
[ADDED]
|
||||||
|
- option functions:
|
||||||
|
alpm_{get,set}_eventcb(), alpm_option_{get,set}_convcb(),
|
||||||
|
alpm_option_{get,set}_progresscb()
|
||||||
|
- package signing functions:
|
||||||
|
alpm_option_get_default_siglevel(), alpm_option_set_default_siglevel(),
|
||||||
|
alpm_option_get_gpgdir(), alpm_option_set_gpgdir(), alpm_db_get_siglevel(),
|
||||||
|
alpm_siglist_cleanup(), alpm_db_check_pgp_signature(), alpm_pkg_check_pgp_signature(),
|
||||||
|
alpm_pkg_get_origin(), alpm_pkg_get_sha256sum(), alpm_pkg_get_base64_sig()
|
||||||
|
- list functions:
|
||||||
|
alpm_list_to_array(), alpm_list_previous()
|
||||||
|
- structs:
|
||||||
|
alpm_backup_t, alpm_file_t, alpm_filelist_t
|
||||||
|
- enums:
|
||||||
|
alpm_siglevel_t, alpm_sigstatus_t, alpm_sigvalidity_t, alpm_pkgfrom_t
|
||||||
|
- error codes:
|
||||||
|
ALPM_ERR_DB_INVALID, ALPM_ERR_DB_INVALID_SIG, ALPM_ERR_GPGME,
|
||||||
|
ALPM_ERR_PKG_INVALID_CHECKSUM, ALPM_ERR_PKG_INVALID_SIG, ALPM_ERR_SIG_INVALID,
|
||||||
|
ALPM_ERR_SIG_MISSING
|
||||||
|
|||||||
57
TODO.aaron
57
TODO.aaron
@@ -1,57 +0,0 @@
|
|||||||
== This is my custom TODO file ==
|
|
||||||
|
|
||||||
* transaction object should contain two package list (install and remove)
|
|
||||||
instead of a single list of syncpkgs - this should allow us to get rid of that
|
|
||||||
type. This also requires seperate functionality to return a list of
|
|
||||||
"replaces" packages to the front end, so the frontend can handle the QUESTION()
|
|
||||||
stuff in that case
|
|
||||||
|
|
||||||
* libalpm -> front end communication needs a work-up. Both progress functions
|
|
||||||
can be combined into one callback, IFF we adjust it to accept a prefix string
|
|
||||||
for the progress bars, and format it at the lib side. Question functions
|
|
||||||
should also do the same - create the string at the library side, and simply
|
|
||||||
call some sort of int yes_no = ask_question("Do foo with bar?");
|
|
||||||
|
|
||||||
* move logging (alpm_logaction) out of the library. log files should be
|
|
||||||
written by the app, not the library. Adding a PM_LOG_* constant that
|
|
||||||
frontends can recognize and send to a file is probably a good idea.
|
|
||||||
|
|
||||||
* clear up list allocation/deallocation - some lists need to be free'd, some
|
|
||||||
do not and there is no clear indication WHEN this should happen.
|
|
||||||
|
|
||||||
* remove DB entries (directories) on a read error?
|
|
||||||
|
|
||||||
* Add a pm_errstr error string, which will allow us to do things like:
|
|
||||||
pm_errno = PM_ERR_LIBARCHIVE;
|
|
||||||
pm_errstr = archive_error_string(archive);
|
|
||||||
or:
|
|
||||||
pm_errno = PM_ERR_LIBDOWNLOAD;
|
|
||||||
pm_errstr = downloadLastErrString;
|
|
||||||
This way we don't break abstraction when returning specific errors in
|
|
||||||
cases like the above.
|
|
||||||
|
|
||||||
* pacman: A LOT of functions are way too long. There should be an upper limit of
|
|
||||||
100-200 lines. _alpm_add_commit is around 600 lines, and is far too complex.
|
|
||||||
|
|
||||||
* pacman: fixup doxygen documentation for public interface
|
|
||||||
|
|
||||||
* feature for 3.1: package file hooks *
|
|
||||||
I've been planning on this one for some time. Here's a simple rundown:
|
|
||||||
in /etc/pacman.d/hooks:
|
|
||||||
Hook /usr/include/* : /usr/bin/ctags -R /usr/include/*.h -f /usr/include/systags
|
|
||||||
This will allow us to make "global hooks" to simplify a lot of repetitive
|
|
||||||
install files (scrollkeeper, depmod, etc). This also allows us to move
|
|
||||||
ldconfig out of pacman entirely.
|
|
||||||
possible: /etc/pacman.hooks/* files for hooks, so packages can add them too
|
|
||||||
|
|
||||||
* feature for 3.1: multiple search/match types
|
|
||||||
option: MatchType regex (current way)
|
|
||||||
MatchType fnmatch (use fnmatch to match things like 'pacman -S gnome*')
|
|
||||||
MatchType plain (no matching. expect plain text).
|
|
||||||
|
|
||||||
* feature for 3.1: revamp the autotools system. I'd LOVE to use a manual system
|
|
||||||
like wmii and friends do. It'd be real nice if we could just do away with
|
|
||||||
autotools altogether.
|
|
||||||
|
|
||||||
**** BUGS ****
|
|
||||||
* Removal of conflicts on -A and -U (INCOMPLETE)
|
|
||||||
101
TODO.dan
101
TODO.dan
@@ -1,101 +0,0 @@
|
|||||||
TODO.dan
|
|
||||||
========
|
|
||||||
|
|
||||||
This is my personal TODO list. No guarantees if it is out of date and things no
|
|
||||||
longer apply. If you want to help out with any of it, send me an email.
|
|
||||||
|
|
||||||
Pacman 3.1:
|
|
||||||
-----------
|
|
||||||
|
|
||||||
Downgrade feature - allow users to see cached packages and downgrade to
|
|
||||||
(previous or any?) available options.
|
|
||||||
|
|
||||||
Installed size and download size in -Si/Qi output should scale with package
|
|
||||||
size- KB to MB to GB. We should also get consistancy of K/KB, M/MB, etc.
|
|
||||||
|
|
||||||
Extreme similarity between some of the sync and add code...we have to be able
|
|
||||||
to abstract more away from sync actions and add actions to just 'actions'
|
|
||||||
(example: sync,c, add.c, and deptest.c all contain a switch on PM_DEP_MOD_*).
|
|
||||||
Merge update, add, and sync code when possible, so we reduce duplication.
|
|
||||||
|
|
||||||
Review progress/transaction event subsystem. (from TODO)
|
|
||||||
|
|
||||||
Add Doxygen comments to every function in libalpm including private functions.
|
|
||||||
Ensure functions are doing exactly their purpose and nothing more. Find
|
|
||||||
functions that perform duplicate behavior and merge them. Combine and refactor
|
|
||||||
others. Delete unnecessary functions. Stop keeping everything clustered in
|
|
||||||
little add/sync/remove parts, allow transactions to share code.
|
|
||||||
|
|
||||||
Go through options list. Decide if namings are good, all options are still
|
|
||||||
relevant, etc. Ideas for -Re (#6273), changing meaning of -c (has two meanings,
|
|
||||||
another FS bug), etc. Remove the -A flag and possibly -D, -T, and -Y (-Y is
|
|
||||||
killed now in favor of vercmp binary) if they can be done by other actions.
|
|
||||||
Possible switch of -U --> -I (#5571).
|
|
||||||
|
|
||||||
Review display and logging functions. There seems to be an abundance of them.
|
|
||||||
Make it extensible to use color, review what verbose/debug means. Perhaps
|
|
||||||
separate logging functionality- Pacman has its normal log, and alpm backend
|
|
||||||
keeps a very simple log file - listing only adds (including syncs) and removes.
|
|
||||||
This way a consistency list can be kept of what is currently installed and what
|
|
||||||
isn't, without all the logging junk from the front end.
|
|
||||||
|
|
||||||
Profile the code. Find the functions that are being called a lot, and see what
|
|
||||||
can be done about it. Find out if all these calls are necessary (e.g. excessive
|
|
||||||
alpm_list_count calls), and maybe think about changing data structures to speed
|
|
||||||
operations up (e.g. a 'count' field). NOTE: already found two huge issues with
|
|
||||||
quick profiling- excessive setlocale calls, and extremely excessive strcmp
|
|
||||||
calls.
|
|
||||||
|
|
||||||
Fix other localized issues- use non-printf when necessary. We may need to use
|
|
||||||
some wchar_t output on the progress bar as char/byte counts differ here. Sizes
|
|
||||||
of packages (e.g. 10,400.23 MB) should all be localized with correct
|
|
||||||
seperators.
|
|
||||||
|
|
||||||
Rewrite makepkg to use terminal-safe coloring/bolding. tput utility should
|
|
||||||
allow us to do this. Make universal message functions for systemwide use,
|
|
||||||
including all pacman utilites- abs, pacman-optimize, etc.
|
|
||||||
|
|
||||||
Bugs/FRs to smash: 6468, 6437, 6430?, 6420, 6404, 6389, 6312?, 6284, 6273?,
|
|
||||||
6255?, 6208, 5987, 5885, 5571, 4182, 3492, 2810?, 1769, 1588, 1571
|
|
||||||
|
|
||||||
Update doxygen comments, they may need some work. Try to document all of the
|
|
||||||
private internal functions too- it helps a ton for people just getting a
|
|
||||||
start on pacman hacking.
|
|
||||||
|
|
||||||
Other smaller things:
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
unsigned int vs. unsigned- determine a standard and stick with it
|
|
||||||
|
|
||||||
FS #4185 - move where message is logged, perhaps?
|
|
||||||
|
|
||||||
Update copyrights (2007)
|
|
||||||
|
|
||||||
Update pacman website, and add/finish pacman coding style page
|
|
||||||
|
|
||||||
Refine makepkg error codes. Each kind of failure could have its own code:
|
|
||||||
--package already built
|
|
||||||
--failed integ checks
|
|
||||||
--failed build
|
|
||||||
--etc.
|
|
||||||
|
|
||||||
Add utility function to either frontend or backend to convert sizes: e.g. bytes
|
|
||||||
to KB, MB, GB.
|
|
||||||
|
|
||||||
Revamp the downloadprog function a bit. Seems kind of messy.
|
|
||||||
|
|
||||||
--print-uri option to sync should not require saying yes or no to up to date
|
|
||||||
|
|
||||||
Build a replacement for this, or at least standardize its use. We shouldn't
|
|
||||||
always need to pass handle->root around, it is constant. Something like char*
|
|
||||||
buildpath(file).
|
|
||||||
/* build the new entryname relative to handle->root */
|
|
||||||
snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
|
|
||||||
|
|
||||||
Random ideas:
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Possibly split utilities/extras from pacman package
|
|
||||||
|
|
||||||
Make .indent.pro file for GNU indent (started, but didn't finish)
|
|
||||||
|
|
||||||
17
TRANSLATORS
17
TRANSLATORS
@@ -1,14 +1,13 @@
|
|||||||
Thanks to all of those who have helped translate pacman, both in the past
|
Thanks to all of those who have helped translate pacman, both in the past and
|
||||||
and currently. Here are some of the current translators (past translators
|
currently. Our translations are currently maintained in Transifex; please read
|
||||||
can be found by looking in the GIT history).
|
doc/translation-help.txt for more details.
|
||||||
|
|
||||||
If your language is listed here and you are interested in helping translate,
|
Below is a list of past translators before we switched to Transifex; more can
|
||||||
contact either the pacman mailing list at pacman-dev@archlinux.org, or one
|
be found by looking in the GIT history.
|
||||||
of the translators listed above.
|
|
||||||
|
|
||||||
If your language is not listed here and you wish it was, let the pacman mailing
|
If your language is not already in the various po/ subdirectories and you wish
|
||||||
list know you are interested in making a translation. We will be happy to add
|
it was, set up a team in Transifex for your language and we will be happy to
|
||||||
your language to the mix.
|
add your language to the mix.
|
||||||
|
|
||||||
Catalan (ca):
|
Catalan (ca):
|
||||||
Manuel Tortosa <manutortosa@chakra-project.org>
|
Manuel Tortosa <manutortosa@chakra-project.org>
|
||||||
|
|||||||
4946
acinclude.m4
4946
acinclude.m4
File diff suppressed because it is too large
Load Diff
13
autoclean.sh
13
autoclean.sh
@@ -26,12 +26,7 @@ rm -f test/pacman/*.pyc
|
|||||||
rm -f doc/html/*.html
|
rm -f doc/html/*.html
|
||||||
rm -f doc/man3/*.3
|
rm -f doc/man3/*.3
|
||||||
|
|
||||||
rm -f po/{Makefile.in,Makefile}
|
rm -f {lib/libalpm,scripts,src/pacman}/po/{Makefile.in,Makefile}
|
||||||
rm -f po/POTFILES
|
rm -f {lib/libalpm,scripts,src/pacman}/po/POTFILES
|
||||||
rm -f po/stamp-po
|
rm -f {lib/libalpm,scripts,src/pacman}/po/stamp-po
|
||||||
rm -f po/*.gmo
|
rm -f {lib/libalpm,scripts,src/pacman}/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
|
||||||
|
|||||||
255
config.guess
vendored
255
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, 2007, 2008
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2008-01-23'
|
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='2008-01-23'
|
|||||||
# 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,
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 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:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||||
|
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
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:*:[456])
|
*: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,12 +811,12 @@ 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)
|
IA64)
|
||||||
@@ -806,6 +826,9 @@ EOF
|
|||||||
[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
|
||||||
@@ -835,6 +858,20 @@ 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
|
eval $set_cc_for_build
|
||||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
@@ -857,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 ;;
|
||||||
@@ -866,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
|
||||||
@@ -943,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
|
||||||
@@ -958,6 +968,9 @@ 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 ;;
|
||||||
@@ -965,71 +978,8 @@ EOF
|
|||||||
echo x86_64-unknown-linux-gnu
|
echo x86_64-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
xtensa*:Linux:*:*)
|
xtensa*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-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
|
||||||
@@ -1058,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:*:*)
|
||||||
@@ -1102,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
|
||||||
@@ -1141,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 ;;
|
||||||
@@ -1153,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:*:*)
|
||||||
@@ -1216,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 ;;
|
||||||
@@ -1243,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}
|
||||||
@@ -1324,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
|
||||||
|
|||||||
159
config.sub
vendored
159
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, 2007, 2008
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2008-01-16'
|
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='2008-01-16'
|
|||||||
|
|
||||||
|
|
||||||
# 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,
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 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,30 @@ 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.
|
# Recognize the basic CPU types without company name, with glob match.
|
||||||
xtensa*)
|
xtensa*)
|
||||||
@@ -439,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
|
||||||
@@ -455,10 +490,27 @@ case $basic_machine in
|
|||||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
os=-linux
|
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
|
||||||
@@ -526,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
|
||||||
@@ -699,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
|
||||||
@@ -803,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
|
||||||
;;
|
;;
|
||||||
@@ -1037,17 +1102,10 @@ 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*)
|
|
||||||
basic_machine=tic55x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic6x | c6x*)
|
|
||||||
basic_machine=tic6x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
;;
|
||||||
tile*)
|
tile*)
|
||||||
basic_machine=tile-unknown
|
basic_machine=tile-unknown
|
||||||
@@ -1128,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
|
||||||
@@ -1166,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)
|
||||||
@@ -1216,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|'`
|
||||||
;;
|
;;
|
||||||
@@ -1236,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* \
|
||||||
@@ -1248,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* \
|
||||||
@@ -1258,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*)
|
||||||
@@ -1388,6 +1455,11 @@ case $os in
|
|||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
|
-dicos*)
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
|
-nacl*)
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1428,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
|
||||||
@@ -1585,7 +1666,7 @@ case $basic_machine in
|
|||||||
-sunos*)
|
-sunos*)
|
||||||
vendor=sun
|
vendor=sun
|
||||||
;;
|
;;
|
||||||
-aix*)
|
-cnk*|-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
-beos*)
|
-beos*)
|
||||||
|
|||||||
174
configure.ac
174
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
|
||||||
#
|
#
|
||||||
@@ -41,13 +41,13 @@ AC_PREREQ(2.60)
|
|||||||
# Bugfix releases:
|
# Bugfix releases:
|
||||||
# pacman_version_micro += 1
|
# pacman_version_micro += 1
|
||||||
|
|
||||||
m4_define([lib_current], [5])
|
m4_define([lib_current], [7])
|
||||||
m4_define([lib_revision], [3])
|
m4_define([lib_revision], [2])
|
||||||
m4_define([lib_age], [0])
|
m4_define([lib_age], [0])
|
||||||
|
|
||||||
m4_define([pacman_version_major], [3])
|
m4_define([pacman_version_major], [4])
|
||||||
m4_define([pacman_version_minor], [4])
|
m4_define([pacman_version_minor], [0])
|
||||||
m4_define([pacman_version_micro], [3])
|
m4_define([pacman_version_micro], [2])
|
||||||
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])
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ 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,
|
||||||
AS_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
|
||||||
@@ -83,20 +83,23 @@ AC_ARG_WITH(src-ext,
|
|||||||
AS_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
|
|
||||||
AC_ARG_WITH(db-ext,
|
|
||||||
AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]),
|
|
||||||
[DBEXT=$withval], [DBEXT=.db.tar.gz])
|
|
||||||
|
|
||||||
# Help line for buildscript filename
|
# Help line for buildscript filename
|
||||||
AC_ARG_WITH(buildscript,
|
AC_ARG_WITH(buildscript,
|
||||||
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
|
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
|
||||||
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
|
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
|
||||||
|
|
||||||
# Help line for libfetch
|
# Help line for using OpenSSL
|
||||||
AC_ARG_ENABLE(internal-download,
|
AC_ARG_WITH(openssl,
|
||||||
AS_HELP_STRING([--disable-internal-download], [do not build with libfetch support]),
|
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
|
||||||
[internaldownload=$enableval], [internaldownload=yes])
|
[], [with_openssl=check])
|
||||||
|
|
||||||
|
# Help line for using gpgme
|
||||||
|
AC_ARG_WITH(gpgme,
|
||||||
|
AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
|
||||||
|
[], [with_gpgme=check])
|
||||||
|
|
||||||
|
# Check for useable libcurl
|
||||||
|
LIBCURL_CHECK_CONFIG([yes], [7.19.4], [with_libcurl=yes], [with_libcurl=no])
|
||||||
|
|
||||||
# Help line for documentation
|
# Help line for documentation
|
||||||
AC_ARG_ENABLE(doc,
|
AC_ARG_ENABLE(doc,
|
||||||
@@ -122,58 +125,90 @@ AC_ARG_ENABLE(git-version,
|
|||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
AC_PROG_CC_C99
|
AC_PROG_CC_C99
|
||||||
|
AC_PROG_CXX
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
|
AC_PROG_RANLIB
|
||||||
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 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], [need-ngettext])
|
||||||
AM_GNU_GETTEXT_VERSION(0.13.1)
|
AM_GNU_GETTEXT_VERSION(0.13.1)
|
||||||
|
|
||||||
|
AC_CHECK_LIB([m], [fabs], ,
|
||||||
|
AC_MSG_ERROR([libm is needed to compile pacman!]))
|
||||||
|
|
||||||
# Check for libarchive
|
# Check for libarchive
|
||||||
AC_CHECK_LIB([archive], [archive_read_data], ,
|
AC_CHECK_LIB([archive], [archive_read_data], ,
|
||||||
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
|
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
|
||||||
|
|
||||||
# Enable or disable usage of libfetch
|
# Check for OpenSSL
|
||||||
AC_MSG_CHECKING(whether to link with libfetch)
|
AC_MSG_CHECKING(whether to link with libssl)
|
||||||
if test "x$internaldownload" = "xyes" ; then
|
AS_IF([test "x$with_openssl" != "xno"],
|
||||||
AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([INTERNAL_DOWNLOAD], , [Use internal download library])
|
AC_CHECK_LIB([ssl], [MD5_Final], ,
|
||||||
# Check for a download library if it was actually requested
|
[if test "x$with_openssl" != "xcheck"; then
|
||||||
AC_CHECK_LIB([fetch], [fetchParseURL], ,
|
AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found])
|
||||||
AC_MSG_ERROR([libfetch is needed to compile with internal download support]), [-lcrypto -ldl] )
|
fi],
|
||||||
# Check if libfetch supports conditional GET
|
[-lcrypto])
|
||||||
# (version >=2.21, struct url has member last_modified)
|
with_openssl=$ac_cv_lib_ssl_MD5_Final],
|
||||||
AC_CHECK_MEMBER(struct url.last_modified, ,
|
AC_MSG_RESULT(no))
|
||||||
AC_MSG_ERROR([libfetch must be version 2.21 or greater]),
|
AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"])
|
||||||
[#include <fetch.h>] )
|
|
||||||
else
|
# Check for gpgme
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_CHECKING(whether to link with libgpgme)
|
||||||
fi
|
AS_IF([test "x$with_gpgme" != "xno"],
|
||||||
AM_CONDITIONAL(INTERNAL_DOWNLOAD, test "x$internaldownload" = "xyes")
|
[AC_MSG_RESULT(yes)
|
||||||
|
AC_CHECK_LIB([gpgme], [gpgme_check_version], ,
|
||||||
|
[if test "x$with_gpgme" != "xcheck"; then
|
||||||
|
AC_MSG_FAILURE([--with-ggpme was given, but -lgpgme was not found])
|
||||||
|
fi],
|
||||||
|
[-lgpgme])
|
||||||
|
with_gpgme=$ac_cv_lib_gpgme_gpgme_check_version],
|
||||||
|
AC_MSG_RESULT(no))
|
||||||
|
AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h sys/time.h syslog.h wchar.h])
|
AC_CHECK_HEADERS([fcntl.h float.h glob.h libintl.h limits.h locale.h \
|
||||||
|
mntent.h netinet/in.h netinet/tcp.h \
|
||||||
|
stddef.h string.h sys/ioctl.h \
|
||||||
|
sys/mnttab.h sys/mount.h \
|
||||||
|
sys/param.h sys/statvfs.h sys/time.h sys/types.h \
|
||||||
|
sys/ucred.h syslog.h termios.h wchar.h])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
|
AC_TYPE_INT64_T
|
||||||
AC_TYPE_MODE_T
|
AC_TYPE_MODE_T
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
AC_TYPE_PID_T
|
AC_TYPE_PID_T
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
AC_TYPE_SSIZE_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_FORK
|
AC_FUNC_FORK
|
||||||
|
AC_FUNC_GETMNTENT
|
||||||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||||
|
AC_FUNC_MALLOC
|
||||||
AC_FUNC_MKTIME
|
AC_FUNC_MKTIME
|
||||||
AC_TYPE_SIGNAL
|
AC_FUNC_STRCOLL
|
||||||
AC_CHECK_FUNCS([geteuid realpath regcomp strcasecmp \
|
AC_CHECK_FUNCS([dup2 getcwd geteuid getmntinfo gettimeofday memmove memset \
|
||||||
strndup strrchr strsep swprintf \
|
mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
|
||||||
wcwidth uname])
|
strchr strcspn strdup strerror strndup strrchr strsep strstr \
|
||||||
|
strtol swprintf tcflush 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
|
||||||
@@ -192,7 +227,7 @@ STRIP_STATIC="--strip-debug"
|
|||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
*bsd*)
|
*bsd*)
|
||||||
SIZECMD="stat -L -f %z"
|
SIZECMD="stat -L -f %z"
|
||||||
SEDINPLACE="sed -i ''"
|
SEDINPLACE="sed -i \"\""
|
||||||
;;
|
;;
|
||||||
cygwin*)
|
cygwin*)
|
||||||
host_os_cygwin=yes
|
host_os_cygwin=yes
|
||||||
@@ -217,48 +252,10 @@ AC_SUBST(STRIP_BINARIES)
|
|||||||
AC_SUBST(STRIP_SHARED)
|
AC_SUBST(STRIP_SHARED)
|
||||||
AC_SUBST(STRIP_STATIC)
|
AC_SUBST(STRIP_STATIC)
|
||||||
|
|
||||||
# Check for architecture, used in default makepkg.conf
|
# Variables plugged into makepkg.conf
|
||||||
# (Note single space left after CARCHFLAGS)
|
CARCH="${host%%-*}"
|
||||||
case "${host}" in
|
|
||||||
i686-*)
|
|
||||||
CARCH="i686"
|
|
||||||
CARCHFLAGS="-march=i686 "
|
|
||||||
;;
|
|
||||||
x86_64-*)
|
|
||||||
CARCH="x86_64"
|
|
||||||
CARCHFLAGS="-march=x86-64 "
|
|
||||||
;;
|
|
||||||
ia64-*)
|
|
||||||
CARCH="ia64"
|
|
||||||
CARCHFLAGS="-march=ia64 "
|
|
||||||
;;
|
|
||||||
sparc-*)
|
|
||||||
CARCH="sparc"
|
|
||||||
CARCHFLAGS="-mcpu=v9 "
|
|
||||||
;;
|
|
||||||
ppc-* | powerpc-*)
|
|
||||||
CARCH="ppc"
|
|
||||||
CARCHFLAGS="-mcpu=750 "
|
|
||||||
;;
|
|
||||||
i386-*)
|
|
||||||
CARCH="i386"
|
|
||||||
CARCHFLAGS="-march=i386 "
|
|
||||||
;;
|
|
||||||
arm-*)
|
|
||||||
CARCH="arm"
|
|
||||||
CARCHFLAGS="-march=armv4 "
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_WARN([[Your architecture is unknown for makepkg.conf, consider adding it to configure.ac]])
|
|
||||||
CARCH="unknown"
|
|
||||||
CARCHFLAGS=""
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Now do some things common to all architectures
|
|
||||||
CHOST="${host}"
|
CHOST="${host}"
|
||||||
AC_SUBST(CARCH)
|
AC_SUBST(CARCH)
|
||||||
AC_SUBST(CARCHFLAGS)
|
|
||||||
AC_SUBST(CHOST)
|
AC_SUBST(CHOST)
|
||||||
|
|
||||||
# Check for documentation support and status
|
# Check for documentation support and status
|
||||||
@@ -305,6 +302,7 @@ 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
|
||||||
|
GCC_FORTIFY_SOURCE_CC
|
||||||
CFLAGS="$CFLAGS -g -Wall -Werror"
|
CFLAGS="$CFLAGS -g -Wall -Werror"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
@@ -338,9 +336,6 @@ 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
|
|
||||||
AC_SUBST(DBEXT)
|
|
||||||
AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases])
|
|
||||||
# Set makepkg build script name
|
# Set makepkg build script name
|
||||||
AC_SUBST(BUILDSCRIPT)
|
AC_SUBST(BUILDSCRIPT)
|
||||||
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
|
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
|
||||||
@@ -350,11 +345,12 @@ AC_CONFIG_FILES([
|
|||||||
lib/libalpm/Makefile
|
lib/libalpm/Makefile
|
||||||
lib/libalpm/po/Makefile.in
|
lib/libalpm/po/Makefile.in
|
||||||
src/pacman/Makefile
|
src/pacman/Makefile
|
||||||
|
src/pacman/po/Makefile.in
|
||||||
src/util/Makefile
|
src/util/Makefile
|
||||||
scripts/Makefile
|
scripts/Makefile
|
||||||
|
scripts/po/Makefile.in
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
etc/Makefile
|
etc/Makefile
|
||||||
po/Makefile.in
|
|
||||||
test/pacman/Makefile
|
test/pacman/Makefile
|
||||||
test/pacman/tests/Makefile
|
test/pacman/tests/Makefile
|
||||||
test/util/Makefile
|
test/util/Makefile
|
||||||
@@ -374,12 +370,15 @@ ${PACKAGE_NAME}:
|
|||||||
localstatedir : $(eval echo ${localstatedir})
|
localstatedir : $(eval echo ${localstatedir})
|
||||||
database dir : $(eval echo ${localstatedir})/lib/pacman/
|
database dir : $(eval echo ${localstatedir})/lib/pacman/
|
||||||
cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
|
cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
|
||||||
|
|
||||||
compiler : ${CC}
|
compiler : ${CC}
|
||||||
|
preprocessor flags : ${CPPFLAGS}
|
||||||
compiler flags : ${CFLAGS}
|
compiler flags : ${CFLAGS}
|
||||||
defines : ${DEFS}
|
defines : ${DEFS}
|
||||||
|
library flags : ${LIBS}
|
||||||
|
linker flags : ${LDFLAGS}
|
||||||
|
|
||||||
Architecture : ${CARCH}
|
Architecture : ${CARCH}
|
||||||
Architecture flags : ${CARCHFLAGS}
|
|
||||||
Host Type : ${CHOST}
|
Host Type : ${CHOST}
|
||||||
Filesize command : ${SIZECMD}
|
Filesize command : ${SIZECMD}
|
||||||
In-place sed command : ${SEDINPLACE}
|
In-place sed command : ${SEDINPLACE}
|
||||||
@@ -393,12 +392,13 @@ ${PACKAGE_NAME}:
|
|||||||
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}
|
build script name : ${BUILDSCRIPT}
|
||||||
|
|
||||||
Compilation options:
|
Compilation options:
|
||||||
|
Use libcurl : ${with_libcurl}
|
||||||
|
Use GPGME : ${with_gpgme}
|
||||||
|
Use OpenSSL : ${with_openssl}
|
||||||
Run make in doc/ dir : ${wantdoc} ${asciidoc}
|
Run make in doc/ dir : ${wantdoc} ${asciidoc}
|
||||||
Use download library : ${internaldownload}
|
|
||||||
Doxygen support : ${usedoxygen}
|
Doxygen support : ${usedoxygen}
|
||||||
debug support : ${debug}
|
debug support : ${debug}
|
||||||
"
|
"
|
||||||
|
|||||||
11
contrib/.gitignore
vendored
Normal file
11
contrib/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
bacman
|
||||||
|
bash_completion
|
||||||
|
paccache
|
||||||
|
pacdiff
|
||||||
|
paclist
|
||||||
|
paclog-pkglist
|
||||||
|
pacscripts
|
||||||
|
pacsearch
|
||||||
|
pacsysclean
|
||||||
|
wget-xdelta.sh
|
||||||
|
zsh_completion
|
||||||
@@ -1,15 +1,68 @@
|
|||||||
EXTRA_DIST = \
|
OURSCRIPTS = \
|
||||||
PKGBUILD.vim \
|
|
||||||
bacman \
|
bacman \
|
||||||
bash_completion \
|
paccache \
|
||||||
pacdiff \
|
pacdiff \
|
||||||
paclist \
|
paclist \
|
||||||
|
paclog-pkglist \
|
||||||
pacscripts \
|
pacscripts \
|
||||||
pacsearch \
|
pacsearch \
|
||||||
pactree \
|
pacsysclean
|
||||||
|
|
||||||
|
OURFILES = \
|
||||||
|
bash_completion \
|
||||||
|
zsh_completion
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
PKGBUILD.vim \
|
||||||
|
bacman.in \
|
||||||
|
bash_completion.in \
|
||||||
|
paccache.in \
|
||||||
|
paclog-pkglist.in \
|
||||||
|
pacdiff.in \
|
||||||
|
paclist.in \
|
||||||
|
pacscripts.in \
|
||||||
|
pacsearch.in \
|
||||||
|
pacsysclean.in \
|
||||||
vimprojects \
|
vimprojects \
|
||||||
wget-xdelta.sh \
|
zsh_completion.in \
|
||||||
zsh_completion \
|
|
||||||
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|@SIZECMD[@]|$(SIZECMD)|g' \
|
||||||
|
-e '1s|!/bin/bash|!$(BASH_SHELL)|g'
|
||||||
|
|
||||||
|
$(OURSCRIPTS): Makefile
|
||||||
|
@echo ' ' GEN $@;
|
||||||
|
@$(RM) $@ $@.tmp
|
||||||
|
@$(edit) $(srcdir)/$@.in >$@.tmp
|
||||||
|
@chmod +x $@.tmp
|
||||||
|
@chmod a-w $@.tmp
|
||||||
|
@mv $@.tmp $@
|
||||||
|
|
||||||
|
$(OURFILES): Makefile
|
||||||
|
@echo ' ' GEN $@;
|
||||||
|
@$(RM) $@ $@.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
|
||||||
|
paccache: $(srcdir)/paccache.in
|
||||||
|
pacdiff: $(srcdir)/pacdiff.in
|
||||||
|
paclist: $(srcdir)/paclist.in
|
||||||
|
paclog-pkglist: $(srcdir)/paclog-pkglist.in
|
||||||
|
pacscripts: $(srcdir)/pacscripts.in
|
||||||
|
pacsearch: $(srcdir)/pacsearch.in
|
||||||
|
pacsysclean: $(srcdir)/pacsysclean.in
|
||||||
|
pactree: $(srcdir)/pactree.in
|
||||||
|
zsh_completion: $(srcdir)/zsh_completion.in
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ elseif exists("b:current_syntax")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let b:main_syntax = "sh"
|
let b:main_syntax = "sh"
|
||||||
|
let b:is_bash = 1
|
||||||
runtime! syntax/sh.vim
|
runtime! syntax/sh.vim
|
||||||
|
|
||||||
" case on
|
" case on
|
||||||
@@ -40,7 +41,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
|
||||||
|
|
||||||
@@ -52,6 +53,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
|
||||||
@@ -100,6 +107,11 @@ syn keyword pb_k_optdepends optdepends contained
|
|||||||
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
||||||
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
|
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
|
" checkdepends
|
||||||
|
syn keyword pb_k_ckdepends ckdepends contained
|
||||||
|
syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
||||||
|
syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
" conflicts
|
" conflicts
|
||||||
syn keyword pb_k_conflicts conflicts contained
|
syn keyword pb_k_conflicts conflicts contained
|
||||||
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
||||||
@@ -166,7 +178,7 @@ 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\|zipman\|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
|
||||||
@@ -208,6 +220,9 @@ hi def link pb_k_pkgrel pbKeywords
|
|||||||
hi def link pbIllegalPkgdesc Error
|
hi def link pbIllegalPkgdesc Error
|
||||||
hi def link pb_k_desc pbKeywords
|
hi def link pb_k_desc pbKeywords
|
||||||
|
|
||||||
|
hi def link pbIllegalEpoch Error
|
||||||
|
hi def link pb_k_epoch pbKeywords
|
||||||
|
|
||||||
hi def link pbIllegalUrl Error
|
hi def link pbIllegalUrl Error
|
||||||
hi def link pb_k_url pbKeywords
|
hi def link pb_k_url pbKeywords
|
||||||
|
|
||||||
@@ -222,6 +237,7 @@ hi def link pbIllegalArch Error
|
|||||||
hi def link pb_k_groups pbKeywords
|
hi def link pb_k_groups pbKeywords
|
||||||
hi def link pb_k_makedepends pbKeywords
|
hi def link pb_k_makedepends pbKeywords
|
||||||
hi def link pb_k_optdepends pbKeywords
|
hi def link pb_k_optdepends pbKeywords
|
||||||
|
hi def link pb_k_ckdepends pbKeywords
|
||||||
hi def link pb_k_depends pbKeywords
|
hi def link pb_k_depends pbKeywords
|
||||||
hi def link pb_k_replaces pbKeywords
|
hi def link pb_k_replaces pbKeywords
|
||||||
hi def link pb_k_conflicts pbKeywords
|
hi def link pb_k_conflicts pbKeywords
|
||||||
|
|||||||
@@ -23,14 +23,8 @@ 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.
|
||||||
|
|
||||||
pactree - generate a dependency tree of an installed package in textual or
|
|
||||||
graphical form (using graphviz).
|
|
||||||
|
|
||||||
bacman - 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.
|
||||||
|
|
||||||
vimprojects - a project file for the vim project plugin.
|
vimprojects - a project file for the vim project plugin.
|
||||||
|
|
||||||
wget-xdelta.sh - A download script for pacman which allows binary deltas
|
|
||||||
generated with makepkg to be used instead of downloading full binary packages.
|
|
||||||
This should cut download sizes for some package upgrades significantly.
|
|
||||||
|
|||||||
310
contrib/bacman
310
contrib/bacman
@@ -1,310 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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 /etc/pacman.conf ]; then
|
|
||||||
echo "ERROR: unable to read /etc/pacman.conf"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
|
|
||||||
pac_db="${DBPath:-/var/lib/pacman/}/local"
|
|
||||||
|
|
||||||
if [ ! -r /etc/makepkg.conf ]; then
|
|
||||||
echo "ERROR: unable to read /etc/makepkg.conf"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "/etc/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,depends} |
|
|
||||||
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
|
|
||||||
;;
|
|
||||||
%FORCE%)
|
|
||||||
echo "force = true" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
|
|
||||||
# files
|
|
||||||
%BACKUP%)
|
|
||||||
# strip the md5sum after the tab
|
|
||||||
echo "backup = ${i%%$'\t'*}" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
|
|
||||||
# depends
|
|
||||||
%DEPENDS%)
|
|
||||||
echo "depend = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%OPTDEPENDS%)
|
|
||||||
echo "optdepend = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%CONFLICTS%)
|
|
||||||
echo "conflict = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%PROVIDES%)
|
|
||||||
echo "provides = $i" >> .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:
|
|
||||||
|
|
||||||
306
contrib/bacman.in
Executable file
306
contrib/bacman.in
Executable file
@@ -0,0 +1,306 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
readonly progname="bacman"
|
||||||
|
readonly progver="0.2.1"
|
||||||
|
|
||||||
|
#
|
||||||
|
# User Friendliness
|
||||||
|
#
|
||||||
|
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 (( $# != 1 )); then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "--help" || $1 == "-h" ]]; then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "--version" || $1 == "-v" ]]; then
|
||||||
|
echo "$progname version $progver"
|
||||||
|
echo "Copyright (C) 2008 locci"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fakeroot support
|
||||||
|
#
|
||||||
|
if (( EUID )); then
|
||||||
|
if [[ -f /usr/bin/fakeroot ]]; then
|
||||||
|
echo "Entering fakeroot environment"
|
||||||
|
export INFAKEROOT="1"
|
||||||
|
/usr/bin/fakeroot -u -- "$0" "$@"
|
||||||
|
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=("$pac_db/$pkg_name"-+([^-])-+([^-]))
|
||||||
|
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 (( ${#pkg_dir[@]} != 1 )); then
|
||||||
|
printf "ERROR: %d entries for package %s found in pacman database\n" \
|
||||||
|
${#pkg_dir[@]} "${pkg_name}"
|
||||||
|
printf "%s\n" "${pkg_dir[@]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d $pkg_dir ]]; then
|
||||||
|
printf "ERROR: package %s is found in pacman database,\n" "${pkg_name}"
|
||||||
|
printf " but \`%s' is not a directory\n" "${pkg_dir}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Begin
|
||||||
|
#
|
||||||
|
echo "Package: ${pkg_namver}"
|
||||||
|
work_dir=$(mktemp -d --tmpdir bacman.XXXXXXXXXX)
|
||||||
|
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 || -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 )); then
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pkg_size=$(du -sk | awk '{print $1 * 1024}')
|
||||||
|
|
||||||
|
#
|
||||||
|
# .PKGINFO stuff
|
||||||
|
# TODO adopt makepkg's write_pkginfo() into this or scripts/library
|
||||||
|
#
|
||||||
|
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..."
|
||||||
|
|
||||||
|
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
|
||||||
|
ret=0
|
||||||
|
|
||||||
|
# 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.Z) compress -c -f ;;
|
||||||
|
*tar) cat ;;
|
||||||
|
*) echo "WARNING: '%s' is not a valid archive extension." \
|
||||||
|
"$PKGEXT" >&2; cat ;;
|
||||||
|
esac > "${pkg_file}"; ret=$?
|
||||||
|
|
||||||
|
if (( ret )); 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:
|
||||||
|
|
||||||
@@ -27,16 +27,30 @@ _arch_incomp() {
|
|||||||
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
|
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pacman_key() {
|
||||||
|
local cur opts prev
|
||||||
|
COMPREPLY=()
|
||||||
|
_get_comp_words_by_ref cur prev
|
||||||
|
if [[ $cur = -* &&
|
||||||
|
$prev != -@(a|-add|c|-config|g|-gpgdir|h|-help|import?(-trustdb)) ]]; then
|
||||||
|
opts=('add delete export finger help list-keys recv-keys updatedb verify version
|
||||||
|
config edit-key gpgdir import import-trustdb init keyserver list-sigs
|
||||||
|
lsign-key populate refresh-keys'
|
||||||
|
'a d e f h l r u v V')
|
||||||
|
_arch_ptr2comp opts
|
||||||
|
fi
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
_makepkg() {
|
_makepkg() {
|
||||||
local cur opts prev
|
local cur opts prev
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=$(_get_cword)
|
_get_comp_words_by_ref cur prev
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
if [[ $cur = -* && ! $prev =~ ^-(-(config|help)$|\w*[Chp]) ]]; then
|
||||||
if [[ $cur = -* && ! $prev =~ ^-(-(cleancache|config|help)$|\w*[Chp]) ]]; then
|
opts=('allsource asroot check clean config force geninteg help holdver ignorearch
|
||||||
opts=('allsource asroot clean cleancache config force geninteg help holdver
|
install log nobuild nocheck nocolor noconfirm nodeps noextract noprogressbar
|
||||||
ignorearch install log nobuild nocolor noconfirm nodeps noextract
|
nosign pkg repackage rmdeps sign skipinteg source syncdeps'
|
||||||
noprogressbar pkg repackage rmdeps skipinteg source syncdeps'
|
'A L R S c d e f g h i m o p r s')
|
||||||
'A C L R c d e f g h i m o p r s')
|
|
||||||
_arch_ptr2comp opts
|
_arch_ptr2comp opts
|
||||||
fi
|
fi
|
||||||
true
|
true
|
||||||
@@ -45,9 +59,9 @@ _makepkg() {
|
|||||||
_pacman_pkg() {
|
_pacman_pkg() {
|
||||||
_arch_compgen "$(
|
_arch_compgen "$(
|
||||||
if [[ $2 ]]; then
|
if [[ $2 ]]; then
|
||||||
\pacman -$1 | \cut -d' ' -f1 | \sort -u
|
\pacman -$1 2>/dev/null | \cut -d' ' -f1 | \sort -u
|
||||||
else
|
else
|
||||||
\pacman -$1
|
\pacman -$1 2>/dev/null
|
||||||
fi
|
fi
|
||||||
)"
|
)"
|
||||||
}
|
}
|
||||||
@@ -55,16 +69,15 @@ _pacman_pkg() {
|
|||||||
_pacman() {
|
_pacman() {
|
||||||
local common core cur database prev query remove sync upgrade o
|
local common core cur database prev query remove sync upgrade o
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=$(_get_cword)
|
_get_comp_words_by_ref cur prev
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
database=('asdeps asexplicit')
|
database=('asdeps asexplicit')
|
||||||
query=('changelog check deps explicit file foreign groups info list owns
|
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')
|
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')
|
remove=('cascade dbonly nodeps nosave print recursive unneeded' 'c n p s u')
|
||||||
sync=('asdeps asexplicit clean downloadonly force groups ignore ignoregroup
|
sync=('asdeps asexplicit clean dbonly downloadonly force groups ignore ignoregroup
|
||||||
info list needed nodeps print refresh search sysupgrade'
|
info list needed nodeps print refresh recursive search sysupgrade'
|
||||||
'c f g i l p s u w y')
|
'c f g i l p s u w y')
|
||||||
upgrade=('asdeps asexplicit force nodeps print' 'f p')
|
upgrade=('asdeps asexplicit force needed nodeps print recursive' 'f p')
|
||||||
common=('arch cachedir config dbpath debug help logfile noconfirm
|
common=('arch cachedir config dbpath debug help logfile noconfirm
|
||||||
noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
|
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')
|
core=('database help query remove sync upgrade version' 'D Q R S U V h')
|
||||||
@@ -100,16 +113,17 @@ _pacman() {
|
|||||||
|
|
||||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||||
_pacman_file() {
|
_pacman_file() {
|
||||||
compopt -o filenames; _filedir 'pkg.tar.*'
|
compopt -o filenames; _filedir 'pkg.tar*'
|
||||||
}
|
}
|
||||||
complete -F _pacman -o default pacman
|
complete -F _pacman -o default pacman
|
||||||
else
|
else
|
||||||
_pacman_file() {
|
_pacman_file() {
|
||||||
_filedir 'pkg.tar.*'
|
_filedir 'pkg.tar*'
|
||||||
}
|
}
|
||||||
complete -F _pacman -o filenames -o default pacman
|
complete -F _pacman -o filenames -o default pacman
|
||||||
fi
|
fi
|
||||||
|
|
||||||
complete -F _makepkg -o default makepkg
|
complete -F _makepkg -o default makepkg
|
||||||
|
complete -F _pacman_key -o default pacman-key
|
||||||
|
|
||||||
# ex:et ts=2 sw=2 ft=sh
|
# ex:et ts=2 sw=2 ft=sh
|
||||||
303
contrib/paccache.in
Executable file
303
contrib/paccache.in
Executable file
@@ -0,0 +1,303 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# pacache - flexible pacman cache cleaning
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 Dave Reisner <dreisner@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/>.
|
||||||
|
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
declare -a candidates=() cmdopts=() whitelist=() blacklist=()
|
||||||
|
declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
|
||||||
|
declare cachedir=@localstatedir@/cache/pacman/pkg delim=$'\n' keep=3 movedir= scanarch=
|
||||||
|
|
||||||
|
msg() {
|
||||||
|
local mesg=$1; shift
|
||||||
|
printf "==> $mesg\n" "$@"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
error() {
|
||||||
|
local mesg=$1; shift
|
||||||
|
printf "==> ERROR: $mesg\n" "$@"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die() {
|
||||||
|
error "$@"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# reads a list of files on stdin and prints out deletion candidates
|
||||||
|
pkgfilter() {
|
||||||
|
# there's whitelist and blacklist parameters passed to this
|
||||||
|
# script after the block of awk.
|
||||||
|
|
||||||
|
awk -v keep="$1" -v scanarch="$2" '
|
||||||
|
function parse_filename(filename, parts, count, i, pkgname, arch) {
|
||||||
|
|
||||||
|
count = split(filename, parts, "-")
|
||||||
|
|
||||||
|
i = 1
|
||||||
|
pkgname = parts[i++]
|
||||||
|
while (i <= count - 3) {
|
||||||
|
pkgname = pkgname "-" parts[i++]
|
||||||
|
}
|
||||||
|
|
||||||
|
arch = substr(parts[count], 1, index(parts[count], ".") - 1)
|
||||||
|
|
||||||
|
# filter on whitelist or blacklist
|
||||||
|
if (wlen && !whitelist[pkgname]) return
|
||||||
|
if (blen && blacklist[pkgname]) return
|
||||||
|
|
||||||
|
if ("" == packages[pkgname,arch]) {
|
||||||
|
packages[pkgname,arch] = filename
|
||||||
|
} else {
|
||||||
|
packages[pkgname,arch] = packages[pkgname,arch] SUBSEP filename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
# create whitelist
|
||||||
|
wlen = ARGV[1]; delete ARGV[1]
|
||||||
|
for (i = 2; i < 2 + wlen; i++) {
|
||||||
|
whitelist[ARGV[i]] = 1
|
||||||
|
delete ARGV[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
# create blacklist
|
||||||
|
blen = ARGV[i]; delete ARGV[i]
|
||||||
|
while (i++ < ARGC) {
|
||||||
|
blacklist[ARGV[i]] = 1
|
||||||
|
delete ARGV[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
# read package filenames
|
||||||
|
while (getline < "/dev/stdin") {
|
||||||
|
parse_filename($0)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (pkglist in packages) {
|
||||||
|
# idx[1,2] = idx[pkgname,arch]
|
||||||
|
split(pkglist, idx, SUBSEP)
|
||||||
|
|
||||||
|
# enforce architecture match if specified
|
||||||
|
if (!scanarch || scanarch == idx[2]) {
|
||||||
|
count = split(packages[idx[1], idx[2]], pkgs, SUBSEP)
|
||||||
|
for(i = 1; i <= count - keep; i++) {
|
||||||
|
print pkgs[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' "${@:3}"
|
||||||
|
}
|
||||||
|
|
||||||
|
size_to_human() {
|
||||||
|
awk -v size="$1" '
|
||||||
|
BEGIN {
|
||||||
|
suffix[1] = "B"
|
||||||
|
suffix[2] = "KiB"
|
||||||
|
suffix[3] = "MiB"
|
||||||
|
suffix[4] = "GiB"
|
||||||
|
suffix[5] = "TiB"
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
while (size > 1024) {
|
||||||
|
size /= 1024
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
|
||||||
|
sizestr = sprintf("%.2f", size)
|
||||||
|
sub(/\.?0+$/, "", sizestr)
|
||||||
|
printf("%s %s", sizestr, suffix[count])
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
runcmd() {
|
||||||
|
if (( needsroot )); then
|
||||||
|
msg "Privilege escalation required"
|
||||||
|
if sudo -v &>/dev/null && sudo -l &>/dev/null; then
|
||||||
|
sudo "$@"
|
||||||
|
else
|
||||||
|
printf '%s ' 'root'
|
||||||
|
su -c "$(printf '%q ' "$@")"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
"$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
summarize() {
|
||||||
|
local -i filecount=$1; shift
|
||||||
|
local seenarch= seen= arch= name=
|
||||||
|
local -r pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.pkg.*'
|
||||||
|
|
||||||
|
if (( delete )); then
|
||||||
|
printf -v output 'finished: %d packages removed' "$filecount"
|
||||||
|
elif (( move )); then
|
||||||
|
printf -v output "finished: %d packages moved to \`%s'" "$filecount" "$movedir"
|
||||||
|
elif (( dryrun )); then
|
||||||
|
if (( verbose )); then
|
||||||
|
msg "Candidate packages:"
|
||||||
|
while read -r pkg; do
|
||||||
|
if (( verbose >= 3 )); then
|
||||||
|
[[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
|
||||||
|
if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then
|
||||||
|
seen=$name seenarch=$arch
|
||||||
|
printf '%s (%s):\n' "$name" "$arch"
|
||||||
|
fi
|
||||||
|
printf ' %s\n' "$pkg"
|
||||||
|
elif (( verbose >= 2 )); then
|
||||||
|
printf "$PWD/%s$delim" "$pkg"
|
||||||
|
else
|
||||||
|
printf "%s$delim" "$pkg"
|
||||||
|
fi
|
||||||
|
done < <(printf '%s\n' "$@" | pacsort)
|
||||||
|
fi
|
||||||
|
printf -v output 'finished dry run: %d candidates' "$filecount"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\n' >&2
|
||||||
|
msg "$output (diskspace saved: %s)" "$(size_to_human "$totalsaved")"
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
usage: ${0##*/} <operation> [options] [targets...]
|
||||||
|
|
||||||
|
${0##*/} is a flexible pacman cache cleaning utility, which has numerous
|
||||||
|
options to help control how much, and what, is deleted from any directory
|
||||||
|
containing pacman package tarballs.
|
||||||
|
|
||||||
|
Operations:
|
||||||
|
-d perform a dry run, only finding candidate packages.
|
||||||
|
-m <movedir> move candidate packages to 'movedir'.
|
||||||
|
-r remove candidate packages.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-a <arch> scan for 'arch' (default: all architectures).
|
||||||
|
-c <cachedir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
|
||||||
|
-f apply force to mv(1) and rm(1) operations.
|
||||||
|
-h display this help message.
|
||||||
|
-i <pkgs> ignore 'pkgs', which is a comma separated. Alternatively,
|
||||||
|
specify '-' to read package names from stdin, newline delimited.
|
||||||
|
-k <num> keep 'num' of each package in 'cachedir' (default: 3).
|
||||||
|
-u target uninstalled packages.
|
||||||
|
-v increase verbosity. specify up to 3 times.
|
||||||
|
-z use null delimiters for candidate names (only with -v and -vv)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if (( ! UID )); then
|
||||||
|
error "Do not run this script as root. You will be prompted for privilege escalation."
|
||||||
|
exit 42
|
||||||
|
fi
|
||||||
|
|
||||||
|
while getopts ':a:c:dfhi:k:m:rsuvz' opt; do
|
||||||
|
case $opt in
|
||||||
|
a) scanarch=$OPTARG ;;
|
||||||
|
c) cachedir=$OPTARG ;;
|
||||||
|
d) dryrun=1 ;;
|
||||||
|
f) cmdopts=(-f) ;;
|
||||||
|
h) usage
|
||||||
|
exit 0 ;;
|
||||||
|
i) if [[ $OPTARG = '-' ]]; then
|
||||||
|
[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
|
||||||
|
else
|
||||||
|
IFS=',' read -r -a ign <<< "$OPTARG"
|
||||||
|
fi
|
||||||
|
blacklist+=("${ign[@]}")
|
||||||
|
unset i ign ;;
|
||||||
|
k) keep=$OPTARG
|
||||||
|
if [[ -z $keep || -n ${keep//[0-9]/} ]]; then
|
||||||
|
die 'argument to option -k must be a non-negative integer'
|
||||||
|
else
|
||||||
|
keep=$(( 10#$keep ))
|
||||||
|
fi ;;
|
||||||
|
m) move=1 movedir=$OPTARG ;;
|
||||||
|
r) delete=1 ;;
|
||||||
|
u) IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
|
||||||
|
blacklist+=("${ign[@]}")
|
||||||
|
unset ign ;;
|
||||||
|
v) (( ++verbose )) ;;
|
||||||
|
z) delim='\0' ;;
|
||||||
|
:) die "option '--%s' requires an argument" "$OPTARG" ;;
|
||||||
|
?) die "invalid option -- '%s'" "$OPTARG" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
|
# remaining args are a whitelist
|
||||||
|
whitelist=("$@")
|
||||||
|
|
||||||
|
# sanity checks
|
||||||
|
case $(( dryrun+delete+move )) in
|
||||||
|
0) die "no operation specified (use -h for help)" ;;
|
||||||
|
[^1]) die "only one operation may be used at a time" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[[ -d $cachedir ]] ||
|
||||||
|
die "cachedir \`%s' does not exist or is not a directory" "$cachedir"
|
||||||
|
|
||||||
|
[[ $movedir && ! -d $movedir ]] &&
|
||||||
|
die "move-to directory \`%s' does not exist or is not a directory" "$movedir"
|
||||||
|
|
||||||
|
if (( move || delete )); then
|
||||||
|
# make it an absolute path since we're about to chdir
|
||||||
|
[[ ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir
|
||||||
|
[[ ! -w $cachedir || ( $movedir && ! -w $movedir ) ]] && needsroot=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# unlikely that this will fail, but better make sure
|
||||||
|
cd "$cachedir" >/dev/null || die "failed to chdir to \`%s'" "$cachedir"
|
||||||
|
|
||||||
|
# note that these results are returned in an arbitrary order from awk, but
|
||||||
|
# they'll be resorted (in summarize) iff we have a verbosity level set.
|
||||||
|
IFS=$'\n' read -r -d '' -a candidates < \
|
||||||
|
<(printf '%s\n' *.pkg.tar?(.+([^.])) | pacsort |
|
||||||
|
pkgfilter "$keep" "$scanarch" \
|
||||||
|
"${#whitelist[*]}" "${whitelist[@]}" \
|
||||||
|
"${#blacklist[*]}" "${blacklist[@]}")
|
||||||
|
|
||||||
|
if (( ! ${#candidates[*]} )); then
|
||||||
|
msg 'no candidate packages found for pruning'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# grab this prior to signature scavenging
|
||||||
|
pkgcount=${#candidates[*]}
|
||||||
|
|
||||||
|
# copy the list, merging in any found sigs
|
||||||
|
for cand in "${candidates[@]}"; do
|
||||||
|
candtemp+=("$cand")
|
||||||
|
[[ -f $cand.sig ]] && candtemp+=("$cand.sig")
|
||||||
|
done
|
||||||
|
candidates=("${candtemp[@]}")
|
||||||
|
unset candtemp
|
||||||
|
|
||||||
|
# do this before we destroy anything
|
||||||
|
totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }')
|
||||||
|
|
||||||
|
# crush. kill. destroy.
|
||||||
|
(( verbose )) && cmdopts+=(-v)
|
||||||
|
if (( delete )); then
|
||||||
|
runcmd rm "${cmdopts[@]}" "${candidates[@]}"
|
||||||
|
elif (( move )); then
|
||||||
|
runcmd mv "${cmdopts[@]}" "${candidates[@]}" "$movedir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
summarize "$pkgcount" "${candidates[@]}"
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
#!/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:
|
|
||||||
43
contrib/paclist.in
Executable file
43
contrib/paclist.in
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# paclist - List all packages installed from a given repo
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
|
||||||
|
# Copyright (C) 2011 Dave Reisner <dreisner@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/>.
|
||||||
|
|
||||||
|
export TEXTDOMAIN='pacman'
|
||||||
|
export TEXTDOMAINDIR='/usr/share/locale'
|
||||||
|
|
||||||
|
# determine whether we have gettext; make it a no-op if we do not
|
||||||
|
if ! type gettext &>/dev/null; then
|
||||||
|
gettext() {
|
||||||
|
echo "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $1 || $1 = -@(h|-help) ]]; then
|
||||||
|
printf '%s - List all packages installed from a given repo\n' "${0##*/}"
|
||||||
|
printf 'Usage: %s <repo>\n' "${0##*/}"
|
||||||
|
printf 'Example: %s testing\n' "${0##*/}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf -v installed '[%s]' "$(gettext installed)"
|
||||||
|
pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
|
||||||
|
|
||||||
|
# exit with pacman's return value, not awk's
|
||||||
|
exit ${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
68
contrib/paclog-pkglist.in
Executable file
68
contrib/paclog-pkglist.in
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# paclog-pkglist - Parse a log file into a list of currently installed packages
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 Dave Reisner <dave@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/>.
|
||||||
|
|
||||||
|
export TEXTDOMAIN='pacman'
|
||||||
|
export TEXTDOMAINDIR='/usr/share/locale'
|
||||||
|
declare logfile=${1:-@localstatedir@/log/pacman.log}
|
||||||
|
|
||||||
|
if [[ $1 ]]; then
|
||||||
|
if [[ $1 = -@(h|-help) ]]; then
|
||||||
|
printf 'usage: %s [pacman log]\n' "${0##*/}"
|
||||||
|
printf 'example: %s @localstatedir@/log/pacman.log\n' "${0##*/}"
|
||||||
|
printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
|
||||||
|
exit 0
|
||||||
|
elif [[ ! -e $logfile ]]; then
|
||||||
|
printf $"target not found: %s\n" "$1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
<"$logfile" awk '
|
||||||
|
{
|
||||||
|
action = $3
|
||||||
|
pkgname = $4
|
||||||
|
pkgver = $5
|
||||||
|
upgver = $7
|
||||||
|
}
|
||||||
|
|
||||||
|
NF == 5 && action == "installed" {
|
||||||
|
gsub(/[()]/, "", pkgver)
|
||||||
|
pkg[pkgname] = pkgver
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
NF == 7 && action == "upgraded" {
|
||||||
|
sub(/\)/, "", upgver)
|
||||||
|
pkg[pkgname] = upgver
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
NF == 5 && action == "removed" {
|
||||||
|
pkg[pkgname] = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
for (i in pkg) {
|
||||||
|
if (pkg[i] != -1) {
|
||||||
|
printf "%s %s\n",i,pkg[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' | sort
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
@@ -27,7 +27,7 @@ set -o errexit
|
|||||||
progname=$(basename $0)
|
progname=$(basename $0)
|
||||||
progver="0.4"
|
progver="0.4"
|
||||||
|
|
||||||
conf="/etc/pacman.conf"
|
conf="@sysconfdir@/pacman.conf"
|
||||||
|
|
||||||
if [ ! -r "$conf" ]; then
|
if [ ! -r "$conf" ]; then
|
||||||
echo "ERROR: unable to read $conf"
|
echo "ERROR: unable to read $conf"
|
||||||
@@ -36,8 +36,8 @@ fi
|
|||||||
|
|
||||||
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
|
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
|
||||||
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
|
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
|
||||||
pac_db="${DBPath:-/var/lib/pacman}/local"
|
pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
|
||||||
pac_cache="${CacheDir:-/var/cache/pacman/pkg}"
|
pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}"
|
||||||
|
|
||||||
error() {
|
error() {
|
||||||
local mesg=$1; shift
|
local mesg=$1; shift
|
||||||
@@ -61,7 +61,7 @@ spacman() {
|
|||||||
if [ $EUID -eq 0 ]; then
|
if [ $EUID -eq 0 ]; then
|
||||||
pacman "$@"
|
pacman "$@"
|
||||||
else
|
else
|
||||||
if [ ! "$(type -p sudo)" ]; then
|
if ! type -p sudo; then
|
||||||
error "Cannot find the sudo binary! Is sudo installed?"
|
error "Cannot find the sudo binary! Is sudo installed?"
|
||||||
error "Otherwise try to run the program as root"
|
error "Otherwise try to run the program as root"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
# pacsearch - Adds color and install information to a 'pacman -Ss' search
|
# pacsearch - Adds color and install information to a 'pacman -Ss' search
|
||||||
#
|
#
|
||||||
# Copyright (C) 2008, 2010 Dan McGee <dpmcgee@gmail.com>
|
# Copyright (C) 2008-2011 Dan McGee <dan@archlinux.org>
|
||||||
#
|
#
|
||||||
# Based off original shell script version:
|
# Based off original shell script version:
|
||||||
# Copyright (C) 2006-2007 Dan McGee <dpmcgee@gmail.com>
|
# Copyright (C) 2006-2007 Dan McGee <dan@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
@@ -39,7 +39,7 @@ if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
|
|||||||
|
|
||||||
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
|
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
|
||||||
print "$progname version $version\n";
|
print "$progname version $version\n";
|
||||||
print "Copyright (C) 2006-2010 Dan McGee\n";
|
print "Copyright (C) 2006-2011 Dan McGee\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +65,7 @@ sub to_color {
|
|||||||
$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
|
$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
|
||||||
$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
|
$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
|
||||||
$line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
|
$line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
|
||||||
|
$line =~ s/(^multilib\/.*)/$CLR6$1$BASE/;
|
||||||
$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
|
$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
|
||||||
# any other unknown repository
|
# any other unknown repository
|
||||||
$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
|
$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
|
||||||
@@ -86,6 +87,11 @@ my $cnt = 0;
|
|||||||
foreach $_ (@syncpkgs) {
|
foreach $_ (@syncpkgs) {
|
||||||
# we grab 4 fields here: repo, name/ver, installed, and desc
|
# we grab 4 fields here: repo, name/ver, installed, and desc
|
||||||
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
|
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
|
# since installed is optional, we should fill it in if necessary
|
||||||
$pkgfields[2] = "" if not defined $pkgfields[2];
|
$pkgfields[2] = "" if not defined $pkgfields[2];
|
||||||
# add a fifth field that indicates original order
|
# add a fifth field that indicates original order
|
||||||
@@ -105,6 +111,8 @@ if ($#querypkgs >= 0) {
|
|||||||
foreach $_ (@querypkgs) {
|
foreach $_ (@querypkgs) {
|
||||||
# we grab 4 fields here: repo, name/ver, installed, and desc
|
# we grab 4 fields here: repo, name/ver, installed, and desc
|
||||||
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
|
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
|
||||||
|
# skip any non-matching line
|
||||||
|
next if not defined $pkgfields[1];
|
||||||
# since installed is optional, we should fill it in if necessary
|
# since installed is optional, we should fill it in if necessary
|
||||||
$pkgfields[2] = "" if not defined $pkgfields[2];
|
$pkgfields[2] = "" if not defined $pkgfields[2];
|
||||||
# check if the package was listed in the sync out
|
# check if the package was listed in the sync out
|
||||||
50
contrib/pacsysclean.in
Executable file
50
contrib/pacsysclean.in
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# pacsysclean - Sort installed packages by decreasing installed size. Useful for system clean-up.
|
||||||
|
|
||||||
|
PACMAN_OPTS=
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "pacsysclean - Sort installed packages by decreasing installed size."
|
||||||
|
echo
|
||||||
|
echo "Usage: pacsysclean [options]"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -o <options> Specify custom pacman query options (e.g., dt)"
|
||||||
|
echo " -h, --help Show this help message and exit"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
case "$1" in
|
||||||
|
-o) PACMAN_OPTS="${2}" ;;
|
||||||
|
-h|--help) usage; exit 0 ;;
|
||||||
|
*) usage; exit 1 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
name="^Name.*: (.*)$"
|
||||||
|
size="^Installed Size.*: (.*) KiB$"
|
||||||
|
for line in $(LANG=C pacman -Qi $PACMAN_OPTS); do
|
||||||
|
if [[ $line =~ $name ]]; then
|
||||||
|
printf "%s\t" ${BASH_REMATCH[1]}
|
||||||
|
elif [[ $line =~ $size ]]; then
|
||||||
|
printf "%s\n" ${BASH_REMATCH[1]}
|
||||||
|
fi
|
||||||
|
done | sort -g -k2 | awk '
|
||||||
|
BEGIN {
|
||||||
|
split("KiB MiB GiB TiB PiB EiB ZiB YiB", suffix)
|
||||||
|
}
|
||||||
|
function format_size(size) {
|
||||||
|
count = 1
|
||||||
|
while (size + 0 > 1024) {
|
||||||
|
size /= 1024
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
sizestr = sprintf("%.2f %s", size, suffix[count])
|
||||||
|
return sizestr
|
||||||
|
}
|
||||||
|
{
|
||||||
|
printf("%s\t%s\n", format_size($2), $1);
|
||||||
|
}'
|
||||||
321
contrib/pactree
321
contrib/pactree
@@ -1,321 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# pactree : a simple dependency tree viewer
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Carlo "carlocci" Bersani <carlocci@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://carlocci.ngi.it/arch/pactree
|
|
||||||
# Credit to scj for the graphviz idea
|
|
||||||
|
|
||||||
# set the colors
|
|
||||||
branch1_color="\033[0;33m" #Brown
|
|
||||||
branch2_color="\033[0;37m" #Gray
|
|
||||||
leaf_color="\033[1;32m" #Light green
|
|
||||||
leaf2_color="\033[0;32m" #Green
|
|
||||||
|
|
||||||
# set the separators
|
|
||||||
separator=" "
|
|
||||||
branch_tip1="|--"
|
|
||||||
branch_tip2="+--"
|
|
||||||
provides="provides "
|
|
||||||
|
|
||||||
# set the graphviz options
|
|
||||||
# http://www.graphviz.org/doc/info/output.html for available output formats
|
|
||||||
# http://www.graphviz.org/doc/info/colors.html for available colors
|
|
||||||
gformat="png" #output format
|
|
||||||
start_color="red" #START color
|
|
||||||
nodes_color="green" #color of the nodes
|
|
||||||
arrow1_color="chocolate4" #color of the normal arrow
|
|
||||||
arrow2_color="grey" #color of the "provided by" headless arrow
|
|
||||||
|
|
||||||
readonly prog_name="pactree"
|
|
||||||
readonly prog_ver="0.3"
|
|
||||||
|
|
||||||
_usage(){
|
|
||||||
echo "This program generates the dependency tree of an installed package"
|
|
||||||
echo "Usage: $prog_name [OPTIONS] <installed packages>"
|
|
||||||
echo
|
|
||||||
echo " OPTIONS:"
|
|
||||||
echo " -c, --color Enable color output"
|
|
||||||
echo " -d, --depth INT Limit the shown dependencies depth"
|
|
||||||
echo " -g, --graph Use graphviz to make an image of the tree"
|
|
||||||
echo " -l, --linear Enable linear output"
|
|
||||||
echo " -r, --reversed Show reversed dependancies"
|
|
||||||
echo " -s, --silent Shh, let me hear those errors!"
|
|
||||||
echo " -u, --unique Print the dependency list with no duplicates"
|
|
||||||
echo
|
|
||||||
echo " -h, --help Print this help message"
|
|
||||||
echo " -v, --version Print the program name and version"
|
|
||||||
echo
|
|
||||||
echo "Example: $prog_name -c -d2 readline"
|
|
||||||
}
|
|
||||||
|
|
||||||
_version(){
|
|
||||||
echo "$prog_name version $prog_ver"
|
|
||||||
echo "Copyright (C) 2008 Carlo \"carlocci\" Bersani <carlocci@gmail.com>"
|
|
||||||
}
|
|
||||||
# end of the friendliness
|
|
||||||
|
|
||||||
|
|
||||||
# grab a field from the database: $1=path/to/file, $2=field to grab
|
|
||||||
_grabfield(){
|
|
||||||
for line in $(cat "$1" 2>/dev/null ); do
|
|
||||||
if [ -z "$line" ]; then
|
|
||||||
continue;
|
|
||||||
fi;
|
|
||||||
if [[ "$line" =~ %[A-Z]*% ]]; then
|
|
||||||
current="$line"
|
|
||||||
continue;
|
|
||||||
fi;
|
|
||||||
if [ "$current" = "$2" ]; then
|
|
||||||
echo "$line"
|
|
||||||
fi;
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# find a dep in the db: $1=dep, $2=field, $3=dbfile, ret=file list
|
|
||||||
_finddep(){
|
|
||||||
for line in $(awk 'BEGIN{RS=""}
|
|
||||||
{
|
|
||||||
if ($1=="'"$2"'"){
|
|
||||||
for (i=2 ; i<=NF ; ++i){
|
|
||||||
if ($i ~ /^'"$1"'([<>=]+.*|)$/ ){
|
|
||||||
print FILENAME}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}' $(find $pac_db -name $3)); do
|
|
||||||
echo "${line%/*}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Recursive function: does all of the work, pays all of the taxes #
|
|
||||||
_tree(){
|
|
||||||
pkg_name="$1"
|
|
||||||
pkg_dirs="$(echo $pac_db/$pkg_name-[0-9]*)"
|
|
||||||
|
|
||||||
# Is $pkg_name real or provided?
|
|
||||||
[ ! -d "$pkg_dirs" ] && pkg_dirs="$(_finddep $pkg_name %PROVIDES% depends)"
|
|
||||||
|
|
||||||
for pkg_dir in $pkg_dirs ; do
|
|
||||||
spaces="$2"
|
|
||||||
unset provided
|
|
||||||
branch_tip="$branch_tip1"
|
|
||||||
branch_color="$branch1_color"
|
|
||||||
pkg_name="$(_grabfield "$pkg_dir/desc" %NAME%)"
|
|
||||||
if [ ! "$pkg_name" = "$1" ]; then
|
|
||||||
provided="$leaf2_color $provides$leaf_color$1"
|
|
||||||
branch_tip="$branch_tip2"
|
|
||||||
branch_color="$branch2_color"
|
|
||||||
if [ $graphviz -eq 1 ] && [[ ! "${dep_list[@]}" =~ _$1_ ]] && [ $spaces -ne $((max_depth+1)) ]; then
|
|
||||||
echo "\"$1\" -> \"$pkg_name\" [arrowhead=none, color=$arrow2_color];"
|
|
||||||
dep_list=( "${dep_list[@]}" "_$1_" )
|
|
||||||
_tree "$pkg_name" $((spaces+1))
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate the spacer
|
|
||||||
spacer=""
|
|
||||||
for each in $(seq 1 $spaces); do
|
|
||||||
spacer="$spacer$separator"
|
|
||||||
done
|
|
||||||
spacer="$spacer$branch_tip"
|
|
||||||
|
|
||||||
[ $silent -ne 1 ] && echo -e "$branch_color$spacer$leaf_color$pkg_name$provided"
|
|
||||||
|
|
||||||
[ ! -d "$pkg_dir" ] && echo "No $pkg_name in the database (inconsistent database?)" >&2
|
|
||||||
|
|
||||||
if [[ ! " ${dep_list[@]} " =~ " $pkg_name " ]] && [ $spaces -ne $max_depth ]; then
|
|
||||||
dep_list=( "${dep_list[@]}" "$pkg_name" )
|
|
||||||
if [ $reversed_dep -eq 0 ]; then
|
|
||||||
deps_pkg="$(_grabfield "$pkg_dir/depends" %DEPENDS%)"
|
|
||||||
else
|
|
||||||
reqs_pkg_dir="$(_finddep "$pkg_name" %DEPENDS% depends)"
|
|
||||||
unset deps_pkg
|
|
||||||
for req_pkg_dir in $reqs_pkg_dir; do
|
|
||||||
deps_pkg=$(echo "$deps_pkg" "$(_grabfield "$req_pkg_dir/desc" %NAME%)")
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
for dep_pkg in $deps_pkg; do
|
|
||||||
spaces=$2 #Bash scoping ;_;
|
|
||||||
if [ $graphviz -eq 1 ]; then
|
|
||||||
echo "\"$1\" -> \"${dep_pkg%%[<>=]*}\" [color=$arrow1_color];"
|
|
||||||
fi
|
|
||||||
_tree "${dep_pkg%%[<>=]*}" $((spaces+1))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Main program: gets all of the money, pays none of the taxes
|
|
||||||
|
|
||||||
# Command line parameters parser
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
_usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
options=( "$@" )
|
|
||||||
len_options=${#options[@]}
|
|
||||||
for (( n=0 ; n < $len_options ; n++ )); do
|
|
||||||
if [ "${options[$n]}" = "--" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [ "${options[$n]}" = "-h" -o "${options[$n]}" = "--help" ]; then
|
|
||||||
_usage
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-v" -o "${options[$n]}" = "--version" ]; then
|
|
||||||
_version
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-l" -o "${options[$n]}" = "--linear" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
linear=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-s" -o "${options[$n]}" = "--silent" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
silent=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-u" -o "${options[$n]}" = "--unique" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
silent=1
|
|
||||||
nodup=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-g" -o "${options[$n]}" = "--graph" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
graphviz=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-c" -o "${options[$n]}" = "--color" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
colored=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${options[$n]}" = "-r" -o "${options[$n]}" = "--reversed" ]; then
|
|
||||||
unset options[$n]
|
|
||||||
reversed_dep=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${options[$n]}" =~ -d[[:digit:]]+ || "${options[$n]}" == "--depth" ]]; then
|
|
||||||
if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then
|
|
||||||
max_depth="${options[$n]#-d}"
|
|
||||||
elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then
|
|
||||||
max_depth="${options[$((n+1))]}"
|
|
||||||
unset options[$((n+1))]
|
|
||||||
((++n))
|
|
||||||
fi
|
|
||||||
unset options[$n]
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# End of the dumb command line parser
|
|
||||||
|
|
||||||
# Env
|
|
||||||
colored=${colored:-0}
|
|
||||||
max_depth=${max_depth:--10}
|
|
||||||
linear=${linear:-0}
|
|
||||||
silent=${silent:-0}
|
|
||||||
nodup=${nodup:-0}
|
|
||||||
graphviz=${graphviz:-0}
|
|
||||||
reversed_dep=${reversed_dep:-0}
|
|
||||||
|
|
||||||
if [ $colored -ne 1 ]; then
|
|
||||||
unset branch1_color
|
|
||||||
unset leaf_color
|
|
||||||
unset leaf2_color
|
|
||||||
unset branch2_color
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $linear -eq 1 ]; then
|
|
||||||
unset separator
|
|
||||||
unset branch_tip1
|
|
||||||
unset branch_tip2
|
|
||||||
unset provides
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $graphviz -eq 1 ]; then
|
|
||||||
silent=1
|
|
||||||
nodup=0
|
|
||||||
if [ ! -f /usr/bin/dot ]; then
|
|
||||||
echo "ERROR: package graphviz is not installed"
|
|
||||||
echo " Run pacman -S graphviz to install it"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -r /etc/pacman.conf ]; then
|
|
||||||
echo "ERROR: unable to read /etc/pacman.conf"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
|
|
||||||
fi
|
|
||||||
|
|
||||||
pac_db="${DBPath:-/var/lib/pacman}/local"
|
|
||||||
|
|
||||||
if [ ! -d "$pac_db" ] ; then
|
|
||||||
echo "ERROR: pacman database directory ${pac_db} not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Env End
|
|
||||||
|
|
||||||
|
|
||||||
# Program starts
|
|
||||||
_main(){
|
|
||||||
for pkg_name in ${options[@]} ; do
|
|
||||||
[ $graphviz -eq 1 ] && echo -e "\"START\" -> \"$pkg_name\" ;"
|
|
||||||
_tree "$pkg_name" 0
|
|
||||||
if [ $nodup -eq 1 ]; then
|
|
||||||
for pkg_tree in ${dep_list[@]} ; do
|
|
||||||
echo "$pkg_tree"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ $silent -eq 0 ]; then
|
|
||||||
echo -ne '\033[0m' # return colors to normal?
|
|
||||||
echo -ne '\033[?25h' #return cursor to normal?
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ $graphviz -eq 1 ]; then
|
|
||||||
root_pkgs="${options[@]}"
|
|
||||||
# Uncomment for the "generated by pactree" node in graphviz
|
|
||||||
#advert="xyz [height=0.07, fontsize=8.0, label=\"GENERATED WITH PACTREE\",shape=box,color="black",style=filled,fontcolor="white"];\n"
|
|
||||||
if [ $reversed_dep -eq 0 ]; then
|
|
||||||
file_extension="deps.$gformat"
|
|
||||||
else
|
|
||||||
file_extension="reqs.$gformat"
|
|
||||||
fi
|
|
||||||
echo -e "digraph G { START [color=$start_color, style=filled];\n node [style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o "${root_pkgs// /_}.$file_extension"
|
|
||||||
else _main
|
|
||||||
fi
|
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 noet:
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ -r "/etc/makepkg.conf" ]; then
|
|
||||||
source /etc/makepkg.conf
|
|
||||||
else
|
|
||||||
echo "wget-xdelta: Unable to find makepkg.conf"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -r ~/.makepkg.conf ]; then
|
|
||||||
source ~/.makepkg.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
out_file=$(basename $1)
|
|
||||||
file_url=$2
|
|
||||||
|
|
||||||
if ! [[ "$out_file" =~ "pkg.tar.gz" ]]; then
|
|
||||||
# If it's not a package file download as normal and exit.
|
|
||||||
#wget --passive-ftp -c -O "$out_file" "$file_url"
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Get the package name and version
|
|
||||||
[[ "$out_file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
|
|
||||||
pkg_data=$(echo $out_file | \
|
|
||||||
sed "s|^\(.*\)-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}${PKGEXT}.part|\1 \2|")
|
|
||||||
pkgname=$(echo $pkg_data | cut -d ' ' -f 1)
|
|
||||||
new_version=$(echo $pkg_data | cut -d ' ' -f 2)
|
|
||||||
base_url=${file_url%/*}
|
|
||||||
|
|
||||||
# Look for the last version
|
|
||||||
for file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
|
|
||||||
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
|
|
||||||
check_version=$(echo $file | \
|
|
||||||
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
|
|
||||||
grep -v "^/var/cache/pacman/pkg")
|
|
||||||
|
|
||||||
[ "$check_version" = "" ] && continue
|
|
||||||
|
|
||||||
vercmp=$(vercmp "$check_version" "$old_version")
|
|
||||||
if [ "$check_version" != "$new_version" -a $vercmp -gt 0 ]; then
|
|
||||||
old_version=$check_version
|
|
||||||
old_file=$file
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$old_version" != "" -a "$old_version" != "$new_version" ]; then
|
|
||||||
# Great, we have a cached file, now calculate a patch name from it
|
|
||||||
delta_name="$pkgname-${old_version}_to_${new_version}-${CARCH}.delta"
|
|
||||||
|
|
||||||
echo "wget-xdelta: Attempting to download delta $delta_name..." >&2
|
|
||||||
if wget --passive-ftp -c "$base_url/$delta_name"; then
|
|
||||||
echo "wget-xdelta: Applying delta..."
|
|
||||||
if xdelta patch "$delta_name" "$old_file" "$out_file"; then
|
|
||||||
echo "wget-xdelta: Delta applied successfully!"
|
|
||||||
rm "$delta_name"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "wget-xdelta: Failed to apply delta!"
|
|
||||||
rm $delta_name
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "wget-xdelta: Downloading new package..."
|
|
||||||
wget --passive-ftp -c -O "$out_file" "$file_url"
|
|
||||||
exit $?
|
|
||||||
|
|
||||||
# vim:set ts=4 sw=4 noet:
|
|
||||||
@@ -33,7 +33,10 @@ _pacman_opts_common=(
|
|||||||
_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.*(.)"'
|
'--dbonly[Only remove database entry, do not remove files]'
|
||||||
|
'--needed[Do not reinstall up to date packages]'
|
||||||
|
'--recursive[Reinstall all dependencies of target packages]'
|
||||||
|
'*:package file:_files -g "*.pkg.tar*(.)"'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: subactions for --query command
|
# options for passing to _arguments: subactions for --query command
|
||||||
@@ -62,9 +65,9 @@ _pacman_opts_query_modifiers=(
|
|||||||
_pacman_opts_remove=(
|
_pacman_opts_remove=(
|
||||||
'-c[Remove all dependent packages]'
|
'-c[Remove all dependent packages]'
|
||||||
'-d[Skip dependency checks]'
|
'-d[Skip dependency checks]'
|
||||||
'-k[Only remove database entry, do not remove files]'
|
|
||||||
'-n[Remove protected configuration files]'
|
'-n[Remove protected configuration files]'
|
||||||
'-s[Remove dependencies not required by other packages]'
|
'-s[Remove dependencies not required by other packages]'
|
||||||
|
'--dbonly[Only remove database entry, do not remove files]'
|
||||||
'*:installed package:_pacman_completions_installed_packages'
|
'*:installed package:_pacman_completions_installed_packages'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,6 +77,9 @@ _pacman_opts_sync_actions=(
|
|||||||
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
|
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
|
||||||
'-g[View all members of a package group]:*:package groups:->sync_group'
|
'-g[View all members of a package group]:*:package groups:->sync_group'
|
||||||
'-s[Search package names and descriptions]:*:search text:->sync_search'
|
'-s[Search package names and descriptions]:*:search text:->sync_search'
|
||||||
|
'--dbonly[Only remove database entry, do not remove files]'
|
||||||
|
'--needed[Do not reinstall up to date packages]'
|
||||||
|
'--recursive[Reinstall all dependencies of target packages]'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: options for --sync command
|
# options for passing to _arguments: options for --sync command
|
||||||
@@ -110,18 +116,18 @@ _pacman_action_none() {
|
|||||||
_pacman_action_query() {
|
_pacman_action_query() {
|
||||||
local context state line
|
local context state line
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
|
||||||
# _arguments -s : \
|
# _arguments -s : \
|
||||||
# "$_pacman_opts_common[@]" \
|
# "$_pacman_opts_common[@]" \
|
||||||
# "$_pacman_opts_query_actions[@]" \
|
# "$_pacman_opts_query_actions[@]" \
|
||||||
# "$_pacman_opts_query_modifiers[@]"
|
# "$_pacman_opts_query_modifiers[@]"
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
query_file)
|
query_file)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:package file:_files -g "*.pkg.tar.*"'
|
'*:package file:_files -g "*.pkg.tar*"'
|
||||||
;;
|
;;
|
||||||
query_group)
|
query_group)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
@@ -162,12 +168,12 @@ _pacman_action_remove() {
|
|||||||
_pacman_action_sync() {
|
_pacman_action_sync() {
|
||||||
local context state line
|
local context state line
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
|
||||||
# _arguments -s : \
|
# _arguments -s : \
|
||||||
# "$_pacman_opts_common[@]" \
|
# "$_pacman_opts_common[@]" \
|
||||||
# "$_pacman_opts_sync_actions[@]" #\
|
# "$_pacman_opts_sync_actions[@]" #\
|
||||||
# #"$_pacman_opts_sync_modifiers[@]"
|
# #"$_pacman_opts_sync_modifiers[@]"
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
sync_clean)
|
sync_clean)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
@@ -214,6 +220,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,23 +228,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +249,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
|
||||||
}
|
}
|
||||||
@@ -253,15 +257,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
|
||||||
@@ -272,7 +276,7 @@ _pacman_completions_repositories() {
|
|||||||
# $cmd must be declared by calling function
|
# $cmd must be declared by calling function
|
||||||
_pacman_get_command() {
|
_pacman_get_command() {
|
||||||
# this is mostly nicked from _perforce
|
# this is mostly nicked from _perforce
|
||||||
cmd=( "pacman" )
|
cmd=( "pacman" "2>/dev/null")
|
||||||
integer i
|
integer i
|
||||||
for (( i = 2; i < CURRENT - 1; i++ )); do
|
for (( i = 2; i < CURRENT - 1; i++ )); do
|
||||||
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
|
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
|
||||||
@@ -296,11 +300,11 @@ _pacman() {
|
|||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:package file:_files'
|
'*:package file:_files'
|
||||||
;;
|
;;
|
||||||
-Q*p*) # file *.pkg.tar.*
|
-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.*"'
|
'*: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:
|
||||||
|
|||||||
7
doc/.gitignore
vendored
7
doc/.gitignore
vendored
@@ -3,10 +3,15 @@ libalpm.3
|
|||||||
makepkg.8
|
makepkg.8
|
||||||
makepkg.conf.5
|
makepkg.conf.5
|
||||||
pacman.8
|
pacman.8
|
||||||
|
pacman-key.8
|
||||||
pacman.conf.5
|
pacman.conf.5
|
||||||
|
pkgdelta.8
|
||||||
repo-add.8
|
repo-add.8
|
||||||
repo-remove.8
|
repo-remove.8
|
||||||
*.css
|
vercmp.8
|
||||||
|
asciidoc-manpage.css
|
||||||
|
asciidoc.css
|
||||||
|
asciidoc.js
|
||||||
*.html
|
*.html
|
||||||
*.xml
|
*.xml
|
||||||
man3
|
man3
|
||||||
|
|||||||
143
doc/Doxyfile
143
doc/Doxyfile
@@ -1,11 +1,13 @@
|
|||||||
# Doxyfile 1.5.5
|
# Doxyfile 1.7.5.1
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = libalpm
|
PROJECT_NAME = libalpm
|
||||||
PROJECT_NUMBER =
|
PROJECT_NUMBER =
|
||||||
|
PROJECT_BRIEF = "Arch Linux Package Manager Library"
|
||||||
|
PROJECT_LOGO =
|
||||||
OUTPUT_DIRECTORY = ./
|
OUTPUT_DIRECTORY = ./
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
@@ -25,27 +27,31 @@ ABBREVIATE_BRIEF = "The $name class" \
|
|||||||
ALWAYS_DETAILED_SEC = YES
|
ALWAYS_DETAILED_SEC = YES
|
||||||
INLINE_INHERITED_MEMB = NO
|
INLINE_INHERITED_MEMB = NO
|
||||||
FULL_PATH_NAMES = NO
|
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 = YES
|
JAVADOC_AUTOBRIEF = YES
|
||||||
QT_AUTOBRIEF = NO
|
QT_AUTOBRIEF = NO
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
DETAILS_AT_TOP = NO
|
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = YES
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
TAB_SIZE = 4
|
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_FOR_FORTRAN = NO
|
||||||
OPTIMIZE_OUTPUT_VHDL = NO
|
OPTIMIZE_OUTPUT_VHDL = NO
|
||||||
|
EXTENSION_MAPPING =
|
||||||
BUILTIN_STL_SUPPORT = NO
|
BUILTIN_STL_SUPPORT = NO
|
||||||
CPP_CLI_SUPPORT = NO
|
CPP_CLI_SUPPORT = NO
|
||||||
SIP_SUPPORT = NO
|
SIP_SUPPORT = NO
|
||||||
|
IDL_PROPERTY_SUPPORT = YES
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
DISTRIBUTE_GROUP_DOC = NO
|
||||||
SUBGROUPING = YES
|
SUBGROUPING = YES
|
||||||
|
INLINE_GROUPED_CLASSES = NO
|
||||||
|
INLINE_SIMPLE_STRUCTS = NO
|
||||||
TYPEDEF_HIDES_STRUCT = NO
|
TYPEDEF_HIDES_STRUCT = NO
|
||||||
|
SYMBOL_CACHE_SIZE = 0
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -63,20 +69,27 @@ INTERNAL_DOCS = NO
|
|||||||
CASE_SENSE_NAMES = YES
|
CASE_SENSE_NAMES = YES
|
||||||
HIDE_SCOPE_NAMES = NO
|
HIDE_SCOPE_NAMES = NO
|
||||||
SHOW_INCLUDE_FILES = YES
|
SHOW_INCLUDE_FILES = YES
|
||||||
|
FORCE_LOCAL_INCLUDES = NO
|
||||||
INLINE_INFO = YES
|
INLINE_INFO = YES
|
||||||
SORT_MEMBER_DOCS = YES
|
SORT_MEMBER_DOCS = YES
|
||||||
SORT_BRIEF_DOCS = NO
|
SORT_BRIEF_DOCS = NO
|
||||||
|
SORT_MEMBERS_CTORS_1ST = NO
|
||||||
SORT_GROUP_NAMES = NO
|
SORT_GROUP_NAMES = NO
|
||||||
SORT_BY_SCOPE_NAME = NO
|
SORT_BY_SCOPE_NAME = NO
|
||||||
|
STRICT_PROTO_MATCHING = NO
|
||||||
GENERATE_TODOLIST = YES
|
GENERATE_TODOLIST = YES
|
||||||
GENERATE_TESTLIST = YES
|
GENERATE_TESTLIST = YES
|
||||||
GENERATE_BUGLIST = YES
|
GENERATE_BUGLIST = YES
|
||||||
GENERATE_DEPRECATEDLIST= YES
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
SHOW_DIRECTORIES = NO
|
SHOW_DIRECTORIES = NO
|
||||||
FILE_VERSION_FILTER =
|
SHOW_FILES = YES
|
||||||
|
SHOW_NAMESPACES = YES
|
||||||
|
FILE_VERSION_FILTER =
|
||||||
|
LAYOUT_FILE =
|
||||||
|
CITE_BIB_FILES =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to warning and progress messages
|
# configuration options related to warning and progress messages
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -86,25 +99,26 @@ WARN_IF_UNDOCUMENTED = YES
|
|||||||
WARN_IF_DOC_ERROR = YES
|
WARN_IF_DOC_ERROR = YES
|
||||||
WARN_NO_PARAMDOC = NO
|
WARN_NO_PARAMDOC = NO
|
||||||
WARN_FORMAT = "$file:$line: $text"
|
WARN_FORMAT = "$file:$line: $text"
|
||||||
WARN_LOGFILE =
|
WARN_LOGFILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the input files
|
# configuration options related to the input files
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
INPUT = ../lib/libalpm/
|
INPUT = ../lib/libalpm/
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
FILE_PATTERNS =
|
FILE_PATTERNS =
|
||||||
RECURSIVE = NO
|
RECURSIVE = NO
|
||||||
EXCLUDE =
|
EXCLUDE =
|
||||||
EXCLUDE_SYMLINKS = NO
|
EXCLUDE_SYMLINKS = NO
|
||||||
EXCLUDE_PATTERNS =
|
EXCLUDE_PATTERNS =
|
||||||
EXCLUDE_SYMBOLS =
|
EXCLUDE_SYMBOLS =
|
||||||
EXAMPLE_PATH =
|
EXAMPLE_PATH =
|
||||||
EXAMPLE_PATTERNS = *
|
EXAMPLE_PATTERNS = *
|
||||||
EXAMPLE_RECURSIVE = NO
|
EXAMPLE_RECURSIVE = NO
|
||||||
IMAGE_PATH =
|
IMAGE_PATH =
|
||||||
INPUT_FILTER =
|
INPUT_FILTER =
|
||||||
FILTER_PATTERNS =
|
FILTER_PATTERNS =
|
||||||
FILTER_SOURCE_FILES = NO
|
FILTER_SOURCE_FILES = NO
|
||||||
|
FILTER_SOURCE_PATTERNS =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to source browsing
|
# configuration options related to source browsing
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -121,31 +135,58 @@ VERBATIM_HEADERS = YES
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
ALPHABETICAL_INDEX = NO
|
ALPHABETICAL_INDEX = NO
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
IGNORE_PREFIX =
|
IGNORE_PREFIX =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the HTML output
|
# configuration options related to the HTML output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
GENERATE_HTML = NO
|
GENERATE_HTML = NO
|
||||||
HTML_OUTPUT = html
|
HTML_OUTPUT = html
|
||||||
HTML_FILE_EXTENSION = .html
|
HTML_FILE_EXTENSION = .html
|
||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER =
|
HTML_FOOTER =
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
HTML_EXTRA_FILES =
|
||||||
|
HTML_COLORSTYLE_HUE = 220
|
||||||
|
HTML_COLORSTYLE_SAT = 100
|
||||||
|
HTML_COLORSTYLE_GAMMA = 80
|
||||||
|
HTML_TIMESTAMP = YES
|
||||||
HTML_ALIGN_MEMBERS = YES
|
HTML_ALIGN_MEMBERS = YES
|
||||||
GENERATE_HTMLHELP = NO
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
GENERATE_DOCSET = NO
|
GENERATE_DOCSET = NO
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||||
CHM_FILE =
|
DOCSET_PUBLISHER_NAME = Publisher
|
||||||
HHC_LOCATION =
|
GENERATE_HTMLHELP = NO
|
||||||
|
CHM_FILE =
|
||||||
|
HHC_LOCATION =
|
||||||
GENERATE_CHI = NO
|
GENERATE_CHI = NO
|
||||||
|
CHM_INDEX_ENCODING =
|
||||||
BINARY_TOC = NO
|
BINARY_TOC = NO
|
||||||
TOC_EXPAND = NO
|
TOC_EXPAND = NO
|
||||||
|
GENERATE_QHP = NO
|
||||||
|
QCH_FILE =
|
||||||
|
QHP_NAMESPACE = org.doxygen.Project
|
||||||
|
QHP_VIRTUAL_FOLDER = doc
|
||||||
|
QHP_CUST_FILTER_NAME =
|
||||||
|
QHP_CUST_FILTER_ATTRS =
|
||||||
|
QHP_SECT_FILTER_ATTRS =
|
||||||
|
QHG_LOCATION =
|
||||||
|
GENERATE_ECLIPSEHELP = NO
|
||||||
|
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||||
DISABLE_INDEX = NO
|
DISABLE_INDEX = NO
|
||||||
ENUM_VALUES_PER_LINE = 4
|
ENUM_VALUES_PER_LINE = 4
|
||||||
GENERATE_TREEVIEW = NO
|
GENERATE_TREEVIEW = NO
|
||||||
|
USE_INLINE_TREES = NO
|
||||||
TREEVIEW_WIDTH = 250
|
TREEVIEW_WIDTH = 250
|
||||||
|
EXT_LINKS_IN_WINDOW = NO
|
||||||
|
FORMULA_FONTSIZE = 10
|
||||||
|
FORMULA_TRANSPARENT = YES
|
||||||
|
USE_MATHJAX = NO
|
||||||
|
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
||||||
|
MATHJAX_EXTENSIONS =
|
||||||
|
SEARCHENGINE = NO
|
||||||
|
SERVER_BASED_SEARCH = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the LaTeX output
|
# configuration options related to the LaTeX output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -154,13 +195,16 @@ LATEX_OUTPUT = latex
|
|||||||
LATEX_CMD_NAME = latex
|
LATEX_CMD_NAME = latex
|
||||||
MAKEINDEX_CMD_NAME = makeindex
|
MAKEINDEX_CMD_NAME = makeindex
|
||||||
COMPACT_LATEX = NO
|
COMPACT_LATEX = NO
|
||||||
PAPER_TYPE = a4wide
|
PAPER_TYPE = letter
|
||||||
EXTRA_PACKAGES =
|
EXTRA_PACKAGES =
|
||||||
LATEX_HEADER =
|
LATEX_HEADER =
|
||||||
|
LATEX_FOOTER =
|
||||||
PDF_HYPERLINKS = NO
|
PDF_HYPERLINKS = NO
|
||||||
USE_PDFLATEX = NO
|
USE_PDFLATEX = NO
|
||||||
LATEX_BATCHMODE = NO
|
LATEX_BATCHMODE = NO
|
||||||
LATEX_HIDE_INDICES = NO
|
LATEX_HIDE_INDICES = NO
|
||||||
|
LATEX_SOURCE_CODE = NO
|
||||||
|
LATEX_BIB_STYLE = plain
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the RTF output
|
# configuration options related to the RTF output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -168,8 +212,8 @@ GENERATE_RTF = NO
|
|||||||
RTF_OUTPUT = rtf
|
RTF_OUTPUT = rtf
|
||||||
COMPACT_RTF = NO
|
COMPACT_RTF = NO
|
||||||
RTF_HYPERLINKS = NO
|
RTF_HYPERLINKS = NO
|
||||||
RTF_STYLESHEET_FILE =
|
RTF_STYLESHEET_FILE =
|
||||||
RTF_EXTENSIONS_FILE =
|
RTF_EXTENSIONS_FILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the man page output
|
# configuration options related to the man page output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -182,8 +226,8 @@ MAN_LINKS = NO
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
GENERATE_XML = NO
|
GENERATE_XML = NO
|
||||||
XML_OUTPUT = xml
|
XML_OUTPUT = xml
|
||||||
XML_SCHEMA =
|
XML_SCHEMA =
|
||||||
XML_DTD =
|
XML_DTD =
|
||||||
XML_PROGRAMLISTING = YES
|
XML_PROGRAMLISTING = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options for the AutoGen Definitions output
|
# configuration options for the AutoGen Definitions output
|
||||||
@@ -195,9 +239,9 @@ GENERATE_AUTOGEN_DEF = NO
|
|||||||
GENERATE_PERLMOD = NO
|
GENERATE_PERLMOD = NO
|
||||||
PERLMOD_LATEX = NO
|
PERLMOD_LATEX = NO
|
||||||
PERLMOD_PRETTY = YES
|
PERLMOD_PRETTY = YES
|
||||||
PERLMOD_MAKEVAR_PREFIX =
|
PERLMOD_MAKEVAR_PREFIX =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the preprocessor
|
# Configuration options related to the preprocessor
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
ENABLE_PREPROCESSING = YES
|
ENABLE_PREPROCESSING = YES
|
||||||
MACRO_EXPANSION = YES
|
MACRO_EXPANSION = YES
|
||||||
@@ -207,24 +251,31 @@ INCLUDE_PATH = ../..
|
|||||||
INCLUDE_FILE_PATTERNS = *.h
|
INCLUDE_FILE_PATTERNS = *.h
|
||||||
PREDEFINED = HAVE_CONFIG_H= \
|
PREDEFINED = HAVE_CONFIG_H= \
|
||||||
SYMHIDDEN= \
|
SYMHIDDEN= \
|
||||||
SYMEXPORT=
|
SYMEXPORT= \
|
||||||
EXPAND_AS_DEFINED =
|
HAVE_LIBARCHIVE \
|
||||||
|
HAVE_LIBCURL \
|
||||||
|
HAVE_LIBGPGME
|
||||||
|
EXPAND_AS_DEFINED =
|
||||||
SKIP_FUNCTION_MACROS = YES
|
SKIP_FUNCTION_MACROS = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration::additions related to external references
|
# Configuration::additions related to external references
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
TAGFILES =
|
TAGFILES =
|
||||||
GENERATE_TAGFILE =
|
GENERATE_TAGFILE =
|
||||||
ALLEXTERNALS = NO
|
ALLEXTERNALS = NO
|
||||||
EXTERNAL_GROUPS = YES
|
EXTERNAL_GROUPS = YES
|
||||||
PERL_PATH = /usr/bin/perl
|
PERL_PATH = /usr/bin/perl
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the dot tool
|
# Configuration options related to the dot tool
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
CLASS_DIAGRAMS = NO
|
CLASS_DIAGRAMS = NO
|
||||||
MSCGEN_PATH =
|
MSCGEN_PATH =
|
||||||
HIDE_UNDOC_RELATIONS = YES
|
HIDE_UNDOC_RELATIONS = YES
|
||||||
HAVE_DOT = YES
|
HAVE_DOT = YES
|
||||||
|
DOT_NUM_THREADS = 0
|
||||||
|
DOT_FONTNAME = Helvetica
|
||||||
|
DOT_FONTSIZE = 10
|
||||||
|
DOT_FONTPATH =
|
||||||
CLASS_GRAPH = YES
|
CLASS_GRAPH = YES
|
||||||
COLLABORATION_GRAPH = YES
|
COLLABORATION_GRAPH = YES
|
||||||
GROUP_GRAPHS = YES
|
GROUP_GRAPHS = YES
|
||||||
@@ -237,15 +288,13 @@ CALLER_GRAPH = NO
|
|||||||
GRAPHICAL_HIERARCHY = YES
|
GRAPHICAL_HIERARCHY = YES
|
||||||
DIRECTORY_GRAPH = YES
|
DIRECTORY_GRAPH = YES
|
||||||
DOT_IMAGE_FORMAT = png
|
DOT_IMAGE_FORMAT = png
|
||||||
DOT_PATH =
|
INTERACTIVE_SVG = NO
|
||||||
DOTFILE_DIRS =
|
DOT_PATH =
|
||||||
|
DOTFILE_DIRS =
|
||||||
|
MSCFILE_DIRS =
|
||||||
DOT_GRAPH_MAX_NODES = 50
|
DOT_GRAPH_MAX_NODES = 50
|
||||||
MAX_DOT_GRAPH_DEPTH = 3
|
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
|
||||||
DOT_CLEANUP = YES
|
DOT_CLEANUP = YES
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration::additions related to the search engine
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
SEARCHENGINE = NO
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ ASCIIDOC_MANS = \
|
|||||||
pacman.8 \
|
pacman.8 \
|
||||||
makepkg.8 \
|
makepkg.8 \
|
||||||
repo-add.8 \
|
repo-add.8 \
|
||||||
|
vercmp.8 \
|
||||||
|
pkgdelta.8 \
|
||||||
|
pacman-key.8 \
|
||||||
PKGBUILD.5 \
|
PKGBUILD.5 \
|
||||||
makepkg.conf.5 \
|
makepkg.conf.5 \
|
||||||
pacman.conf.5 \
|
pacman.conf.5 \
|
||||||
@@ -18,6 +21,9 @@ HTML_MANPAGES = \
|
|||||||
pacman.8.html \
|
pacman.8.html \
|
||||||
makepkg.8.html \
|
makepkg.8.html \
|
||||||
repo-add.8.html \
|
repo-add.8.html \
|
||||||
|
vercmp.8.html \
|
||||||
|
pkgdelta.8.html \
|
||||||
|
pacman-key.8.html \
|
||||||
PKGBUILD.5.html \
|
PKGBUILD.5.html \
|
||||||
makepkg.conf.5.html \
|
makepkg.conf.5.html \
|
||||||
pacman.conf.5.html \
|
pacman.conf.5.html \
|
||||||
@@ -35,9 +41,13 @@ HTML_DOCS = \
|
|||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
asciidoc.conf \
|
asciidoc.conf \
|
||||||
|
asciidoc-override.css \
|
||||||
pacman.8.txt \
|
pacman.8.txt \
|
||||||
makepkg.8.txt \
|
makepkg.8.txt \
|
||||||
repo-add.8.txt \
|
repo-add.8.txt \
|
||||||
|
vercmp.8.txt \
|
||||||
|
pkgdelta.8.txt \
|
||||||
|
pacman-key.8.txt \
|
||||||
PKGBUILD.5.txt \
|
PKGBUILD.5.txt \
|
||||||
PKGBUILD-example.txt \
|
PKGBUILD-example.txt \
|
||||||
makepkg.conf.5.txt \
|
makepkg.conf.5.txt \
|
||||||
@@ -60,14 +70,14 @@ dist-hook:
|
|||||||
$(MAKE) $(AM_MAKEFLAGS) all
|
$(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
|
||||||
if USE_GIT_VERSION
|
if USE_GIT_VERSION
|
||||||
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 | sed s/^v//')-dirty
|
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
|
||||||
REAL_PACKAGE_VERSION = $(GIT_VERSION)
|
REAL_PACKAGE_VERSION = $(GIT_VERSION)
|
||||||
else
|
else
|
||||||
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
|
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
man_MANS =
|
man_MANS =
|
||||||
dist_man_MANS = $(ASCIIDOC_MANS) repo-remove.8
|
dist_man_MANS = $(ASCIIDOC_MANS)
|
||||||
|
|
||||||
if USE_DOXYGEN
|
if USE_DOXYGEN
|
||||||
man_MANS += $(DOXYGEN_MANS)
|
man_MANS += $(DOXYGEN_MANS)
|
||||||
@@ -82,31 +92,34 @@ html: $(HTML_DOCS)
|
|||||||
|
|
||||||
website: html
|
website: html
|
||||||
bsdtar czf website.tar.gz $(HTML_DOCS) \
|
bsdtar czf website.tar.gz $(HTML_DOCS) \
|
||||||
|
asciidoc-override.css \
|
||||||
-C /etc/asciidoc/stylesheets/ \
|
-C /etc/asciidoc/stylesheets/ \
|
||||||
xhtml11.css xhtml11-manpage.css xhtml11-quirks.css \
|
asciidoc.css \
|
||||||
-C /etc/asciidoc/javascripts/ \
|
-C /etc/asciidoc/javascripts/ \
|
||||||
asciidoc-xhtml11.js \
|
asciidoc.js \
|
||||||
-C /etc/asciidoc/ \
|
-C /etc/asciidoc/ \
|
||||||
images
|
images
|
||||||
|
|
||||||
pkgdatadir = ${datadir}/${PACKAGE}
|
pkgdatadir = ${datadir}/${PACKAGE}
|
||||||
|
|
||||||
ASCIIDOC_OPTS = \
|
ASCIIDOC_OPTS = \
|
||||||
-f asciidoc.conf \
|
-f $(srcdir)/asciidoc.conf \
|
||||||
-a pacman_version="$(REAL_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 pkgdatadir=$(pkgdatadir) \
|
||||||
|
-a localstatedir=$(localstatedir) \
|
||||||
-a sysconfdir=$(sysconfdir)
|
-a sysconfdir=$(sysconfdir)
|
||||||
|
|
||||||
A2X_OPTS = \
|
A2X_OPTS = \
|
||||||
--no-xmllint \
|
--no-xmllint \
|
||||||
-d manpage \
|
-d manpage \
|
||||||
-f manpage \
|
-f manpage \
|
||||||
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
|
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0' \
|
||||||
|
--destination-dir='./'
|
||||||
|
|
||||||
# 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 Makefile.am
|
||||||
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt
|
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt
|
||||||
|
|
||||||
%.html: %.txt
|
%.html: %.txt
|
||||||
asciidoc $(ASCIIDOC_OPTS) $*.txt
|
asciidoc $(ASCIIDOC_OPTS) $*.txt
|
||||||
@@ -117,9 +130,9 @@ HACKING.html: ../HACKING
|
|||||||
dos2unix $@
|
dos2unix $@
|
||||||
|
|
||||||
# Customizations for certain HTML docs
|
# Customizations for certain HTML docs
|
||||||
$(HTML_MANPAGES): asciidoc.conf footer.txt
|
$(HTML_MANPAGES): asciidoc.conf footer.txt Makefile.am
|
||||||
$(HTML_OTHER): asciidoc.conf
|
$(HTML_OTHER): asciidoc.conf Makefile.am
|
||||||
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons
|
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons -a max-width=960px -a stylesheet=asciidoc-override.css
|
||||||
%.8.html: ASCIIDOC_OPTS += -d manpage
|
%.8.html: ASCIIDOC_OPTS += -d manpage
|
||||||
%.5.html: ASCIIDOC_OPTS += -d manpage
|
%.5.html: ASCIIDOC_OPTS += -d manpage
|
||||||
%.3.html: ASCIIDOC_OPTS += -d manpage
|
%.3.html: ASCIIDOC_OPTS += -d manpage
|
||||||
@@ -128,13 +141,26 @@ $(HTML_OTHER): asciidoc.conf
|
|||||||
pacman.8 pacman.8.html: pacman.8.txt
|
pacman.8 pacman.8.html: pacman.8.txt
|
||||||
makepkg.8 makepkg.8.html: makepkg.8.txt
|
makepkg.8 makepkg.8.html: makepkg.8.txt
|
||||||
repo-add.8 repo-add.8.html: repo-add.8.txt
|
repo-add.8 repo-add.8.html: repo-add.8.txt
|
||||||
|
vercmp.8 vercmp.8.html: vercmp.8.txt
|
||||||
|
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.txt
|
||||||
|
pacman-key.8 pacman-key.8.html: pacman-key.8.txt
|
||||||
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.txt PKGBUILD-example.txt
|
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.txt PKGBUILD-example.txt
|
||||||
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.txt
|
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.txt
|
||||||
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.txt
|
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.txt
|
||||||
libalpm.3 libalpm.3.html: libalpm.3.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
|
||||||
rm -f repo-remove.8
|
$(RM) repo-remove.8
|
||||||
$(LN_S) repo-add.8 repo-remove.8
|
$(LN_S) repo-add.8 repo-remove.8
|
||||||
|
|
||||||
|
install-data-hook:
|
||||||
|
cd $(DESTDIR)$(mandir)/man8 && \
|
||||||
|
$(RM) repo-remove.8 && \
|
||||||
|
( $(LN_S) repo-add.8 repo-remove.8 || \
|
||||||
|
ln repo-add.8 repo-remove.8 || \
|
||||||
|
cp repo-add.8 repo-remove.8 )
|
||||||
|
|
||||||
|
uninstall-hook:
|
||||||
|
$(RM) $(DESTDIR)$(mandir)/man8/repo-remove.8
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
|
|||||||
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
|
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd $srcdir/$pkgname-$pkgver
|
cd "$srcdir"/$pkgname-$pkgver
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make prefix=$pkgdir/usr install
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir"/$pkgname-$pkgver
|
||||||
|
make prefix="$pkgdir"/usr install
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
PKGBUILD(5)
|
PKGBUILD(5)
|
||||||
===========
|
===========
|
||||||
@@ -16,12 +16,12 @@ PKGBUILD
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
This manual page is meant to describe general rules about PKGBUILDs. Once a
|
This manual page describes 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: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'.
|
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'
|
||||||
Also located there are other example files such as a ChangeLog and an install
|
along with other example files such as a ChangeLog and an install
|
||||||
script. You can copy the provided PKGBUILD.proto file to a new package build
|
script. You can copy the provided PKGBUILD.proto file to a new package build
|
||||||
directory and make customizations to suit your needs.
|
directory and make customizations to suit your needs.
|
||||||
|
|
||||||
@@ -30,86 +30,98 @@ Options and Directives
|
|||||||
----------------------
|
----------------------
|
||||||
The following is a list of standard options and directives available for use
|
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
|
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
|
||||||
will be directly transferred to the built package.
|
of them will be directly transferred to the built package.
|
||||||
|
|
||||||
If you need to create any custom variables for use in your build process, it is
|
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.
|
recommended to prefix their name with an '_' (underscore).
|
||||||
This will prevent any possible name clashes with internal makepkg variables.
|
This will prevent any possible name clashes with internal makepkg variables.
|
||||||
For example, to store the base kernel version in a variable, use something
|
For example, to store the base kernel version in a variable, use something
|
||||||
similar to `$_basekernver`.
|
similar to `$_basekernver`.
|
||||||
|
|
||||||
*pkgname (array)*::
|
*pkgname (array)*::
|
||||||
The name of the package. This has be a unix-friendly name as it will be
|
Either the name of the package or an array of names for split packages.
|
||||||
used in the package filename. Members of the array are not allowed to start
|
Because it will be used in the package filename, this has to be unix-friendly.
|
||||||
with hyphens.
|
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 hyphens.
|
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. This is typically set to '1' for each new upstream
|
||||||
software release and is incremented for intermediate PKGBUILD updates. The
|
software release and incremented for intermediate PKGBUILD updates. The
|
||||||
variable is not allowed to contain hyphens.
|
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 and not use the package's name.
|
||||||
|
|
||||||
|
*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. Typically the project's website.
|
||||||
|
|
||||||
*license (array)*::
|
*license (array)*::
|
||||||
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 can be 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
|
available in '/usr/share/licenses/common', then you should include it
|
||||||
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, 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*::
|
*changelog*::
|
||||||
Specifies a changelog file that is to be included in the package.
|
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
|
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. `changelog=$pkgname.changelog`).
|
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
|
||||||
must either reside in the same directory as the PKGBUILD file, or be a
|
must either reside in the same directory as the PKGBUILD, or be a
|
||||||
fully-qualified URL that makepkg will use to download the file. In order
|
fully-qualified URL that makepkg can use to download the file.
|
||||||
to make the PKGBUILD as useful as possible, use the $pkgname and $pkgver
|
To make the PKGBUILD as useful as possible, use the `$pkgname` and `$pkgver`
|
||||||
variables if possible when specifying the download location. Any files
|
variables if possible when specifying the download location. Compressed files
|
||||||
that are compressed will automatically be extracted, unless found in
|
will be extracted automatically unless found in
|
||||||
the noextract array listed below.
|
the noextract array described below.
|
||||||
+
|
+
|
||||||
It is also possible to specify an optional filename, which is helpful
|
It is also possible to change the name of the downloaded file, which is helpful
|
||||||
with weird URLs and for handling multiple source files with the same
|
with weird URLs and for handling multiple source files with the same
|
||||||
name. The syntax is: `source=('filename::url')`.
|
name. The syntax is: `source=('filename::url')`.
|
||||||
|
+
|
||||||
|
Files in the source array with extensions `.sig`, `.sign` or `.asc` are recognized by
|
||||||
|
makepkg as PGP signatures and will be automatically used to verify the integrity
|
||||||
|
of the corresponding source file.
|
||||||
|
|
||||||
*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
|
||||||
listed here will not be extracted with the rest of the source files. This
|
listed here will not be extracted with the rest of the source files. This
|
||||||
is useful for packages which use compressed data which is downloaded but
|
is useful for packages that use compressed data directly.
|
||||||
not necessary to uncompress.
|
|
||||||
|
|
||||||
*md5sums (array)*::
|
*md5sums (array)*::
|
||||||
This array contains an MD5 hash for every source file specified in the
|
This array contains an MD5 hash for every source file specified in the
|
||||||
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.
|
appropriate location.
|
||||||
|
|
||||||
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
|
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
|
||||||
@@ -124,29 +136,40 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
example, one could install all KDE packages by installing the 'kde' group.
|
example, one could install all KDE packages by installing the 'kde' group.
|
||||||
|
|
||||||
*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')`). Packages that contain no architecture specific
|
`arch=('i686' 'x86_64')`). Packages that contain no architecture specific
|
||||||
files may use arch=('any').
|
files should use `arch=('any')`.
|
||||||
|
|
||||||
*backup (array)*::
|
*backup (array)*::
|
||||||
A space-delimited array of filenames, without preceding slashes, that
|
An array of filenames, without preceding slashes, that
|
||||||
should be backed up if the package is removed or upgraded. This is
|
should be backed up if the package is removed or upgraded. This is
|
||||||
commonly used for packages placing configuration files in /etc. See
|
commonly used for packages placing configuration files in /etc. See
|
||||||
Handling Config Files in linkman:pacman[8] for more information.
|
Handling Config Files in linkman:pacman[8] for more information.
|
||||||
|
|
||||||
*depends (array)*::
|
*depends (array)*::
|
||||||
An array of packages that this package depends on to run. Packages in
|
An array of packages this package depends on to run. Entries in
|
||||||
this list should be surrounded with single quotes and contain at least
|
this list should be surrounded with single quotes and contain at least
|
||||||
the package name. Entries can also include a version requirement of the
|
the package name. Entries can also include a version requirement of the
|
||||||
form 'name<>version', where <> is one of five comparisons: >= (greater
|
form 'name<>version', where `<>` is one of five comparisons: `>=` (greater
|
||||||
than or equal to), <= (less than or equal to), = (equal to), > (greater
|
than or equal to), `<=` (less than or equal to), `=` (equal to), `>`
|
||||||
than), or < (less than).
|
(greater than), or `<` (less than).
|
||||||
|
+
|
||||||
|
If the dependency name appears to be a library (ends with .so), makepkg will
|
||||||
|
try to find a binary that depends on the library in the built package and
|
||||||
|
append the version needed by the binary. Appending the version yourself
|
||||||
|
disables auto detection.
|
||||||
|
|
||||||
*makedepends (array)*::
|
*makedepends (array)*::
|
||||||
An array of packages that this package depends on to build, but are not
|
An array of packages this package depends on to build but are not
|
||||||
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 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 packages (and accompanying reasons) that are not essential for
|
An array of packages (and accompanying reasons) that are not essential for
|
||||||
base functionality, but may be necessary to make full use of the contents
|
base functionality, but may be necessary to make full use of the contents
|
||||||
@@ -159,26 +182,33 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
*conflicts (array)*::
|
*conflicts (array)*::
|
||||||
An array of packages that will conflict with this package (i.e. they
|
An array of packages that will conflict with this package (i.e. they
|
||||||
cannot both be installed at the same time). This directive follows the
|
cannot both be installed at the same time). This directive follows the
|
||||||
same format as depends. Versioned conflicts are also supported.
|
same format as depends. Versioned conflicts are supported using the
|
||||||
|
operators as described in `depends`.
|
||||||
|
|
||||||
*provides (array)*::
|
*provides (array)*::
|
||||||
An array of ``virtual provisions'' that this package provides. This allows
|
An array of ``virtual provisions'' this package provides. This allows
|
||||||
a package to provide dependencies other than its own package name. For
|
a package to provide dependencies other than its own package name. For
|
||||||
example, the dcron package can provide 'cron', which allows packages to
|
example, the dcron package can provide 'cron', which allows packages to
|
||||||
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.
|
+
|
||||||
For example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0'
|
Versioned provisions are also possible, in the 'name=version' format. For
|
||||||
dependency of other packages. Provisions involving the '>' and '<'
|
example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0' dependency of
|
||||||
operators are invalid as only specific versions of a package may be
|
other packages. Provisions involving the `>` and `<` operators are invalid as
|
||||||
provided.
|
only specific versions of a package may be provided.
|
||||||
|
+
|
||||||
|
If the provision name appears to be a library (ends with .so), makepkg will
|
||||||
|
try to find the library in the built package and append the correct
|
||||||
|
version. Appending the version yourself disables auto detection.
|
||||||
|
|
||||||
*replaces (array)*::
|
*replaces (array)*::
|
||||||
An array of packages that this package should replace, and can be used
|
An array of packages this package should replace. This can be used
|
||||||
to handle renamed/combined packages. For example, if the 'j2re' package
|
to handle renamed/combined packages. For example, if the 'j2re' package
|
||||||
is renamed to 'jre', this directive allows future upgrades to continue
|
is renamed to 'jre', this directive allows future upgrades to continue
|
||||||
as expected even though the package has moved. Sysupgrade is currently
|
as expected even though the package has moved. Versioned replaces are
|
||||||
the only pacman operation that utilizes this field, a normal sync will
|
supported using the operators as described in `depends`.
|
||||||
not use its value.
|
+
|
||||||
|
Sysupgrade is currently the only pacman operation that utilizes this field.
|
||||||
|
A normal sync or upgrade will not use its value.
|
||||||
|
|
||||||
*options (array)*::
|
*options (array)*::
|
||||||
This array allows you to override some of makepkg's default behavior
|
This array allows you to override some of makepkg's default behavior
|
||||||
@@ -186,8 +216,8 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
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
|
||||||
@@ -208,6 +238,9 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
*zipman*;;
|
*zipman*;;
|
||||||
Compress man and info pages with gzip.
|
Compress man and info pages with gzip.
|
||||||
|
|
||||||
|
*upx*;;
|
||||||
|
Compress binary executable files using UPX.
|
||||||
|
|
||||||
*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
|
||||||
@@ -218,53 +251,61 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
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). See linkman:pacman[8] for
|
|
||||||
more information on version comparisons.
|
|
||||||
|
|
||||||
|
|
||||||
build() Function
|
build() Function
|
||||||
----------------
|
----------------
|
||||||
In addition to the above directives, the optional build() bash function usually
|
In addition to the above directives, the optional build() function usually
|
||||||
comprises the remainder of the PKGBUILD. This is directly sourced and executed
|
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
|
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
|
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
|
with a non-zero status will cause the function to exit. Be sure any exotic
|
||||||
commands used are covered by `makedepends`.
|
commands used are covered by `makedepends`.
|
||||||
|
|
||||||
All of the above variables such as `pkgname` and `pkgver` are available for use
|
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
|
in the build function. In addition, makepkg defines the following three
|
||||||
use during the build and install process. These three variables are as follows:
|
variables for use during the build and install process:
|
||||||
|
|
||||||
*startdir*::
|
*startdir*::
|
||||||
This contains the absolute path to the directory where the PKGBUILD was
|
This contains the absolute path to the directory where the PKGBUILD is
|
||||||
located, which is usually the output of `$(pwd)` when makepkg is started.
|
located, which is usually the output of `$(pwd)` when makepkg is started.
|
||||||
|
Use of this variable is deprecated and strongly discouraged.
|
||||||
|
|
||||||
*srcdir*::
|
*srcdir*::
|
||||||
This points to the directory where makepkg extracts or copies all source
|
This contains the directory where makepkg extracts, or copies, all source
|
||||||
files.
|
files.
|
||||||
|
|
||||||
*pkgdir*::
|
*pkgdir*::
|
||||||
This points to the directory where makepkg bundles the installed package
|
This contains the directory where makepkg bundles the installed package
|
||||||
(this directory will become the root directory of your built 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
|
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
|
recommended to use the bash `local` keyword to scope the variable to inside
|
||||||
the build function.
|
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
|
package() Function
|
||||||
------------------
|
------------------
|
||||||
An optional package() function can be specified in addition to the build()
|
An optional package() function can be specified in addition to the build()
|
||||||
function. This function is run immediately after the build() function. The
|
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
|
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
|
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
|
with the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
|
||||||
@@ -279,9 +320,9 @@ Each split package uses a corresponding packaging function with name
|
|||||||
`package_foo()`, where `foo` is the name of the split package.
|
`package_foo()`, where `foo` is the name of the split package.
|
||||||
|
|
||||||
All options and directives for the split packages default to the global values
|
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
|
given in the PKGBUILD. Nevertheless, the following ones can be overridden within
|
||||||
split package's packaging function. The following variables can be overridden:
|
each split package's packaging function:
|
||||||
`pkgver`, `pkgrel`, `pkgdesc`, `arch`, `license`, `groups`, `depends`,
|
`pkgver`, `pkgrel`, `epoch`, `pkgdesc`, `arch`, `license`, `groups`, `depends`,
|
||||||
`optdepends`, `provides`, `conflicts`, `replaces`, `backup`, `options`,
|
`optdepends`, `provides`, `conflicts`, `replaces`, `backup`, `options`,
|
||||||
`install` and `changelog`.
|
`install` and `changelog`.
|
||||||
|
|
||||||
@@ -299,31 +340,37 @@ Pacman has the ability to store and execute a package-specific script when it
|
|||||||
installs, removes, or upgrades a package. This allows a package to configure
|
installs, removes, or upgrades a package. This allows a package to configure
|
||||||
itself after installation and perform an opposite action upon removal.
|
itself after installation and perform an opposite action upon removal.
|
||||||
|
|
||||||
The exact time the script is run varies with each operation:
|
The exact time the script is run varies with each operation, and should be
|
||||||
|
self-explanatory. Note that during an upgrade operation, none of the install
|
||||||
|
or remove scripts will be called.
|
||||||
|
|
||||||
|
Scripts are passed either one or two ``full version strings'', where a full
|
||||||
|
version string is either 'pkgver-pkgrel' or 'epoch:pkgver-pkgrel' if epoch is
|
||||||
|
non-zero.
|
||||||
|
|
||||||
*pre_install*::
|
*pre_install*::
|
||||||
script is run right before files are extracted. One argument is passed:
|
Run right before files are extracted. One argument is passed:
|
||||||
new package version.
|
new package full version string.
|
||||||
|
|
||||||
*post_install*::
|
*post_install*::
|
||||||
script is run right after files are extracted. One argument is passed:
|
Run right after files are extracted. One argument is passed:
|
||||||
new package version.
|
new package full version string.
|
||||||
|
|
||||||
*pre_upgrade*::
|
*pre_upgrade*::
|
||||||
script is run right before files are extracted. Two arguments are passed
|
Run right before files are extracted. Two arguments are passed in this
|
||||||
in the following order: new package version, old package version.
|
order: new package full version string, old package full version string.
|
||||||
|
|
||||||
*post_upgrade*::
|
*post_upgrade*::
|
||||||
script is run after files are extracted. Two arguments are passed
|
Run after files are extracted. Two arguments are passed in this order:
|
||||||
in the following order: new package version, old package version.
|
new package full version string, old package full version string.
|
||||||
|
|
||||||
*pre_remove*::
|
*pre_remove*::
|
||||||
script is run right before files are removed. One argument is passed:
|
Run right before files are removed. One argument is passed:
|
||||||
old package version.
|
old package full version string.
|
||||||
|
|
||||||
*post_remove*::
|
*post_remove*::
|
||||||
script is run right after files are removed. One argument is passed:
|
Run right after files are removed. One argument is passed:
|
||||||
old package version.
|
old package full version string.
|
||||||
|
|
||||||
To use this feature, create a file such as 'pkgname.install' and put it in the
|
To use this feature, create a file such as 'pkgname.install' and put it in the
|
||||||
same directory as the PKGBUILD script. Then use the install directive:
|
same directory as the PKGBUILD script. Then use the install directive:
|
||||||
@@ -341,7 +388,7 @@ makepkg supports building development versions of packages without having to
|
|||||||
manually update the pkgver in the PKGBUILD. This was formerly done using the
|
manually update the pkgver in the PKGBUILD. This was formerly done using the
|
||||||
separate utility 'versionpkg'. In order to utilize this functionality, your
|
separate utility 'versionpkg'. In order to utilize this functionality, your
|
||||||
PKGBUILD must use correct variable names depending on the SCM being fetched
|
PKGBUILD must use correct variable names depending on the SCM being fetched
|
||||||
from.
|
from (e.g., 'makepkg-git', 'mplayer-svn').
|
||||||
|
|
||||||
*CVS*::
|
*CVS*::
|
||||||
The generated pkgver will be the date the package is built.
|
The generated pkgver will be the date the package is built.
|
||||||
@@ -362,8 +409,7 @@ from.
|
|||||||
The SVN module to fetch.
|
The SVN module to fetch.
|
||||||
|
|
||||||
*Git*::
|
*Git*::
|
||||||
The generated pkgver will be one formatted by the 'git-describe'
|
The generated pkgver will be the date the package is built.
|
||||||
command, with '-' characters converted to '_' characters.
|
|
||||||
|
|
||||||
*_gitroot*;;
|
*_gitroot*;;
|
||||||
The URL (all protocols supported) to the GIT repository.
|
The URL (all protocols supported) to the GIT repository.
|
||||||
|
|||||||
7
doc/asciidoc-override.css
Normal file
7
doc/asciidoc-override.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
table th, table td {
|
||||||
|
padding: 0.2em 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td p.table {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
@@ -17,7 +17,11 @@ plus=+
|
|||||||
caret=^
|
caret=^
|
||||||
startsb=[
|
startsb=[
|
||||||
endsb=]
|
endsb=]
|
||||||
|
backslash=\
|
||||||
tilde=~
|
tilde=~
|
||||||
|
apostrophe='
|
||||||
|
backtick=`
|
||||||
|
litdd=--
|
||||||
|
|
||||||
ifdef::backend-docbook[]
|
ifdef::backend-docbook[]
|
||||||
[linkman-inlinemacro]
|
[linkman-inlinemacro]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
|
|
||||||
See the pacman website at http://www.archlinux.org/pacman/[] for current
|
See the pacman website at http://www.archlinux.org/pacman/[] for current
|
||||||
@@ -18,13 +18,17 @@ Authors
|
|||||||
|
|
||||||
Current maintainers:
|
Current maintainers:
|
||||||
|
|
||||||
|
* Allan McRae <allan@archlinux.org>
|
||||||
* Dan McGee <dan@archlinux.org>
|
* Dan McGee <dan@archlinux.org>
|
||||||
* Xavier Chantry <shiningxc@gmail.com>
|
* Dave Reisner <dreisner@archlinux.org>
|
||||||
* Aaron Griffin <aaron@archlinux.org>
|
|
||||||
|
|
||||||
Past contributors:
|
Past major 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>
|
||||||
|
* Xavier Chantry <shiningxc@gmail.com>
|
||||||
|
* Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
||||||
|
|
||||||
See the 'AUTHORS' file for additional contributors.
|
For additional contributors, use `git shortlog -s` on the pacman.git
|
||||||
|
repository.
|
||||||
|
|||||||
153
doc/index.txt
153
doc/index.txt
@@ -16,10 +16,10 @@ automatically and can download packages from a remote server.
|
|||||||
|
|
||||||
History
|
History
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
Version 2.0 of pacman introduced the ability to sync packages (the `--sync`
|
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
|
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
|
this, packages would have to be installed manually using the '\--add' and
|
||||||
`--upgrade` operations.
|
'\--upgrade' operations.
|
||||||
|
|
||||||
Version 3.0 was the switch to a two-part pacman- a backend named libalpm
|
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.
|
(library for Arch Linux Package Management), and the familiar pacman frontend.
|
||||||
@@ -28,6 +28,9 @@ 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
|
library-based program should also make it easier in the future to develop
|
||||||
alternative front ends.
|
alternative front ends.
|
||||||
|
|
||||||
|
Version 4.0 added package signing and verification capabilities to the entire
|
||||||
|
makepkg/repo-add/pacman toolchain via GNUPG and GPGME.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
@@ -41,8 +44,11 @@ configuration files dealing with pacman.
|
|||||||
* linkman:makepkg[8]
|
* linkman:makepkg[8]
|
||||||
* linkman:makepkg.conf[5]
|
* linkman:makepkg.conf[5]
|
||||||
* linkman:pacman[8]
|
* linkman:pacman[8]
|
||||||
|
* linkman:pacman-key[8]
|
||||||
* linkman:pacman.conf[5]
|
* linkman:pacman.conf[5]
|
||||||
|
* linkman:pkgdelta[8]
|
||||||
* linkman:repo-add[8]
|
* linkman:repo-add[8]
|
||||||
|
* linkman:vercmp[8]
|
||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
@@ -59,51 +65,108 @@ contain the biggest changes in a format more concise than the commit log.
|
|||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
|
|
||||||
`------------`-------
|
[frame="none",grid="none",options="autowidth",cols="3*a"]
|
||||||
Date Version
|
|======
|
||||||
---------------------
|
|
|
||||||
2011-01-22 v3.4.3
|
[frame="topbot",grid="none",options="header,autowidth"]
|
||||||
2010-12-29 v3.4.2
|
!======
|
||||||
2010-09-03 v3.4.1
|
!Version !Date
|
||||||
2010-06-16 v3.4.0
|
!4.0.2 !2011-02-11
|
||||||
2009-11-10 v3.3.3
|
!4.0.1 !2011-11-20
|
||||||
2009-10-05 v3.3.2
|
!4.0.0 !2011-10-13
|
||||||
2009-09-22 v3.3.1
|
!4.0.0rc2 !2011-09-22
|
||||||
2009-08-02 v3.3.0
|
!4.0.0rc1 !2011-08-11
|
||||||
2009-01-05 v3.2.2
|
!3.5.4 !2011-08-10
|
||||||
2008-08-26 v3.2.1
|
!3.5.3 !2011-06-07
|
||||||
2008-07-30 v3.2.0
|
!3.5.2 !2011-04-18
|
||||||
2008-04-01 v3.1.4
|
!3.5.1 !2011-03-23
|
||||||
2008-03-06 v3.1.3
|
!3.5.0 !2011-03-16
|
||||||
2008-02-20 v3.1.2
|
!3.4.3 !2011-01-22
|
||||||
2008-01-20 v3.1.1
|
!3.4.2 !2010-12-29
|
||||||
2008-01-09 v3.1.0
|
!3.4.1 !2010-09-03
|
||||||
2007-09-16 v3.0.6
|
!3.4.0 !2010-06-16
|
||||||
2007-06-17 v3.0.5
|
!3.3.3 !2009-11-10
|
||||||
2007-05-08 v3.0.4
|
!3.3.2 !2009-10-05
|
||||||
2007-04-28 v3.0.3
|
!3.3.1 !2009-09-22
|
||||||
2007-04-23 v3.0.2
|
!3.3.0 !2009-08-02
|
||||||
2007-04-04 v3.0.1
|
!3.2.2 !2009-01-05
|
||||||
2007-03-25 v3.0.0
|
!3.2.1 !2008-08-26
|
||||||
2006-02-02 v2.9.8
|
!3.2.0 !2008-07-30
|
||||||
2005-09-16 v2.9.7
|
!3.1.4 !2008-04-01
|
||||||
2005-06-10 v2.9.6
|
!3.1.3 !2008-03-06
|
||||||
2005-01-11 v2.9.5
|
!3.1.2 !2008-02-20
|
||||||
2004-12-19 v2.9.4
|
!3.1.1 !2008-01-20
|
||||||
2004-12-18 v2.9.3
|
!3.1.0 !2008-01-09
|
||||||
2004-09-25 v2.9.2
|
!======
|
||||||
2004-09-24 v2.9.1
|
|
|
||||||
2004-09-18 v2.9
|
[frame="topbot",grid="none",options="header,autowidth"]
|
||||||
---------------------
|
!======
|
||||||
|
!Version !Date
|
||||||
|
!2.9.8 !2006-02-02
|
||||||
|
!2.9.7 !2005-09-16
|
||||||
|
!2.9.7-TEST3 !2005-09-11
|
||||||
|
!2.9.7-TEST2 !2005-09-07
|
||||||
|
!2.9.7-TEST !2005-08-19
|
||||||
|
!2.9.6 !2005-06-10
|
||||||
|
!2.9.5 !2005-01-11
|
||||||
|
!2.9.4 !2004-12-20
|
||||||
|
!2.9.3 !2004-12-19
|
||||||
|
!2.9.2 !2004-09-25
|
||||||
|
!2.9.1 !2004-09-25
|
||||||
|
!2.9 !2004-09-18
|
||||||
|
!2.8.4 !2004-08-23
|
||||||
|
!2.8.3 !2004-08-04
|
||||||
|
!2.8.2 !2004-07-22
|
||||||
|
!2.8.1 !2004-07-17
|
||||||
|
!2.8 !2004-07-03
|
||||||
|
!2.7.9 !2004-04-30
|
||||||
|
!2.7.8 !2004-04-29
|
||||||
|
!2.7.7 !2004-04-15
|
||||||
|
!2.7.6 !2004-04-04
|
||||||
|
!2.7.5 !2004-03-02
|
||||||
|
!2.7.4 !2004-02-18
|
||||||
|
!2.7.3 !2004-02-07
|
||||||
|
!======
|
||||||
|
|
|
||||||
|
[frame="topbot",grid="none",options="header,autowidth"]
|
||||||
|
!======
|
||||||
|
!Version !Date
|
||||||
|
!2.7.2 !2004-01-04
|
||||||
|
!2.7.1 !2003-12-21
|
||||||
|
!2.7 !2003-11-25
|
||||||
|
!2.6.4 !2003-10-17
|
||||||
|
!2.6.3 !2003-10-01
|
||||||
|
!2.6.2 !2003-09-29
|
||||||
|
!2.6.1 !2003-09-15
|
||||||
|
!2.6 !2003-09-03
|
||||||
|
!2.5.1 !2003-07-12
|
||||||
|
!2.5 !2003-05-30
|
||||||
|
!2.4.1 !2003-04-19
|
||||||
|
!2.4 !2003-04-11
|
||||||
|
!2.3.2 !2003-03-17
|
||||||
|
!2.3.1 !2003-03-14
|
||||||
|
!2.3 !2003-02-27
|
||||||
|
!2.2 !2002-12-11
|
||||||
|
!2.1 !2002-09-16
|
||||||
|
!2.0 !2002-08-09
|
||||||
|
!1.23 !2002-04-30
|
||||||
|
!1.22 !2002-04-12
|
||||||
|
!1.21 !2002-04-03
|
||||||
|
!1.2 !2002-03-18
|
||||||
|
!1.1 !2002-03-10
|
||||||
|
!1.0 !2002-02-25
|
||||||
|
!======
|
||||||
|
|
||||||
|
|======
|
||||||
|
|
||||||
Source code for all releases is available at
|
Source code for all releases is available at
|
||||||
link:ftp://ftp.archlinux.org/other/pacman/[]. To install, download the newest
|
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
|
available source tarball, unpack it in a directory, and run the three magic
|
||||||
commands:
|
commands:
|
||||||
|
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make
|
$ make
|
||||||
# make install
|
# make install
|
||||||
|
|
||||||
You may wish to read the options presented by `./configure --help` in order to
|
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.
|
set appropriate paths and build options that are correct for your system.
|
||||||
@@ -126,7 +189,7 @@ these trees).
|
|||||||
|
|
||||||
The current development tree can be fetched with the following command:
|
The current development tree can be fetched with the following command:
|
||||||
|
|
||||||
git clone git://projects.archlinux.org/pacman.git pacman
|
git clone git://projects.archlinux.org/pacman.git pacman
|
||||||
|
|
||||||
which will fetch the full development history into a directory named pacman.
|
which will fetch the full development history into a directory named pacman.
|
||||||
You can browse the source as well using
|
You can browse the source as well using
|
||||||
@@ -194,11 +257,11 @@ Pacman/libalpm frontends:
|
|||||||
|
|
||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
pacman is Copyright (C) 2006-2010 Pacman Development Team
|
pacman is Copyright (C) 2006-2012 Pacman Development Team
|
||||||
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
|
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
|
||||||
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
|
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
|
||||||
version 2 or later.
|
version 2 or later.
|
||||||
|
|
||||||
/////
|
/////
|
||||||
vim: set ts=2 sw=2 syntax=asciidoc et:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
libalpm(3)
|
libalpm(3)
|
||||||
==========
|
==========
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
makepkg(8)
|
makepkg(8)
|
||||||
==========
|
==========
|
||||||
@@ -11,24 +11,24 @@ makepkg - package build utility
|
|||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
makepkg [options]
|
'makepkg' [options]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
makepkg is a script to automate the building of packages. The requirements for
|
'makepkg' is a script to automate the building of packages. The requirements for
|
||||||
using the script are a build-capable \*nix platform and a custom build script
|
using the script are a build-capable \*nix platform and a custom build script
|
||||||
for each package you wish to build (known as a PKGBUILD). See
|
for each package you wish to build (known as a PKGBUILD). See
|
||||||
linkman:PKGBUILD[5] for details on creating your own build scripts.
|
linkman:PKGBUILD[5] for details on creating your own build scripts.
|
||||||
|
|
||||||
The advantage to a script-based build is that the work is only done once. Once
|
The advantage to a script-based build is that the work is only done once. Once
|
||||||
you have the build script for a package, makepkg will do the rest: download and
|
you have the build script for a package, 'makepkg' will do the rest: download and
|
||||||
validate source files, check dependencies, configure the build-time settings,
|
validate source files, check dependencies, configure the build-time settings,
|
||||||
build the package, install the package into a temporary root, make
|
build the package, install the package into a temporary root, make
|
||||||
customizations, generate meta-info, and package the whole thing up for pacman
|
customizations, generate meta-info, and package the whole thing up for pacman
|
||||||
to use.
|
to use.
|
||||||
|
|
||||||
NOTE: makepkg uses your current locale by default and does not unset it when
|
NOTE: 'makepkg' uses your current locale by default and does not unset it when
|
||||||
building packages. If you wish to share your build output with others when
|
building packages. If you wish to share your build output with others when
|
||||||
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
|
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
|
||||||
your logs and output are not localized.
|
your logs and output are not localized.
|
||||||
@@ -48,12 +48,9 @@ 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.
|
||||||
|
|
||||||
*-C, \--cleancache*::
|
*\--config* <file>::
|
||||||
Removes all cached source files from the directory specified in `SRCDEST`
|
Use an alternate config file instead of the +{sysconfdir}/makepkg.conf+
|
||||||
in linkman:makepkg.conf[5].
|
default.
|
||||||
|
|
||||||
*--config* <`/path/to/config`>::
|
|
||||||
Use an alternate config file instead of the `/etc/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
|
||||||
@@ -88,7 +85,13 @@ Options
|
|||||||
using "`makepkg -g >> PKGBUILD`".
|
using "`makepkg -g >> PKGBUILD`".
|
||||||
|
|
||||||
*--skipinteg*::
|
*--skipinteg*::
|
||||||
Do not perform any integrity checks, just print a warning instead.
|
Do not perform any integrity checks (checksum and PGP) on source files.
|
||||||
|
|
||||||
|
*\--skipchecksums*::
|
||||||
|
Do not verify checksums of source files.
|
||||||
|
|
||||||
|
*\--skippgpcheck*::
|
||||||
|
Do not verify PGP signatures of source files.
|
||||||
|
|
||||||
*-h, \--help*::
|
*-h, \--help*::
|
||||||
Output syntax and command line options.
|
Output syntax and command line options.
|
||||||
@@ -114,10 +117,10 @@ Options
|
|||||||
|
|
||||||
*-o, \--nobuild*::
|
*-o, \--nobuild*::
|
||||||
Download and extract files only, but do not build them. Useful with the
|
Download and extract files only, but do not build them. Useful with the
|
||||||
`\--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].
|
||||||
|
|
||||||
@@ -135,6 +138,13 @@ Options
|
|||||||
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.
|
||||||
|
|
||||||
|
*-S, \--source*::
|
||||||
|
Do not actually build the package, but build a source-only tarball that
|
||||||
|
does not include sources that can be fetched via a download URL. This is
|
||||||
|
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.
|
||||||
|
|
||||||
*\--allsource*::
|
*\--allsource*::
|
||||||
Do not actually build the package, but build a source-only tarball that
|
Do not actually build the package, but build a source-only tarball that
|
||||||
includes all sources, including those that are normally download via
|
includes all sources, including those that are normally download via
|
||||||
@@ -142,16 +152,27 @@ Options
|
|||||||
such as a chroot or remote builder. It will also satisfy requirements of
|
such as a chroot or remote builder. It will also satisfy requirements of
|
||||||
the GPL when distributing binary packages.
|
the GPL when distributing binary packages.
|
||||||
|
|
||||||
*\--source*::
|
*\--pkg <list>*::
|
||||||
Do not actually build the package, but build a source-only tarball that
|
Only build listed packages from a split package.
|
||||||
does not include sources that can be fetched via a download URL. This is
|
|
||||||
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`>*::
|
*\--check*::
|
||||||
Only build listed packages from a split package. The use of quotes is
|
Run the check() function in the PKGBUILD, overriding the setting in
|
||||||
necessary when specifying multiple packages. e.g. `--pkg "pkg1 pkg3"`
|
linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
*\--nocheck*::
|
||||||
|
Do not run the check() function in the PKGBUILD or handle the checkdepends.
|
||||||
|
|
||||||
|
*\--sign*::
|
||||||
|
Sign the resulting package with gpg, overriding the setting in
|
||||||
|
linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
*\--nosign*::
|
||||||
|
Do not create a signature for the built package.
|
||||||
|
|
||||||
|
*\--key* <key>::
|
||||||
|
Specify a key to use when signing packages, overriding the GPGKEY setting
|
||||||
|
in linkman:makepkg.conf[5]. If not specified in either location, the
|
||||||
|
default key from the keyring will be used.
|
||||||
|
|
||||||
*\--noconfirm*::
|
*\--noconfirm*::
|
||||||
(Passed to pacman) Prevent pacman from waiting for user input before
|
(Passed to pacman) Prevent pacman from waiting for user input before
|
||||||
@@ -186,6 +207,9 @@ Environment Variables
|
|||||||
Folder where the downloaded sources will be stored. Overrides the
|
Folder where the downloaded sources will be stored. Overrides the
|
||||||
corresponding value defined in linkman:makepkg.conf[5].
|
corresponding value defined in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
**BUILDDIR=**"/path/to/folder"::
|
||||||
|
Folder where the package will be built. Overrides the corresponding
|
||||||
|
value defined in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
makepkg.conf(5)
|
makepkg.conf(5)
|
||||||
===============
|
===============
|
||||||
@@ -70,7 +70,7 @@ Options
|
|||||||
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**)**::
|
**BUILDENV=(**fakeroot !distcc color !ccache check !sign**)**::
|
||||||
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
|
||||||
@@ -93,12 +93,36 @@ 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.
|
||||||
|
|
||||||
|
*check*;;
|
||||||
|
Run the check() function if present in the PKGBUILD. This can be
|
||||||
|
enabled or disabled for individual packages through the use of
|
||||||
|
makepkg's '\--check' and '\--nocheck' options respectively.
|
||||||
|
|
||||||
|
*sign*;;
|
||||||
|
Generate a PGP signature file using GnuPG. This will execute `gpg
|
||||||
|
--detach-sign --use-agent` on the built package to generate a detached
|
||||||
|
signature file, using the GPG agent if it is available. The signature
|
||||||
|
file will be the entire filename of the package with a ``.sig''
|
||||||
|
extension.
|
||||||
|
|
||||||
**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 zipman**)**::
|
**BUILDDIR=**"/path/to/folder"::
|
||||||
|
If this value is not set, packages will by default be built in
|
||||||
|
subdirectories of the directory that makepkg is called from. This
|
||||||
|
option allows setting the build location to another folder.
|
||||||
|
Incorrect use of `$startdir` in a PKGBUILD may cause building with
|
||||||
|
this option to fail.
|
||||||
|
|
||||||
|
|
||||||
|
**GPGKEY=**""::
|
||||||
|
Specify a key to use for gpg signing instead of the default key in the
|
||||||
|
keyring. Can be overridden with makepkg's '\--key' option.
|
||||||
|
|
||||||
|
**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**::
|
||||||
This array contains options that affect the default packaging. They 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
|
||||||
@@ -130,6 +154,10 @@ Options
|
|||||||
Remove files specified by the `PURGE_TARGETS` variable from the
|
Remove files specified by the `PURGE_TARGETS` variable from the
|
||||||
package.
|
package.
|
||||||
|
|
||||||
|
*upx*;;
|
||||||
|
Compress binary executable files using UPX. Additional options
|
||||||
|
can be passed to UPX by specifying the `UPXFLAGS` variable.
|
||||||
|
|
||||||
**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:
|
||||||
@@ -160,13 +188,6 @@ Options
|
|||||||
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.
|
||||||
|
|
||||||
**STRIP_DIRS=(**bin lib sbin usr/{bin,lib} ...**)**::
|
|
||||||
If `strip` is specified in the OPTIONS array, this variable will
|
|
||||||
instruct makepkg where to look to for files to strip. 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.
|
|
||||||
|
|
||||||
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
|
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
|
||||||
If `purge` is specified in the OPTIONS array, this variable will
|
If `purge` is specified in the OPTIONS array, this variable will
|
||||||
instruct makepkg which files to remove from the package. This is
|
instruct makepkg which files to remove from the package. This is
|
||||||
@@ -185,17 +206,19 @@ Options
|
|||||||
|
|
||||||
**SRCPKGDEST=**"/path/to/folder"::
|
**SRCPKGDEST=**"/path/to/folder"::
|
||||||
If this value is not set, source package files will be stored in
|
If this value is not set, source package files will be stored in
|
||||||
PKGDEST. Many people like to keep all source package files in
|
in the current directory. Many people like to keep all source package files
|
||||||
a central location for easy cleanup, so this path can be set here.
|
in a central location for easy cleanup, so this path can be set here.
|
||||||
|
|
||||||
**PACKAGER=**"John Doe <john@example.com>"::
|
**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.
|
||||||
|
|
||||||
*PKGEXT*, *SRCEXT*::
|
**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`, `.tar.xz`, and
|
||||||
|
`.tar.Z`.
|
||||||
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]
|
||||||
|
|||||||
142
doc/pacman-key.8.txt
Normal file
142
doc/pacman-key.8.txt
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/////
|
||||||
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
|
/////
|
||||||
|
pacman-key(8)
|
||||||
|
=============
|
||||||
|
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
pacman-key - manage pacman's list of trusted keys
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
'pacman-key' [options]
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
'pacman-key' is a wrapper script for GnuPG used to manage pacman's keyring, which
|
||||||
|
is the collection of PGP keys used to check signed packages and databases. It
|
||||||
|
provides the ability to import and export keys, fetch keys from keyservers and
|
||||||
|
update the key trust database.
|
||||||
|
|
||||||
|
More complex keyring management can be achieved using GnuPG directly combined with
|
||||||
|
the '\--homedir' option pointing at the pacman keyring (located in
|
||||||
|
+{sysconfdir}/pacman.d/gnupg+ by default).
|
||||||
|
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
*-a, \--add* [file(s)]::
|
||||||
|
Add the key(s) contained in the specified file or files to pacman's
|
||||||
|
keyring. If a key already exists, update it.
|
||||||
|
|
||||||
|
*\--config* <file>::
|
||||||
|
Use an alternate config file instead of the +{sysconfdir}/pacman.conf+
|
||||||
|
default.
|
||||||
|
|
||||||
|
*-d, \--delete* <keyid(s)>::
|
||||||
|
Remove the key(s) identified by the specified keyid(s) from pacman's
|
||||||
|
keyring.
|
||||||
|
|
||||||
|
*-e, \--export* [keyid(s)]::
|
||||||
|
Export key(s) identified by the specified keyid(s) to 'stdout'. If no keyid
|
||||||
|
is specified, all keys will be exported.
|
||||||
|
|
||||||
|
*\--edit-key* <keyid(s)>::
|
||||||
|
Present a menu for key management task on the specified keyid(s). Useful
|
||||||
|
for adjusting a keys trust level.
|
||||||
|
|
||||||
|
*-f, \--finger* [keyid(s)]::
|
||||||
|
List a fingerprint for each specified keyid, or for all known keys if no
|
||||||
|
keyids are specified.
|
||||||
|
|
||||||
|
*\--gpgdir* <dir>::
|
||||||
|
Set an alternate home directory for GnuPG. If unspecified, the value is
|
||||||
|
read from +{sysconfdir}/pacman.conf+.
|
||||||
|
|
||||||
|
*-h, \--help*::
|
||||||
|
Output syntax and command line options.
|
||||||
|
|
||||||
|
*\--import* <dir(s)>::
|
||||||
|
Imports keys from `pubring.gpg` into the public keyring from the specified
|
||||||
|
directories.
|
||||||
|
|
||||||
|
*\--import-trustdb* <dir(s)> ::
|
||||||
|
Imports ownertrust values from `trustdb.gpg` into the shared trust database
|
||||||
|
from the specified directories.
|
||||||
|
|
||||||
|
*\--init*::
|
||||||
|
Ensure the keyring is properly initialized and has the required access
|
||||||
|
permissions.
|
||||||
|
|
||||||
|
*\--keyserver* <keyserver>::
|
||||||
|
Use the specified keyserver if the operation requires one. This will take
|
||||||
|
precedence over any keyserver option specified in a `gpg.conf`
|
||||||
|
configuration file. Running '\--init' with this option will set the default
|
||||||
|
keyserver if one was not already configured.
|
||||||
|
|
||||||
|
*-l, \--list-keys* [keyid(s)]::
|
||||||
|
Lists all or specified keys from the public keyring.
|
||||||
|
|
||||||
|
*\--list-sigs* [keyid(s)]::
|
||||||
|
Same as '\--list-keys', but the signatures are listed too.
|
||||||
|
|
||||||
|
*\--lsign-key* <keyid>::
|
||||||
|
Locally sign the given key. This is primarily used to root the web of trust
|
||||||
|
in the local private key generated by '\--init'.
|
||||||
|
|
||||||
|
*-r, \--recv-keys* <keyid(s)>::
|
||||||
|
Equivalent to '\--recv-keys' in GnuPG.
|
||||||
|
|
||||||
|
*\--refresh-keys* [keyid(s)]::
|
||||||
|
Equivalent to '\--refresh-keys' in GnuPG.
|
||||||
|
|
||||||
|
*\--populate* [keyring(s)]::
|
||||||
|
Reload the default keys from the (optionally provided) keyrings in
|
||||||
|
+{pkgdatadir}/keyrings+. For more information, see
|
||||||
|
<<SC,Providing a Keyring for Import>> below.
|
||||||
|
|
||||||
|
*-u, \--updatedb*::
|
||||||
|
Equivalent to '\--check-trustdb' in GnuPG.
|
||||||
|
|
||||||
|
*-v, \--verify* <signature>::
|
||||||
|
Verify the given signature file.
|
||||||
|
|
||||||
|
*-V, \--version*::
|
||||||
|
Displays the program version.
|
||||||
|
|
||||||
|
|
||||||
|
Providing a Keyring for Import
|
||||||
|
------------------------------
|
||||||
|
A distribution or other repository provided may want to provide a set of
|
||||||
|
PGP keys used in the signing of its packages and repository databases that can
|
||||||
|
be readily imported into the pacman keyring. This is achieved by providing a
|
||||||
|
PGP keyring file `foo.gpg` that contains the keys for the foo keyring in the
|
||||||
|
directory +{pkgdatadir}/keyrings+.
|
||||||
|
|
||||||
|
Optionally, the file `foo-trusted` can be provided containing a list of trusted
|
||||||
|
key IDs for that keyring. This is a file in a format compatible with 'gpg
|
||||||
|
\--export-ownertrust' output. This file will inform the user which keys a user
|
||||||
|
needs to verify and sign to build a local web of trust, in addition to
|
||||||
|
assigning provided owner trust values.
|
||||||
|
|
||||||
|
Also optionally, the file `foo-revoked` can be provided containing a list of
|
||||||
|
revoked key IDs for that keyring. Revoked is defined as "no longer valid for
|
||||||
|
any signing", so should be used with prudence. A key being marked as revoked
|
||||||
|
will be disabled in the keyring and no longer treated as valid, so this always
|
||||||
|
takes priority over it's trusted state in any other keyring.
|
||||||
|
|
||||||
|
All files are required to be signed (detached) by a trusted PGP key that the
|
||||||
|
user must manually import to the pacman keyring. This prevents a potentially
|
||||||
|
malicious repository adding keys to the pacman keyring without the users
|
||||||
|
knowledge.
|
||||||
|
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
linkman:pacman[8], linkman:pacman.conf[5]
|
||||||
|
|
||||||
|
include::footer.txt[]
|
||||||
316
doc/pacman.8.txt
316
doc/pacman.8.txt
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
pacman(8)
|
pacman(8)
|
||||||
=========
|
=========
|
||||||
@@ -11,8 +11,7 @@ pacman - package manager utility
|
|||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
'pacman' <operation> [options] [packages]
|
'pacman' <operation> [options] [targets]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
@@ -25,11 +24,17 @@ Since version 3.0.0, pacman has been the frontend to linkman:libalpm[3], the
|
|||||||
``Arch Linux Package Management'' library. This library allows alternative
|
``Arch Linux Package Management'' library. This library allows alternative
|
||||||
front 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
|
||||||
----------
|
----------
|
||||||
*-D, \--database*::
|
*-D, \--database*::
|
||||||
Modify the package database. This options allows you to modify certain
|
Modify the package database. This operation allows you to modify certain
|
||||||
attributes of the installed packages in pacman's database. At the
|
attributes of the installed packages in pacman's database. At the
|
||||||
moment, you can only change the install reason using '\--asdeps' and
|
moment, you can only change the install reason using '\--asdeps' and
|
||||||
'\--asexplicit' options.
|
'\--asexplicit' options.
|
||||||
@@ -49,7 +54,7 @@ Operations
|
|||||||
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*::
|
||||||
@@ -63,27 +68,37 @@ Operations
|
|||||||
interprets ">" as redirection to file.)
|
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 provide a
|
||||||
package in the gnome group, as well as the dependencies of those packages.
|
prompt allowing you to select which packages to install from a numbered list.
|
||||||
|
The package selection is specified using a space separated list of package
|
||||||
|
numbers. Sequential packages may be selected by specifying the first and last
|
||||||
|
package numbers separated by a hyphen (`-`). Excluding packages is achieved by
|
||||||
|
prefixing a number or range of numbers with a caret (`^`).
|
||||||
+
|
+
|
||||||
Packages which provide other packages are also handled. For example, `pacman -S
|
Packages that provide other packages are also handled. For example, `pacman -S
|
||||||
foo` will first look for a foo package. If foo is not found, packages which
|
foo` will first look for a foo package. If foo is not found, packages that
|
||||||
provide the same functionality as foo will be searched for. If any package is
|
provide the same functionality as foo will be searched for. If any package is
|
||||||
found, it will be installed.
|
found, it will be installed. A selection prompt is provided if multiple packages
|
||||||
|
providing foo are found.
|
||||||
+
|
+
|
||||||
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. When upgrading, pacman performs version comparison
|
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
|
||||||
to determine which packages need upgrading. This behavior operates as follows:
|
to determine which packages need upgrading. This behavior operates as follows:
|
||||||
|
|
||||||
Alphanumeric:
|
Alphanumeric:
|
||||||
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
|
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
|
||||||
Numeric:
|
Numeric:
|
||||||
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
|
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*::
|
*-T, \--deptest*::
|
||||||
Check dependencies; this is useful in scripts such as makepkg to check
|
Check dependencies; this is useful in scripts such as makepkg to check
|
||||||
installed packages. This operation will check each dependency specified and
|
installed packages. This operation will check each dependency specified and
|
||||||
return a list of those which are not currently satisfied on the system.
|
return a list of dependencies that are not currently satisfied on the system.
|
||||||
This operation accepts no other options. Example usage: `pacman -T qt
|
This operation accepts no other options. Example usage: `pacman -T qt
|
||||||
"bash>=3.2"`.
|
"bash>=3.2"`.
|
||||||
|
|
||||||
@@ -104,6 +119,94 @@ to determine which packages need upgrading. This behavior operates as follows:
|
|||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
*-b, \--dbpath* <path>::
|
||||||
|
Specify an alternative database location (a typical default is
|
||||||
|
+{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
|
||||||
|
not automatically prepended.
|
||||||
|
|
||||||
|
*-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 that is "owned" by another system.
|
||||||
|
*NOTE*: if database path or logfile are not specified on either the
|
||||||
|
command line or in linkman:pacman.conf[5], their default location will
|
||||||
|
be inside this root path.
|
||||||
|
|
||||||
|
*-v, \--verbose*::
|
||||||
|
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
|
||||||
|
|
||||||
|
*\--arch* <arch>::
|
||||||
|
Specify an alternate architecture.
|
||||||
|
|
||||||
|
*\--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.
|
||||||
|
|
||||||
|
*\--debug*::
|
||||||
|
Display debug messages. When reporting bugs, this option is recommended
|
||||||
|
to be used.
|
||||||
|
|
||||||
|
*\--gpgdir* <dir>::
|
||||||
|
Specify a directory of files used by GnuPG to verify package signatures (a
|
||||||
|
typical default is +{sysconfdir}/pacman.d/gnupg+). This directory should contain
|
||||||
|
two files: `pubring.gpg` and `trustdb.gpg`. `pubring.gpg` holds the public keys
|
||||||
|
of all packagers. `trustdb.gpg` contains a so-called trust database, which
|
||||||
|
specifies that the keys are authentic and trusted. *NOTE*: this is an absolute
|
||||||
|
path, the root path is not automatically prepended.
|
||||||
|
|
||||||
|
*\--logfile* <file>::
|
||||||
|
Specify an alternate log file. This is an absolute path, regardless of
|
||||||
|
the installation root setting.
|
||||||
|
|
||||||
|
*\--noconfirm*::
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*\--dbonly*::
|
||||||
|
Adds/Removes the database entry only, leaves all files in place.
|
||||||
|
|
||||||
|
*\--noprogressbar*::
|
||||||
|
Do not show a progress bar when downloading files. This can be useful
|
||||||
|
for scripts that call pacman and capture the output.
|
||||||
|
|
||||||
|
*\--noscriptlet*::
|
||||||
|
If an install scriptlet exists, do not execute it. Do not use this
|
||||||
|
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*::
|
*\--asdeps*::
|
||||||
Install packages non-explicitly; in other words, fake their install reason
|
Install packages non-explicitly; in other words, fake their install reason
|
||||||
to be installed as a dependency. This is useful for makepkg and other
|
to be installed as a dependency. This is useful for makepkg and other
|
||||||
@@ -116,96 +219,42 @@ Options
|
|||||||
as explicitly installed so it will not be removed by the '\--recursive'
|
as explicitly installed so it will not be removed by the '\--recursive'
|
||||||
remove operation.
|
remove operation.
|
||||||
|
|
||||||
*-b, \--dbpath* <'path'>::
|
*\--ignore* <package>::
|
||||||
Specify an alternative database location (a typical default is
|
Directs pacman to ignore upgrades of package even if there is one
|
||||||
``/var/lib/pacman''). This should not be used unless you know what you are
|
available. Multiple packages can be specified by separating them
|
||||||
doing. *NOTE*: if specified, this is an absolute path and the root path is
|
with a comma.
|
||||||
not automatically prepended.
|
|
||||||
|
|
||||||
*-d, \--nodeps*::
|
*\--ignoregroup* <group>::
|
||||||
Skips all dependency checks. Normally, pacman will always check a
|
Directs pacman to ignore upgrades of all packages in 'group' even if
|
||||||
package's dependency fields to ensure that all dependencies are
|
there is one available. Multiple groups can be specified by
|
||||||
installed and there are no package conflicts in the system.
|
separating them with a comma.
|
||||||
|
|
||||||
*-f, \--force*::
|
*\--needed*::
|
||||||
Bypass file conflict checks and overwrite conflicting files. If the
|
Do not reinstall the targets that are already up to date.
|
||||||
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'>::
|
*\--recursive*::
|
||||||
Specify an alternative installation root (default is ``/''). This should
|
Recursively reinstall all dependencies of the targets. This forces upgrades
|
||||||
not be used as a way to install software into ``/usr/local'' instead of
|
or reinstalls of all dependencies without requiring explicit version
|
||||||
``/usr''. This option is used if you want to install a package on a
|
requirements. This is most useful in combination with the '\--needed' flag,
|
||||||
temporary mounted partition which is "owned" by another system.
|
which will induce a deep dependency upgrade without any unnecessary
|
||||||
*NOTE*: if database path or logfile are not specified on either the
|
reinstalls.
|
||||||
command line or in linkman:pacman.conf[5], their default location will
|
|
||||||
be inside this root path.
|
|
||||||
|
|
||||||
*-v, \--verbose*::
|
|
||||||
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
|
|
||||||
|
|
||||||
*\--debug*::
|
|
||||||
Display debug messages. When reporting bugs, this option is recommended
|
|
||||||
to be used.
|
|
||||||
|
|
||||||
*\--cachedir* <'dir'>::
|
|
||||||
Specify an alternative package cache location (a typical default is
|
|
||||||
``/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.
|
|
||||||
|
|
||||||
*\--config* <'file'>::
|
|
||||||
Specify an alternate configuration file.
|
|
||||||
|
|
||||||
*\--logfile* <'file'>::
|
|
||||||
Specify an alternate log file. This is an absolute path, regardless of
|
|
||||||
the installation root setting.
|
|
||||||
|
|
||||||
*\--noconfirm*::
|
|
||||||
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.
|
|
||||||
|
|
||||||
*\--noprogressbar*::
|
|
||||||
Do not show a progress bar when downloading files. This can be useful
|
|
||||||
for scripts that call pacman and capture the output.
|
|
||||||
|
|
||||||
*\--noscriptlet*::
|
|
||||||
If an install scriptlet exists, do not execute it. Do not use this
|
|
||||||
unless you know what you are doing.
|
|
||||||
|
|
||||||
*\--arch* <'arch'>::
|
|
||||||
Specify an alternate architecture.
|
|
||||||
|
|
||||||
*-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 url with '-S',
|
|
||||||
filename 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 are attributes are : %n for pkgname, %v for pkgver, %l
|
|
||||||
for location, %r for repo and %s for size.
|
|
||||||
|
|
||||||
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*::
|
||||||
Restrict or filter output to packages installed as dependencies. This
|
Restrict or filter output to packages installed as dependencies. This
|
||||||
option can be combined with '-t' for listing real orphans- packages that
|
option can be combined with '-t' for listing real orphans - packages that
|
||||||
were installed as dependencies but are no longer required by any
|
were installed as dependencies but are no longer required by any
|
||||||
installed package. ('-Qdt' is equivalent to the pacman 3.0.X '-Qe'
|
installed package.
|
||||||
option.)
|
|
||||||
|
|
||||||
*-e, \--explicit*::
|
*-e, \--explicit*::
|
||||||
Restrict or filter output to packages explicitly installed. This option
|
Restrict or filter output to explicitly installed packages. This option
|
||||||
can be combined with '-t' to list top-level packages- those packages
|
can be combined with '-t' to list explicitly installed packages that
|
||||||
that were explicitly installed but are not required by any other
|
are not required by any other package.
|
||||||
package. ('-Qet' is equivalent 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
|
||||||
@@ -231,9 +280,9 @@ 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
|
||||||
@@ -250,11 +299,10 @@ Query Options[[QO]]
|
|||||||
and missing files; a bare query will only show package names
|
and missing files; a bare query will only show package names
|
||||||
rather than names and versions.
|
rather than names and versions.
|
||||||
|
|
||||||
*-s, \--search* <'regexp'>::
|
*-s, \--search* <regexp>::
|
||||||
This will search each locally-installed package for names or
|
Search each locally-installed package for names or descriptions that
|
||||||
descriptions that match `regexp`. When you include multiple search
|
match `regexp`. When including multiple search terms, only packages
|
||||||
terms, only packages with descriptions matching ALL of those terms will
|
with descriptions matching ALL of those terms are returned.
|
||||||
be 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
|
||||||
@@ -274,13 +322,10 @@ 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, \--dbonly*::
|
|
||||||
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
|
||||||
@@ -290,7 +335,7 @@ Remove Options[[RO]]
|
|||||||
orphans. If you want to omit condition (B), pass this option twice.
|
orphans. If you want to omit condition (B), pass this option twice.
|
||||||
|
|
||||||
*-u, \--unneeded*::
|
*-u, \--unneeded*::
|
||||||
Removes the targets that are not required by any other packages.
|
Removes targets that are not required by any other packages.
|
||||||
This is mostly useful when removing a group without using the '-c' option,
|
This is mostly useful when removing a group without using the '-c' option,
|
||||||
to avoid breaking any dependencies.
|
to avoid breaking any dependencies.
|
||||||
|
|
||||||
@@ -304,7 +349,7 @@ Sync Options[[SO]]
|
|||||||
databases are saved for every sync DB you download from, and are not
|
databases are saved for every sync DB you download from, and are not
|
||||||
deleted even if they are removed from the configuration file
|
deleted even if they are removed from the configuration file
|
||||||
linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
|
linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
|
||||||
packages that are no longer installed; use two to remove all packages
|
packages that are no longer installed; use two to remove all files
|
||||||
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.
|
||||||
+
|
+
|
||||||
@@ -332,7 +377,7 @@ linkman:pacman.conf[5].
|
|||||||
will only show package names and omit databases and versions; group will
|
will only show package names and omit databases and versions; group will
|
||||||
only show package names and omit group names.
|
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`. When you include multiple search
|
descriptions that match `regexp`. When you include multiple search
|
||||||
terms, only packages with descriptions matching ALL of those terms will
|
terms, only packages with descriptions matching ALL of those terms will
|
||||||
@@ -344,44 +389,34 @@ linkman:pacman.conf[5].
|
|||||||
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. Pass this option twice to enable package downgrade; in this
|
necessary.
|
||||||
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
|
Pass this option twice to enable package downgrade; in this case pacman will
|
||||||
repo to a stable one. Additional targets can also be specified manually, so
|
select sync packages whose version does not match with the local version. This
|
||||||
that '-Su foo' will do a system upgrade and install/upgrade the foo package in
|
can be useful when the user switches from a testing repo to a stable one.
|
||||||
the same operation.
|
+
|
||||||
|
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*::
|
||||||
Don't reinstall the targets that are already up-to-date.
|
Do not reinstall the targets that are already up to date.
|
||||||
|
|
||||||
*\--ignore* <'package'>::
|
*\--recursive*::
|
||||||
Directs pacman to ignore upgrades of package even if there is one
|
Recursively reinstall all dependencies of the targets. This forces upgrades
|
||||||
available. Multiple packages can be specified by separating them
|
or reinstalls of all dependencies without requiring explicit version
|
||||||
with a comma.
|
requirements. This is most useful in combination with the '\--needed' flag,
|
||||||
|
which will induce a deep dependency upgrade without any unnecessary
|
||||||
*\--ignoregroup* <'group'>::
|
reinstalls.
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
Upgrade Options[[UO]]
|
|
||||||
--------------------
|
|
||||||
*-k, \--dbonly*::
|
|
||||||
Adds the database entries for the specified packages but do not install any
|
|
||||||
of the files. On an upgrade operation, the existing package and all files
|
|
||||||
will be removed and the database entry for the new package will be added.
|
|
||||||
|
|
||||||
|
|
||||||
Handling Config Files[[HCF]]
|
Handling Config Files[[HCF]]
|
||||||
@@ -394,7 +429,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::
|
||||||
@@ -415,6 +450,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
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
pacman.conf(5)
|
pacman.conf(5)
|
||||||
==============
|
==============
|
||||||
@@ -57,22 +57,31 @@ 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.
|
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.
|
path, the root path is not automatically prepended.
|
||||||
|
|
||||||
|
*GPGDir =* path/to/gpg/dir::
|
||||||
|
Overrides the default location of the directory containing configuration
|
||||||
|
files for GnuPG. A typical default is +{sysconfdir}/pacman.d/gnupg/+.
|
||||||
|
This directory should contain two files: `pubring.gpg` and `trustdb.gpg`.
|
||||||
|
`pubring.gpg` holds the public keys of all packagers. `trustdb.gpg`
|
||||||
|
contains a so-called trust database, which specifies that the keys are
|
||||||
|
authentic and trusted.
|
||||||
|
*NOTE*: this is an absolute path, the root path is not automatically
|
||||||
|
prepended.
|
||||||
|
|
||||||
*LogFile =* '/path/to/file'::
|
*LogFile =* '/path/to/file'::
|
||||||
Overrides the default location of the pacman log file. A typical default
|
Overrides the default location of the pacman log file. A typical default
|
||||||
is ``/var/log/pacman.log''. This is an absolute path and the root directory
|
is +{localstatedir}/log/pacman.log+. This is an absolute path and the root directory
|
||||||
is not prepended.
|
is not prepended.
|
||||||
|
|
||||||
*HoldPkg =* package ...::
|
*HoldPkg =* package ...::
|
||||||
@@ -136,21 +145,24 @@ Options
|
|||||||
These files refer to files in the package archive, so do not include the
|
These files refer to files in the package archive, so do not include the
|
||||||
leading slash (the RootDir) when specifying them.
|
leading slash (the RootDir) when specifying them.
|
||||||
|
|
||||||
*CleanMethod =* KeepInstalled | KeepCurrent::
|
*CleanMethod =* KeepInstalled &| KeepCurrent::
|
||||||
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
|
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
|
||||||
packages that are no longer installed (not present in the local database).
|
packages that are no longer installed (not present in the local database).
|
||||||
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
|
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
|
||||||
any sync database).
|
any sync database).
|
||||||
The second behavior is useful when the package cache is shared among
|
The second behavior is useful when the package cache is shared among
|
||||||
multiple machines, where the local databases are usually different, but the
|
multiple machines, where the local databases are usually different, but the
|
||||||
sync databases in use could be the same.
|
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.
|
||||||
|
|
||||||
|
*SigLevel =* ...::
|
||||||
|
Set the default signature verification level. For more information, see
|
||||||
|
<<SC,Package and Database Signature Checking>> below.
|
||||||
|
|
||||||
*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*::
|
|
||||||
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
|
||||||
@@ -162,6 +174,14 @@ Options
|
|||||||
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.
|
||||||
|
|
||||||
|
*VerbosePkgLists*::
|
||||||
|
Displays name, version and size of target packages formatted
|
||||||
|
as a table for upgrade, sync and remove operations.
|
||||||
|
|
||||||
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
|
||||||
@@ -177,20 +197,10 @@ contain a file that lists the servers for that repository.
|
|||||||
|
|
||||||
--------
|
--------
|
||||||
[core]
|
[core]
|
||||||
# use this repository first
|
# use this server first
|
||||||
Server = ftp://ftp.archlinux.org/core/os/arch
|
|
||||||
# next use servers as defined in the mirrorlist below
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
|
||||||
--------
|
|
||||||
|
|
||||||
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'
|
|
||||||
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
|
||||||
|
# next use servers as defined in the mirrorlist below
|
||||||
|
Include = {sysconfdir}/pacman.d/mirrorlist
|
||||||
--------
|
--------
|
||||||
|
|
||||||
The order of repositories in the configuration files matters; repositories
|
The order of repositories in the configuration files matters; repositories
|
||||||
@@ -198,6 +208,88 @@ listed first will take precedence over those listed later in the file when
|
|||||||
packages in two repositories have identical names, regardless of version
|
packages in two repositories have identical names, regardless of version
|
||||||
number.
|
number.
|
||||||
|
|
||||||
|
*Include =* path::
|
||||||
|
Include another config file. This file can include repositories or
|
||||||
|
general configuration options. Wildcards in the specified paths will get
|
||||||
|
expanded based on linkman:glob[7] rules.
|
||||||
|
|
||||||
|
*Server =* url::
|
||||||
|
A full URL to a location where the database, packages, and signatures (if
|
||||||
|
available) for this repository can be found.
|
||||||
|
+
|
||||||
|
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'
|
||||||
|
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.
|
||||||
|
|
||||||
|
*SigLevel =* ...::
|
||||||
|
Set the signature verification level for this repository. For more
|
||||||
|
information, see <<SC,Package and Database Signature Checking>> below.
|
||||||
|
|
||||||
|
Package and Database Signature Checking
|
||||||
|
---------------------------------------
|
||||||
|
The 'SigLevel' directive is valid in both the `[options]` and repository
|
||||||
|
sections. If used in `[options]`, it sets a default value for any repository
|
||||||
|
that does not provide the setting.
|
||||||
|
|
||||||
|
* If set to *Never*, no signature checking will take place.
|
||||||
|
* If set to *Optional* , signatures will be checked when present, but unsigned
|
||||||
|
databases and packages will also be accepted.
|
||||||
|
* If set to *Required*, signatures will be required on all packages and
|
||||||
|
databases.
|
||||||
|
|
||||||
|
Alternatively, you can get more fine-grained control by combining some of
|
||||||
|
the options and prefixes described below. All options in a config file are
|
||||||
|
processed in top-to-bottom, left-to-right fashion, where later options override
|
||||||
|
and/or supplement earlier ones. If 'SigLevel' is specified in a repository
|
||||||
|
section, the starting value is that from the `[options]` section, or the
|
||||||
|
built-in system default as shown below if not specified.
|
||||||
|
|
||||||
|
The options are split into two main groups, described below. Terms used such as
|
||||||
|
``marginally trusted'' are terms used by GnuPG, for more information please
|
||||||
|
consult linkman:gpg[1].
|
||||||
|
|
||||||
|
When to Check::
|
||||||
|
These options control if and when signature checks should take place.
|
||||||
|
|
||||||
|
*Never*;;
|
||||||
|
All signature checking is suppressed, even if signatures are present.
|
||||||
|
|
||||||
|
*Optional* (default);;
|
||||||
|
Signatures are checked if present; absence of a signature is not an
|
||||||
|
error. An invalid signature is a fatal error, as is a signature from a
|
||||||
|
key not in the keyring.
|
||||||
|
|
||||||
|
*Required*;;
|
||||||
|
Signatures are required; absence of a signature or an invalid signature
|
||||||
|
is a fatal error, as is a signature from a key not in the keyring.
|
||||||
|
|
||||||
|
What is Allowed::
|
||||||
|
These options control what signatures are viewed as permissible. Note that
|
||||||
|
neither of these options allows acceptance of invalid or expired
|
||||||
|
signatures, or those from revoked keys.
|
||||||
|
|
||||||
|
*TrustedOnly* (default);;
|
||||||
|
If a signature is checked, it must be in the keyring and fully trusted;
|
||||||
|
marginal trust does not meet this criteria.
|
||||||
|
|
||||||
|
*TrustAll*;;
|
||||||
|
If a signature is checked, it must be in the keyring, but is not
|
||||||
|
required to be assigned a trust level (e.g., unknown or marginal
|
||||||
|
trust).
|
||||||
|
|
||||||
|
Options in both groups can additionally be prefixed with either *Package* or
|
||||||
|
*Database*, which will cause it to only take effect on the specified object
|
||||||
|
type. For example, `PackageTrustAll` would allow marginal and unknown trust
|
||||||
|
level signatures for packages.
|
||||||
|
|
||||||
|
The built-in default is the following:
|
||||||
|
|
||||||
|
--------
|
||||||
|
SigLevel = Optional TrustedOnly
|
||||||
|
--------
|
||||||
|
|
||||||
Using Your Own Repository
|
Using Your Own Repository
|
||||||
-------------------------
|
-------------------------
|
||||||
If you have numerous custom packages of your own, it is often easier to generate
|
If you have numerous custom packages of your own, it is often easier to generate
|
||||||
@@ -209,11 +301,12 @@ directory with these packages so pacman can find it when run with '\--refresh'.
|
|||||||
|
|
||||||
The above command will generate a compressed database named
|
The above command will generate a compressed database named
|
||||||
'/home/pkgs/custom.db.tar.gz'. Note that the database must be of the form
|
'/home/pkgs/custom.db.tar.gz'. Note that the database must be of the form
|
||||||
'{treename}.db.tar.gz', where '{treename}' is the name of the section defined in
|
'\{treename\}.db.tar.{ext}', where '\{treename\}' is the name of the section
|
||||||
the configuration file. That's it! Now configure your custom section in the
|
defined in the configuration file and '\{ext\}' is a valid compression type as
|
||||||
configuration file as shown in the config example above. Pacman will now use your
|
documented in linkman:repo-add[8]. That's it! Now configure your custom section
|
||||||
package repository. If you add new packages to the repository, remember to
|
in the configuration file as shown in the config example above. Pacman will now
|
||||||
re-generate the database and use pacman's '\--refresh' option.
|
use your package repository. If you add new packages to the repository,
|
||||||
|
remember to re-generate the database and use pacman's '\--refresh' option.
|
||||||
|
|
||||||
For more information on the repo-add command, see ``repo-add \--help'' or
|
For more information on the repo-add command, see ``repo-add \--help'' or
|
||||||
linkman:repo-add[8].
|
linkman:repo-add[8].
|
||||||
|
|||||||
42
doc/pkgdelta.8.txt
Normal file
42
doc/pkgdelta.8.txt
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/////
|
||||||
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
|
/////
|
||||||
|
pkgdelta(8)
|
||||||
|
=========
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
pkgdelta - package delta generation utility
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
'pkgdelta' [-q] <package1> <package2>
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
'pkgdelta' is used to create package delta files between two versions of the
|
||||||
|
same package. These files are essentially binary patches. linkman:pacman[8] can
|
||||||
|
download deltas instead of full package upgrades, and use them with the
|
||||||
|
previous versions of packages (in the package cache) to synthesize the upgraded
|
||||||
|
version of the packages. This likely reduces download sizes for upgrades
|
||||||
|
significantly.
|
||||||
|
|
||||||
|
'pkgdelta' requires linkman:xdelta3[1] to do its job.
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
*-q, \--quiet*::
|
||||||
|
Be quiet. Do not output anything but warnings and errors.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
$ pkgdelta libreoffice-3.3.2-1-x86_64.pkg.tar.xz libreoffice-3.3.2-2-x86_64.pkg.tar.xz
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
linkman:pacman[8], linkman:xdelta3[1]
|
||||||
|
|
||||||
|
include::footer.txt[]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/////
|
/////
|
||||||
vim:set ts=4 sw=4 syntax=asciidoc noet:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
repo-add(8)
|
repo-add(8)
|
||||||
==========
|
==========
|
||||||
@@ -10,33 +10,66 @@ repo-add - package database maintenance utility
|
|||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
repo-add [-q] <path-to-db> <package1> [<package2> ...]
|
'repo-add' [options] <path-to-db> <package|delta> [<package|delta> ...]
|
||||||
|
|
||||||
repo-remove [-q] <path-to-db> <packagename> [<packagename2> ...]
|
'repo-remove' [options] <path-to-db> <packagename|delta> [<packagename|delta> ...]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
repo-add and repo-remove are two scripts to help build a package database for
|
'repo-add' and 'repo-remove' are two scripts to help build a package database for
|
||||||
packages built with linkman:makepkg[8] and installed with linkman:pacman[8].
|
packages built with linkman:makepkg[8] and installed with linkman:pacman[8].
|
||||||
|
They also handle package deltas produced by linkman:pkgdelta[8].
|
||||||
|
|
||||||
repo-add will update a package database by reading a built package file.
|
'repo-add' will update a package database by reading a built package or package
|
||||||
Multiple packages to add can be specified on the command line.
|
delta file. Multiple packages and/or deltas to add can be specified on the
|
||||||
|
command line.
|
||||||
|
|
||||||
repo-remove will update a package database by removing the package name
|
'repo-remove' will update a package database by removing the package name or
|
||||||
specified on the command line. Multiple packages to remove can be specified
|
delta specified on the command line. Multiple packages and/or delta to remove
|
||||||
on the command line.
|
can be specified on the command line.
|
||||||
|
|
||||||
|
A package database is a tar file, optionally compressed. Valid extensions are
|
||||||
|
``.db'' or ``.files'' followed by an archive extension of ``.tar'',
|
||||||
|
``.tar.gz'', ``.tar.bz2'', ``.tar.xz'', or ``.tar.Z''. The file does not need
|
||||||
|
to exist, but all parent directories must exist.
|
||||||
|
|
||||||
|
|
||||||
Options
|
Common Options
|
||||||
-------
|
--------------
|
||||||
*-q, \--quiet*::
|
*-q, \--quiet*::
|
||||||
Force this program to keep quiet and run silent except for warning and
|
Force this program to keep quiet and run silent except for warning and
|
||||||
error messages.
|
error messages.
|
||||||
|
|
||||||
|
*-s, \--sign*::
|
||||||
|
Generate a PGP signature file using GnuPG. This will execute `gpg
|
||||||
|
--detach-sign --use-agent` on the generated database to generate a detached
|
||||||
|
signature file, using the GPG agent if it is available. The signature file
|
||||||
|
will be the entire filename of the database with a ``.sig'' extension.
|
||||||
|
|
||||||
|
*-k, \--key* <key>::
|
||||||
|
Specify a key to use when signing packages. Can also be specified using
|
||||||
|
the GPGKEY environmental variable. If not specified in either location, the
|
||||||
|
default key from the keyring will be used.
|
||||||
|
|
||||||
|
*-v, \--verify*::
|
||||||
|
Verify the PGP signature of the database before updating the database.
|
||||||
|
If the signature is invalid, an error is produced and the update does not
|
||||||
|
proceed.
|
||||||
|
|
||||||
|
repo-add Options
|
||||||
|
----------------
|
||||||
|
*-d, \--delta*::
|
||||||
|
Automatically generate and add a delta file between the old entry and the
|
||||||
|
new one, if the old package file is found next to the new one.
|
||||||
|
|
||||||
|
*-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.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
linkman:makepkg[8], linkman:pacman[8]
|
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
||||||
|
|
||||||
include::footer.txt[]
|
include::footer.txt[]
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ started with GIT if you have not worked with it before.
|
|||||||
|
|
||||||
The pacman code can be fetched using the following command:
|
The pacman code can be fetched using the following command:
|
||||||
|
|
||||||
git clone git://projects.archlinux.org/pacman.git
|
git clone git://projects.archlinux.org/pacman.git
|
||||||
|
|
||||||
|
|
||||||
Creating your patch
|
Creating your patch
|
||||||
@@ -32,7 +32,7 @@ Creating your patch
|
|||||||
The -s allows you to credit yourself by adding a "Signed Off By" line to
|
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.
|
indicate who has "signed" the patch - who has approved it.
|
||||||
|
|
||||||
Signed-off-by: Aaron Griffin <aaron@archlinux.org>
|
Signed-off-by: Aaron Griffin <aaron@archlinux.org>
|
||||||
|
|
||||||
Please use your real name and email address. Feel free to "scramble" the
|
Please use your real name and email address. Feel free to "scramble" the
|
||||||
address if you're afraid of spam.
|
address if you're afraid of spam.
|
||||||
@@ -94,5 +94,5 @@ aren't their own.
|
|||||||
--
|
--
|
||||||
|
|
||||||
/////
|
/////
|
||||||
vim: set ts=2 sw=2 syntax=asciidoc et:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
|
|||||||
@@ -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
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -64,7 +79,7 @@ Incremental Updates
|
|||||||
If you have more advanced needs you will have to get a copy of the pacman
|
If you have more advanced needs you will have to get a copy of the pacman
|
||||||
repository.
|
repository.
|
||||||
|
|
||||||
git clone git://projects.archlinux.org/pacman.git pacman
|
git clone git://projects.archlinux.org/pacman.git pacman
|
||||||
|
|
||||||
Next, you will need to run `./autogen.sh` and `./configure` in the base
|
Next, you will need to run `./autogen.sh` and `./configure` in the base
|
||||||
directory to generate the correct Makefiles. At this point, all necessary
|
directory to generate the correct Makefiles. At this point, all necessary
|
||||||
@@ -76,11 +91,11 @@ We need to first update the main message catalog file. Navigate into either the
|
|||||||
work on first, and execute the following command. If you are working in the
|
work on first, and execute the following command. If you are working in the
|
||||||
`po/` tree, replace 'libalpm.pot' with 'pacman.pot':
|
`po/` tree, replace 'libalpm.pot' with 'pacman.pot':
|
||||||
|
|
||||||
make libalpm.pot-update
|
make libalpm.pot-update
|
||||||
|
|
||||||
Next, update your specific language's translation file:
|
Next, update your specific language's translation file:
|
||||||
|
|
||||||
make <po file>-update
|
make <po file>-update
|
||||||
|
|
||||||
At this point, you can do the translation. To submit your changes, either email
|
At this point, you can do the translation. To submit your changes, either email
|
||||||
the new `.po` file to the mailing-list with *[translation]* in the subject, or
|
the new `.po` file to the mailing-list with *[translation]* in the subject, or
|
||||||
@@ -89,7 +104,7 @@ submit a GIT-formatted patch (please do not include any `.pot` file changes).
|
|||||||
As a shortcut, all translation files (including `.pot` files) can be updated
|
As a shortcut, all translation files (including `.pot` files) can be updated
|
||||||
with the following command:
|
with the following command:
|
||||||
|
|
||||||
make update-po
|
make update-po
|
||||||
|
|
||||||
Adding a New Language
|
Adding a New Language
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -118,16 +133,16 @@ msgid and msgstr 'variables' can be on as many lines as necessary. Line breaks
|
|||||||
are ignored- if you need a literal line break, use an `\n` in your string. The
|
are ignored- if you need a literal line break, use an `\n` in your string. The
|
||||||
following two translations are equivalent:
|
following two translations are equivalent:
|
||||||
|
|
||||||
msgstr "This is a test translation"
|
msgstr "This is a test translation"
|
||||||
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"This is a test translation"
|
"This is a test translation"
|
||||||
|
|
||||||
If you want to test the translation (for example, the frontend one):
|
If you want to test the translation (for example, the frontend one):
|
||||||
|
|
||||||
rm *.gmo stamp-po
|
rm *.gmo stamp-po
|
||||||
make
|
make
|
||||||
cp <lang code>.gmo /usr/share/locale/<lang code>/LC_MESSAGES/pacman.mo
|
cp <lang code>.gmo /usr/share/locale/<lang code>/LC_MESSAGES/pacman.mo
|
||||||
|
|
||||||
|
|
||||||
Translating Manpages
|
Translating Manpages
|
||||||
@@ -145,5 +160,5 @@ check there first before undergoing a translation effort to ensure you are not
|
|||||||
duplicating efforts.
|
duplicating efforts.
|
||||||
|
|
||||||
/////
|
/////
|
||||||
vim: set ts=2 sw=2 syntax=asciidoc et:
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
/////
|
/////
|
||||||
|
|||||||
76
doc/vercmp.8.txt
Normal file
76
doc/vercmp.8.txt
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/////
|
||||||
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
|
/////
|
||||||
|
vercmp(8)
|
||||||
|
=========
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
vercmp - version comparison 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 comparison operates as follows:
|
||||||
|
|
||||||
|
Alphanumeric:
|
||||||
|
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
|
||||||
|
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`.
|
||||||
|
|
||||||
|
Keep in mind that the 'pkgrel' is only compared if it is available on both
|
||||||
|
versions given to this tool. For example, comparing `1.5-1` and `1.5` will
|
||||||
|
yield 0; comparing `1.5-1` and `1.5-2` will yield < 0 as expected. This is
|
||||||
|
mainly for supporting versioned dependencies that do not include the 'pkgrel'.
|
||||||
|
|
||||||
|
|
||||||
|
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[]
|
||||||
@@ -19,12 +19,11 @@ edit = sed \
|
|||||||
-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' \
|
||||||
-e 's|@CARCHFLAGS[@]|$(CARCHFLAGS)|g' \
|
|
||||||
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
|
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
|
||||||
|
|
||||||
$(dist_sysconf_DATA): Makefile
|
$(dist_sysconf_DATA): Makefile
|
||||||
@echo ' ' GEN $@;
|
@echo ' ' GEN $@;
|
||||||
@rm -f $@ $@.tmp
|
@$(RM) $@ $@.tmp
|
||||||
@$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
|
@$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
|
||||||
@mv $@.tmp $@
|
@mv $@.tmp $@
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
#
|
#
|
||||||
#-- 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 -O %o %u'
|
DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'http::/usr/bin/wget -c -t 3 --waitretry=3 -O %o %u'
|
'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate -O %o %u'
|
'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'rsync::/usr/bin/rsync -z %u %o'
|
'rsync::/usr/bin/rsync --no-motd -z %u %o'
|
||||||
'scp::/usr/bin/scp -C %u %o')
|
'scp::/usr/bin/scp -C %u %o')
|
||||||
|
|
||||||
# Other common tools:
|
# Other common tools:
|
||||||
# /usr/bin/snarf
|
# /usr/bin/snarf
|
||||||
# /usr/bin/lftpget -c
|
# /usr/bin/lftpget -c
|
||||||
# /usr/bin/curl
|
# /usr/bin/wget
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# ARCHITECTURE, COMPILE FLAGS
|
# ARCHITECTURE, COMPILE FLAGS
|
||||||
@@ -26,11 +26,9 @@ DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
|
|||||||
CARCH="@CARCH@"
|
CARCH="@CARCH@"
|
||||||
CHOST="@CHOST@"
|
CHOST="@CHOST@"
|
||||||
|
|
||||||
#-- Exclusive: will only run on @CARCH@
|
#-- Compiler and Linker Flags
|
||||||
# -march (or -mcpu) builds exclusively for an architecture
|
#CFLAGS="-O2 -pipe"
|
||||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
#CXXFLAGS="-O2 -pipe"
|
||||||
CFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
|
||||||
CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
|
||||||
#LDFLAGS=""
|
#LDFLAGS=""
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
@@ -39,36 +37,42 @@ CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
|
|||||||
# BUILD ENVIRONMENT
|
# BUILD ENVIRONMENT
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache)
|
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
||||||
# 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
|
||||||
|
#-- check: Run the check() function if present in the PKGBUILD
|
||||||
|
#-- sign: Generate PGP signature file
|
||||||
#
|
#
|
||||||
BUILDENV=(fakeroot !distcc color !ccache)
|
BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
||||||
#
|
#
|
||||||
#-- 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.
|
||||||
#DISTCC_HOSTS=""
|
#DISTCC_HOSTS=""
|
||||||
|
#
|
||||||
|
#-- Specify a directory for package building.
|
||||||
|
#BUILDDIR=/tmp/makepkg
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# GLOBAL PACKAGE OPTIONS
|
# GLOBAL PACKAGE OPTIONS
|
||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
|
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge !upx)
|
||||||
# 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 in STRIP_DIRS
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
#-- docs: Save doc directories specified by DOC_DIRS
|
#-- 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
|
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||||
#-- purge: Remove files specified by PURGE_TARGETS
|
#-- purge: Remove files specified by PURGE_TARGETS
|
||||||
|
#-- upx: Compress binary executable files using UPX
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool emptydirs zipman purge)
|
OPTIONS=(strip docs libtool emptydirs zipman purge !upx)
|
||||||
|
|
||||||
#-- 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)
|
||||||
@@ -82,8 +86,6 @@ STRIP_STATIC="@STRIP_STATIC@"
|
|||||||
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
|
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
|
||||||
#-- Doc directories to remove (if !docs is specified)
|
#-- Doc directories to remove (if !docs is specified)
|
||||||
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
||||||
#-- Directories to be searched for the strip option (if strip is specified)
|
|
||||||
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
|
|
||||||
#-- Files to be removed from all packages (if purge is specified)
|
#-- Files to be removed from all packages (if purge is specified)
|
||||||
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
||||||
|
|
||||||
@@ -101,6 +103,8 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
|||||||
#SRCPKGDEST=/home/srcpackages
|
#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>"
|
||||||
|
#-- Specify a key to use for package signing
|
||||||
|
#GPGKEY=""
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# EXTENSION DEFAULTS
|
# EXTENSION DEFAULTS
|
||||||
|
|||||||
@@ -13,11 +13,12 @@
|
|||||||
#DBPath = @localstatedir@/lib/pacman/
|
#DBPath = @localstatedir@/lib/pacman/
|
||||||
#CacheDir = @localstatedir@/cache/pacman/pkg/
|
#CacheDir = @localstatedir@/cache/pacman/pkg/
|
||||||
#LogFile = @localstatedir@/log/pacman.log
|
#LogFile = @localstatedir@/log/pacman.log
|
||||||
|
#GPGDir = @sysconfdir@/pacman.d/gnupg/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
# If upgrades are available for these packages they will be asked for first
|
# If upgrades are available for these packages they will be asked for first
|
||||||
SyncFirst = pacman
|
SyncFirst = pacman
|
||||||
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#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 - %u > %o
|
|
||||||
#CleanMethod = KeepInstalled
|
#CleanMethod = KeepInstalled
|
||||||
Architecture = auto
|
Architecture = auto
|
||||||
|
|
||||||
@@ -28,11 +29,15 @@ Architecture = auto
|
|||||||
#NoUpgrade =
|
#NoUpgrade =
|
||||||
#NoExtract =
|
#NoExtract =
|
||||||
|
|
||||||
# Misc options (all disabled by default)
|
# Misc options
|
||||||
#UseSyslog
|
#UseSyslog
|
||||||
#ShowSize
|
|
||||||
#UseDelta
|
#UseDelta
|
||||||
#TotalDownload
|
#TotalDownload
|
||||||
|
CheckSpace
|
||||||
|
#VerbosePkgLists
|
||||||
|
|
||||||
|
# PGP signature checking
|
||||||
|
#SigLevel = Optional
|
||||||
|
|
||||||
#
|
#
|
||||||
# REPOSITORIES
|
# REPOSITORIES
|
||||||
@@ -58,6 +63,7 @@ Architecture = auto
|
|||||||
# 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]
|
||||||
|
#SigLevel = Required
|
||||||
#Server = ftp://ftp.example.com/foobar/$repo/os/$arch/
|
#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
|
||||||
@@ -65,5 +71,6 @@ Architecture = auto
|
|||||||
# An example of a custom package repository. See the pacman manpage for
|
# An example of a custom package repository. See the pacman manpage for
|
||||||
# tips on creating your own repositories.
|
# tips on creating your own repositories.
|
||||||
#[custom]
|
#[custom]
|
||||||
|
#SigLevel = Optional TrustAll
|
||||||
#Server = file:///home/custompkgs
|
#Server = file:///home/custompkgs
|
||||||
|
|
||||||
|
|||||||
231
install-sh
231
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=
|
||||||
|
else
|
||||||
|
posix_glob=:
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
'
|
||||||
|
|
||||||
posix_glob=
|
|
||||||
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,65 +110,55 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
|||||||
In the 4th, create DIRECTORIES.
|
In the 4th, create DIRECTORIES.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-c (ignored)
|
--help display this help and exit.
|
||||||
-d create directories instead of installing files.
|
--version display version info and exit.
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
|
||||||
-m MODE $chmodprog installed files to MODE.
|
-c (ignored)
|
||||||
-o USER $chownprog installed files to USER.
|
-C install only if different (preserve the last data modification time)
|
||||||
-s $stripprog installed files.
|
-d create directories instead of installing files.
|
||||||
-t DIRECTORY install into DIRECTORY.
|
-g GROUP $chgrpprog installed files to GROUP.
|
||||||
-T report an error if DSTFILE is a directory.
|
-m MODE $chmodprog installed files to MODE.
|
||||||
--help display this help and exit.
|
-o USER $chownprog installed files to USER.
|
||||||
--version display version info and exit.
|
-s $stripprog installed files.
|
||||||
|
-t DIRECTORY install into DIRECTORY.
|
||||||
|
-T report an error if DSTFILE is a directory.
|
||||||
|
|
||||||
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.
|
||||||
@@ -224,7 +234,7 @@ for src
|
|||||||
do
|
do
|
||||||
# Protect names starting with `-'.
|
# Protect names starting with `-'.
|
||||||
case $src in
|
case $src in
|
||||||
-*) src=./$src ;;
|
-*) src=./$src;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
if test -n "$dir_arg"; then
|
||||||
@@ -242,22 +252,22 @@ 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;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work
|
# If destination is a directory, append the input filename; won't work
|
||||||
# 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"; } &&
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
# If -C, don't bother to copy if it wouldn't change the file.
|
||||||
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|
if $copy_on_change &&
|
||||||
|| {
|
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||||
# to itself, or perhaps because mv is so ancient that it does not
|
|
||||||
# support -f.
|
|
||||||
|
|
||||||
# Now remove or move aside any old file at destination location.
|
eval "$initialize_posix_glob" &&
|
||||||
# We try this two ways since rm can't unlink itself on some
|
$posix_glob set -f &&
|
||||||
# systems and the destination file might be busy for other
|
set X $old && old=:$2:$4:$5:$6 &&
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
set X $new && new=:$2:$4:$5:$6 &&
|
||||||
# file should still install successfully.
|
$posix_glob set +f &&
|
||||||
{
|
|
||||||
if test -f "$dst"; then
|
|
||||||
$doit $rmcmd -f "$dst" 2>/dev/null \
|
|
||||||
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
|
|
||||||
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|
|
||||||
|| {
|
|
||||||
echo "$0: cannot unlink or rename $dst" >&2
|
|
||||||
(exit 1); exit 1
|
|
||||||
}
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
} &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
test "$old" = "$new" &&
|
||||||
$doit $mvcmd "$dsttmp" "$dst"
|
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||||
}
|
then
|
||||||
} || exit 1
|
rm -f "$dsttmp"
|
||||||
|
else
|
||||||
|
# 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
|
||||||
|
# to itself, or perhaps because mv is so ancient that it does not
|
||||||
|
# support -f.
|
||||||
|
{
|
||||||
|
# Now remove or move aside any old file at destination location.
|
||||||
|
# We try this two ways since rm can't unlink itself on some
|
||||||
|
# systems and the destination file might be busy for other
|
||||||
|
# reasons. In this case, the final cleanup might fail but the new
|
||||||
|
# file should still install successfully.
|
||||||
|
{
|
||||||
|
test ! -f "$dst" ||
|
||||||
|
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||||
|
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||||
|
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||||
|
} ||
|
||||||
|
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||||
|
(exit 1); exit 1
|
||||||
|
}
|
||||||
|
} &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
$doit $mvcmd "$dsttmp" "$dst"
|
||||||
|
}
|
||||||
|
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:
|
||||||
|
|||||||
@@ -25,28 +25,42 @@ 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 \
|
||||||
be_package.c \
|
be_package.c \
|
||||||
cache.h cache.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 \
|
||||||
|
diskspace.h diskspace.c \
|
||||||
dload.h dload.c \
|
dload.h dload.c \
|
||||||
error.c \
|
error.c \
|
||||||
graph.h \
|
graph.h graph.c \
|
||||||
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 \
|
||||||
|
rawstr.c \
|
||||||
remove.h remove.c \
|
remove.h remove.c \
|
||||||
|
signing.c signing.h \
|
||||||
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
|
version.c
|
||||||
|
|
||||||
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
|
if !HAVE_LIBSSL
|
||||||
|
libalpm_la_SOURCES += \
|
||||||
|
md5.h md5.c \
|
||||||
|
sha2.h sha2.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
if HAVE_LIBGPGME
|
||||||
|
libalpm_la_SOURCES += \
|
||||||
|
base64.h base64.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@
|
||||||
libalpm_la_LIBADD = $(LTLIBINTL)
|
libalpm_la_LIBADD = $(LTLIBINTL)
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* add.c
|
* add.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -37,92 +38,109 @@
|
|||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "add.h"
|
#include "add.h"
|
||||||
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
#include "handle.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "cache.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "backup.h"
|
#include "backup.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "conflict.h"
|
|
||||||
#include "deps.h"
|
|
||||||
#include "remove.h"
|
#include "remove.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
|
||||||
/** Add a file target to the transaction.
|
/** Add a package to the transaction. */
|
||||||
* @param target the name of the file target to add
|
int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_add_target(char *target)
|
|
||||||
{
|
{
|
||||||
pmpkg_t *pkg = NULL;
|
|
||||||
const char *pkgname, *pkgver;
|
const char *pkgname, *pkgver;
|
||||||
alpm_list_t *i;
|
alpm_trans_t *trans;
|
||||||
pmtrans_t *trans;
|
alpm_pkg_t *local;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(target != NULL && strlen(target) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
|
||||||
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
|
ASSERT(trans->state == STATE_INITIALIZED,
|
||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "loading target '%s'\n", target);
|
pkgname = pkg->name;
|
||||||
|
pkgver = pkg->version;
|
||||||
|
|
||||||
if(alpm_pkg_load(target, 1, &pkg) != 0) {
|
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);
|
||||||
goto error;
|
|
||||||
|
if(_alpm_pkg_find(trans->add, pkgname)) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
|
||||||
}
|
}
|
||||||
pkgname = alpm_pkg_get_name(pkg);
|
|
||||||
pkgver = alpm_pkg_get_version(pkg);
|
|
||||||
|
|
||||||
/* check if an older version of said package is already in transaction
|
local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname);
|
||||||
* packages. if so, replace it in the list */
|
if(local) {
|
||||||
for(i = trans->add; i; i = i->next) {
|
const char *localpkgname = local->name;
|
||||||
pmpkg_t *transpkg = i->data;
|
const char *localpkgver = local->version;
|
||||||
if(strcmp(transpkg->name, pkgname) == 0) {
|
int cmp = _alpm_pkg_compare_versions(pkg, local);
|
||||||
if(alpm_pkg_vercmp(transpkg->version, pkgver) < 0) {
|
|
||||||
_alpm_log(PM_LOG_WARNING,
|
if(cmp == 0) {
|
||||||
_("replacing older version %s-%s by %s in target list\n"),
|
if(trans->flags & ALPM_TRANS_FLAG_NEEDED) {
|
||||||
transpkg->name, transpkg->version, pkgver);
|
/* with the NEEDED flag, packages up to date are not reinstalled */
|
||||||
_alpm_pkg_free(i->data);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
|
||||||
i->data = pkg;
|
localpkgname, localpkgver);
|
||||||
} else {
|
return 0;
|
||||||
_alpm_log(PM_LOG_WARNING,
|
} else if(!(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY)) {
|
||||||
_("skipping %s-%s because newer version %s is in target list\n"),
|
_alpm_log(handle, ALPM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
|
||||||
pkgname, pkgver, transpkg->version);
|
localpkgname, localpkgver);
|
||||||
_alpm_pkg_free(pkg);
|
|
||||||
}
|
}
|
||||||
return(0);
|
} else if(cmp < 0) {
|
||||||
|
/* local version is newer */
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"),
|
||||||
|
localpkgname, localpkgver, pkgver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the package to the transaction */
|
/* add the package to the transaction */
|
||||||
|
pkg->reason = ALPM_PKG_REASON_EXPLICIT;
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s-%s to the transaction add list\n",
|
||||||
|
pkgname, pkgver);
|
||||||
trans->add = alpm_list_add(trans->add, pkg);
|
trans->add = alpm_list_add(trans->add, pkg);
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
|
|
||||||
error:
|
|
||||||
_alpm_pkg_free(pkg);
|
|
||||||
return(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int extract_single_file(struct archive *archive,
|
static int perform_extraction(alpm_handle_t *handle, struct archive *archive,
|
||||||
struct archive_entry *entry, pmpkg_t *newpkg, pmpkg_t *oldpkg,
|
struct archive_entry *entry, const char *filename, const char *origname)
|
||||||
pmtrans_t *trans, pmdb_t *db)
|
{
|
||||||
|
int ret;
|
||||||
|
const int archive_flags = ARCHIVE_EXTRACT_OWNER |
|
||||||
|
ARCHIVE_EXTRACT_PERM |
|
||||||
|
ARCHIVE_EXTRACT_TIME;
|
||||||
|
|
||||||
|
archive_entry_set_pathname(entry, filename);
|
||||||
|
|
||||||
|
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(handle, ALPM_LOG_WARNING, _("warning given when extracting %s (%s)\n"),
|
||||||
|
origname, archive_error_string(archive));
|
||||||
|
} else if(ret != ARCHIVE_OK) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
||||||
|
origname, archive_error_string(archive));
|
||||||
|
alpm_logaction(handle, "error: could not extract %s (%s)\n",
|
||||||
|
origname, archive_error_string(archive));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
||||||
|
struct archive_entry *entry, alpm_pkg_t *newpkg, alpm_pkg_t *oldpkg)
|
||||||
{
|
{
|
||||||
const char *entryname;
|
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;
|
const char *hash_orig = NULL;
|
||||||
char *entryname_orig = NULL;
|
char *entryname_orig = NULL;
|
||||||
const int archive_flags = ARCHIVE_EXTRACT_OWNER |
|
|
||||||
ARCHIVE_EXTRACT_PERM |
|
|
||||||
ARCHIVE_EXTRACT_TIME;
|
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
entryname = archive_entry_pathname(entry);
|
entryname = archive_entry_pathname(entry);
|
||||||
@@ -133,19 +151,19 @@ 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",
|
snprintf(filename, PATH_MAX, "%s%s-%s/install",
|
||||||
_alpm_db_path(db), newpkg->name, newpkg->version);
|
_alpm_db_path(handle->db_local), newpkg->name, newpkg->version);
|
||||||
archive_entry_set_perm(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",
|
snprintf(filename, PATH_MAX, "%s%s-%s/changelog",
|
||||||
_alpm_db_path(db), newpkg->name, newpkg->version);
|
_alpm_db_path(handle->db_local), newpkg->name, newpkg->version);
|
||||||
archive_entry_set_perm(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) */
|
||||||
_alpm_log(PM_LOG_DEBUG, "skipping extraction of '%s'\n", entryname);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "skipping extraction of '%s'\n", entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(0);
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* build the new entryname relative to handle->root */
|
/* build the new entryname relative to handle->root */
|
||||||
snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
|
snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
|
||||||
@@ -153,20 +171,12 @@ static int extract_single_file(struct archive *archive,
|
|||||||
|
|
||||||
/* if a file is in NoExtract then we never extract it */
|
/* if a file is in NoExtract then we never extract it */
|
||||||
if(alpm_list_find_str(handle->noextract, entryname)) {
|
if(alpm_list_find_str(handle->noextract, entryname)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "%s is in NoExtract, skipping extraction\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoExtract, skipping extraction\n",
|
||||||
entryname);
|
entryname);
|
||||||
alpm_logaction("note: %s is in NoExtract, skipping extraction\n",
|
alpm_logaction(handle, "note: %s is in NoExtract, skipping extraction\n",
|
||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(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
|
||||||
@@ -200,42 +210,42 @@ static int extract_single_file(struct archive *archive,
|
|||||||
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 */
|
||||||
mode_t mask = 07777;
|
mode_t mask = 07777;
|
||||||
_alpm_log(PM_LOG_WARNING, _("directory permissions differ on %s\n"
|
_alpm_log(handle, ALPM_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);
|
||||||
alpm_logaction("warning: directory permissions differ on %s\n"
|
alpm_logaction(handle, "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);
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
|
||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(0);
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* case 10/11: trying to overwrite dir with file/symlink, don't allow it */
|
/* case 10/11: trying to overwrite dir with file/symlink, don't allow it */
|
||||||
_alpm_log(PM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
|
||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(1);
|
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)) {
|
||||||
/* the symlink on FS is to a directory, so we'll use it */
|
/* the symlink on FS is to a directory, so we'll use it */
|
||||||
_alpm_log(PM_LOG_DEBUG, "extract: skipping symlink overwrite of %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping symlink overwrite of %s\n",
|
||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(0);
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* this is BAD. symlink was not to a directory */
|
/* this is BAD. symlink was not to a directory */
|
||||||
_alpm_log(PM_LOG_ERROR, _("extract: symlink %s does not point to dir\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("extract: symlink %s does not point to dir\n"),
|
||||||
entryname);
|
entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return(1);
|
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(handle, ALPM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
|
||||||
entryname);
|
entryname);
|
||||||
} else if(S_ISREG(entrymode)) {
|
} else if(S_ISREG(entrymode)) {
|
||||||
/* case 4,7: */
|
/* case 4,7: */
|
||||||
@@ -243,24 +253,24 @@ static int extract_single_file(struct archive *archive,
|
|||||||
if(alpm_list_find_str(handle->noupgrade, entryname)) {
|
if(alpm_list_find_str(handle->noupgrade, entryname)) {
|
||||||
notouch = 1;
|
notouch = 1;
|
||||||
} else {
|
} else {
|
||||||
|
alpm_backup_t *backup;
|
||||||
/* go to the backup array and see if our conflict is there */
|
/* go to the backup array and see if our conflict is there */
|
||||||
/* check newpkg first, so that adding backup files is retroactive */
|
/* check newpkg first, so that adding backup files is retroactive */
|
||||||
if(alpm_list_find_str(alpm_pkg_get_backup(newpkg), entryname) != NULL) {
|
backup = _alpm_needbackup(entryname, newpkg);
|
||||||
|
if(backup) {
|
||||||
|
/* if we force hash_orig to be non-NULL retroactive backup works */
|
||||||
|
hash_orig = "";
|
||||||
needbackup = 1;
|
needbackup = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check oldpkg for a backup entry, store the hash if available */
|
/* check oldpkg for a backup entry, store the hash if available */
|
||||||
if(oldpkg) {
|
if(oldpkg) {
|
||||||
hash_orig = _alpm_needbackup(entryname, alpm_pkg_get_backup(oldpkg));
|
backup = _alpm_needbackup(entryname, oldpkg);
|
||||||
if(hash_orig) {
|
if(backup) {
|
||||||
|
hash_orig = backup->hash;
|
||||||
needbackup = 1;
|
needbackup = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we force hash_orig to be non-NULL retroactive backup works */
|
|
||||||
if(needbackup && !hash_orig) {
|
|
||||||
STRDUP(hash_orig, "", RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* else if(S_ISLNK(entrymode)) */
|
/* else if(S_ISLNK(entrymode)) */
|
||||||
@@ -269,7 +279,7 @@ static int extract_single_file(struct archive *archive,
|
|||||||
|
|
||||||
/* we need access to the original entryname later after calls to
|
/* we need access to the original entryname later after calls to
|
||||||
* archive_entry_set_pathname(), so we need to dupe it and free() later */
|
* archive_entry_set_pathname(), so we need to dupe it and free() later */
|
||||||
STRDUP(entryname_orig, entryname, RET_ERR(PM_ERR_MEMORY, -1));
|
STRDUP(entryname_orig, entryname, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
|
|
||||||
if(needbackup) {
|
if(needbackup) {
|
||||||
char checkfile[PATH_MAX];
|
char checkfile[PATH_MAX];
|
||||||
@@ -277,53 +287,37 @@ static int extract_single_file(struct archive *archive,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
snprintf(checkfile, PATH_MAX, "%s.paccheck", filename);
|
snprintf(checkfile, PATH_MAX, "%s.paccheck", filename);
|
||||||
archive_entry_set_pathname(entry, checkfile);
|
|
||||||
|
|
||||||
ret = archive_read_extract(archive, entry, archive_flags);
|
ret = perform_extraction(handle, archive, entry, checkfile, entryname_orig);
|
||||||
if(ret == ARCHIVE_WARN) {
|
if(ret == 1) {
|
||||||
/* operation succeeded but a non-critical error was encountered */
|
/* error */
|
||||||
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
|
|
||||||
entryname_orig, archive_error_string(archive));
|
|
||||||
} else if(ret != ARCHIVE_OK) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
|
||||||
entryname_orig, archive_error_string(archive));
|
|
||||||
alpm_logaction("error: could not extract %s (%s)\n",
|
|
||||||
entryname_orig, archive_error_string(archive));
|
|
||||||
FREE(hash_orig);
|
|
||||||
FREE(entryname_orig);
|
FREE(entryname_orig);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_local = alpm_compute_md5sum(filename);
|
hash_local = alpm_compute_md5sum(filename);
|
||||||
hash_pkg = alpm_compute_md5sum(checkfile);
|
hash_pkg = alpm_compute_md5sum(checkfile);
|
||||||
|
|
||||||
/* append the new md5 hash to it's respective entry
|
/* update the md5 hash in newpkg's backup (it will be the new orginal) */
|
||||||
* in newpkg's backup (it will be the new orginal) */
|
alpm_list_t *i;
|
||||||
alpm_list_t *backups;
|
for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) {
|
||||||
for(backups = alpm_pkg_get_backup(newpkg); backups;
|
alpm_backup_t *backup = i->data;
|
||||||
backups = alpm_list_next(backups)) {
|
char *newhash;
|
||||||
char *oldbackup = alpm_list_getdata(backups);
|
if(!backup->name || strcmp(backup->name, entryname_orig) != 0) {
|
||||||
if(!oldbackup || strcmp(oldbackup, entryname_orig) != 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
char *backup = NULL;
|
STRDUP(newhash, hash_pkg, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
/* length is tab char, null byte and MD5 (32 char) */
|
FREE(backup->hash);
|
||||||
size_t backup_len = strlen(oldbackup) + 34;
|
backup->hash = newhash;
|
||||||
MALLOC(backup, backup_len, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
|
|
||||||
sprintf(backup, "%s\t%s", oldbackup, hash_pkg);
|
|
||||||
backup[backup_len-1] = '\0';
|
|
||||||
FREE(oldbackup);
|
|
||||||
backups->data = backup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "checking hashes for %s\n", entryname_orig);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking hashes for %s\n", entryname_orig);
|
||||||
_alpm_log(PM_LOG_DEBUG, "current: %s\n", hash_local);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "current: %s\n", hash_local);
|
||||||
_alpm_log(PM_LOG_DEBUG, "new: %s\n", hash_pkg);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "new: %s\n", hash_pkg);
|
||||||
_alpm_log(PM_LOG_DEBUG, "original: %s\n", hash_orig);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "original: %s\n", hash_orig);
|
||||||
|
|
||||||
if(!oldpkg) {
|
if(!oldpkg) {
|
||||||
if(strcmp(hash_local, hash_pkg) != 0) {
|
if(hash_local && hash_pkg && 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 */
|
||||||
char newpath[PATH_MAX];
|
char newpath[PATH_MAX];
|
||||||
@@ -331,22 +325,22 @@ static int extract_single_file(struct archive *archive,
|
|||||||
|
|
||||||
/* move the existing file to the "pacorig" */
|
/* move the existing file to the "pacorig" */
|
||||||
if(rename(filename, newpath)) {
|
if(rename(filename, newpath)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
filename, newpath, strerror(errno));
|
filename, newpath, strerror(errno));
|
||||||
alpm_logaction("error: could not rename %s to %s (%s)\n",
|
alpm_logaction(handle, "error: could not rename %s to %s (%s)\n",
|
||||||
filename, newpath, strerror(errno));
|
filename, newpath, strerror(errno));
|
||||||
errors++;
|
errors++;
|
||||||
} else {
|
} else {
|
||||||
/* rename the file we extracted to the real name */
|
/* rename the file we extracted to the real name */
|
||||||
if(rename(checkfile, filename)) {
|
if(rename(checkfile, filename)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
checkfile, filename, strerror(errno));
|
checkfile, filename, strerror(errno));
|
||||||
alpm_logaction("error: could not rename %s to %s (%s)\n",
|
alpm_logaction(handle, "error: could not rename %s to %s (%s)\n",
|
||||||
checkfile, filename, strerror(errno));
|
checkfile, filename, strerror(errno));
|
||||||
errors++;
|
errors++;
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
|
||||||
alpm_logaction("warning: %s saved as %s\n", filename, newpath);
|
alpm_logaction(handle, "warning: %s saved as %s\n", filename, newpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -356,51 +350,51 @@ static int extract_single_file(struct archive *archive,
|
|||||||
} else if(hash_orig) {
|
} else if(hash_orig) {
|
||||||
/* the fun part */
|
/* the fun part */
|
||||||
|
|
||||||
if(strcmp(hash_orig, hash_local) == 0) {
|
if(hash_local && strcmp(hash_orig, hash_local) == 0) {
|
||||||
/* installed file has NOT been changed by user */
|
/* installed file has NOT been changed by user */
|
||||||
if(strcmp(hash_orig, hash_pkg) != 0) {
|
if(hash_pkg && strcmp(hash_orig, hash_pkg) != 0) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: installing new file: %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "action: installing new file: %s\n",
|
||||||
entryname_orig);
|
entryname_orig);
|
||||||
|
|
||||||
if(rename(checkfile, filename)) {
|
if(rename(checkfile, filename)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
checkfile, filename, strerror(errno));
|
checkfile, filename, strerror(errno));
|
||||||
alpm_logaction("error: could not rename %s to %s (%s)\n",
|
alpm_logaction(handle, "error: could not rename %s to %s (%s)\n",
|
||||||
checkfile, filename, strerror(errno));
|
checkfile, filename, strerror(errno));
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* there's no sense in installing the same file twice, install
|
/* no sense in installing the same file twice, install
|
||||||
* ONLY is the original and package hashes differ */
|
* ONLY if the original and package hashes differ */
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "action: leaving existing file in place\n");
|
||||||
unlink(checkfile);
|
unlink(checkfile);
|
||||||
}
|
}
|
||||||
} else if(strcmp(hash_orig, hash_pkg) == 0) {
|
} else if(hash_pkg && 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(handle, ALPM_LOG_DEBUG, "action: leaving existing file in place\n");
|
||||||
unlink(checkfile);
|
unlink(checkfile);
|
||||||
} else if(strcmp(hash_local, hash_pkg) == 0) {
|
} else if(hash_local && hash_pkg && 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(handle, ALPM_LOG_DEBUG, "action: leaving existing file in place\n");
|
||||||
unlink(checkfile);
|
unlink(checkfile);
|
||||||
} else {
|
} else {
|
||||||
char newpath[PATH_MAX];
|
char newpath[PATH_MAX];
|
||||||
_alpm_log(PM_LOG_DEBUG, "action: keeping current file and installing"
|
_alpm_log(handle, ALPM_LOG_DEBUG, "action: keeping current file and installing"
|
||||||
" new one with .pacnew ending\n");
|
" new one with .pacnew ending\n");
|
||||||
snprintf(newpath, PATH_MAX, "%s.pacnew", filename);
|
snprintf(newpath, PATH_MAX, "%s.pacnew", filename);
|
||||||
if(rename(checkfile, newpath)) {
|
if(rename(checkfile, newpath)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not install %s as %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_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",
|
alpm_logaction(handle, "error: could not install %s as %s (%s)\n",
|
||||||
filename, newpath, strerror(errno));
|
filename, newpath, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s installed as %s\n"),
|
_alpm_log(handle, ALPM_LOG_WARNING, _("%s installed as %s\n"),
|
||||||
filename, newpath);
|
filename, newpath);
|
||||||
alpm_logaction("warning: %s installed as %s\n",
|
alpm_logaction(handle, "warning: %s installed as %s\n",
|
||||||
filename, newpath);
|
filename, newpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -408,135 +402,107 @@ static int extract_single_file(struct archive *archive,
|
|||||||
|
|
||||||
FREE(hash_local);
|
FREE(hash_local);
|
||||||
FREE(hash_pkg);
|
FREE(hash_pkg);
|
||||||
FREE(hash_orig);
|
|
||||||
} else {
|
} else {
|
||||||
int ret;
|
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 */
|
||||||
_alpm_log(PM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename);
|
||||||
_alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew\n"), filename, filename);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("extracting %s as %s.pacnew\n"), filename, filename);
|
||||||
alpm_logaction("warning: extracting %s as %s.pacnew\n", filename, filename);
|
alpm_logaction(handle, "warning: extracting %s as %s.pacnew\n", filename, filename);
|
||||||
strncat(filename, ".pacnew", PATH_MAX - strlen(filename));
|
strncat(filename, ".pacnew", PATH_MAX - strlen(filename));
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_DEBUG, "extracting %s\n", filename);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extracting %s\n", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trans->flags & PM_TRANS_FLAG_FORCE) {
|
if(handle->trans->flags & ALPM_TRANS_FLAG_FORCE) {
|
||||||
/* if FORCE was used, unlink() each file (whether it's there
|
/* if FORCE was used, unlink() each file (whether it's there
|
||||||
* or not) before extracting. This prevents the old "Text file busy"
|
* or not) before extracting. This prevents the old "Text file busy"
|
||||||
* error that crops up if forcing a glibc or pacman upgrade. */
|
* error that crops up if forcing a glibc or pacman upgrade. */
|
||||||
unlink(filename);
|
unlink(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_entry_set_pathname(entry, filename);
|
ret = perform_extraction(handle, archive, entry, filename, entryname_orig);
|
||||||
|
if(ret == 1) {
|
||||||
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_orig, archive_error_string(archive));
|
|
||||||
} else if(ret != ARCHIVE_OK) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
|
||||||
entryname_orig, archive_error_string(archive));
|
|
||||||
alpm_logaction("error: could not extract %s (%s)\n",
|
|
||||||
entryname_orig, archive_error_string(archive));
|
|
||||||
FREE(entryname_orig);
|
FREE(entryname_orig);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate an hash if this is in newpkg's backup */
|
/* calculate an hash if this is in newpkg's backup */
|
||||||
alpm_list_t *b;
|
alpm_list_t *i;
|
||||||
for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) {
|
for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) {
|
||||||
char *backup = NULL, *hash = NULL;
|
alpm_backup_t *backup = i->data;
|
||||||
char *oldbackup = alpm_list_getdata(b);
|
char *newhash;
|
||||||
/* length is tab char, null byte and MD5 (32 char) */
|
if(!backup->name || strcmp(backup->name, entryname_orig) != 0) {
|
||||||
size_t backup_len = strlen(oldbackup) + 34;
|
|
||||||
|
|
||||||
if(!oldbackup || strcmp(oldbackup, entryname_orig) != 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "appending backup entry for %s\n", filename);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "appending backup entry for %s\n", entryname_orig);
|
||||||
|
newhash = alpm_compute_md5sum(filename);
|
||||||
hash = alpm_compute_md5sum(filename);
|
FREE(backup->hash);
|
||||||
MALLOC(backup, backup_len, RET_ERR(PM_ERR_MEMORY, -1));
|
backup->hash = newhash;
|
||||||
|
|
||||||
sprintf(backup, "%s\t%s", oldbackup, hash);
|
|
||||||
backup[backup_len-1] = '\0';
|
|
||||||
FREE(hash);
|
|
||||||
FREE(oldbackup);
|
|
||||||
b->data = backup;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(entryname_orig);
|
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(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
||||||
pmtrans_t *trans, pmdb_t *db)
|
size_t pkg_current, size_t pkg_count)
|
||||||
{
|
{
|
||||||
int i, ret = 0, errors = 0;
|
int i, ret = 0, errors = 0;
|
||||||
char scriptlet[PATH_MAX+1];
|
int is_upgrade;
|
||||||
int is_upgrade = 0;
|
alpm_pkg_t *oldpkg = NULL;
|
||||||
pmpkg_t *oldpkg = NULL;
|
alpm_db_t *db = handle->db_local;
|
||||||
|
alpm_trans_t *trans = handle->trans;
|
||||||
|
const char *pkgfile;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ASSERT(trans != NULL, return -1);
|
||||||
|
|
||||||
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);
|
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
|
||||||
if(local) {
|
if(local) {
|
||||||
is_upgrade = 1;
|
is_upgrade = 1;
|
||||||
|
|
||||||
/* we'll need to save some record for backup checks later */
|
/* we'll need to save some record for backup checks later */
|
||||||
oldpkg = _alpm_pkg_dup(local);
|
if(_alpm_pkg_dup(local, &oldpkg) == -1) {
|
||||||
/* make sure all infos are loaded because the database entry
|
ret = -1;
|
||||||
* will be removed soon */
|
goto cleanup;
|
||||||
_alpm_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",
|
|
||||||
newpkg->name, newpkg->version);
|
|
||||||
|
|
||||||
/* copy over the install reason */
|
/* copy over the install reason */
|
||||||
newpkg->reason = alpm_pkg_get_reason(oldpkg);
|
newpkg->reason = alpm_pkg_get_reason(local);
|
||||||
|
|
||||||
/* pre_upgrade scriptlet */
|
EVENT(handle, ALPM_EVENT_UPGRADE_START, newpkg, local);
|
||||||
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
|
||||||
_alpm_runscriptlet(handle->root, newpkg->origin_data.file,
|
|
||||||
"pre_upgrade", newpkg->version, oldpkg->version, trans);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
is_upgrade = 0;
|
is_upgrade = 0;
|
||||||
|
EVENT(handle, ALPM_EVENT_ADD_START, newpkg, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
EVENT(trans, PM_TRANS_EVT_ADD_START, newpkg, NULL);
|
pkgfile = newpkg->origin_data.file;
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s\n",
|
|
||||||
newpkg->name, newpkg->version);
|
|
||||||
|
|
||||||
/* pre_install scriptlet */
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s package %s-%s\n",
|
||||||
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
is_upgrade ? "upgrading" : "adding", newpkg->name, newpkg->version);
|
||||||
_alpm_runscriptlet(handle->root, newpkg->origin_data.file,
|
/* pre_install/pre_upgrade scriptlet */
|
||||||
"pre_install", newpkg->version, NULL, trans);
|
if(alpm_pkg_has_scriptlet(newpkg) &&
|
||||||
}
|
!(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
|
||||||
|
const char *scriptlet_name = is_upgrade ? "pre_upgrade" : "pre_install";
|
||||||
|
_alpm_runscriptlet(handle, pkgfile,
|
||||||
|
scriptlet_name, newpkg->version, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we override any pre-set reason if we have alldeps or allexplicit set */
|
/* we override any pre-set reason if we have alldeps or allexplicit set */
|
||||||
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
|
if(trans->flags & ALPM_TRANS_FLAG_ALLDEPS) {
|
||||||
newpkg->reason = PM_PKG_REASON_DEPEND;
|
newpkg->reason = ALPM_PKG_REASON_DEPEND;
|
||||||
} else if(trans->flags & PM_TRANS_FLAG_ALLEXPLICIT) {
|
} else if(trans->flags & ALPM_TRANS_FLAG_ALLEXPLICIT) {
|
||||||
newpkg->reason = PM_PKG_REASON_EXPLICIT;
|
newpkg->reason = ALPM_PKG_REASON_EXPLICIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldpkg) {
|
if(oldpkg) {
|
||||||
/* set up fake remove transaction */
|
/* set up fake remove transaction */
|
||||||
if(_alpm_upgraderemove_package(oldpkg, newpkg, trans) == -1) {
|
if(_alpm_remove_single_package(handle, oldpkg, newpkg, 0, 0) == -1) {
|
||||||
pm_errno = PM_ERR_TRANS_ABORT;
|
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -544,23 +510,23 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
|
|
||||||
/* prepare directory for database entries so permission are correct after
|
/* prepare directory for database entries so permission are correct after
|
||||||
changelog/install script installation (FS#12263) */
|
changelog/install script installation (FS#12263) */
|
||||||
if(_alpm_db_prepare(db, newpkg)) {
|
if(_alpm_local_db_prepare(db, newpkg)) {
|
||||||
alpm_logaction("error: could not create database entry %s-%s\n",
|
alpm_logaction(handle, "error: could not create database entry %s-%s\n",
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
newpkg->name, newpkg->version);
|
||||||
pm_errno = PM_ERR_DB_WRITE;
|
handle->pm_errno = ALPM_ERR_DB_WRITE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
if(!(trans->flags & ALPM_TRANS_FLAG_DBONLY)) {
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
char cwd[PATH_MAX] = "";
|
int cwdfd;
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n");
|
||||||
|
|
||||||
if ((archive = archive_read_new()) == NULL) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -568,83 +534,88 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
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);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "archive: %s\n", pkgfile);
|
||||||
if(archive_read_open_filename(archive, newpkg->origin_data.file,
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ALPM_BUFFER_SIZE) != ARCHIVE_OK) {
|
||||||
pm_errno = PM_ERR_PKG_OPEN;
|
handle->pm_errno = ALPM_ERR_PKG_OPEN;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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) {
|
do {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not get current working directory\n"));
|
cwdfd = open(".", O_RDONLY);
|
||||||
cwd[0] = 0;
|
} while(cwdfd == -1 && errno == EINTR);
|
||||||
|
if(cwdfd < 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* libarchive requires this for extracting hard links */
|
/* libarchive requires this for extracting hard links */
|
||||||
chdir(handle->root);
|
if(chdir(handle->root) != 0) {
|
||||||
|
_alpm_log(handle, ALPM_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) {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_UPGRADE_START,
|
PROGRESS(handle, ALPM_PROGRESS_UPGRADE_START,
|
||||||
alpm_pkg_get_name(newpkg), 0, pkg_count, pkg_current);
|
newpkg->name, 0, pkg_count, pkg_current);
|
||||||
} else {
|
} else {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
PROGRESS(handle, ALPM_PROGRESS_ADD_START,
|
||||||
alpm_pkg_get_name(newpkg), 0, pkg_count, pkg_current);
|
newpkg->name, 0, pkg_count, pkg_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
|
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
|
||||||
double percent;
|
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) */
|
||||||
int64_t 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: "
|
if(percent >= 100) {
|
||||||
"%f%% (%"PRId64" / %jd)\n",
|
percent = 100;
|
||||||
percent*100.0, pos, (intmax_t)newpkg->size);
|
|
||||||
if(percent >= 1.0) {
|
|
||||||
percent = 1.0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
percent = 0.0;
|
percent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_UPGRADE_START,
|
PROGRESS(handle, ALPM_PROGRESS_UPGRADE_START,
|
||||||
alpm_pkg_get_name(newpkg), (int)(percent * 100), pkg_count,
|
newpkg->name, percent, pkg_count, pkg_current);
|
||||||
pkg_current);
|
|
||||||
} else {
|
} else {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
PROGRESS(handle, ALPM_PROGRESS_ADD_START,
|
||||||
alpm_pkg_get_name(newpkg), (int)(percent * 100), pkg_count,
|
newpkg->name, percent, pkg_count, pkg_current);
|
||||||
pkg_current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* extract the next file from the archive */
|
/* extract the next file from the archive */
|
||||||
errors += extract_single_file(archive, entry, newpkg, oldpkg,
|
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
|
||||||
trans, db);
|
|
||||||
}
|
}
|
||||||
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(cwdfd >= 0) {
|
||||||
chdir(cwd);
|
if(fchdir(cwdfd) != 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("could not restore working directory (%s)\n"), strerror(errno));
|
||||||
|
}
|
||||||
|
close(cwdfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
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(handle, ALPM_LOG_ERROR, _("problem occurred while upgrading %s\n"),
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
alpm_logaction("error: problem occurred while upgrading %s\n",
|
alpm_logaction(handle, "error: problem occurred while upgrading %s\n",
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_ERROR, _("problem occurred while installing %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("problem occurred while installing %s\n"),
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
alpm_logaction("error: problem occurred while installing %s\n",
|
alpm_logaction(handle, "error: problem occurred while installing %s\n",
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -653,68 +624,63 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
|
|||||||
/* make an install date (in UTC) */
|
/* make an install date (in UTC) */
|
||||||
newpkg->installdate = time(NULL);
|
newpkg->installdate = time(NULL);
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "updating database\n");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "updating database\n");
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name);
|
_alpm_log(handle, ALPM_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(handle, ALPM_LOG_ERROR, _("could not update database entry %s-%s\n"),
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
newpkg->name, newpkg->version);
|
||||||
alpm_logaction("error: could not update database entry %s-%s\n",
|
alpm_logaction(handle, "error: could not update database entry %s-%s\n",
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
newpkg->name, newpkg->version);
|
||||||
pm_errno = PM_ERR_DB_WRITE;
|
handle->pm_errno = ALPM_ERR_DB_WRITE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
|
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not add entry '%s' in cache\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not add entry '%s' in cache\n"),
|
||||||
alpm_pkg_get_name(newpkg));
|
newpkg->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_UPGRADE_START,
|
PROGRESS(handle, ALPM_PROGRESS_UPGRADE_START,
|
||||||
alpm_pkg_get_name(newpkg), 100, pkg_count, pkg_current);
|
newpkg->name, 100, pkg_count, pkg_current);
|
||||||
} else {
|
} else {
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
|
PROGRESS(handle, ALPM_PROGRESS_ADD_START,
|
||||||
alpm_pkg_get_name(newpkg), 100, pkg_count, pkg_current);
|
newpkg->name, 100, pkg_count, pkg_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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)
|
||||||
&& !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
&& !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
|
||||||
if(is_upgrade) {
|
char *scriptlet = _alpm_local_db_pkgpath(db, newpkg, "install");
|
||||||
_alpm_runscriptlet(handle->root, scriptlet, "post_upgrade",
|
const char *scriptlet_name = is_upgrade ? "post_upgrade" : "post_install";
|
||||||
alpm_pkg_get_version(newpkg),
|
|
||||||
oldpkg ? alpm_pkg_get_version(oldpkg) : NULL, trans);
|
_alpm_runscriptlet(handle, scriptlet, scriptlet_name,
|
||||||
} else {
|
newpkg->version, oldpkg ? oldpkg->version : NULL, 0);
|
||||||
_alpm_runscriptlet(handle->root, scriptlet, "post_install",
|
free(scriptlet);
|
||||||
alpm_pkg_get_version(newpkg), NULL, trans);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
EVENT(trans, PM_TRANS_EVT_UPGRADE_DONE, newpkg, oldpkg);
|
EVENT(handle, ALPM_EVENT_UPGRADE_DONE, newpkg, oldpkg);
|
||||||
} else {
|
} else {
|
||||||
EVENT(trans, PM_TRANS_EVT_ADD_DONE, newpkg, oldpkg);
|
EVENT(handle, ALPM_EVENT_ADD_DONE, newpkg, oldpkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
_alpm_pkg_free(oldpkg);
|
_alpm_pkg_free(oldpkg);
|
||||||
return(ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db)
|
int _alpm_upgrade_packages(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
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_trans_t *trans = handle->trans;
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
|
||||||
|
|
||||||
if(trans->add == NULL) {
|
if(trans->add == NULL) {
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_count = alpm_list_count(trans->add);
|
pkg_count = alpm_list_count(trans->add);
|
||||||
@@ -722,19 +688,30 @@ int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db)
|
|||||||
|
|
||||||
/* 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->add; targ; targ = targ->next) {
|
for(targ = trans->add; targ; targ = targ->next) {
|
||||||
|
alpm_pkg_t *newpkg = targ->data;
|
||||||
|
|
||||||
if(handle->trans->state == STATE_INTERRUPTED) {
|
if(handle->trans->state == STATE_INTERRUPTED) {
|
||||||
return(0);
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(commit_single_pkg(handle, newpkg, pkg_current, pkg_count)) {
|
||||||
|
/* something screwed up on the commit, abort the trans */
|
||||||
|
trans->state = STATE_INTERRUPTED;
|
||||||
|
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
|
||||||
|
/* running ldconfig at this point could possibly screw system */
|
||||||
|
skip_ldconfig = 1;
|
||||||
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkg_t *newpkg = (pmpkg_t *)targ->data;
|
|
||||||
commit_single_pkg(newpkg, pkg_current, pkg_count, trans, db);
|
|
||||||
pkg_current++;
|
pkg_current++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run ldconfig if it exists */
|
if(!skip_ldconfig) {
|
||||||
_alpm_ldconfig(handle->root);
|
/* run ldconfig if it exists */
|
||||||
|
_alpm_ldconfig(handle);
|
||||||
|
}
|
||||||
|
|
||||||
return(0);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* add.h
|
* add.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
|
|
||||||
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db);
|
int _alpm_upgrade_packages(alpm_handle_t *handle);
|
||||||
|
|
||||||
#endif /* _ALPM_ADD_H */
|
#endif /* _ALPM_ADD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm.c
|
* alpm.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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>
|
||||||
@@ -23,15 +23,17 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* Globals */
|
|
||||||
enum _pmerrno_t pm_errno SYMEXPORT;
|
|
||||||
|
|
||||||
/** \addtogroup alpm_interface Interface Functions
|
/** \addtogroup alpm_interface Interface Functions
|
||||||
* @brief Functions to initialize and release libalpm
|
* @brief Functions to initialize and release libalpm
|
||||||
* @{
|
* @{
|
||||||
@@ -39,41 +41,85 @@ enum _pmerrno_t pm_errno SYMEXPORT;
|
|||||||
|
|
||||||
/** Initializes the library. This must be called before any other
|
/** Initializes the library. This must be called before any other
|
||||||
* functions are called.
|
* functions are called.
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @param root the root path for all filesystem operations
|
||||||
|
* @param dbpath the absolute path to the libalpm database
|
||||||
|
* @param err an optional variable to hold any error return codes
|
||||||
|
* @return a context handle on success, NULL on error, err will be set if provided
|
||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_initialize(void)
|
alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
||||||
|
enum _alpm_errno_t *err)
|
||||||
{
|
{
|
||||||
ASSERT(handle == NULL, RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1));
|
enum _alpm_errno_t myerr;
|
||||||
|
const char *lf = "db.lck";
|
||||||
|
size_t lockfilelen;
|
||||||
|
alpm_handle_t *myhandle = _alpm_handle_new();
|
||||||
|
|
||||||
handle = _alpm_handle_new();
|
if(myhandle == NULL) {
|
||||||
if(handle == NULL) {
|
myerr = ALPM_ERR_MEMORY;
|
||||||
RET_ERR(PM_ERR_MEMORY, -1);
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if((myerr = _alpm_set_directory_option(dbpath, &(myhandle->dbpath), 1))) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
lockfilelen = strlen(myhandle->dbpath) + strlen(lf) + 1;
|
||||||
|
myhandle->lockfile = calloc(lockfilelen, sizeof(char));
|
||||||
|
snprintf(myhandle->lockfile, lockfilelen, "%s%s", myhandle->dbpath, lf);
|
||||||
|
|
||||||
|
if(_alpm_db_register_local(myhandle) == NULL) {
|
||||||
|
myerr = myhandle->pm_errno;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
bindtextdomain("libalpm", LOCALEDIR);
|
bindtextdomain("libalpm", LOCALEDIR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(0);
|
return myhandle;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
_alpm_handle_free(myhandle);
|
||||||
|
if(err && myerr) {
|
||||||
|
*err = myerr;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Release the library. This should be the last alpm call you make.
|
/** Release the library. This should be the last alpm call you make.
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* After this returns, handle should be considered invalid and cannot be reused
|
||||||
|
* in any way.
|
||||||
|
* @param myhandle the context handle
|
||||||
|
* @return 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_release(void)
|
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
int ret = 0;
|
||||||
|
alpm_db_t *db;
|
||||||
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
CHECK_HANDLE(myhandle, return -1);
|
||||||
|
|
||||||
if(alpm_db_unregister_all() == -1) {
|
/* close local database */
|
||||||
return(-1);
|
db = myhandle->db_local;
|
||||||
|
if(db) {
|
||||||
|
db->ops->unregister(db);
|
||||||
|
myhandle->db_local = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_handle_free(handle);
|
if(alpm_db_unregister_all(myhandle) == -1) {
|
||||||
handle = NULL;
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return(0);
|
_alpm_handle_unlock(myhandle);
|
||||||
|
_alpm_handle_free(myhandle);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
curl_global_cleanup();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
@@ -82,9 +128,30 @@ int SYMEXPORT alpm_release(void)
|
|||||||
* @brief Various libalpm functions
|
* @brief Various libalpm functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Get the version of library */
|
/** Get the version of library.
|
||||||
const char SYMEXPORT *alpm_version(void) {
|
* @return the library version, e.g. "6.0.4"
|
||||||
return(LIB_VERSION);
|
* */
|
||||||
|
const char SYMEXPORT *alpm_version(void)
|
||||||
|
{
|
||||||
|
return LIB_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the capabilities of the library.
|
||||||
|
* @return a bitmask of the capabilities
|
||||||
|
* */
|
||||||
|
enum alpm_caps SYMEXPORT alpm_capabilities(void)
|
||||||
|
{
|
||||||
|
return 0
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
| ALPM_CAPABILITY_NLS
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
| ALPM_CAPABILITY_DOWNLOADER
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBGPGME
|
||||||
|
| ALPM_CAPABILITY_SIGNATURES
|
||||||
|
#endif
|
||||||
|
| 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
1436
lib/libalpm/alpm.h
1436
lib/libalpm/alpm.h
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm_list.c
|
* alpm_list.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
@@ -90,9 +89,9 @@ alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
{
|
{
|
||||||
alpm_list_t *ptr, *lp;
|
alpm_list_t *ptr, *lp;
|
||||||
|
|
||||||
ptr = calloc(1, sizeof(alpm_list_t));
|
ptr = malloc(sizeof(alpm_list_t));
|
||||||
if(ptr == NULL) {
|
if(ptr == NULL) {
|
||||||
return(list);
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr->data = data;
|
ptr->data = data;
|
||||||
@@ -101,7 +100,7 @@ alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
/* Special case: the input list is empty */
|
/* Special case: the input list is empty */
|
||||||
if(list == NULL) {
|
if(list == NULL) {
|
||||||
ptr->prev = ptr;
|
ptr->prev = ptr;
|
||||||
return(ptr);
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
lp = alpm_list_last(list);
|
lp = alpm_list_last(list);
|
||||||
@@ -109,7 +108,7 @@ alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
ptr->prev = lp;
|
ptr->prev = lp;
|
||||||
list->prev = ptr;
|
list->prev = ptr;
|
||||||
|
|
||||||
return(list);
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,13 +123,13 @@ 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 || !list) {
|
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 = calloc(1, sizeof(alpm_list_t));
|
add = malloc(sizeof(alpm_list_t));
|
||||||
if(add == NULL) {
|
if(add == NULL) {
|
||||||
return(list);
|
return list;
|
||||||
}
|
}
|
||||||
add->data = data;
|
add->data = data;
|
||||||
|
|
||||||
@@ -146,19 +145,19 @@ alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_
|
|||||||
add->prev = list->prev; /* list != NULL */
|
add->prev = list->prev; /* list != NULL */
|
||||||
add->next = list;
|
add->next = list;
|
||||||
list->prev = add;
|
list->prev = add;
|
||||||
return(add);
|
return add;
|
||||||
} else if(next == NULL) { /* another special case: add last element */
|
} else if(next == NULL) { /* another special case: add last element */
|
||||||
add->prev = prev;
|
add->prev = prev;
|
||||||
add->next = NULL;
|
add->next = NULL;
|
||||||
prev->next = add;
|
prev->next = add;
|
||||||
list->prev = add;
|
list->prev = add;
|
||||||
return(list);
|
return list;
|
||||||
} else {
|
} else {
|
||||||
add->prev = prev;
|
add->prev = prev;
|
||||||
add->next = next;
|
add->next = next;
|
||||||
next->prev = add;
|
next->prev = add;
|
||||||
prev->next = add;
|
prev->next = add;
|
||||||
return(list);
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,11 +177,11 @@ 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;
|
||||||
@@ -193,7 +192,7 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
|
|||||||
/* set the back reference to the tail */
|
/* set the back reference to the tail */
|
||||||
second->prev = tmp;
|
second->prev = tmp;
|
||||||
|
|
||||||
return(first);
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,14 +206,20 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
|
|||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
|
alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
|
||||||
{
|
{
|
||||||
alpm_list_t *newlist, *lp;
|
alpm_list_t *newlist, *lp, *tail_ptr, *left_tail_ptr, *right_tail_ptr;
|
||||||
|
|
||||||
if (left == NULL)
|
if(left == NULL) {
|
||||||
return right;
|
return right;
|
||||||
if (right == NULL)
|
}
|
||||||
|
if(right == NULL) {
|
||||||
return left;
|
return left;
|
||||||
|
}
|
||||||
|
|
||||||
if (fn(left->data, right->data) <= 0) {
|
/* Save tail node pointers for future use */
|
||||||
|
left_tail_ptr = left->prev;
|
||||||
|
right_tail_ptr = right->prev;
|
||||||
|
|
||||||
|
if(fn(left->data, right->data) <= 0) {
|
||||||
newlist = left;
|
newlist = left;
|
||||||
left = left->next;
|
left = left->next;
|
||||||
}
|
}
|
||||||
@@ -226,8 +231,8 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
newlist->next = NULL;
|
newlist->next = NULL;
|
||||||
lp = newlist;
|
lp = newlist;
|
||||||
|
|
||||||
while ((left != NULL) && (right != NULL)) {
|
while((left != NULL) && (right != NULL)) {
|
||||||
if (fn(left->data, right->data) <= 0) {
|
if(fn(left->data, right->data) <= 0) {
|
||||||
lp->next = left;
|
lp->next = left;
|
||||||
left->prev = lp;
|
left->prev = lp;
|
||||||
left = left->next;
|
left = left->next;
|
||||||
@@ -240,24 +245,23 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
lp->next = NULL;
|
lp->next = NULL;
|
||||||
}
|
}
|
||||||
if (left != NULL) {
|
if(left != NULL) {
|
||||||
lp->next = left;
|
lp->next = left;
|
||||||
left->prev = lp;
|
left->prev = lp;
|
||||||
|
tail_ptr = left_tail_ptr;
|
||||||
}
|
}
|
||||||
else if (right != NULL) {
|
else if(right != NULL) {
|
||||||
lp->next = right;
|
lp->next = right;
|
||||||
right->prev = lp;
|
right->prev = lp;
|
||||||
|
tail_ptr = right_tail_ptr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tail_ptr = lp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find our tail pointer
|
newlist->prev = tail_ptr;
|
||||||
* TODO maintain this in the algorithm itself */
|
|
||||||
lp = newlist;
|
|
||||||
while(lp && lp->next) {
|
|
||||||
lp = lp->next;
|
|
||||||
}
|
|
||||||
newlist->prev = lp;
|
|
||||||
|
|
||||||
return(newlist);
|
return newlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,22 +273,72 @@ 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;
|
||||||
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
|
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
|
||||||
alpm_list_t *right = lastleft->next;
|
alpm_list_t *right = lastleft->next;
|
||||||
/* terminate first list */
|
|
||||||
|
/* tidy new lists */
|
||||||
lastleft->next = NULL;
|
lastleft->next = NULL;
|
||||||
|
right->prev = left->prev;
|
||||||
|
left->prev = lastleft;
|
||||||
|
|
||||||
left = alpm_list_msort(left, n/2, fn);
|
left = alpm_list_msort(left, n/2, fn);
|
||||||
right = alpm_list_msort(right, n - (n/2), fn);
|
right = alpm_list_msort(right, n - (n/2), fn);
|
||||||
list = alpm_list_mmerge(left, right, fn);
|
list = alpm_list_mmerge(left, right, fn);
|
||||||
}
|
}
|
||||||
return(list);
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove an item from the list.
|
||||||
|
* item is not freed; this is the responsibility 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.
|
||||||
*
|
*
|
||||||
@@ -295,16 +349,17 @@ 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) {
|
if(needle == NULL) {
|
||||||
return(haystack);
|
return haystack;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(i) {
|
while(i) {
|
||||||
@@ -312,48 +367,20 @@ alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needl
|
|||||||
i = i->next;
|
i = i->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmp = i->next;
|
|
||||||
if(fn(i->data, needle) == 0) {
|
if(fn(i->data, needle) == 0) {
|
||||||
/* we found a matching item */
|
haystack = alpm_list_remove_item(haystack, i);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -368,8 +395,8 @@ alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needl
|
|||||||
alpm_list_t SYMEXPORT *alpm_list_remove_str(alpm_list_t *haystack,
|
alpm_list_t SYMEXPORT *alpm_list_remove_str(alpm_list_t *haystack,
|
||||||
const char *needle, char **data)
|
const char *needle, char **data)
|
||||||
{
|
{
|
||||||
return(alpm_list_remove(haystack, (const void *)needle,
|
return alpm_list_remove(haystack, (const void *)needle,
|
||||||
(alpm_list_fn_cmp)strcmp, (void **)data));
|
(alpm_list_fn_cmp)strcmp, (void **)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -391,7 +418,7 @@ alpm_list_t SYMEXPORT *alpm_list_remove_dupes(const alpm_list_t *list)
|
|||||||
}
|
}
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
}
|
}
|
||||||
return(newlist);
|
return newlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -409,7 +436,7 @@ alpm_list_t SYMEXPORT *alpm_list_strdup(const alpm_list_t *list)
|
|||||||
newlist = alpm_list_add(newlist, strdup(lp->data));
|
newlist = alpm_list_add(newlist, strdup(lp->data));
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
}
|
}
|
||||||
return(newlist);
|
return newlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -427,7 +454,7 @@ alpm_list_t SYMEXPORT *alpm_list_copy(const alpm_list_t *list)
|
|||||||
newlist = alpm_list_add(newlist, lp->data);
|
newlist = alpm_list_add(newlist, lp->data);
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
}
|
}
|
||||||
return(newlist);
|
return newlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,14 +473,14 @@ alpm_list_t SYMEXPORT *alpm_list_copy_data(const alpm_list_t *list,
|
|||||||
const alpm_list_t *lp = list;
|
const alpm_list_t *lp = list;
|
||||||
alpm_list_t *newlist = NULL;
|
alpm_list_t *newlist = NULL;
|
||||||
while(lp) {
|
while(lp) {
|
||||||
void *newdata = calloc(1, size);
|
void *newdata = malloc(size);
|
||||||
if(newdata) {
|
if(newdata) {
|
||||||
memcpy(newdata, lp->data, size);
|
memcpy(newdata, lp->data, size);
|
||||||
newlist = alpm_list_add(newlist, newdata);
|
newlist = alpm_list_add(newlist, newdata);
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(newlist);
|
return newlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -469,7 +496,7 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
|||||||
alpm_list_t *newlist = NULL, *backup;
|
alpm_list_t *newlist = NULL, *backup;
|
||||||
|
|
||||||
if(list == NULL) {
|
if(list == NULL) {
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lp = alpm_list_last(list);
|
lp = alpm_list_last(list);
|
||||||
@@ -482,27 +509,11 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
|||||||
lp = lp->prev;
|
lp = lp->prev;
|
||||||
}
|
}
|
||||||
list->prev = backup; /* restore tail pointer */
|
list->prev = backup; /* restore tail pointer */
|
||||||
return(newlist);
|
return newlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Accessors */
|
/* Accessors */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the first element of a list.
|
|
||||||
*
|
|
||||||
* @param list the list
|
|
||||||
*
|
|
||||||
* @return the first element in the list
|
|
||||||
*/
|
|
||||||
inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
|
|
||||||
{
|
|
||||||
if(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).
|
||||||
*
|
*
|
||||||
@@ -511,13 +522,13 @@ inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
|
|||||||
*
|
*
|
||||||
* @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--) {
|
||||||
i = i->next;
|
i = i->next;
|
||||||
}
|
}
|
||||||
return((alpm_list_t*)i);
|
return (alpm_list_t *)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -530,9 +541,25 @@ 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) {
|
if(node) {
|
||||||
return(node->next);
|
return node->next;
|
||||||
} else {
|
} else {
|
||||||
return(NULL);
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the previous element of a list.
|
||||||
|
*
|
||||||
|
* @param list the list head
|
||||||
|
*
|
||||||
|
* @return the previous element, or NULL when no previous element exist
|
||||||
|
*/
|
||||||
|
inline alpm_list_t SYMEXPORT *alpm_list_previous(const alpm_list_t *list)
|
||||||
|
{
|
||||||
|
if(list && list->prev->next) {
|
||||||
|
return list->prev;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,9 +573,9 @@ inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
|
|||||||
alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
|
alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
|
||||||
{
|
{
|
||||||
if(list) {
|
if(list) {
|
||||||
return(list->prev);
|
return list->prev;
|
||||||
} else {
|
} else {
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,8 +588,8 @@ alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
|
|||||||
*/
|
*/
|
||||||
void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
|
void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
|
||||||
{
|
{
|
||||||
if(node == NULL) return(NULL);
|
if(node == NULL) return NULL;
|
||||||
return(node->data);
|
return node->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
@@ -574,15 +601,15 @@ 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;
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
}
|
}
|
||||||
return(i);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -600,17 +627,17 @@ void SYMEXPORT *alpm_list_find(const alpm_list_t *haystack, const void *needle,
|
|||||||
const alpm_list_t *lp = haystack;
|
const alpm_list_t *lp = haystack;
|
||||||
while(lp) {
|
while(lp) {
|
||||||
if(lp->data && fn(lp->data, needle) == 0) {
|
if(lp->data && fn(lp->data, needle) == 0) {
|
||||||
return(lp->data);
|
return lp->data;
|
||||||
}
|
}
|
||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
}
|
}
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trivial helper function for alpm_list_find_ptr */
|
/* trivial helper function for alpm_list_find_ptr */
|
||||||
static int ptr_cmp(const void *p, const void *q)
|
static int ptr_cmp(const void *p, const void *q)
|
||||||
{
|
{
|
||||||
return(p != q);
|
return (p != q);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -623,9 +650,10 @@ static int ptr_cmp(const void *p, const void *q)
|
|||||||
*
|
*
|
||||||
* @return `needle` if found, NULL otherwise
|
* @return `needle` if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
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, ptr_cmp));
|
return alpm_list_find(haystack, needle, ptr_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -639,8 +667,8 @@ void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack, const void *need
|
|||||||
char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
|
char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
|
||||||
const char *needle)
|
const char *needle)
|
||||||
{
|
{
|
||||||
return((char *)alpm_list_find(haystack, (const void*)needle,
|
return (char *)alpm_list_find(haystack, (const void *)needle,
|
||||||
(alpm_list_fn_cmp)strcmp));
|
(alpm_list_fn_cmp)strcmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -668,7 +696,7 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (l != NULL && r != NULL) {
|
while(l != NULL && r != NULL) {
|
||||||
int cmp = fn(l->data, r->data);
|
int cmp = fn(l->data, r->data);
|
||||||
if(cmp < 0) {
|
if(cmp < 0) {
|
||||||
if(onlyleft) {
|
if(onlyleft) {
|
||||||
@@ -686,13 +714,13 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
|
|||||||
r = r->next;
|
r = r->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (l != NULL) {
|
while(l != NULL) {
|
||||||
if(onlyleft) {
|
if(onlyleft) {
|
||||||
*onlyleft = alpm_list_add(*onlyleft, l->data);
|
*onlyleft = alpm_list_add(*onlyleft, l->data);
|
||||||
}
|
}
|
||||||
l = l->next;
|
l = l->next;
|
||||||
}
|
}
|
||||||
while (r != NULL) {
|
while(r != NULL) {
|
||||||
if(onlyright) {
|
if(onlyright) {
|
||||||
*onlyright = alpm_list_add(*onlyright, r->data);
|
*onlyright = alpm_list_add(*onlyright, r->data);
|
||||||
}
|
}
|
||||||
@@ -725,7 +753,39 @@ alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
|
|||||||
|
|
||||||
alpm_list_free(left);
|
alpm_list_free(left);
|
||||||
alpm_list_free(right);
|
alpm_list_free(right);
|
||||||
return(ret);
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy a list and data into a standard C array of fixed length.
|
||||||
|
* Note that the data elements are shallow copied so any contained pointers
|
||||||
|
* will point to the original data.
|
||||||
|
*
|
||||||
|
* @param list the list to copy
|
||||||
|
* @param n the size of the list
|
||||||
|
* @param size the size of each data element
|
||||||
|
*
|
||||||
|
* @return an array version of the original list, data copied as well
|
||||||
|
*/
|
||||||
|
void SYMEXPORT *alpm_list_to_array(const alpm_list_t *list, size_t n,
|
||||||
|
size_t size)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
const alpm_list_t *item;
|
||||||
|
char *array;
|
||||||
|
|
||||||
|
if(n == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
array = malloc(n * size);
|
||||||
|
if(array == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for(i = 0, item = list; i < n && item; i++, item = item->next) {
|
||||||
|
memcpy(array + i * size, item->data, size);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm_list.h
|
* alpm_list.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -56,7 +56,8 @@ 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_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);
|
||||||
@@ -66,20 +67,21 @@ alpm_list_t *alpm_list_copy_data(const alpm_list_t *list, size_t size);
|
|||||||
alpm_list_t *alpm_list_reverse(alpm_list_t *list);
|
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_nth(const alpm_list_t *list, size_t n);
|
||||||
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int 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_previous(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,
|
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);
|
alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright);
|
||||||
|
void *alpm_list_to_array(const alpm_list_t *list, size_t n, size_t size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* backup.c
|
* backup.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* 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,82 +32,67 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#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 the relevant components */
|
||||||
static int backup_split(const char *string, char **file, char **hash)
|
int _alpm_split_backup(const char *string, alpm_backup_t **backup)
|
||||||
{
|
{
|
||||||
char *str = strdup(string);
|
char *str, *ptr;
|
||||||
char *ptr;
|
|
||||||
|
STRDUP(str, string, return -1);
|
||||||
|
|
||||||
/* tab delimiter */
|
/* tab delimiter */
|
||||||
ptr = strchr(str, '\t');
|
ptr = str ? strchr(str, '\t') : NULL;
|
||||||
if(ptr == NULL) {
|
if(ptr == NULL) {
|
||||||
if(file) {
|
(*backup)->name = str;
|
||||||
*file = str;
|
(*backup)->hash = NULL;
|
||||||
} else {
|
return 0;
|
||||||
/* don't need our dup as the fname wasn't requested, so free it */
|
|
||||||
FREE(str);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
ptr++;
|
ptr++;
|
||||||
/* now str points to the filename and ptr points to the hash */
|
/* now str points to the filename and ptr points to the hash */
|
||||||
if(file) {
|
STRDUP((*backup)->name, str, return -1);
|
||||||
*file = strdup(str);
|
STRDUP((*backup)->hash, ptr, return -1);
|
||||||
}
|
|
||||||
if(hash) {
|
|
||||||
*hash = strdup(ptr);
|
|
||||||
}
|
|
||||||
FREE(str);
|
FREE(str);
|
||||||
return(1);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_alpm_backup_file(const char *string)
|
/* Look for a filename in a alpm_pkg_t.backup list. If we find it,
|
||||||
{
|
* then we return the full backup entry.
|
||||||
char *file = NULL;
|
|
||||||
backup_split(string, &file, NULL);
|
|
||||||
return(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *_alpm_backup_hash(const char *string)
|
|
||||||
{
|
|
||||||
char *hash = NULL;
|
|
||||||
backup_split(string, NULL, &hash);
|
|
||||||
return(hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look for a filename in a pmpkg_t.backup list. If we find it,
|
|
||||||
* then we return the md5 hash (parsed from the same line)
|
|
||||||
*/
|
*/
|
||||||
char *_alpm_needbackup(const char *file, const alpm_list_t *backup)
|
alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
const alpm_list_t *lp;
|
const alpm_list_t *lp;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
if(file == NULL || pkg == NULL) {
|
||||||
|
return NULL;
|
||||||
if(file == NULL || backup == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run through the backup list and parse out the hash for our file */
|
for(lp = alpm_pkg_get_backup(pkg); lp; lp = lp->next) {
|
||||||
for(lp = backup; lp; lp = lp->next) {
|
alpm_backup_t *backup = lp->data;
|
||||||
char *filename = NULL;
|
|
||||||
char *hash = NULL;
|
|
||||||
|
|
||||||
/* no hash found */
|
if(strcmp(file, backup->name) == 0) {
|
||||||
if(!backup_split((char *)lp->data, &filename, &hash)) {
|
return backup;
|
||||||
FREE(filename);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if(strcmp(file, filename) == 0) {
|
|
||||||
FREE(filename);
|
|
||||||
return(hash);
|
|
||||||
}
|
|
||||||
FREE(filename);
|
|
||||||
FREE(hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(NULL);
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _alpm_backup_free(alpm_backup_t *backup)
|
||||||
|
{
|
||||||
|
free(backup->name);
|
||||||
|
free(backup->hash);
|
||||||
|
free(backup);
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
|
||||||
|
{
|
||||||
|
alpm_backup_t *newbackup;
|
||||||
|
CALLOC(newbackup, 1, sizeof(alpm_backup_t), return NULL);
|
||||||
|
|
||||||
|
STRDUP(newbackup->name, backup->name, return NULL);
|
||||||
|
STRDUP(newbackup->hash, backup->hash, return NULL);
|
||||||
|
|
||||||
|
return newbackup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* backup.h
|
* backup.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -21,10 +21,12 @@
|
|||||||
#define _ALPM_BACKUP_H
|
#define _ALPM_BACKUP_H
|
||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
#include "alpm.h"
|
||||||
|
|
||||||
char *_alpm_backup_file(const char *string);
|
int _alpm_split_backup(const char *string, alpm_backup_t **backup);
|
||||||
char *_alpm_backup_hash(const char *string);
|
alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg);
|
||||||
char *_alpm_needbackup(const char *file, const alpm_list_t *backup);
|
void _alpm_backup_free(alpm_backup_t *backup);
|
||||||
|
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup);
|
||||||
|
|
||||||
#endif /* _ALPM_BACKUP_H */
|
#endif /* _ALPM_BACKUP_H */
|
||||||
|
|
||||||
|
|||||||
190
lib/libalpm/base64.c
Normal file
190
lib/libalpm/base64.c
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
/*
|
||||||
|
* RFC 1521 base64 encoding/decoding
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||||
|
*
|
||||||
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||||
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Pacman Notes:
|
||||||
|
*
|
||||||
|
* Taken from the PolarSSL project at www.polarssl.org under terms of the
|
||||||
|
* GPL. This is from version 0.14.2 of the library, and has been modified
|
||||||
|
* as following, which may be helpful for future updates:
|
||||||
|
* * remove "polarssl/config.h" include
|
||||||
|
* * change include from "polarssl/base64.h" to "base64.h"
|
||||||
|
* * removal of SELF_TEST code
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "base64.h"
|
||||||
|
|
||||||
|
static const unsigned char base64_enc_map[64] =
|
||||||
|
{
|
||||||
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||||
|
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||||
|
'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
|
||||||
|
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||||
|
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
||||||
|
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
|
'8', '9', '+', '/'
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned char base64_dec_map[128] =
|
||||||
|
{
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 62, 127, 127, 127, 63, 52, 53,
|
||||||
|
54, 55, 56, 57, 58, 59, 60, 61, 127, 127,
|
||||||
|
127, 64, 127, 127, 127, 0, 1, 2, 3, 4,
|
||||||
|
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||||
|
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||||
|
25, 127, 127, 127, 127, 127, 127, 26, 27, 28,
|
||||||
|
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
||||||
|
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||||
|
49, 50, 51, 127, 127, 127, 127, 127
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Encode a buffer into base64 format
|
||||||
|
*/
|
||||||
|
int base64_encode( unsigned char *dst, size_t *dlen,
|
||||||
|
const unsigned char *src, size_t slen )
|
||||||
|
{
|
||||||
|
size_t i, n;
|
||||||
|
int C1, C2, C3;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
if( slen == 0 )
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
n = (slen << 3) / 6;
|
||||||
|
|
||||||
|
switch( (slen << 3) - (n * 6) )
|
||||||
|
{
|
||||||
|
case 2: n += 3; break;
|
||||||
|
case 4: n += 2; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( *dlen < n + 1 )
|
||||||
|
{
|
||||||
|
*dlen = n + 1;
|
||||||
|
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||||
|
}
|
||||||
|
|
||||||
|
n = (slen / 3) * 3;
|
||||||
|
|
||||||
|
for( i = 0, p = dst; i < n; i += 3 )
|
||||||
|
{
|
||||||
|
C1 = *src++;
|
||||||
|
C2 = *src++;
|
||||||
|
C3 = *src++;
|
||||||
|
|
||||||
|
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[(((C2 & 15) << 2) + (C3 >> 6)) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[C3 & 0x3F];
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i < slen )
|
||||||
|
{
|
||||||
|
C1 = *src++;
|
||||||
|
C2 = ((i + 1) < slen) ? *src++ : 0;
|
||||||
|
|
||||||
|
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
|
||||||
|
|
||||||
|
if( (i + 1) < slen )
|
||||||
|
*p++ = base64_enc_map[((C2 & 15) << 2) & 0x3F];
|
||||||
|
else *p++ = '=';
|
||||||
|
|
||||||
|
*p++ = '=';
|
||||||
|
}
|
||||||
|
|
||||||
|
*dlen = p - dst;
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Decode a base64-formatted buffer
|
||||||
|
*/
|
||||||
|
int base64_decode( unsigned char *dst, size_t *dlen,
|
||||||
|
const unsigned char *src, size_t slen )
|
||||||
|
{
|
||||||
|
size_t i, j, n;
|
||||||
|
unsigned long x;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
for( i = j = n = 0; i < slen; i++ )
|
||||||
|
{
|
||||||
|
if( ( slen - i ) >= 2 &&
|
||||||
|
src[i] == '\r' && src[i + 1] == '\n' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( src[i] == '\n' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( src[i] == '=' && ++j > 2 )
|
||||||
|
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
if( src[i] > 127 || base64_dec_map[src[i]] == 127 )
|
||||||
|
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
if( base64_dec_map[src[i]] < 64 && j != 0 )
|
||||||
|
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( n == 0 )
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
n = ((n * 6) + 7) >> 3;
|
||||||
|
|
||||||
|
if( *dlen < n )
|
||||||
|
{
|
||||||
|
*dlen = n;
|
||||||
|
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( j = 3, n = x = 0, p = dst; i > 0; i--, src++ )
|
||||||
|
{
|
||||||
|
if( *src == '\r' || *src == '\n' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
j -= ( base64_dec_map[*src] == 64 );
|
||||||
|
x = (x << 6) | ( base64_dec_map[*src] & 0x3F );
|
||||||
|
|
||||||
|
if( ++n == 4 )
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
if( j > 0 ) *p++ = (unsigned char)( x >> 16 );
|
||||||
|
if( j > 1 ) *p++ = (unsigned char)( x >> 8 );
|
||||||
|
if( j > 2 ) *p++ = (unsigned char)( x );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*dlen = p - dst;
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
70
lib/libalpm/base64.h
Normal file
70
lib/libalpm/base64.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* \file base64.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||||
|
*
|
||||||
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||||
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* 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 _BASE64_H
|
||||||
|
#define _BASE64_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010 /**< Output buffer too small. */
|
||||||
|
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012 /**< Invalid character in input. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Encode a buffer into base64 format
|
||||||
|
*
|
||||||
|
* \param dst destination buffer
|
||||||
|
* \param dlen size of the buffer
|
||||||
|
* \param src source buffer
|
||||||
|
* \param slen amount of data to be encoded
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
|
||||||
|
* *dlen is always updated to reflect the amount
|
||||||
|
* of data that has (or would have) been written.
|
||||||
|
*
|
||||||
|
* \note Call this function with *dlen = 0 to obtain the
|
||||||
|
* required buffer size in *dlen
|
||||||
|
*/
|
||||||
|
int base64_encode( unsigned char *dst, size_t *dlen,
|
||||||
|
const unsigned char *src, size_t slen );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Decode a base64-formatted buffer
|
||||||
|
*
|
||||||
|
* \param dst destination buffer
|
||||||
|
* \param dlen size of the buffer
|
||||||
|
* \param src source buffer
|
||||||
|
* \param slen amount of data to be decoded
|
||||||
|
*
|
||||||
|
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
|
||||||
|
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
|
||||||
|
* correct. *dlen is always updated to reflect the amount
|
||||||
|
* of data that has (or would have) been written.
|
||||||
|
*
|
||||||
|
* \note Call this function with *dlen = 0 to obtain the
|
||||||
|
* required buffer size in *dlen
|
||||||
|
*/
|
||||||
|
int base64_decode( unsigned char *dst, size_t *dlen,
|
||||||
|
const unsigned char *src, size_t slen );
|
||||||
|
|
||||||
|
#endif /* base64.h */
|
||||||
@@ -1,977 +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> /* intmax_t */
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <limits.h> /* PATH_MAX */
|
|
||||||
#include <locale.h> /* setlocale */
|
|
||||||
|
|
||||||
/* libarchive */
|
|
||||||
#include <archive.h>
|
|
||||||
#include <archive_entry.h>
|
|
||||||
|
|
||||||
/* libalpm */
|
|
||||||
#include "db.h"
|
|
||||||
#include "alpm_list.h"
|
|
||||||
#include "cache.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "alpm.h"
|
|
||||||
#include "handle.h"
|
|
||||||
#include "package.h"
|
|
||||||
#include "delta.h"
|
|
||||||
#include "deps.h"
|
|
||||||
#include "dload.h"
|
|
||||||
|
|
||||||
|
|
||||||
static int checkdbdir(pmdb_t *db)
|
|
||||||
{
|
|
||||||
struct stat buf;
|
|
||||||
const char *path = _alpm_db_path(db);
|
|
||||||
|
|
||||||
if(stat(path, &buf) != 0) {
|
|
||||||
_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, -1);
|
|
||||||
}
|
|
||||||
} else if(!S_ISDIR(buf.st_mode)) {
|
|
||||||
_alpm_log(PM_LOG_WARNING, _("removing invalid database: %s\n"), path);
|
|
||||||
if(unlink(path) != 0 || _alpm_makepath(path) != 0) {
|
|
||||||
RET_ERR(PM_ERR_SYSTEM, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create list of directories in db */
|
|
||||||
static int dirlist_from_tar(const char *archive, alpm_list_t **dirlist)
|
|
||||||
{
|
|
||||||
struct archive *_archive;
|
|
||||||
struct archive_entry *entry;
|
|
||||||
|
|
||||||
if((_archive = archive_read_new()) == NULL)
|
|
||||||
RET_ERR(PM_ERR_LIBARCHIVE, -1);
|
|
||||||
|
|
||||||
archive_read_support_compression_all(_archive);
|
|
||||||
archive_read_support_format_all(_archive);
|
|
||||||
|
|
||||||
if(archive_read_open_filename(_archive, archive,
|
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive,
|
|
||||||
archive_error_string(_archive));
|
|
||||||
RET_ERR(PM_ERR_PKG_OPEN, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while(archive_read_next_header(_archive, &entry) == ARCHIVE_OK) {
|
|
||||||
const struct stat *st;
|
|
||||||
const char *entryname; /* the name of the file in the archive */
|
|
||||||
|
|
||||||
st = archive_entry_stat(entry);
|
|
||||||
entryname = archive_entry_pathname(entry);
|
|
||||||
|
|
||||||
if(S_ISDIR(st->st_mode)) {
|
|
||||||
char *name = strdup(entryname);
|
|
||||||
*dirlist = alpm_list_add(*dirlist, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
archive_read_finish(_archive);
|
|
||||||
|
|
||||||
*dirlist = alpm_list_msort(*dirlist, alpm_list_count(*dirlist), _alpm_str_cmp);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create list of directories in db */
|
|
||||||
static int dirlist_from_fs(const char *syncdbpath, alpm_list_t **dirlist)
|
|
||||||
{
|
|
||||||
DIR *dbdir;
|
|
||||||
struct dirent *ent = NULL;
|
|
||||||
struct stat sbuf;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
|
|
||||||
dbdir = opendir(syncdbpath);
|
|
||||||
if (dbdir != NULL) {
|
|
||||||
while((ent = readdir(dbdir)) != NULL) {
|
|
||||||
char *name = ent->d_name;
|
|
||||||
size_t len;
|
|
||||||
char *entry;
|
|
||||||
|
|
||||||
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* stat the entry, make sure it's a directory */
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", syncdbpath, name);
|
|
||||||
if(stat(path, &sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = strlen(name);
|
|
||||||
MALLOC(entry, len + 2, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
strcpy(entry, name);
|
|
||||||
entry[len] = '/';
|
|
||||||
entry[len+1] = '\0';
|
|
||||||
*dirlist = alpm_list_add(*dirlist, entry);
|
|
||||||
}
|
|
||||||
closedir(dbdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
*dirlist = alpm_list_msort(*dirlist, alpm_list_count(*dirlist), _alpm_str_cmp);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove old directories from dbdir */
|
|
||||||
static int remove_olddir(const char *syncdbpath, alpm_list_t *dirlist)
|
|
||||||
{
|
|
||||||
alpm_list_t *i;
|
|
||||||
for (i = dirlist; i; i = i->next) {
|
|
||||||
const char *name = i->data;
|
|
||||||
char *dbdir;
|
|
||||||
size_t len = strlen(syncdbpath) + strlen(name) + 2;
|
|
||||||
MALLOC(dbdir, len, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
snprintf(dbdir, len, "%s%s", syncdbpath, name);
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "removing: %s\n", dbdir);
|
|
||||||
if(_alpm_rmrf(dbdir) != 0) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not remove database directory %s\n"), dbdir);
|
|
||||||
free(dbdir);
|
|
||||||
RET_ERR(PM_ERR_DB_REMOVE, -1);
|
|
||||||
}
|
|
||||||
free(dbdir);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 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
|
|
||||||
* pmdb_t *db;
|
|
||||||
* int result;
|
|
||||||
* db = alpm_list_getdata(alpm_option_get_syncdbs());
|
|
||||||
* if(alpm_trans_init(0, NULL, NULL, NULL) == 0) {
|
|
||||||
* result = alpm_db_update(0, db);
|
|
||||||
* alpm_trans_release();
|
|
||||||
*
|
|
||||||
* if(result > 0) {
|
|
||||||
* printf("Unable to update database: %s\n", alpm_strerrorlast());
|
|
||||||
* } else if(result < 0) {
|
|
||||||
* 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, > 0 on error (pm_errno is set accordingly), < 0 if up
|
|
||||||
* to date
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
|
||||||
{
|
|
||||||
char *dbfile, *dbfilepath;
|
|
||||||
const char *dbpath, *syncdbpath;
|
|
||||||
alpm_list_t *newdirlist = NULL, *olddirlist = NULL;
|
|
||||||
alpm_list_t *onlynew = NULL, *onlyold = NULL;
|
|
||||||
size_t len;
|
|
||||||
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));
|
|
||||||
|
|
||||||
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
|
|
||||||
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
len = strlen(db->treename) + strlen(DBEXT) + 1;
|
|
||||||
MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
sprintf(dbfile, "%s" DBEXT, db->treename);
|
|
||||||
|
|
||||||
dbpath = alpm_option_get_dbpath();
|
|
||||||
|
|
||||||
ret = _alpm_download_single_file(dbfile, db->servers, dbpath, force);
|
|
||||||
free(dbfile);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
syncdbpath = _alpm_db_path(db);
|
|
||||||
|
|
||||||
/* form the path to the db location */
|
|
||||||
len = strlen(dbpath) + strlen(db->treename) + strlen(DBEXT) + 1;
|
|
||||||
MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
sprintf(dbfilepath, "%s%s" DBEXT, dbpath, db->treename);
|
|
||||||
|
|
||||||
if(force) {
|
|
||||||
/* if forcing update, remove the old dir and extract the db */
|
|
||||||
if(_alpm_rmrf(syncdbpath) != 0) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not remove database %s\n"), db->treename);
|
|
||||||
RET_ERR(PM_ERR_DB_REMOVE, -1);
|
|
||||||
} else {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "database dir %s removed\n", _alpm_db_path(db));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* if not forcing, only remove and extract what is necessary */
|
|
||||||
ret = dirlist_from_tar(dbfilepath, &newdirlist);
|
|
||||||
if(ret) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ret = dirlist_from_fs(syncdbpath, &olddirlist);
|
|
||||||
if(ret) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_diff_sorted(olddirlist, newdirlist, _alpm_str_cmp, &onlyold, &onlynew);
|
|
||||||
|
|
||||||
ret = remove_olddir(syncdbpath, onlyold);
|
|
||||||
if(ret) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cache needs to be rebuilt */
|
|
||||||
_alpm_db_free_pkgcache(db);
|
|
||||||
|
|
||||||
checkdbdir(db);
|
|
||||||
ret = _alpm_unpack(dbfilepath, syncdbpath, onlynew, 0);
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
FREELIST(newdirlist);
|
|
||||||
FREELIST(olddirlist);
|
|
||||||
alpm_list_free(onlynew);
|
|
||||||
alpm_list_free(onlyold);
|
|
||||||
|
|
||||||
free(dbfilepath);
|
|
||||||
|
|
||||||
if(ret) {
|
|
||||||
RET_ERR(PM_ERR_SYSTEM, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int splitname(const char *target, pmpkg_t *pkg)
|
|
||||||
{
|
|
||||||
/* 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 || pkg == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
STRDUP(tmp, target, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
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(pkg->version) {
|
|
||||||
FREE(pkg->version);
|
|
||||||
}
|
|
||||||
STRDUP(pkg->version, p+1, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
/* insert a terminator at the end of the name (on hyphen)- then copy it */
|
|
||||||
*p = '\0';
|
|
||||||
if(pkg->name) {
|
|
||||||
FREE(pkg->name);
|
|
||||||
}
|
|
||||||
STRDUP(pkg->name, tmp, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
|
|
||||||
free(tmp);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_populate(pmdb_t *db)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
struct dirent *ent = NULL;
|
|
||||||
struct stat sbuf;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
const char *dbpath;
|
|
||||||
DIR *dbdir;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
|
||||||
|
|
||||||
dbpath = _alpm_db_path(db);
|
|
||||||
dbdir = opendir(dbpath);
|
|
||||||
if(dbdir == NULL) {
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
while((ent = readdir(dbdir)) != NULL) {
|
|
||||||
const char *name = ent->d_name;
|
|
||||||
pmpkg_t *pkg;
|
|
||||||
|
|
||||||
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* stat the entry, make sure it's a directory */
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", dbpath, name);
|
|
||||||
if(stat(path, &sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg = _alpm_pkg_new();
|
|
||||||
if(pkg == NULL) {
|
|
||||||
closedir(dbdir);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
/* split the db entry name */
|
|
||||||
if(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_pkg_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_CACHE;
|
|
||||||
pkg->origin_data.db = db;
|
|
||||||
|
|
||||||
/* explicitly read with only 'BASE' data, accessors will handle the rest */
|
|
||||||
if(_alpm_db_read(db, pkg, INFRQ_BASE) == -1) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
|
|
||||||
_alpm_pkg_free(pkg);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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_list_add(db->pkgcache, pkg);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir(dbdir);
|
|
||||||
db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
|
|
||||||
return(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note: the return value must be freed by the caller */
|
|
||||||
static char *get_pkgpath(pmdb_t *db, pmpkg_t *info)
|
|
||||||
{
|
|
||||||
size_t len;
|
|
||||||
char *pkgpath;
|
|
||||||
const char *dbpath;
|
|
||||||
|
|
||||||
dbpath = _alpm_db_path(db);
|
|
||||||
len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3;
|
|
||||||
MALLOC(pkgpath, len, RET_ERR(PM_ERR_MEMORY, NULL));
|
|
||||||
sprintf(pkgpath, "%s%s-%s/", dbpath, info->name, info->version);
|
|
||||||
return(pkgpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
|
||||||
{
|
|
||||||
FILE *fp = NULL;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
char line[513];
|
|
||||||
int sline = sizeof(line)-1;
|
|
||||||
char *pkgpath = NULL;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_NULL, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(info == NULL || info->name == NULL || info->version == NULL) {
|
|
||||||
_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 all of 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, sline+1);
|
|
||||||
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
|
||||||
|
|
||||||
if(access(pkgpath, F_OK)) {
|
|
||||||
/* 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);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DESC */
|
|
||||||
if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) {
|
|
||||||
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
|
|
||||||
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, "%NAME%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
if(strcmp(_alpm_strtrim(line), info->name) != 0) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
|
|
||||||
"mismatch on package %s\n"), db->treename, info->name);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%VERSION%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
if(strcmp(_alpm_strtrim(line), info->version) != 0) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
|
|
||||||
"mismatch on package %s\n"), db->treename, info->name);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%FILENAME%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
STRDUP(info->filename, _alpm_strtrim(line), goto error);
|
|
||||||
} else if(strcmp(line, "%DESC%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
STRDUP(info->desc, _alpm_strtrim(line), goto error);
|
|
||||||
} else if(strcmp(line, "%GROUPS%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->groups = alpm_list_add(info->groups, linedup);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%URL%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
STRDUP(info->url, _alpm_strtrim(line), goto error);
|
|
||||||
} else if(strcmp(line, "%LICENSE%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->licenses = alpm_list_add(info->licenses, linedup);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%ARCH%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
STRDUP(info->arch, _alpm_strtrim(line), goto error);
|
|
||||||
} else if(strcmp(line, "%BUILDDATE%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
|
|
||||||
char first = tolower((unsigned char)line[0]);
|
|
||||||
if(first > 'a' && first < 'z') {
|
|
||||||
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
|
|
||||||
setlocale(LC_TIME, "C");
|
|
||||||
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
|
|
||||||
info->builddate = mktime(&tmp_tm);
|
|
||||||
setlocale(LC_TIME, "");
|
|
||||||
} else {
|
|
||||||
info->builddate = atol(line);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%INSTALLDATE%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
|
|
||||||
char first = tolower((unsigned char)line[0]);
|
|
||||||
if(first > 'a' && first < 'z') {
|
|
||||||
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
|
|
||||||
setlocale(LC_TIME, "C");
|
|
||||||
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
|
|
||||||
info->installdate = mktime(&tmp_tm);
|
|
||||||
setlocale(LC_TIME, "");
|
|
||||||
} else {
|
|
||||||
info->installdate = atol(line);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%PACKAGER%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
STRDUP(info->packager, _alpm_strtrim(line), goto error);
|
|
||||||
} else if(strcmp(line, "%REASON%") == 0) {
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
info->reason = (pmpkgreason_t)atol(_alpm_strtrim(line));
|
|
||||||
} else if(strcmp(line, "%SIZE%") == 0 || 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.
|
|
||||||
*/
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
info->size = atol(_alpm_strtrim(line));
|
|
||||||
/* also store this value to isize if isize is unset */
|
|
||||||
if(info->isize == 0) {
|
|
||||||
info->isize = info->size;
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%ISIZE%") == 0) {
|
|
||||||
/* ISIZE (installed size) tag only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
info->isize = atol(_alpm_strtrim(line));
|
|
||||||
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
|
||||||
/* MD5SUM tag only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
if(fgets(line, sline, fp) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
STRDUP(info->md5sum, _alpm_strtrim(line), goto error);
|
|
||||||
} else if(strcmp(line, "%REPLACES%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->replaces = alpm_list_add(info->replaces, linedup);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%FORCE%") == 0) {
|
|
||||||
info->force = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FILES */
|
|
||||||
if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) {
|
|
||||||
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
|
|
||||||
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%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->files = alpm_list_add(info->files, linedup);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%BACKUP%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->backup = alpm_list_add(info->backup, linedup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DEPENDS */
|
|
||||||
if(inforeq & INFRQ_DEPENDS && !(info->infolevel & INFRQ_DEPENDS)) {
|
|
||||||
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
|
|
||||||
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%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
pmdepend_t *dep = _alpm_splitdep(_alpm_strtrim(line));
|
|
||||||
info->depends = alpm_list_add(info->depends, dep);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->optdepends = alpm_list_add(info->optdepends, linedup);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->conflicts = alpm_list_add(info->conflicts, linedup);
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
char *linedup;
|
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
|
||||||
info->provides = alpm_list_add(info->provides, linedup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DELTAS */
|
|
||||||
if(inforeq & INFRQ_DELTAS && !(info->infolevel & INFRQ_DELTAS)) {
|
|
||||||
snprintf(path, PATH_MAX, "%sdeltas", pkgpath);
|
|
||||||
if((fp = fopen(path, "r"))) {
|
|
||||||
while(!feof(fp)) {
|
|
||||||
fgets(line, 255, fp);
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
if(strcmp(line, "%DELTAS%") == 0) {
|
|
||||||
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
|
|
||||||
pmdelta_t *delta = _alpm_delta_parse(line);
|
|
||||||
if(delta) {
|
|
||||||
info->deltas = alpm_list_add(info->deltas, delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* INSTALL */
|
|
||||||
if(inforeq & INFRQ_SCRIPTLET && !(info->infolevel & INFRQ_SCRIPTLET)) {
|
|
||||||
snprintf(path, PATH_MAX, "%sinstall", pkgpath);
|
|
||||||
if(access(path, F_OK) == 0) {
|
|
||||||
info->scriptlet = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* internal */
|
|
||||||
info->infolevel |= inforeq;
|
|
||||||
|
|
||||||
free(pkgpath);
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
error:
|
|
||||||
free(pkgpath);
|
|
||||||
if(fp) {
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info)
|
|
||||||
{
|
|
||||||
mode_t oldmask;
|
|
||||||
int retval = 0;
|
|
||||||
char *pkgpath = NULL;
|
|
||||||
|
|
||||||
if(checkdbdir(db) != 0) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
oldmask = umask(0000);
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
|
||||||
|
|
||||||
if((retval = mkdir(pkgpath, 0755)) != 0) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s\n"),
|
|
||||||
pkgpath, strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
free(pkgpath);
|
|
||||||
umask(oldmask);
|
|
||||||
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
char *pkgpath = NULL;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || info == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
|
||||||
|
|
||||||
/* make sure we have a sane umask */
|
|
||||||
oldmask = 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, "%sdesc", pkgpath);
|
|
||||||
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) {
|
|
||||||
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(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(local) {
|
|
||||||
if(info->url) {
|
|
||||||
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) {
|
|
||||||
fprintf(fp, "%%ARCH%%\n"
|
|
||||||
"%s\n\n", info->arch);
|
|
||||||
}
|
|
||||||
if(info->builddate) {
|
|
||||||
fprintf(fp, "%%BUILDDATE%%\n"
|
|
||||||
"%ld\n\n", info->builddate);
|
|
||||||
}
|
|
||||||
if(info->installdate) {
|
|
||||||
fprintf(fp, "%%INSTALLDATE%%\n"
|
|
||||||
"%ld\n\n", info->installdate);
|
|
||||||
}
|
|
||||||
if(info->packager) {
|
|
||||||
fprintf(fp, "%%PACKAGER%%\n"
|
|
||||||
"%s\n\n", info->packager);
|
|
||||||
}
|
|
||||||
if(info->isize) {
|
|
||||||
/* only write installed size, csize is irrelevant once installed */
|
|
||||||
fprintf(fp, "%%SIZE%%\n"
|
|
||||||
"%jd\n\n", (intmax_t)info->isize);
|
|
||||||
}
|
|
||||||
if(info->reason) {
|
|
||||||
fprintf(fp, "%%REASON%%\n"
|
|
||||||
"%u\n\n", info->reason);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(info->size) {
|
|
||||||
fprintf(fp, "%%CSIZE%%\n"
|
|
||||||
"%jd\n\n", (intmax_t)info->size);
|
|
||||||
}
|
|
||||||
if(info->isize) {
|
|
||||||
fprintf(fp, "%%ISIZE%%\n"
|
|
||||||
"%jd\n\n", (intmax_t)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, "%sfiles", pkgpath);
|
|
||||||
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, "%sdepends", pkgpath);
|
|
||||||
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_compute_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");
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* INSTALL */
|
|
||||||
/* nothing needed here (script is automatically extracted) */
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
umask(oldmask);
|
|
||||||
free(pkgpath);
|
|
||||||
|
|
||||||
if(fp) {
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
char *pkgpath = NULL;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || info == NULL) {
|
|
||||||
RET_ERR(PM_ERR_DB_NULL, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
|
||||||
|
|
||||||
ret = _alpm_rmrf(pkgpath);
|
|
||||||
free(pkgpath);
|
|
||||||
if(ret != 0) {
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
|
||||||
947
lib/libalpm/be_local.c
Normal file
947
lib/libalpm/be_local.c
Normal file
@@ -0,0 +1,947 @@
|
|||||||
|
/*
|
||||||
|
* be_local.c : backend for the local database
|
||||||
|
*
|
||||||
|
* 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 <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h> /* intmax_t */
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <limits.h> /* PATH_MAX */
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "db.h"
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "handle.h"
|
||||||
|
#include "package.h"
|
||||||
|
#include "deps.h"
|
||||||
|
|
||||||
|
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
|
||||||
|
|
||||||
|
#define LAZY_LOAD(info, errret) \
|
||||||
|
do { \
|
||||||
|
if(!(pkg->infolevel & info)) { \
|
||||||
|
local_db_read(pkg, info); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Cache-specific accessor functions. These implementations allow for lazy
|
||||||
|
* loading by the files backend when a data member is actually needed
|
||||||
|
* rather than loading all pieces of information when the package is first
|
||||||
|
* initialized.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char *_cache_get_desc(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *_cache_get_url(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
static time_t _cache_get_builddate(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, 0);
|
||||||
|
return pkg->builddate;
|
||||||
|
}
|
||||||
|
|
||||||
|
static time_t _cache_get_installdate(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, 0);
|
||||||
|
return pkg->installdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *_cache_get_packager(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->packager;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *_cache_get_arch(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
static off_t _cache_get_isize(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, -1);
|
||||||
|
return pkg->isize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_pkgreason_t _cache_get_reason(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, -1);
|
||||||
|
return pkg->reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_licenses(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->licenses;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_groups(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int _cache_has_scriptlet(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_SCRIPTLET, NULL);
|
||||||
|
return pkg->scriptlet;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_depends(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->depends;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_optdepends(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->optdepends;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_conflicts(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->conflicts;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_provides(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->provides;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_replaces(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
|
return pkg->replaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_filelist_t *_cache_get_files(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_FILES, NULL);
|
||||||
|
return &(pkg->files);
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_FILES, NULL);
|
||||||
|
return pkg->backup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a package changelog for reading. Similar to fopen in functionality,
|
||||||
|
* except that the returned 'file stream' is from the database.
|
||||||
|
* @param pkg the package (from db) to read the changelog
|
||||||
|
* @return a 'file stream' to the package changelog
|
||||||
|
*/
|
||||||
|
static void *_cache_changelog_open(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||||
|
char *clfile = _alpm_local_db_pkgpath(db, pkg, "changelog");
|
||||||
|
FILE *f = fopen(clfile, "r");
|
||||||
|
free(clfile);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 _cache_changelog_read(void *ptr, size_t size,
|
||||||
|
const alpm_pkg_t UNUSED *pkg, void *fp)
|
||||||
|
{
|
||||||
|
return fread(ptr, 1, size, (FILE *)fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close a package changelog for reading. Similar to fclose in functionality,
|
||||||
|
* except that the 'file stream' is from the database.
|
||||||
|
* @param pkg the package 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 _cache_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
||||||
|
{
|
||||||
|
return fclose((FILE *)fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int _cache_force_load(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
return local_db_read(pkg, INFRQ_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** The local database operations struct. Get package fields through
|
||||||
|
* lazy accessor methods that handle any backend loading and caching
|
||||||
|
* logic.
|
||||||
|
*/
|
||||||
|
static struct pkg_operations local_pkg_ops = {
|
||||||
|
.get_desc = _cache_get_desc,
|
||||||
|
.get_url = _cache_get_url,
|
||||||
|
.get_builddate = _cache_get_builddate,
|
||||||
|
.get_installdate = _cache_get_installdate,
|
||||||
|
.get_packager = _cache_get_packager,
|
||||||
|
.get_arch = _cache_get_arch,
|
||||||
|
.get_isize = _cache_get_isize,
|
||||||
|
.get_reason = _cache_get_reason,
|
||||||
|
.has_scriptlet = _cache_has_scriptlet,
|
||||||
|
.get_licenses = _cache_get_licenses,
|
||||||
|
.get_groups = _cache_get_groups,
|
||||||
|
.get_depends = _cache_get_depends,
|
||||||
|
.get_optdepends = _cache_get_optdepends,
|
||||||
|
.get_conflicts = _cache_get_conflicts,
|
||||||
|
.get_provides = _cache_get_provides,
|
||||||
|
.get_replaces = _cache_get_replaces,
|
||||||
|
.get_files = _cache_get_files,
|
||||||
|
.get_backup = _cache_get_backup,
|
||||||
|
|
||||||
|
.changelog_open = _cache_changelog_open,
|
||||||
|
.changelog_read = _cache_changelog_read,
|
||||||
|
.changelog_close = _cache_changelog_close,
|
||||||
|
|
||||||
|
.force_load = _cache_force_load,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int checkdbdir(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
const char *path = _alpm_db_path(db);
|
||||||
|
|
||||||
|
if(stat(path, &buf) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
||||||
|
path);
|
||||||
|
if(_alpm_makepath(path) != 0) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_SYSTEM, -1);
|
||||||
|
}
|
||||||
|
} else if(!S_ISDIR(buf.st_mode)) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_WARNING, _("removing invalid database: %s\n"), path);
|
||||||
|
if(unlink(path) != 0 || _alpm_makepath(path) != 0) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_SYSTEM, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int is_dir(const char *path, struct dirent *entry)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
|
||||||
|
if(entry->d_type != DT_UNKNOWN) {
|
||||||
|
return (entry->d_type == DT_DIR);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char buffer[PATH_MAX];
|
||||||
|
struct stat sbuf;
|
||||||
|
|
||||||
|
snprintf(buffer, PATH_MAX, "%s/%s", path, entry->d_name);
|
||||||
|
|
||||||
|
if(!stat(buffer, &sbuf)) {
|
||||||
|
return S_ISDIR(sbuf.st_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int local_db_validate(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
struct dirent *ent = NULL;
|
||||||
|
const char *dbpath;
|
||||||
|
DIR *dbdir;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if(db->status & DB_STATUS_VALID) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(db->status & DB_STATUS_INVALID) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbpath = _alpm_db_path(db);
|
||||||
|
if(dbpath == NULL) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
|
}
|
||||||
|
dbdir = opendir(dbpath);
|
||||||
|
if(dbdir == NULL) {
|
||||||
|
if(errno == ENOENT) {
|
||||||
|
/* database dir doesn't exist yet */
|
||||||
|
db->status |= DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status |= DB_STATUS_MISSING;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
db->status |= DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
|
|
||||||
|
while((ent = readdir(dbdir)) != NULL) {
|
||||||
|
const char *name = ent->d_name;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
|
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!is_dir(dbpath, ent)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
|
||||||
|
if(access(path, F_OK) == 0) {
|
||||||
|
/* we found a depends file- bail */
|
||||||
|
db->status &= ~DB_STATUS_VALID;
|
||||||
|
db->status |= DB_STATUS_INVALID;
|
||||||
|
db->handle->pm_errno = ALPM_ERR_DB_VERSION;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* we found no depends file after full scan */
|
||||||
|
db->status |= DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if(dbdir) {
|
||||||
|
closedir(dbdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int local_db_populate(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
size_t est_count;
|
||||||
|
int count = 0;
|
||||||
|
struct stat buf;
|
||||||
|
struct dirent *ent = NULL;
|
||||||
|
const char *dbpath;
|
||||||
|
DIR *dbdir;
|
||||||
|
|
||||||
|
if(db->status & DB_STATUS_INVALID) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_INVALID, -1);
|
||||||
|
}
|
||||||
|
/* note: DB_STATUS_MISSING is not fatal for local database */
|
||||||
|
|
||||||
|
dbpath = _alpm_db_path(db);
|
||||||
|
if(dbpath == NULL) {
|
||||||
|
/* pm_errno set in _alpm_db_path() */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbdir = opendir(dbpath);
|
||||||
|
if(dbdir == NULL) {
|
||||||
|
if(errno == ENOENT) {
|
||||||
|
/* no database existing yet is not an error */
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status |= DB_STATUS_MISSING;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
|
}
|
||||||
|
if(fstat(dirfd(dbdir), &buf) != 0) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
|
}
|
||||||
|
db->status |= DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
|
if(buf.st_nlink >= 2) {
|
||||||
|
est_count = buf.st_nlink;
|
||||||
|
} else {
|
||||||
|
/* Some filesystems don't subscribe to the two-implicit links school of
|
||||||
|
* thought, e.g. BTRFS, HFS+. See
|
||||||
|
* http://kerneltrap.org/mailarchive/linux-btrfs/2010/1/23/6723483/thread
|
||||||
|
*/
|
||||||
|
est_count = 0;
|
||||||
|
while(readdir(dbdir) != NULL) {
|
||||||
|
est_count++;
|
||||||
|
}
|
||||||
|
rewinddir(dbdir);
|
||||||
|
}
|
||||||
|
if(est_count >= 2) {
|
||||||
|
/* subtract the two extra pointers to get # of children */
|
||||||
|
est_count -= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize hash at 50% full */
|
||||||
|
db->pkgcache = _alpm_pkghash_create(est_count * 2);
|
||||||
|
if(db->pkgcache == NULL){
|
||||||
|
closedir(dbdir);
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while((ent = readdir(dbdir)) != NULL) {
|
||||||
|
const char *name = ent->d_name;
|
||||||
|
|
||||||
|
alpm_pkg_t *pkg;
|
||||||
|
|
||||||
|
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!is_dir(dbpath, ent)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg = _alpm_pkg_new();
|
||||||
|
if(pkg == NULL) {
|
||||||
|
closedir(dbdir);
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
||||||
|
}
|
||||||
|
/* split the db entry name */
|
||||||
|
if(_alpm_splitname(name, &(pkg->name), &(pkg->version),
|
||||||
|
&(pkg->name_hash)) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_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(db->handle, ALPM_LOG_ERROR, _("duplicated database entry '%s'\n"), pkg->name);
|
||||||
|
_alpm_pkg_free(pkg);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg->origin = PKG_FROM_LOCALDB;
|
||||||
|
pkg->origin_data.db = db;
|
||||||
|
pkg->ops = &local_pkg_ops;
|
||||||
|
pkg->handle = db->handle;
|
||||||
|
|
||||||
|
/* explicitly read with only 'BASE' data, accessors will handle the rest */
|
||||||
|
if(local_db_read(pkg, INFRQ_BASE) == -1) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
|
||||||
|
_alpm_pkg_free(pkg);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add to the collection */
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
|
||||||
|
pkg->name, db->treename);
|
||||||
|
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(dbdir);
|
||||||
|
if(count > 0) {
|
||||||
|
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
|
||||||
|
}
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
|
||||||
|
count, db->treename);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note: the return value must be freed by the caller */
|
||||||
|
char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info, const char *filename)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *pkgpath;
|
||||||
|
const char *dbpath;
|
||||||
|
|
||||||
|
dbpath = _alpm_db_path(db);
|
||||||
|
len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3;
|
||||||
|
len += filename ? strlen(filename) : 0;
|
||||||
|
MALLOC(pkgpath, len, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
|
||||||
|
sprintf(pkgpath, "%s%s-%s/%s", dbpath, info->name, info->version,
|
||||||
|
filename ? filename : "");
|
||||||
|
return pkgpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define READ_NEXT() do { \
|
||||||
|
if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) goto error; \
|
||||||
|
_alpm_strip_newline(line); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define READ_AND_STORE(f) do { \
|
||||||
|
READ_NEXT(); \
|
||||||
|
STRDUP(f, line, goto error); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define READ_AND_STORE_ALL(f) do { \
|
||||||
|
char *linedup; \
|
||||||
|
if(fgets(line, sizeof(line), fp) == NULL) {\
|
||||||
|
if(!feof(fp)) goto error; else break; \
|
||||||
|
} \
|
||||||
|
if(_alpm_strip_newline(line) == 0) break; \
|
||||||
|
STRDUP(linedup, line, goto error); \
|
||||||
|
f = alpm_list_add(f, linedup); \
|
||||||
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
|
#define READ_AND_SPLITDEP(f) do { \
|
||||||
|
if(fgets(line, sizeof(line), fp) == NULL) {\
|
||||||
|
if(!feof(fp)) goto error; else break; \
|
||||||
|
} \
|
||||||
|
if(_alpm_strip_newline(line) == 0) break; \
|
||||||
|
f = alpm_list_add(f, _alpm_splitdep(line)); \
|
||||||
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
|
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
|
{
|
||||||
|
FILE *fp = NULL;
|
||||||
|
char line[1024];
|
||||||
|
char *pkgpath;
|
||||||
|
alpm_db_t *db = info->origin_data.db;
|
||||||
|
|
||||||
|
/* 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 all of this info, do nothing */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(info->infolevel & INFRQ_ERROR) {
|
||||||
|
/* We've encountered an error loading this package before. Don't attempt
|
||||||
|
* repeated reloads, just give up. */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
|
||||||
|
info->name, inforeq);
|
||||||
|
|
||||||
|
pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
|
||||||
|
if(!pkgpath || access(pkgpath, F_OK)) {
|
||||||
|
/* directory doesn't exist or can't be opened */
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
|
||||||
|
info->name, info->version, db->treename);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
free(pkgpath);
|
||||||
|
|
||||||
|
/* clear out 'line', to be certain - and to make valgrind happy */
|
||||||
|
memset(line, 0, sizeof(line));
|
||||||
|
|
||||||
|
/* DESC */
|
||||||
|
if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) {
|
||||||
|
char *path = _alpm_local_db_pkgpath(db, info, "desc");
|
||||||
|
if(!path || (fp = fopen(path, "r")) == NULL) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
||||||
|
free(path);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
while(!feof(fp)) {
|
||||||
|
if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if(_alpm_strip_newline(line) == 0) {
|
||||||
|
/* length of stripped line was zero */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(strcmp(line, "%NAME%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
if(strcmp(line, info->name) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: name "
|
||||||
|
"mismatch on package %s\n"), db->treename, info->name);
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%VERSION%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
if(strcmp(line, info->version) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: version "
|
||||||
|
"mismatch on package %s\n"), db->treename, info->name);
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%DESC%") == 0) {
|
||||||
|
READ_AND_STORE(info->desc);
|
||||||
|
} else if(strcmp(line, "%GROUPS%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(info->groups);
|
||||||
|
} else if(strcmp(line, "%URL%") == 0) {
|
||||||
|
READ_AND_STORE(info->url);
|
||||||
|
} else if(strcmp(line, "%LICENSE%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(info->licenses);
|
||||||
|
} else if(strcmp(line, "%ARCH%") == 0) {
|
||||||
|
READ_AND_STORE(info->arch);
|
||||||
|
} else if(strcmp(line, "%BUILDDATE%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
info->builddate = _alpm_parsedate(line);
|
||||||
|
} else if(strcmp(line, "%INSTALLDATE%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
info->installdate = _alpm_parsedate(line);
|
||||||
|
} else if(strcmp(line, "%PACKAGER%") == 0) {
|
||||||
|
READ_AND_STORE(info->packager);
|
||||||
|
} else if(strcmp(line, "%REASON%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
info->reason = (alpm_pkgreason_t)atoi(line);
|
||||||
|
} else if(strcmp(line, "%SIZE%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
info->isize = _alpm_strtoofft(line);
|
||||||
|
} else if(strcmp(line, "%REPLACES%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(info->replaces);
|
||||||
|
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(info->depends);
|
||||||
|
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(info->optdepends);
|
||||||
|
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(info->conflicts);
|
||||||
|
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(info->provides);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
fp = NULL;
|
||||||
|
info->infolevel |= INFRQ_DESC;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FILES */
|
||||||
|
if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) {
|
||||||
|
char *path = _alpm_local_db_pkgpath(db, info, "files");
|
||||||
|
if(!path || (fp = fopen(path, "r")) == NULL) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
||||||
|
free(path);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
while(fgets(line, sizeof(line), fp)) {
|
||||||
|
_alpm_strip_newline(line);
|
||||||
|
if(strcmp(line, "%FILES%") == 0) {
|
||||||
|
size_t files_count = 0, files_size = 0;
|
||||||
|
alpm_file_t *files = NULL;
|
||||||
|
|
||||||
|
while(fgets(line, sizeof(line), fp) && _alpm_strip_newline(line)) {
|
||||||
|
if(files_count >= files_size) {
|
||||||
|
size_t old_size = files_size;
|
||||||
|
if(files_size == 0) {
|
||||||
|
files_size = 8;
|
||||||
|
} else {
|
||||||
|
files_size *= 2;
|
||||||
|
}
|
||||||
|
files = realloc(files, sizeof(alpm_file_t) * files_size);
|
||||||
|
if(!files) {
|
||||||
|
ALLOC_FAIL(sizeof(alpm_file_t) * files_size);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
/* ensure all new memory is zeroed out, in both the initial
|
||||||
|
* allocation and later reallocs */
|
||||||
|
memset(files + old_size, 0,
|
||||||
|
sizeof(alpm_file_t) * (files_size - old_size));
|
||||||
|
}
|
||||||
|
STRDUP(files[files_count].name, line, goto error);
|
||||||
|
/* TODO: lstat file, get mode/size */
|
||||||
|
files_count++;
|
||||||
|
}
|
||||||
|
/* attempt to hand back any memory we don't need */
|
||||||
|
files = realloc(files, sizeof(alpm_file_t) * files_count);
|
||||||
|
info->files.count = files_count;
|
||||||
|
info->files.files = files;
|
||||||
|
} else if(strcmp(line, "%BACKUP%") == 0) {
|
||||||
|
while(fgets(line, sizeof(line), fp) && _alpm_strip_newline(line)) {
|
||||||
|
alpm_backup_t *backup;
|
||||||
|
CALLOC(backup, 1, sizeof(alpm_backup_t), goto error);
|
||||||
|
if(_alpm_split_backup(line, &backup)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
info->backup = alpm_list_add(info->backup, backup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
fp = NULL;
|
||||||
|
info->infolevel |= INFRQ_FILES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* INSTALL */
|
||||||
|
if(inforeq & INFRQ_SCRIPTLET && !(info->infolevel & INFRQ_SCRIPTLET)) {
|
||||||
|
char *path = _alpm_local_db_pkgpath(db, info, "install");
|
||||||
|
if(access(path, F_OK) == 0) {
|
||||||
|
info->scriptlet = 1;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
info->infolevel |= INFRQ_SCRIPTLET;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
info->infolevel |= INFRQ_ERROR;
|
||||||
|
if(fp) {
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info)
|
||||||
|
{
|
||||||
|
mode_t oldmask;
|
||||||
|
int retval = 0;
|
||||||
|
char *pkgpath;
|
||||||
|
|
||||||
|
if(checkdbdir(db) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
oldmask = umask(0000);
|
||||||
|
pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
|
||||||
|
|
||||||
|
if((retval = mkdir(pkgpath, 0755)) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"),
|
||||||
|
pkgpath, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pkgpath);
|
||||||
|
umask(oldmask);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
|
{
|
||||||
|
FILE *fp = NULL;
|
||||||
|
mode_t oldmask;
|
||||||
|
alpm_list_t *lp;
|
||||||
|
int retval = 0;
|
||||||
|
|
||||||
|
if(db == NULL || info == NULL || !(db->status & DB_STATUS_LOCAL)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make sure we have a sane umask */
|
||||||
|
oldmask = umask(0022);
|
||||||
|
|
||||||
|
/* DESC */
|
||||||
|
if(inforeq & INFRQ_DESC) {
|
||||||
|
char *path;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
|
||||||
|
info->name, info->version);
|
||||||
|
path = _alpm_local_db_pkgpath(db, info, "desc");
|
||||||
|
if(!path || (fp = fopen(path, "w")) == NULL) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
||||||
|
path, strerror(errno));
|
||||||
|
retval = -1;
|
||||||
|
free(path);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
fprintf(fp, "%%NAME%%\n%s\n\n"
|
||||||
|
"%%VERSION%%\n%s\n\n", info->name, info->version);
|
||||||
|
if(info->desc) {
|
||||||
|
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(info->replaces) {
|
||||||
|
fputs("%REPLACES%\n", fp);
|
||||||
|
for(lp = info->replaces; lp; lp = lp->next) {
|
||||||
|
char *depstring = alpm_dep_compute_string(lp->data);
|
||||||
|
fprintf(fp, "%s\n", depstring);
|
||||||
|
free(depstring);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
}
|
||||||
|
if(info->url) {
|
||||||
|
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) {
|
||||||
|
fprintf(fp, "%%ARCH%%\n"
|
||||||
|
"%s\n\n", info->arch);
|
||||||
|
}
|
||||||
|
if(info->builddate) {
|
||||||
|
fprintf(fp, "%%BUILDDATE%%\n"
|
||||||
|
"%ld\n\n", info->builddate);
|
||||||
|
}
|
||||||
|
if(info->installdate) {
|
||||||
|
fprintf(fp, "%%INSTALLDATE%%\n"
|
||||||
|
"%ld\n\n", info->installdate);
|
||||||
|
}
|
||||||
|
if(info->packager) {
|
||||||
|
fprintf(fp, "%%PACKAGER%%\n"
|
||||||
|
"%s\n\n", info->packager);
|
||||||
|
}
|
||||||
|
if(info->isize) {
|
||||||
|
/* only write installed size, csize is irrelevant once installed */
|
||||||
|
fprintf(fp, "%%SIZE%%\n"
|
||||||
|
"%jd\n\n", (intmax_t)info->isize);
|
||||||
|
}
|
||||||
|
if(info->reason) {
|
||||||
|
fprintf(fp, "%%REASON%%\n"
|
||||||
|
"%u\n\n", info->reason);
|
||||||
|
}
|
||||||
|
if(info->depends) {
|
||||||
|
fputs("%DEPENDS%\n", fp);
|
||||||
|
for(lp = info->depends; lp; lp = lp->next) {
|
||||||
|
char *depstring = alpm_dep_compute_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) {
|
||||||
|
char *depstring = alpm_dep_compute_string(lp->data);
|
||||||
|
fprintf(fp, "%s\n", depstring);
|
||||||
|
free(depstring);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
}
|
||||||
|
if(info->provides) {
|
||||||
|
fputs("%PROVIDES%\n", fp);
|
||||||
|
for(lp = info->provides; lp; lp = lp->next) {
|
||||||
|
char *depstring = alpm_dep_compute_string(lp->data);
|
||||||
|
fprintf(fp, "%s\n", depstring);
|
||||||
|
free(depstring);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
fp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FILES */
|
||||||
|
if(inforeq & INFRQ_FILES) {
|
||||||
|
char *path;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
|
||||||
|
info->name, info->version);
|
||||||
|
path = _alpm_local_db_pkgpath(db, info, "files");
|
||||||
|
if(!path || (fp = fopen(path, "w")) == NULL) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
||||||
|
path, strerror(errno));
|
||||||
|
retval = -1;
|
||||||
|
free(path);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
if(info->files.count) {
|
||||||
|
size_t i;
|
||||||
|
fprintf(fp, "%%FILES%%\n");
|
||||||
|
for(i = 0; i < info->files.count; i++) {
|
||||||
|
const alpm_file_t *file = info->files.files + i;
|
||||||
|
fprintf(fp, "%s\n", file->name);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
}
|
||||||
|
if(info->backup) {
|
||||||
|
fprintf(fp, "%%BACKUP%%\n");
|
||||||
|
for(lp = info->backup; lp; lp = lp->next) {
|
||||||
|
const alpm_backup_t *backup = lp->data;
|
||||||
|
fprintf(fp, "%s\t%s\n", backup->name, backup->hash);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
fp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* INSTALL */
|
||||||
|
/* nothing needed here (script is automatically extracted) */
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
umask(oldmask);
|
||||||
|
|
||||||
|
if(fp) {
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
char *pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
|
||||||
|
|
||||||
|
/* TODO explicit file removes and then an rmdir? */
|
||||||
|
ret = _alpm_rmrf(pkgpath);
|
||||||
|
free(pkgpath);
|
||||||
|
if(ret != 0) {
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct db_operations local_db_ops = {
|
||||||
|
.validate = local_db_validate,
|
||||||
|
.populate = local_db_populate,
|
||||||
|
.unregister = _alpm_db_unregister,
|
||||||
|
};
|
||||||
|
|
||||||
|
alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
alpm_db_t *db;
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "registering local database\n");
|
||||||
|
|
||||||
|
db = _alpm_db_new("local", 1);
|
||||||
|
if(db == NULL) {
|
||||||
|
handle->pm_errno = ALPM_ERR_DB_CREATE;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
db->ops = &local_db_ops;
|
||||||
|
db->handle = handle;
|
||||||
|
|
||||||
|
if(local_db_validate(db)) {
|
||||||
|
/* pm_errno set in local_db_validate() */
|
||||||
|
_alpm_db_free(db);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle->db_local = db;
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* be_package.c
|
* be_package.c : backend for packages
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -20,12 +20,9 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <locale.h> /* setlocale */
|
|
||||||
|
|
||||||
/* libarchive */
|
/* libarchive */
|
||||||
#include <archive.h>
|
#include <archive.h>
|
||||||
@@ -33,146 +30,372 @@
|
|||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
#include "alpm.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "handle.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "deps.h" /* _alpm_splitdep */
|
#include "deps.h" /* _alpm_splitdep */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the package description file for a package into a pmpkg_t struct.
|
* Open a package changelog for reading. Similar to fopen in functionality,
|
||||||
* @param archive the archive to read from, pointed at the .PKGINFO entry
|
* except that the returned 'file stream' is from an archive.
|
||||||
* @param newpkg an empty pmpkg_t struct to fill with package info
|
* @param pkg the package (file) to read the changelog
|
||||||
*
|
* @return a 'file stream' to the package changelog
|
||||||
* @return 0 on success, 1 on error
|
|
||||||
*/
|
*/
|
||||||
static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
|
static void *_package_changelog_open(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
char line[PATH_MAX];
|
ASSERT(pkg != NULL, return NULL);
|
||||||
char *ptr = NULL;
|
|
||||||
char *key = NULL;
|
|
||||||
int linenum = 0;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
struct archive *archive = NULL;
|
||||||
|
|
||||||
/* loop until we reach EOF (where archive_fgets will return NULL) */
|
|
||||||
while(_alpm_archive_fgets(line, PATH_MAX, a) != NULL) {
|
|
||||||
linenum++;
|
|
||||||
_alpm_strtrim(line);
|
|
||||||
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);
|
|
||||||
ptr = _alpm_strtrim(ptr);
|
|
||||||
if(!strcmp(key, "pkgname")) {
|
|
||||||
STRDUP(newpkg->name, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
} else if(!strcmp(key, "pkgver")) {
|
|
||||||
STRDUP(newpkg->version, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
} else if(!strcmp(key, "pkgdesc")) {
|
|
||||||
STRDUP(newpkg->desc, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
} else if(!strcmp(key, "force")) {
|
|
||||||
newpkg->force = 1;
|
|
||||||
} else if(!strcmp(key, "group")) {
|
|
||||||
newpkg->groups = alpm_list_add(newpkg->groups, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "url")) {
|
|
||||||
STRDUP(newpkg->url, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
} else if(!strcmp(key, "license")) {
|
|
||||||
newpkg->licenses = alpm_list_add(newpkg->licenses, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "builddate")) {
|
|
||||||
char first = tolower((unsigned char)ptr[0]);
|
|
||||||
if(first > 'a' && first < 'z') {
|
|
||||||
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
|
|
||||||
setlocale(LC_TIME, "C");
|
|
||||||
strptime(ptr, "%a %b %e %H:%M:%S %Y", &tmp_tm);
|
|
||||||
newpkg->builddate = mktime(&tmp_tm);
|
|
||||||
setlocale(LC_TIME, "");
|
|
||||||
} else {
|
|
||||||
newpkg->builddate = atol(ptr);
|
|
||||||
}
|
|
||||||
} else if(!strcmp(key, "packager")) {
|
|
||||||
STRDUP(newpkg->packager, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
} else if(!strcmp(key, "arch")) {
|
|
||||||
STRDUP(newpkg->arch, ptr, RET_ERR(PM_ERR_MEMORY, -1));
|
|
||||||
} else if(!strcmp(key, "size")) {
|
|
||||||
/* size in the raw package is uncompressed (installed) size */
|
|
||||||
newpkg->isize = atol(ptr);
|
|
||||||
} else if(!strcmp(key, "depend")) {
|
|
||||||
pmdepend_t *dep = _alpm_splitdep(ptr);
|
|
||||||
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
|
||||||
} else if(!strcmp(key, "optdepend")) {
|
|
||||||
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "conflict")) {
|
|
||||||
newpkg->conflicts = alpm_list_add(newpkg->conflicts, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "replaces")) {
|
|
||||||
newpkg->replaces = alpm_list_add(newpkg->replaces, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "provides")) {
|
|
||||||
newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "backup")) {
|
|
||||||
newpkg->backup = alpm_list_add(newpkg->backup, strdup(ptr));
|
|
||||||
} else if(!strcmp(key, "makepkgopt")) {
|
|
||||||
/* not used atm */
|
|
||||||
} else {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
|
|
||||||
newpkg->name ? newpkg->name : "error", 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;
|
struct archive_entry *entry;
|
||||||
pmpkg_t *newpkg = NULL;
|
const char *pkgfile = pkg->origin_data.file;
|
||||||
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) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
RET_ERR(PM_ERR_LIBARCHIVE, NULL);
|
RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_support_compression_all(archive);
|
archive_read_support_compression_all(archive);
|
||||||
archive_read_support_format_all(archive);
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
if (archive_read_open_filename(archive, pkgfile,
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ALPM_BUFFER_SIZE) != ARCHIVE_OK) {
|
||||||
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
RET_ERR(pkg->handle, ALPM_ERR_PKG_OPEN, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
newpkg = _alpm_pkg_new();
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
if(newpkg == NULL) {
|
const char *entry_name = archive_entry_pathname(entry);
|
||||||
archive_read_finish(archive);
|
|
||||||
RET_ERR(PM_ERR_MEMORY, NULL);
|
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 alpm_pkg_t UNUSED *pkg, void *fp)
|
||||||
|
{
|
||||||
|
ssize_t sret = archive_read_data((struct archive *)fp, ptr, size);
|
||||||
|
/* Report error (negative values) */
|
||||||
|
if(sret < 0) {
|
||||||
|
RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, 0);
|
||||||
|
} else {
|
||||||
|
return (size_t)sret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 alpm_pkg_t UNUSED *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 alpm_pkg_t struct.
|
||||||
|
* @param archive the archive to read from, pointed at the .PKGINFO entry
|
||||||
|
* @param newpkg an empty alpm_pkg_t struct to fill with package info
|
||||||
|
*
|
||||||
|
* @return 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *newpkg)
|
||||||
|
{
|
||||||
|
char *ptr = NULL;
|
||||||
|
char *key = NULL;
|
||||||
|
int ret, linenum = 0;
|
||||||
|
struct archive_read_buffer buf;
|
||||||
|
|
||||||
|
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((ret = _alpm_archive_fgets(a, &buf)) == ARCHIVE_OK) {
|
||||||
|
size_t len = _alpm_strip_newline(buf.line);
|
||||||
|
|
||||||
|
linenum++;
|
||||||
|
if(len == 0 || buf.line[0] == '#') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ptr = buf.line;
|
||||||
|
key = strsep(&ptr, "=");
|
||||||
|
if(key == NULL || ptr == NULL) {
|
||||||
|
_alpm_log(handle, ALPM_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, return -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, return -1);
|
||||||
|
} else if(strcmp(key, "pkgdesc") == 0) {
|
||||||
|
STRDUP(newpkg->desc, ptr, return -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, return -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, return -1);
|
||||||
|
} else if(strcmp(key, "arch") == 0) {
|
||||||
|
STRDUP(newpkg->arch, ptr, return -1);
|
||||||
|
} else if(strcmp(key, "size") == 0) {
|
||||||
|
/* size in the raw package is uncompressed (installed) size */
|
||||||
|
newpkg->isize = _alpm_strtoofft(ptr);
|
||||||
|
} else if(strcmp(key, "depend") == 0) {
|
||||||
|
alpm_depend_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) {
|
||||||
|
alpm_depend_t *conflict = _alpm_splitdep(ptr);
|
||||||
|
newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);
|
||||||
|
} else if(strcmp(key, "replaces") == 0) {
|
||||||
|
alpm_depend_t *replace = _alpm_splitdep(ptr);
|
||||||
|
newpkg->replaces = alpm_list_add(newpkg->replaces, replace);
|
||||||
|
} else if(strcmp(key, "provides") == 0) {
|
||||||
|
alpm_depend_t *provide = _alpm_splitdep(ptr);
|
||||||
|
newpkg->provides = alpm_list_add(newpkg->provides, provide);
|
||||||
|
} else if(strcmp(key, "backup") == 0) {
|
||||||
|
alpm_backup_t *backup;
|
||||||
|
CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
|
||||||
|
STRDUP(backup->name, ptr, return -1);
|
||||||
|
newpkg->backup = alpm_list_add(newpkg->backup, backup);
|
||||||
|
} else if(strcmp(key, "force") == 0) {
|
||||||
|
/* deprecated, skip it */
|
||||||
|
} else if(strcmp(key, "makepkgopt") == 0) {
|
||||||
|
/* not used atm */
|
||||||
|
} else {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
|
||||||
|
newpkg->name ? newpkg->name : "error", key, linenum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ret != ARCHIVE_EOF) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "error parsing package descfile\n");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
newpkg->filename = strdup(pkgfile);
|
return 0;
|
||||||
newpkg->size = st.st_size;
|
}
|
||||||
|
|
||||||
|
static void files_merge(alpm_file_t a[], alpm_file_t b[], alpm_file_t c[],
|
||||||
|
size_t m, size_t n)
|
||||||
|
{
|
||||||
|
size_t i = 0, j = 0, k = 0;
|
||||||
|
while(i < m && j < n) {
|
||||||
|
if(strcmp(a[i].name, b[j].name) < 0) {
|
||||||
|
c[k++] = a[i++];
|
||||||
|
} else {
|
||||||
|
c[k++] = b[j++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(i < m) {
|
||||||
|
c[k++] = a[i++];
|
||||||
|
}
|
||||||
|
while(j < n) {
|
||||||
|
c[k++] = b[j++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static alpm_file_t *files_msort(alpm_file_t *files, size_t n)
|
||||||
|
{
|
||||||
|
alpm_file_t *work;
|
||||||
|
size_t blocksize = 1;
|
||||||
|
|
||||||
|
CALLOC(work, n, sizeof(alpm_file_t), return NULL);
|
||||||
|
|
||||||
|
for(blocksize = 1; blocksize < n; blocksize *= 2) {
|
||||||
|
size_t i, max_extent = 0;
|
||||||
|
for(i = 0; i < n - blocksize; i += 2 * blocksize) {
|
||||||
|
/* this limits our actual merge to the length of the array, since we will
|
||||||
|
* not likely be a perfect power of two. */
|
||||||
|
size_t right_blocksize = blocksize;
|
||||||
|
if(i + blocksize * 2 > n) {
|
||||||
|
right_blocksize = n - i - blocksize;
|
||||||
|
}
|
||||||
|
files_merge(files + i, files + i + blocksize, work + i,
|
||||||
|
blocksize, right_blocksize);
|
||||||
|
max_extent = i + blocksize + right_blocksize;
|
||||||
|
}
|
||||||
|
/* ensure we only copy what we actually touched on this merge pass,
|
||||||
|
* no more, no less */
|
||||||
|
memcpy(files, work, max_extent * sizeof(alpm_file_t));
|
||||||
|
}
|
||||||
|
free(work);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate a package.
|
||||||
|
* @param handle the context handle
|
||||||
|
* @param pkgfile path to the package file
|
||||||
|
* @param syncpkg package object to load verification data from (md5sum,
|
||||||
|
* sha256sum, and/or base64 signature)
|
||||||
|
* @param level the required level of signature verification
|
||||||
|
* @param sigdata signature data from the package to pass back
|
||||||
|
* @return 0 if package is fully valid, -1 and pm_errno otherwise
|
||||||
|
*/
|
||||||
|
int _alpm_pkg_validate_internal(alpm_handle_t *handle,
|
||||||
|
const char *pkgfile, alpm_pkg_t *syncpkg, alpm_siglevel_t level,
|
||||||
|
alpm_siglist_t **sigdata)
|
||||||
|
{
|
||||||
|
int has_sig;
|
||||||
|
handle->pm_errno = 0;
|
||||||
|
|
||||||
|
if(pkgfile == NULL || strlen(pkgfile) == 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* attempt to access the package file, ensure it exists */
|
||||||
|
if(access(pkgfile, R_OK) != 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_NOT_FOUND, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* can we get away with skipping checksums? */
|
||||||
|
has_sig = 0;
|
||||||
|
if(level & ALPM_SIG_PACKAGE) {
|
||||||
|
if(syncpkg && syncpkg->base64_sig) {
|
||||||
|
has_sig = 1;
|
||||||
|
} else {
|
||||||
|
char *sigpath = _alpm_sigpath(handle, pkgfile);
|
||||||
|
if(sigpath && !_alpm_access(handle, NULL, sigpath, R_OK)) {
|
||||||
|
has_sig = 1;
|
||||||
|
}
|
||||||
|
free(sigpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(syncpkg && !has_sig) {
|
||||||
|
if(syncpkg->md5sum && !syncpkg->sha256sum) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "md5sum: %s\n", syncpkg->md5sum);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile);
|
||||||
|
if(_alpm_test_checksum(pkgfile, syncpkg->md5sum, ALPM_CSUM_MD5) != 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(syncpkg->sha256sum) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "sha256sum: %s\n", syncpkg->sha256sum);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking sha256sum for %s\n", pkgfile);
|
||||||
|
if(_alpm_test_checksum(pkgfile, syncpkg->sha256sum, ALPM_CSUM_SHA256) != 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* even if we don't have a sig, run the check code if level tells us to */
|
||||||
|
if(has_sig || level & ALPM_SIG_PACKAGE) {
|
||||||
|
const char *sig = syncpkg ? syncpkg->base64_sig : NULL;
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "sig data: %s\n", sig ? sig : "<from .sig>");
|
||||||
|
if(_alpm_check_pgp_helper(handle, pkgfile, sig,
|
||||||
|
level & ALPM_SIG_PACKAGE_OPTIONAL, level & ALPM_SIG_PACKAGE_MARGINAL_OK,
|
||||||
|
level & ALPM_SIG_PACKAGE_UNKNOWN_OK, sigdata)) {
|
||||||
|
handle->pm_errno = ALPM_ERR_PKG_INVALID_SIG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a package and create the corresponding alpm_pkg_t struct.
|
||||||
|
* @param handle the context handle
|
||||||
|
* @param pkgfile path to the package file
|
||||||
|
* @param full whether to stop the load after metadata is read or continue
|
||||||
|
* through the full archive
|
||||||
|
*/
|
||||||
|
alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
||||||
|
const char *pkgfile, int full)
|
||||||
|
{
|
||||||
|
int ret, config = 0;
|
||||||
|
struct archive *archive;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
alpm_pkg_t *newpkg = NULL;
|
||||||
|
struct stat st;
|
||||||
|
size_t files_count = 0, files_size = 0;
|
||||||
|
alpm_file_t *files = NULL;
|
||||||
|
|
||||||
|
if(pkgfile == NULL || strlen(pkgfile) == 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* attempt to stat the package file, ensure it exists */
|
||||||
|
if(stat(pkgfile, &st) == 0) {
|
||||||
|
newpkg = _alpm_pkg_new();
|
||||||
|
if(newpkg == NULL) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_MEMORY, NULL);
|
||||||
|
}
|
||||||
|
newpkg->filename = strdup(pkgfile);
|
||||||
|
newpkg->size = st.st_size;
|
||||||
|
} else {
|
||||||
|
/* couldn't stat the pkgfile, return an error */
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_NOT_FOUND, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* try to create an archive object to read in the package */
|
||||||
|
if((archive = archive_read_new()) == NULL) {
|
||||||
|
alpm_pkg_free(newpkg);
|
||||||
|
RET_ERR(handle, ALPM_ERR_LIBARCHIVE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
archive_read_support_compression_all(archive);
|
||||||
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
|
ALPM_BUFFER_SIZE) != ARCHIVE_OK) {
|
||||||
|
alpm_pkg_free(newpkg);
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
|
||||||
|
|
||||||
/* If full is false, only read through the archive until we find our needed
|
/* 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
|
* metadata. If it is true, read through the entire archive, which serves
|
||||||
@@ -182,17 +405,17 @@ static pmpkg_t *pkg_load(const char *pkgfile, int full)
|
|||||||
|
|
||||||
if(strcmp(entry_name, ".PKGINFO") == 0) {
|
if(strcmp(entry_name, ".PKGINFO") == 0) {
|
||||||
/* parse the info file */
|
/* parse the info file */
|
||||||
if(parse_descfile(archive, newpkg) != 0) {
|
if(parse_descfile(handle, archive, newpkg) != 0) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not parse package description file in %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not parse package description file in %s\n"),
|
||||||
pkgfile);
|
pkgfile);
|
||||||
goto pkg_invalid;
|
goto pkg_invalid;
|
||||||
}
|
}
|
||||||
if(newpkg->name == NULL || strlen(newpkg->name) == 0) {
|
if(newpkg->name == NULL || strlen(newpkg->name) == 0) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("missing package name in %s\n"), pkgfile);
|
_alpm_log(handle, ALPM_LOG_ERROR, _("missing package name in %s\n"), pkgfile);
|
||||||
goto pkg_invalid;
|
goto pkg_invalid;
|
||||||
}
|
}
|
||||||
if(newpkg->version == NULL || strlen(newpkg->version) == 0) {
|
if(newpkg->version == NULL || strlen(newpkg->version) == 0) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
|
_alpm_log(handle, ALPM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
|
||||||
goto pkg_invalid;
|
goto pkg_invalid;
|
||||||
}
|
}
|
||||||
config = 1;
|
config = 1;
|
||||||
@@ -202,15 +425,35 @@ static pmpkg_t *pkg_load(const char *pkgfile, int full)
|
|||||||
} else if(*entry_name == '.') {
|
} else if(*entry_name == '.') {
|
||||||
/* 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) */
|
||||||
} else {
|
} else if(full) {
|
||||||
/* Keep track of all files for filelist generation */
|
/* Keep track of all files for filelist generation */
|
||||||
newpkg->files = alpm_list_add(newpkg->files, strdup(entry_name));
|
if(files_count >= files_size) {
|
||||||
|
size_t old_size = files_size;
|
||||||
|
if(files_size == 0) {
|
||||||
|
files_size = 4;
|
||||||
|
} else {
|
||||||
|
files_size *= 2;
|
||||||
|
}
|
||||||
|
files = realloc(files, sizeof(alpm_file_t) * files_size);
|
||||||
|
if(!files) {
|
||||||
|
ALLOC_FAIL(sizeof(alpm_file_t) * files_size);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
/* ensure all new memory is zeroed out, in both the initial
|
||||||
|
* allocation and later reallocs */
|
||||||
|
memset(files + old_size, 0,
|
||||||
|
sizeof(alpm_file_t) * (files_size - old_size));
|
||||||
|
}
|
||||||
|
STRDUP(files[files_count].name, entry_name, goto error);
|
||||||
|
files[files_count].size = archive_entry_size(entry);
|
||||||
|
files[files_count].mode = archive_entry_mode(entry);
|
||||||
|
files_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(archive_read_data_skip(archive)) {
|
if(archive_read_data_skip(archive)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
pkgfile, archive_error_string(archive));
|
pkgfile, archive_error_string(archive));
|
||||||
pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,72 +464,67 @@ static pmpkg_t *pkg_load(const char *pkgfile, int full)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
|
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
|
||||||
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
pkgfile, archive_error_string(archive));
|
pkgfile, archive_error_string(archive));
|
||||||
pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!config) {
|
if(!config) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("missing package metadata in %s\n"), pkgfile);
|
_alpm_log(handle, ALPM_LOG_ERROR, _("missing package metadata in %s\n"), pkgfile);
|
||||||
goto pkg_invalid;
|
goto pkg_invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_finish(archive);
|
archive_read_finish(archive);
|
||||||
|
|
||||||
/* internal fields for package struct */
|
/* internal fields for package struct */
|
||||||
newpkg->origin = PKG_FROM_FILE;
|
newpkg->origin = PKG_FROM_FILE;
|
||||||
newpkg->origin_data.file = strdup(pkgfile);
|
newpkg->origin_data.file = strdup(pkgfile);
|
||||||
|
newpkg->ops = get_file_pkg_ops();
|
||||||
|
newpkg->handle = handle;
|
||||||
|
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_SCRIPTLET;
|
||||||
|
|
||||||
if(full) {
|
if(full) {
|
||||||
/* "checking for conflicts" requires a sorted list, ensure that here */
|
if(files) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
|
/* attempt to hand back any memory we don't need */
|
||||||
newpkg->files = alpm_list_msort(newpkg->files, alpm_list_count(newpkg->files),
|
files = realloc(files, sizeof(alpm_file_t) * files_count);
|
||||||
_alpm_str_cmp);
|
/* "checking for conflicts" requires a sorted list, ensure that here */
|
||||||
newpkg->infolevel = INFRQ_ALL;
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
} else {
|
"sorting package filelist for %s\n", pkgfile);
|
||||||
/* get rid of any partial filelist we may have collected, it is invalid */
|
newpkg->files.files = files_msort(files, files_count);
|
||||||
FREELIST(newpkg->files);
|
}
|
||||||
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_DEPENDS;
|
newpkg->files.count = files_count;
|
||||||
|
newpkg->infolevel |= INFRQ_FILES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(newpkg);
|
return newpkg;
|
||||||
|
|
||||||
pkg_invalid:
|
pkg_invalid:
|
||||||
pm_errno = PM_ERR_PKG_INVALID;
|
handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
||||||
error:
|
error:
|
||||||
_alpm_pkg_free(newpkg);
|
_alpm_pkg_free(newpkg);
|
||||||
archive_read_finish(archive);
|
archive_read_finish(archive);
|
||||||
|
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a package from a file.
|
int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
|
||||||
* If full is false, the archive is read only until all necessary
|
alpm_siglevel_t level, alpm_pkg_t **pkg)
|
||||||
* metadata is found. If it is true, the entire archive is read, which
|
|
||||||
* serves as a verfication of integrity and the filelist can be created.
|
|
||||||
* @param filename location of the package tarball
|
|
||||||
* @param full whether to stop the load after metadata is read or continue
|
|
||||||
* through the full archive
|
|
||||||
* @param pkg address of the package pointer
|
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_pkg_load(const char *filename, int full, pmpkg_t **pkg)
|
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
/* Sanity checks */
|
if(_alpm_pkg_validate_internal(handle, filename, NULL, level, NULL) == -1) {
|
||||||
ASSERT(filename != NULL && strlen(filename) != 0,
|
/* pm_errno is set by pkg_validate */
|
||||||
RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
return -1;
|
||||||
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
}
|
||||||
|
*pkg = _alpm_pkg_load_internal(handle, filename, full);
|
||||||
*pkg = pkg_load(filename, full);
|
|
||||||
if(*pkg == NULL) {
|
if(*pkg == NULL) {
|
||||||
/* pm_errno is set by pkg_load */
|
/* pm_errno is set by pkg_load */
|
||||||
return(-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
663
lib/libalpm/be_sync.c
Normal file
663
lib/libalpm/be_sync.c
Normal file
@@ -0,0 +1,663 @@
|
|||||||
|
/*
|
||||||
|
* be_sync.c : backend for sync databases
|
||||||
|
*
|
||||||
|
* 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 <sys/stat.h>
|
||||||
|
#include <unistd.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"
|
||||||
|
|
||||||
|
static char *get_sync_dir(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
size_t len = strlen(handle->dbpath) + 6;
|
||||||
|
char *syncpath;
|
||||||
|
struct stat buf;
|
||||||
|
|
||||||
|
MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
|
sprintf(syncpath, "%s%s", handle->dbpath, "sync/");
|
||||||
|
|
||||||
|
if(stat(syncpath, &buf) != 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
||||||
|
syncpath);
|
||||||
|
if(_alpm_makepath(syncpath) != 0) {
|
||||||
|
free(syncpath);
|
||||||
|
RET_ERR(handle, ALPM_ERR_SYSTEM, NULL);
|
||||||
|
}
|
||||||
|
} else if(!S_ISDIR(buf.st_mode)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath);
|
||||||
|
if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
|
||||||
|
free(syncpath);
|
||||||
|
RET_ERR(handle, ALPM_ERR_SYSTEM, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return syncpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sync_db_validate(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
alpm_siglevel_t level;
|
||||||
|
const char *dbpath;
|
||||||
|
|
||||||
|
if(db->status & DB_STATUS_VALID || db->status & DB_STATUS_MISSING) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(db->status & DB_STATUS_INVALID) {
|
||||||
|
db->handle->pm_errno = ALPM_ERR_DB_INVALID_SIG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbpath = _alpm_db_path(db);
|
||||||
|
if(!dbpath) {
|
||||||
|
/* pm_errno set in _alpm_db_path() */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we can skip any validation if the database doesn't exist */
|
||||||
|
if(access(dbpath, R_OK) != 0 && errno == ENOENT) {
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status |= DB_STATUS_MISSING;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_WARNING,
|
||||||
|
"database file for '%s' does not exist\n", db->treename);
|
||||||
|
goto valid;
|
||||||
|
}
|
||||||
|
db->status |= DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
|
|
||||||
|
/* this takes into account the default verification level if UNKNOWN
|
||||||
|
* was assigned to this db */
|
||||||
|
level = alpm_db_get_siglevel(db);
|
||||||
|
|
||||||
|
if(level & ALPM_SIG_DATABASE) {
|
||||||
|
int retry, ret;
|
||||||
|
do {
|
||||||
|
retry = 0;
|
||||||
|
alpm_siglist_t *siglist;
|
||||||
|
ret = _alpm_check_pgp_helper(db->handle, dbpath, NULL,
|
||||||
|
level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
|
||||||
|
level & ALPM_SIG_DATABASE_UNKNOWN_OK, &siglist);
|
||||||
|
if(ret) {
|
||||||
|
retry = _alpm_process_siglist(db->handle, db->treename, siglist,
|
||||||
|
level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
|
||||||
|
level & ALPM_SIG_DATABASE_UNKNOWN_OK);
|
||||||
|
}
|
||||||
|
alpm_siglist_cleanup(siglist);
|
||||||
|
free(siglist);
|
||||||
|
} while(retry);
|
||||||
|
|
||||||
|
if(ret) {
|
||||||
|
db->status &= ~DB_STATUS_VALID;
|
||||||
|
db->status |= DB_STATUS_INVALID;
|
||||||
|
db->handle->pm_errno = ALPM_ERR_DB_INVALID_SIG;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
valid:
|
||||||
|
db->status |= DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 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.
|
||||||
|
*
|
||||||
|
* This operation requires a database lock, and will return an applicable error
|
||||||
|
* if the lock could not be obtained.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* alpm_list_t *syncs = alpm_option_get_syncdbs();
|
||||||
|
* for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
|
* alpm_db_t *db = alpm_list_getdata(i);
|
||||||
|
* result = alpm_db_update(0, db);
|
||||||
|
*
|
||||||
|
* 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, alpm_db_t *db)
|
||||||
|
{
|
||||||
|
char *syncpath;
|
||||||
|
alpm_list_t *i;
|
||||||
|
int ret = -1;
|
||||||
|
mode_t oldmask;
|
||||||
|
alpm_handle_t *handle;
|
||||||
|
alpm_siglevel_t level;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(db != NULL, return -1);
|
||||||
|
handle = db->handle;
|
||||||
|
handle->pm_errno = 0;
|
||||||
|
ASSERT(db != handle->db_local, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(db->servers != NULL, RET_ERR(handle, ALPM_ERR_SERVER_NONE, -1));
|
||||||
|
|
||||||
|
syncpath = get_sync_dir(handle);
|
||||||
|
if(!syncpath) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make sure we have a sane umask */
|
||||||
|
oldmask = umask(0022);
|
||||||
|
|
||||||
|
level = alpm_db_get_siglevel(db);
|
||||||
|
|
||||||
|
/* attempt to grab a lock */
|
||||||
|
if(_alpm_handle_lock(handle)) {
|
||||||
|
free(syncpath);
|
||||||
|
umask(oldmask);
|
||||||
|
RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = db->servers; i; i = i->next) {
|
||||||
|
const char *server = i->data;
|
||||||
|
struct dload_payload payload;
|
||||||
|
size_t len;
|
||||||
|
int sig_ret = 0;
|
||||||
|
|
||||||
|
memset(&payload, 0, sizeof(struct dload_payload));
|
||||||
|
|
||||||
|
/* set hard upper limit of 25MiB */
|
||||||
|
payload.max_size = 25 * 1024 * 1024;
|
||||||
|
|
||||||
|
/* print server + filename into a buffer */
|
||||||
|
len = strlen(server) + strlen(db->treename) + 5;
|
||||||
|
MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
|
snprintf(payload.fileurl, len, "%s/%s.db", server, db->treename);
|
||||||
|
payload.handle = handle;
|
||||||
|
payload.force = force;
|
||||||
|
payload.unlink_on_fail = 1;
|
||||||
|
|
||||||
|
ret = _alpm_download(&payload, syncpath, NULL);
|
||||||
|
_alpm_dload_payload_reset(&payload);
|
||||||
|
|
||||||
|
if(ret == 0 && (level & ALPM_SIG_DATABASE)) {
|
||||||
|
/* an existing sig file is no good at this point */
|
||||||
|
char *sigpath = _alpm_sigpath(handle, _alpm_db_path(db));
|
||||||
|
if(!sigpath) {
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
unlink(sigpath);
|
||||||
|
free(sigpath);
|
||||||
|
|
||||||
|
/* if we downloaded a DB, we want the .sig from the same server */
|
||||||
|
/* print server + filename into a buffer (leave space for .sig) */
|
||||||
|
len = strlen(server) + strlen(db->treename) + 9;
|
||||||
|
MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
|
snprintf(payload.fileurl, len, "%s/%s.db.sig", server, db->treename);
|
||||||
|
payload.handle = handle;
|
||||||
|
payload.force = 1;
|
||||||
|
payload.errors_ok = (level & ALPM_SIG_DATABASE_OPTIONAL);
|
||||||
|
|
||||||
|
/* set hard upper limit of 16KiB */
|
||||||
|
payload.max_size = 16 * 1024;
|
||||||
|
|
||||||
|
sig_ret = _alpm_download(&payload, syncpath, NULL);
|
||||||
|
/* errors_ok suppresses error messages, but not the return code */
|
||||||
|
sig_ret = payload.errors_ok ? 0 : sig_ret;
|
||||||
|
_alpm_dload_payload_reset(&payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret != -1 && sig_ret != -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret == 1) {
|
||||||
|
/* files match, do nothing */
|
||||||
|
handle->pm_errno = 0;
|
||||||
|
goto cleanup;
|
||||||
|
} else if(ret == -1) {
|
||||||
|
/* pm_errno was set by the download code */
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "failed to sync db: %s\n",
|
||||||
|
alpm_strerror(handle->pm_errno));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cache needs to be rebuilt */
|
||||||
|
_alpm_db_free_pkgcache(db);
|
||||||
|
|
||||||
|
/* clear all status flags regarding validity/existence */
|
||||||
|
db->status &= ~DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
|
|
||||||
|
if(sync_db_validate(db)) {
|
||||||
|
/* pm_errno should be set */
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
|
||||||
|
if(_alpm_handle_unlock(handle)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
|
||||||
|
handle->lockfile);
|
||||||
|
}
|
||||||
|
free(syncpath);
|
||||||
|
umask(oldmask);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Forward decl so I don't reorganize the whole file right now */
|
||||||
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
|
struct archive_entry *entry, alpm_pkg_t **likely_pkg);
|
||||||
|
|
||||||
|
static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
||||||
|
const char **entry_filename, alpm_pkg_t *likely_pkg)
|
||||||
|
{
|
||||||
|
char *pkgname = NULL, *pkgver = NULL;
|
||||||
|
unsigned long pkgname_hash;
|
||||||
|
alpm_pkg_t *pkg;
|
||||||
|
|
||||||
|
/* get package and db file names */
|
||||||
|
if(entry_filename) {
|
||||||
|
char *fname = strrchr(entryname, '/');
|
||||||
|
if(fname) {
|
||||||
|
*entry_filename = fname + 1;
|
||||||
|
} else {
|
||||||
|
*entry_filename = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(_alpm_splitname(entryname, &pkgname, &pkgver, &pkgname_hash) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR,
|
||||||
|
_("invalid name for database entry '%s'\n"), entryname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(likely_pkg && strcmp(likely_pkg->name, pkgname) == 0) {
|
||||||
|
pkg = likely_pkg;
|
||||||
|
} else {
|
||||||
|
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);
|
||||||
|
}
|
||||||
|
if(pkg == NULL) {
|
||||||
|
pkg = _alpm_pkg_new();
|
||||||
|
if(pkg == NULL) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg->name = pkgname;
|
||||||
|
pkg->version = pkgver;
|
||||||
|
pkg->name_hash = pkgname_hash;
|
||||||
|
|
||||||
|
pkg->origin = PKG_FROM_SYNCDB;
|
||||||
|
pkg->origin_data.db = db;
|
||||||
|
pkg->ops = &default_pkg_ops;
|
||||||
|
pkg->handle = db->handle;
|
||||||
|
|
||||||
|
/* add to the collection */
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
|
||||||
|
pkg->name, db->treename);
|
||||||
|
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
|
||||||
|
} else {
|
||||||
|
free(pkgname);
|
||||||
|
free(pkgver);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 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(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
const char *dbpath;
|
||||||
|
size_t est_count;
|
||||||
|
int count = 0;
|
||||||
|
struct stat buf;
|
||||||
|
struct archive *archive;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
alpm_pkg_t *pkg = NULL;
|
||||||
|
|
||||||
|
if(db->status & DB_STATUS_INVALID) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_INVALID, -1);
|
||||||
|
}
|
||||||
|
if(db->status & DB_STATUS_MISSING) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_NOT_FOUND, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((archive = archive_read_new()) == NULL) {
|
||||||
|
RET_ERR(db->handle, ALPM_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(db->handle, ALPM_LOG_DEBUG, "opening database archive %s\n", dbpath);
|
||||||
|
|
||||||
|
if(archive_read_open_filename(archive, dbpath,
|
||||||
|
ALPM_BUFFER_SIZE) != ARCHIVE_OK) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), dbpath,
|
||||||
|
archive_error_string(archive));
|
||||||
|
archive_read_finish(archive);
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
|
}
|
||||||
|
if(stat(dbpath, &buf) != 0) {
|
||||||
|
RET_ERR(db->handle, ALPM_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(db->handle, ALPM_ERR_MEMORY, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
|
mode_t mode = archive_entry_mode(entry);
|
||||||
|
if(S_ISDIR(mode)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
/* we have desc, depends or deltas - parse it */
|
||||||
|
if(sync_db_read(db, archive, entry, &pkg) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR,
|
||||||
|
_("could not parse package description file '%s' from db '%s'\n"),
|
||||||
|
archive_entry_pathname(entry), db->treename);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
count = alpm_list_count(db->pkgcache->list);
|
||||||
|
|
||||||
|
if(count > 0) {
|
||||||
|
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
|
||||||
|
}
|
||||||
|
archive_read_finish(archive);
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
|
||||||
|
count, db->treename);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define READ_NEXT() do { \
|
||||||
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
|
line = buf.line; \
|
||||||
|
_alpm_strip_newline(line); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define READ_AND_STORE(f) do { \
|
||||||
|
READ_NEXT(); \
|
||||||
|
STRDUP(f, line, goto error); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define READ_AND_STORE_ALL(f) do { \
|
||||||
|
char *linedup; \
|
||||||
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
|
if(_alpm_strip_newline(buf.line) == 0) break; \
|
||||||
|
STRDUP(linedup, buf.line, goto error); \
|
||||||
|
f = alpm_list_add(f, linedup); \
|
||||||
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
|
#define READ_AND_SPLITDEP(f) do { \
|
||||||
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
|
if(_alpm_strip_newline(buf.line) == 0) break; \
|
||||||
|
f = alpm_list_add(f, _alpm_splitdep(line)); \
|
||||||
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
|
struct archive_entry *entry, alpm_pkg_t **likely_pkg)
|
||||||
|
{
|
||||||
|
const char *entryname, *filename;
|
||||||
|
alpm_pkg_t *pkg;
|
||||||
|
struct archive_read_buffer buf;
|
||||||
|
|
||||||
|
entryname = archive_entry_pathname(entry);
|
||||||
|
if(entryname == NULL) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
|
"invalid archive entry provided to _alpm_sync_db_read, skipping\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_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;
|
||||||
|
|
||||||
|
pkg = load_pkg_for_entry(db, entryname, &filename, *likely_pkg);
|
||||||
|
|
||||||
|
if(pkg == NULL) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
|
"entry %s could not be loaded into %s sync database",
|
||||||
|
entryname, db->treename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
|
||||||
|
|| strcmp(filename, "deltas") == 0) {
|
||||||
|
int ret;
|
||||||
|
while((ret = _alpm_archive_fgets(archive, &buf)) == ARCHIVE_OK) {
|
||||||
|
char *line = buf.line;
|
||||||
|
if(_alpm_strip_newline(line) == 0) {
|
||||||
|
/* length of stripped line was zero */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(line, "%NAME%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
if(strcmp(line, pkg->name) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: name "
|
||||||
|
"mismatch on package %s\n"), db->treename, pkg->name);
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%VERSION%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
if(strcmp(line, pkg->version) != 0) {
|
||||||
|
_alpm_log(db->handle, ALPM_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();
|
||||||
|
pkg->builddate = _alpm_parsedate(line);
|
||||||
|
} else if(strcmp(line, "%PACKAGER%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->packager);
|
||||||
|
} else if(strcmp(line, "%CSIZE%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
pkg->size = _alpm_strtoofft(line);
|
||||||
|
} else if(strcmp(line, "%ISIZE%") == 0) {
|
||||||
|
READ_NEXT();
|
||||||
|
pkg->isize = _alpm_strtoofft(line);
|
||||||
|
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->md5sum);
|
||||||
|
} else if(strcmp(line, "%SHA256SUM%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->sha256sum);
|
||||||
|
} else if(strcmp(line, "%PGPSIG%") == 0) {
|
||||||
|
READ_AND_STORE(pkg->base64_sig);
|
||||||
|
} else if(strcmp(line, "%REPLACES%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(pkg->replaces);
|
||||||
|
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(pkg->depends);
|
||||||
|
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||||
|
READ_AND_STORE_ALL(pkg->optdepends);
|
||||||
|
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(pkg->conflicts);
|
||||||
|
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(pkg->provides);
|
||||||
|
} else if(strcmp(line, "%DELTAS%") == 0) {
|
||||||
|
/* Different than the rest because of the _alpm_delta_parse call. */
|
||||||
|
while(1) {
|
||||||
|
READ_NEXT();
|
||||||
|
if(strlen(line) == 0) break;
|
||||||
|
pkg->deltas = alpm_list_add(pkg->deltas, _alpm_delta_parse(line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ret != ARCHIVE_EOF) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
*likely_pkg = pkg;
|
||||||
|
} else if(strcmp(filename, "files") == 0) {
|
||||||
|
/* currently do nothing with this file */
|
||||||
|
} else {
|
||||||
|
/* unknown database file */
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "unknown database file: %s\n", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "error parsing database file: %s\n", filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct db_operations sync_db_ops = {
|
||||||
|
.validate = sync_db_validate,
|
||||||
|
.populate = sync_db_populate,
|
||||||
|
.unregister = _alpm_db_unregister,
|
||||||
|
};
|
||||||
|
|
||||||
|
alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
||||||
|
alpm_siglevel_t level)
|
||||||
|
{
|
||||||
|
alpm_db_t *db;
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
||||||
|
|
||||||
|
#ifndef HAVE_LIBGPGME
|
||||||
|
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
db = _alpm_db_new(treename, 0);
|
||||||
|
if(db == NULL) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_DB_CREATE, NULL);
|
||||||
|
}
|
||||||
|
db->ops = &sync_db_ops;
|
||||||
|
db->handle = handle;
|
||||||
|
db->siglevel = level;
|
||||||
|
|
||||||
|
sync_db_validate(db);
|
||||||
|
|
||||||
|
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,291 +0,0 @@
|
|||||||
/*
|
|
||||||
* cache.c
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006-2010 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 <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* libalpm */
|
|
||||||
#include "cache.h"
|
|
||||||
#include "alpm_list.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "alpm.h"
|
|
||||||
#include "util.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)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
if(_alpm_db_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(db->pkgcache, (alpm_list_fn_free)_alpm_pkg_free);
|
|
||||||
alpm_list_free(db->pkgcache);
|
|
||||||
db->pkgcache = NULL;
|
|
||||||
db->pkgcache_loaded = 0;
|
|
||||||
|
|
||||||
_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_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* "duplicate" pkg with BASE info (to spare some memory) then add it to pkgcache */
|
|
||||||
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
|
|
||||||
{
|
|
||||||
pmpkg_t *newpkg;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
newpkg = _alpm_pkg_new();
|
|
||||||
if(newpkg == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
newpkg->name = strdup(pkg->name);
|
|
||||||
newpkg->version = strdup(pkg->version);
|
|
||||||
if(newpkg->name == NULL || newpkg->version == NULL) {
|
|
||||||
pm_errno = PM_ERR_MEMORY;
|
|
||||||
_alpm_pkg_free(newpkg);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
newpkg->origin = PKG_FROM_CACHE;
|
|
||||||
newpkg->origin_data.db = db;
|
|
||||||
newpkg->infolevel = INFRQ_BASE;
|
|
||||||
|
|
||||||
_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 || !db->pkgcache_loaded || 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, "warning: failed to get '%s' from NULL pkgcache\n",
|
|
||||||
target);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(_alpm_pkg_find(pkgcache, target));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!db->grpcache_loaded) {
|
|
||||||
_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,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* cache.h
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006-2010 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/>.
|
|
||||||
*/
|
|
||||||
#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,7 @@
|
|||||||
/*
|
/*
|
||||||
* conflict.c
|
* conflict.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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>
|
||||||
@@ -34,105 +34,90 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "conflict.h"
|
#include "conflict.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
#include "alpm.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.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, const char *reason)
|
static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
|
||||||
|
alpm_depend_t *reason)
|
||||||
{
|
{
|
||||||
pmconflict_t *conflict;
|
alpm_conflict_t *conflict;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
MALLOC(conflict, sizeof(alpm_conflict_t), return NULL);
|
||||||
|
|
||||||
MALLOC(conflict, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
conflict->package1_hash = pkg1->name_hash;
|
||||||
|
conflict->package2_hash = pkg2->name_hash;
|
||||||
|
STRDUP(conflict->package1, pkg1->name, return NULL);
|
||||||
|
STRDUP(conflict->package2, pkg2->name, return NULL);
|
||||||
|
conflict->reason = reason;
|
||||||
|
|
||||||
STRDUP(conflict->package1, package1, RET_ERR(PM_ERR_MEMORY, NULL));
|
return conflict;
|
||||||
STRDUP(conflict->package2, package2, RET_ERR(PM_ERR_MEMORY, NULL));
|
|
||||||
STRDUP(conflict->reason, reason, RET_ERR(PM_ERR_MEMORY, NULL));
|
|
||||||
|
|
||||||
return(conflict);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_conflict_free(pmconflict_t *conflict)
|
void _alpm_conflict_free(alpm_conflict_t *conflict)
|
||||||
{
|
{
|
||||||
FREE(conflict->package2);
|
FREE(conflict->package2);
|
||||||
FREE(conflict->package1);
|
FREE(conflict->package1);
|
||||||
FREE(conflict->reason);
|
|
||||||
FREE(conflict);
|
FREE(conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict)
|
alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
||||||
{
|
{
|
||||||
pmconflict_t *newconflict;
|
alpm_conflict_t *newconflict;
|
||||||
CALLOC(newconflict, 1, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(newconflict, 1, sizeof(alpm_conflict_t), return NULL);
|
||||||
|
|
||||||
STRDUP(newconflict->package1, conflict->package1, RET_ERR(PM_ERR_MEMORY, NULL));
|
newconflict->package1_hash = conflict->package1_hash;
|
||||||
STRDUP(newconflict->package2, conflict->package2, RET_ERR(PM_ERR_MEMORY, NULL));
|
newconflict->package2_hash = conflict->package2_hash;
|
||||||
STRDUP(newconflict->reason, conflict->reason, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(newconflict->package1, conflict->package1, return NULL);
|
||||||
|
STRDUP(newconflict->package2, conflict->package2, return NULL);
|
||||||
|
newconflict->reason = conflict->reason;
|
||||||
|
|
||||||
return(newconflict);
|
return newconflict;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
|
static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
for(i = haystack; i; i = i->next) {
|
for(i = haystack; i; i = i->next) {
|
||||||
pmconflict_t *conflict = i->data;
|
alpm_conflict_t *conflict = i->data;
|
||||||
char *cpkg1 = conflict->package1;
|
if(needle->package1_hash == conflict->package1_hash
|
||||||
char *cpkg2 = conflict->package2;
|
&& needle->package2_hash == conflict->package2_hash
|
||||||
char *npkg1 = needle->package1;
|
&& strcmp(needle->package1, conflict->package1) == 0
|
||||||
char *npkg2 = needle->package2;
|
&& strcmp(needle->package2, conflict->package2) == 0) {
|
||||||
if((!strcmp(cpkg1, npkg1) && !strcmp(cpkg2, npkg2))
|
return 1;
|
||||||
|| (!strcmp(cpkg1, npkg2) && !strcmp(cpkg2, npkg1))) {
|
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if pkg1 conflicts with pkg2
|
/** Adds the pkg1/pkg2 conflict to the baddeps list.
|
||||||
* @param pkg1 package we are looking at
|
* @param handle the context handle
|
||||||
* @param conflict name of the possible conflict
|
* @param baddeps list to add conflict to
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
_alpm_dep_free(conf);
|
|
||||||
return(match);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Adds the pkg1/pkg2 conflict to the baddeps list
|
|
||||||
* @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
|
||||||
|
* @param reason reason for this conflict
|
||||||
*/
|
*/
|
||||||
static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
|
static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps,
|
||||||
const char *pkg2, const char *reason)
|
alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, alpm_depend_t *reason)
|
||||||
{
|
{
|
||||||
pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2, reason);
|
alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason);
|
||||||
if(conflict && !_alpm_conflict_isin(conflict, *baddeps)) {
|
if(!conflict) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(!conflict_isin(conflict, *baddeps)) {
|
||||||
|
char *conflict_str = alpm_dep_compute_string(reason);
|
||||||
*baddeps = alpm_list_add(*baddeps, conflict);
|
*baddeps = alpm_list_add(*baddeps, conflict);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
|
||||||
|
pkg1->name, pkg2->name, conflict_str);
|
||||||
|
free(conflict_str);
|
||||||
} else {
|
} else {
|
||||||
_alpm_conflict_free(conflict);
|
_alpm_conflict_free(conflict);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if packages from list1 conflict with packages from list2.
|
/** Check if packages from list1 conflict with packages from list2.
|
||||||
@@ -141,39 +126,42 @@ static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
|
|||||||
* If a conflict (pkg1, pkg2) is found, it is added to the baddeps list
|
* If a conflict (pkg1, pkg2) is found, it is added to the baddeps list
|
||||||
* in this order if order >= 0, or reverse order (pkg2,pkg1) otherwise.
|
* in this order if order >= 0, or reverse order (pkg2,pkg1) otherwise.
|
||||||
*
|
*
|
||||||
|
* @param handle the context handle
|
||||||
* @param list1 first list of packages
|
* @param list1 first list of packages
|
||||||
* @param list2 second list of packages
|
* @param list2 second list of packages
|
||||||
* @param *baddeps list to store conflicts
|
* @param baddeps list to store conflicts
|
||||||
* @param order if >= 0 the conflict order is preserved, if < 0 it's reversed
|
* @param order if >= 0 the conflict order is preserved, if < 0 it's reversed
|
||||||
*/
|
*/
|
||||||
static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
|
static void check_conflict(alpm_handle_t *handle,
|
||||||
|
alpm_list_t *list1, alpm_list_t *list2,
|
||||||
alpm_list_t **baddeps, int order) {
|
alpm_list_t **baddeps, int order) {
|
||||||
alpm_list_t *i, *j, *k;
|
alpm_list_t *i;
|
||||||
|
|
||||||
if(!baddeps) {
|
if(!baddeps) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(i = list1; i; i = i->next) {
|
for(i = list1; i; i = i->next) {
|
||||||
pmpkg_t *pkg1 = i->data;
|
alpm_pkg_t *pkg1 = i->data;
|
||||||
const char *pkg1name = alpm_pkg_get_name(pkg1);
|
alpm_list_t *j;
|
||||||
|
|
||||||
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;
|
alpm_depend_t *conflict = j->data;
|
||||||
|
alpm_list_t *k;
|
||||||
|
|
||||||
for(k = list2; k; k = k->next) {
|
for(k = list2; k; k = k->next) {
|
||||||
pmpkg_t *pkg2 = k->data;
|
alpm_pkg_t *pkg2 = k->data;
|
||||||
const char *pkg2name = alpm_pkg_get_name(pkg2);
|
|
||||||
|
|
||||||
if(strcmp(pkg1name, pkg2name) == 0) {
|
if(pkg1->name_hash == pkg2->name_hash
|
||||||
|
&& strcmp(pkg1->name, pkg2->name) == 0) {
|
||||||
/* skip the package we're currently processing */
|
/* skip the package we're currently processing */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(does_conflict(pkg1, conflict, pkg2)) {
|
if(_alpm_depcmp(pkg2, conflict)) {
|
||||||
if(order >= 0) {
|
if(order >= 0) {
|
||||||
add_conflict(baddeps, pkg1name, pkg2name, conflict);
|
add_conflict(handle, baddeps, pkg1, pkg2, conflict);
|
||||||
} else {
|
} else {
|
||||||
add_conflict(baddeps, pkg2name, pkg1name, conflict);
|
add_conflict(handle, baddeps, pkg2, pkg1, conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,189 +170,179 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for inter-conflicts */
|
/* Check for inter-conflicts */
|
||||||
alpm_list_t *_alpm_innerconflicts(alpm_list_t *packages)
|
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages)
|
||||||
{
|
{
|
||||||
alpm_list_t *baddeps = NULL;
|
alpm_list_t *baddeps = NULL;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
_alpm_log(handle, ALPM_LOG_DEBUG, "check targets vs targets\n");
|
||||||
|
check_conflict(handle, packages, packages, &baddeps, 0);
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "check targets vs targets\n");
|
return baddeps;
|
||||||
check_conflict(packages, packages, &baddeps, 0);
|
|
||||||
|
|
||||||
return(baddeps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for target vs (db - target) conflicts
|
/* Check for target vs (db - target) conflicts */
|
||||||
* In case of conflict the package1 field of pmdepconflict_t contains
|
alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages)
|
||||||
* the target package, package2 field contains the local package
|
|
||||||
*/
|
|
||||||
alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
|
|
||||||
{
|
{
|
||||||
alpm_list_t *baddeps = NULL;
|
alpm_list_t *baddeps = NULL;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
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(db->handle, ALPM_LOG_DEBUG, "check targets vs db\n");
|
||||||
check_conflict(packages, dblist, &baddeps, 1);
|
check_conflict(db->handle, packages, dblist, &baddeps, 1);
|
||||||
_alpm_log(PM_LOG_DEBUG, "check db vs targets\n");
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "check db vs targets\n");
|
||||||
check_conflict(dblist, packages, &baddeps, -1);
|
check_conflict(db->handle, dblist, packages, &baddeps, -1);
|
||||||
|
|
||||||
alpm_list_free(dblist);
|
alpm_list_free(dblist);
|
||||||
return(baddeps);
|
return baddeps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check the package conflicts in a database
|
/** Check the package conflicts in a database
|
||||||
*
|
*
|
||||||
|
* @param handle the context handle
|
||||||
* @param pkglist the list of packages to check
|
* @param pkglist the list of packages to check
|
||||||
* @return an alpm_list_t of pmconflict_t
|
* @return an alpm_list_t of alpm_conflict_t
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_list_t *pkglist) {
|
alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle,
|
||||||
return(_alpm_innerconflicts(pkglist));
|
alpm_list_t *pkglist)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
return _alpm_innerconflicts(handle, pkglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a alpm_list_t* of file conflicts.
|
static const int DIFFERENCE = 0;
|
||||||
* Hooray for set-intersects!
|
static const int INTERSECT = 1;
|
||||||
* Pre-condition: both lists are sorted!
|
/* Returns a set operation on the provided two lists of files.
|
||||||
|
* Pre-condition: both lists are sorted!
|
||||||
|
* When done, free the list but NOT the contained data.
|
||||||
|
*
|
||||||
|
* Operations:
|
||||||
|
* DIFFERENCE - a difference operation is performed. filesA - filesB.
|
||||||
|
* INTERSECT - an intersection operation is performed. filesA & filesB.
|
||||||
*/
|
*/
|
||||||
static alpm_list_t *chk_fileconflicts(alpm_list_t *filesA, alpm_list_t *filesB)
|
static alpm_list_t *filelist_operation(alpm_filelist_t *filesA,
|
||||||
|
alpm_filelist_t *filesB, int operation)
|
||||||
{
|
{
|
||||||
alpm_list_t *ret = NULL;
|
alpm_list_t *ret = NULL;
|
||||||
alpm_list_t *pA = filesA, *pB = filesB;
|
size_t ctrA = 0, ctrB = 0;
|
||||||
|
|
||||||
while(pA && pB) {
|
while(ctrA < filesA->count && ctrB < filesB->count) {
|
||||||
const char *strA = pA->data;
|
alpm_file_t *fileA = filesA->files + ctrA;
|
||||||
const char *strB = pB->data;
|
alpm_file_t *fileB = filesB->files + ctrB;
|
||||||
/* skip directories, we don't care about dir conflicts */
|
const char *strA = fileA->name;
|
||||||
|
const char *strB = fileB->name;
|
||||||
|
/* skip directories, we don't care about them */
|
||||||
if(strA[strlen(strA)-1] == '/') {
|
if(strA[strlen(strA)-1] == '/') {
|
||||||
pA = pA->next;
|
ctrA++;
|
||||||
} else if(strB[strlen(strB)-1] == '/') {
|
} else if(strB[strlen(strB)-1] == '/') {
|
||||||
pB = pB->next;
|
ctrB++;
|
||||||
} else {
|
} else {
|
||||||
int cmp = strcmp(strA, strB);
|
int cmp = strcmp(strA, strB);
|
||||||
if(cmp < 0) {
|
if(cmp < 0) {
|
||||||
/* item only in filesA, ignore it */
|
if(operation == DIFFERENCE) {
|
||||||
pA = pA->next;
|
/* item only in filesA, qualifies as a difference */
|
||||||
|
ret = alpm_list_add(ret, fileA);
|
||||||
|
}
|
||||||
|
ctrA++;
|
||||||
} else if(cmp > 0) {
|
} else if(cmp > 0) {
|
||||||
/* item only in filesB, ignore it */
|
ctrB++;
|
||||||
pB = pB->next;
|
|
||||||
} else {
|
} else {
|
||||||
/* item in both, record it */
|
if(operation == INTERSECT) {
|
||||||
ret = alpm_list_add(ret, strdup(strA));
|
/* item in both, qualifies as an intersect */
|
||||||
pA = pA->next;
|
ret = alpm_list_add(ret, fileA);
|
||||||
pB = pB->next;
|
}
|
||||||
|
ctrA++;
|
||||||
|
ctrB++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(ret);
|
/* if doing a difference, ensure we have completely emptied pA */
|
||||||
}
|
while(operation == DIFFERENCE && ctrA < filesA->count) {
|
||||||
|
alpm_file_t *fileA = filesA->files + ctrA;
|
||||||
/* Returns a alpm_list_t* of files that are in filesA but *NOT* in filesB
|
const char *strA = fileA->name;
|
||||||
* This is an 'A minus B' set operation
|
|
||||||
* Pre-condition: both lists are sorted!
|
|
||||||
*/
|
|
||||||
static alpm_list_t *chk_filedifference(alpm_list_t *filesA, alpm_list_t *filesB)
|
|
||||||
{
|
|
||||||
alpm_list_t *ret = NULL;
|
|
||||||
alpm_list_t *pA = filesA, *pB = filesB;
|
|
||||||
|
|
||||||
/* if both filesA and filesB have entries, do this loop */
|
|
||||||
while(pA && pB) {
|
|
||||||
const char *strA = pA->data;
|
|
||||||
const char *strB = pB->data;
|
|
||||||
/* skip directories, we don't care about dir conflicts */
|
|
||||||
if(strA[strlen(strA)-1] == '/') {
|
|
||||||
pA = pA->next;
|
|
||||||
} else if(strB[strlen(strB)-1] == '/') {
|
|
||||||
pB = pB->next;
|
|
||||||
} else {
|
|
||||||
int cmp = strcmp(strA, strB);
|
|
||||||
if(cmp < 0) {
|
|
||||||
/* item only in filesA, record it */
|
|
||||||
ret = alpm_list_add(ret, strdup(strA));
|
|
||||||
pA = pA->next;
|
|
||||||
} else if(cmp > 0) {
|
|
||||||
/* item only in fileB, but this means nothing */
|
|
||||||
pB = pB->next;
|
|
||||||
} else {
|
|
||||||
/* item in both, ignore it */
|
|
||||||
pA = pA->next;
|
|
||||||
pB = pB->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* ensure we have completely emptied pA */
|
|
||||||
while(pA) {
|
|
||||||
const char *strA = pA->data;
|
|
||||||
/* skip directories */
|
/* skip directories */
|
||||||
if(strA[strlen(strA)-1] != '/') {
|
if(strA[strlen(strA)-1] != '/') {
|
||||||
ret = alpm_list_add(ret, strdup(strA));
|
ret = alpm_list_add(ret, fileA);
|
||||||
}
|
}
|
||||||
pA = pA->next;
|
ctrA++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adds pmfileconflict_t to a conflicts list. Pass the conflicts list, type (either
|
/* Adds alpm_fileconflict_t to a conflicts list. Pass the conflicts list, the
|
||||||
* PM_FILECONFLICT_TARGET or PM_FILECONFLICT_FILESYSTEM), a file string, and either
|
* conflicting file path, and either two packages or one package and NULL.
|
||||||
* two package names or one package name and NULL. This is a wrapper for former
|
|
||||||
* functionality that was done inline.
|
|
||||||
*/
|
*/
|
||||||
static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
|
static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
|
||||||
pmfileconflicttype_t type, const char *filestr,
|
alpm_list_t *conflicts, const char *filestr,
|
||||||
const char* name1, const char* name2)
|
alpm_pkg_t *pkg1, alpm_pkg_t *pkg2)
|
||||||
{
|
{
|
||||||
pmfileconflict_t *conflict;
|
alpm_fileconflict_t *conflict;
|
||||||
MALLOC(conflict, sizeof(pmfileconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error);
|
||||||
|
|
||||||
conflict->type = type;
|
STRDUP(conflict->target, pkg1->name, goto error);
|
||||||
STRDUP(conflict->target, name1, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(conflict->file, filestr, goto error);
|
||||||
STRDUP(conflict->file, filestr, RET_ERR(PM_ERR_MEMORY, NULL));
|
if(pkg2) {
|
||||||
if(name2) {
|
conflict->type = ALPM_FILECONFLICT_TARGET;
|
||||||
STRDUP(conflict->ctarget, name2, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(conflict->ctarget, pkg2->name, goto error);
|
||||||
} else {
|
} else {
|
||||||
conflict->ctarget = "";
|
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
|
||||||
|
STRDUP(conflict->ctarget, "", goto error);
|
||||||
}
|
}
|
||||||
|
|
||||||
conflicts = alpm_list_add(conflicts, conflict);
|
conflicts = alpm_list_add(conflicts, conflict);
|
||||||
_alpm_log(PM_LOG_DEBUG, "found file conflict %s, packages %s and %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "found file conflict %s, packages %s and %s\n",
|
||||||
filestr, name1, name2 ? name2 : "(filesystem)");
|
filestr, pkg1->name, pkg2 ? pkg2->name : "(filesystem)");
|
||||||
|
|
||||||
return(conflicts);
|
return conflicts;
|
||||||
|
|
||||||
|
error:
|
||||||
|
RET_ERR(handle, ALPM_ERR_MEMORY, conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_fileconflict_free(pmfileconflict_t *conflict)
|
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
||||||
{
|
{
|
||||||
if(strlen(conflict->ctarget) > 0) {
|
FREE(conflict->ctarget);
|
||||||
FREE(conflict->ctarget);
|
FREE(conflict->file);
|
||||||
}
|
|
||||||
FREE(conflict->file);;
|
|
||||||
FREE(conflict->target);
|
FREE(conflict->target);
|
||||||
FREE(conflict);
|
FREE(conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dir_belongsto_pkg(char *dirpath, pmpkg_t *pkg)
|
const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
const alpm_file_t *file = filelist->files;
|
||||||
|
for(i = 0; i < filelist->count; i++) {
|
||||||
|
if(strcmp(file->name, name) == 0) {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
file++;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dir_belongsto_pkg(const char *root, const char *dirpath,
|
||||||
|
alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
struct dirent *ent = NULL;
|
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char abspath[PATH_MAX];
|
char abspath[PATH_MAX];
|
||||||
|
struct dirent *ent = NULL;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
|
||||||
snprintf(abspath, PATH_MAX, "%s%s", handle->root, dirpath);
|
snprintf(abspath, PATH_MAX, "%s%s", root, dirpath);
|
||||||
dir = opendir(abspath);
|
dir = opendir(abspath);
|
||||||
if(dir == NULL) {
|
if(dir == NULL) {
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while((ent = readdir(dir)) != NULL) {
|
while((ent = readdir(dir)) != NULL) {
|
||||||
const char *name = ent->d_name;
|
const char *name = ent->d_name;
|
||||||
|
|
||||||
@@ -372,105 +350,117 @@ static int dir_belongsto_pkg(char *dirpath, pmpkg_t *pkg)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
snprintf(path, PATH_MAX, "%s/%s", dirpath, name);
|
snprintf(path, PATH_MAX, "%s/%s", dirpath, name);
|
||||||
snprintf(abspath, PATH_MAX, "%s%s", handle->root, path);
|
snprintf(abspath, PATH_MAX, "%s%s", root, path);
|
||||||
if(stat(abspath, &sbuf) != 0) {
|
if(stat(abspath, &sbuf) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(S_ISDIR(sbuf.st_mode)) {
|
if(S_ISDIR(sbuf.st_mode)) {
|
||||||
if(dir_belongsto_pkg(path, pkg)) {
|
if(dir_belongsto_pkg(root, path, pkg)) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(alpm_list_find_str(alpm_pkg_get_files(pkg),path)) {
|
if(_alpm_filelist_contains(alpm_pkg_get_files(pkg), path)) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return(1);
|
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,
|
alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
||||||
alpm_list_t *upgrade, alpm_list_t *remove)
|
alpm_list_t *upgrade, alpm_list_t *remove)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *conflicts = NULL;
|
alpm_list_t *i, *conflicts = NULL;
|
||||||
int numtargs = alpm_list_count(upgrade);
|
size_t numtargs = alpm_list_count(upgrade);
|
||||||
int current;
|
size_t current;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
if(!upgrade) {
|
||||||
|
return NULL;
|
||||||
if(db == NULL || upgrade == NULL || trans == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO this whole function needs a huge change, which hopefully will
|
/* TODO this whole function needs a huge change, which hopefully will
|
||||||
* 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 = upgrade; i; i = i->next, current++) {
|
for(current = 0, i = upgrade; i; i = i->next, current++) {
|
||||||
alpm_list_t *k, *tmpfiles = NULL;
|
alpm_pkg_t *p1 = i->data;
|
||||||
pmpkg_t *p1, *p2, *dbpkg;
|
alpm_list_t *j;
|
||||||
char path[PATH_MAX+1];
|
alpm_filelist_t tmpfiles;
|
||||||
|
alpm_pkg_t *dbpkg;
|
||||||
|
size_t filenum;
|
||||||
|
|
||||||
p1 = i->data;
|
int percent = (current * 100) / numtargs;
|
||||||
if(!p1) {
|
PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", percent,
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
double percent = (double)current / numtargs;
|
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100),
|
|
||||||
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_log(handle, ALPM_LOG_DEBUG, "searching for file conflicts: %s\n",
|
||||||
alpm_pkg_get_name(p1));
|
p1->name);
|
||||||
for(j = i->next; j; j = j->next) {
|
for(j = i->next; j; j = j->next) {
|
||||||
p2 = j->data;
|
alpm_list_t *common_files;
|
||||||
if(!p2) {
|
alpm_pkg_t *p2 = j->data;
|
||||||
continue;
|
common_files = filelist_operation(alpm_pkg_get_files(p1),
|
||||||
}
|
alpm_pkg_get_files(p2), INTERSECT);
|
||||||
tmpfiles = chk_fileconflicts(alpm_pkg_get_files(p1), alpm_pkg_get_files(p2));
|
|
||||||
|
|
||||||
if(tmpfiles) {
|
if(common_files) {
|
||||||
for(k = tmpfiles; k; k = k->next) {
|
alpm_list_t *k;
|
||||||
snprintf(path, PATH_MAX, "%s%s", handle->root, (char *)k->data);
|
char path[PATH_MAX];
|
||||||
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_TARGET, path,
|
for(k = common_files; k; k = k->next) {
|
||||||
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
alpm_file_t *file = k->data;
|
||||||
|
snprintf(path, PATH_MAX, "%s%s", handle->root, file->name);
|
||||||
|
conflicts = add_fileconflict(handle, conflicts, path, p1, p2);
|
||||||
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
||||||
|
FREELIST(conflicts);
|
||||||
|
FREELIST(common_files);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FREELIST(tmpfiles);
|
alpm_list_free(common_files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* declarations for second check */
|
|
||||||
struct stat lsbuf, sbuf;
|
|
||||||
char *filestr = NULL;
|
|
||||||
|
|
||||||
/* CHECK 2: check every target against the filesystem */
|
/* CHECK 2: check every target against the filesystem */
|
||||||
_alpm_log(PM_LOG_DEBUG, "searching for filesystem conflicts: %s\n", p1->name);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "searching for filesystem conflicts: %s\n",
|
||||||
dbpkg = _alpm_db_get_pkgfromcache(db, p1->name);
|
p1->name);
|
||||||
|
dbpkg = _alpm_db_get_pkgfromcache(handle->db_local, p1->name);
|
||||||
|
|
||||||
/* Do two different checks here. If 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. Note
|
||||||
|
* that the former list needs to be freed while the latter list should NOT
|
||||||
|
* be freed. */
|
||||||
if(dbpkg) {
|
if(dbpkg) {
|
||||||
|
alpm_list_t *difference;
|
||||||
/* older ver of package currently installed */
|
/* older ver of package currently installed */
|
||||||
tmpfiles = chk_filedifference(alpm_pkg_get_files(p1),
|
difference = filelist_operation(alpm_pkg_get_files(p1),
|
||||||
alpm_pkg_get_files(dbpkg));
|
alpm_pkg_get_files(dbpkg), DIFFERENCE);
|
||||||
|
tmpfiles.count = alpm_list_count(difference);
|
||||||
|
tmpfiles.files = alpm_list_to_array(difference, tmpfiles.count,
|
||||||
|
sizeof(alpm_file_t));
|
||||||
|
alpm_list_free(difference);
|
||||||
} else {
|
} else {
|
||||||
/* no version of package currently installed */
|
/* no version of package currently installed */
|
||||||
tmpfiles = alpm_list_strdup(alpm_pkg_get_files(p1));
|
tmpfiles = *alpm_pkg_get_files(p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j = tmpfiles; j; j = j->next) {
|
for(filenum = 0; filenum < tmpfiles.count; filenum++) {
|
||||||
filestr = j->data;
|
alpm_file_t *file = tmpfiles.files + filenum;
|
||||||
|
const char *filestr = file->name;
|
||||||
|
const char *relative_path;
|
||||||
|
alpm_list_t *k;
|
||||||
|
/* have we acted on this conflict? */
|
||||||
|
int resolved_conflict = 0;
|
||||||
|
struct stat lsbuf;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
|
||||||
|
|
||||||
@@ -478,46 +468,57 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
|
|||||||
if(_alpm_lstat(path, &lsbuf) != 0) {
|
if(_alpm_lstat(path, &lsbuf) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
stat(path, &sbuf);
|
|
||||||
|
|
||||||
if(path[strlen(path)-1] == '/') {
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
||||||
|
|
||||||
|
if(S_ISDIR(file->mode)) {
|
||||||
|
struct stat sbuf;
|
||||||
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(handle, ALPM_LOG_DEBUG, "file is a directory, not a conflict\n");
|
||||||
continue;
|
|
||||||
} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG,
|
|
||||||
"%s is a symlink to a dir, hopefully not a conflict\n", path);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
stat(path, &sbuf);
|
||||||
|
if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"file is a symlink to a dir, hopefully not a conflict\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* if we made it to here, we want all subsequent path comparisons to
|
||||||
|
* not include the trailing slash. This allows things like file ->
|
||||||
|
* directory replacements. */
|
||||||
|
path[strlen(path) - 1] = '\0';
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
|
||||||
|
|
||||||
int resolved_conflict = 0; /* have we acted on this conflict? */
|
relative_path = path + strlen(handle->root);
|
||||||
|
|
||||||
/* Check remove list (will we remove the conflicting local file?) */
|
/* Check remove list (will we remove the conflicting local file?) */
|
||||||
for(k = remove; k && !resolved_conflict; k = k->next) {
|
for(k = remove; k && !resolved_conflict; k = k->next) {
|
||||||
pmpkg_t *rempkg = k->data;
|
alpm_pkg_t *rempkg = k->data;
|
||||||
if(rempkg && alpm_list_find_str(alpm_pkg_get_files(rempkg), filestr)) {
|
if(rempkg && _alpm_filelist_contains(alpm_pkg_get_files(rempkg),
|
||||||
_alpm_log(PM_LOG_DEBUG, "local file will be removed, not a conflict: %s\n", filestr);
|
relative_path)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"local file will be removed, not a conflict\n");
|
||||||
resolved_conflict = 1;
|
resolved_conflict = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look at all the targets to see if file has changed hands */
|
/* Look at all the targets to see if file has changed hands */
|
||||||
for(k = upgrade; k && !resolved_conflict; k = k->next) {
|
for(k = upgrade; k && !resolved_conflict; k = k->next) {
|
||||||
p2 = k->data;
|
alpm_pkg_t *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);
|
alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name);
|
||||||
|
|
||||||
/* localp2->files will be removed (target conflicts are handled by CHECK 1) */
|
/* localp2->files will be removed (target conflicts are handled by CHECK 1) */
|
||||||
if(localp2 && alpm_list_find_str(alpm_pkg_get_files(localp2), filestr)) {
|
if(localp2 && _alpm_filelist_contains(alpm_pkg_get_files(localp2), 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(filestr));
|
handle->trans->skip_remove =
|
||||||
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s\n", filestr);
|
alpm_list_add(handle->trans->skip_remove, strdup(filestr));
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"file changed packages, adding to remove skiplist\n");
|
||||||
resolved_conflict = 1;
|
resolved_conflict = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,113 +527,70 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
|
|||||||
if(!resolved_conflict && S_ISDIR(lsbuf.st_mode) && dbpkg) {
|
if(!resolved_conflict && S_ISDIR(lsbuf.st_mode) && dbpkg) {
|
||||||
char *dir = malloc(strlen(filestr) + 2);
|
char *dir = malloc(strlen(filestr) + 2);
|
||||||
sprintf(dir, "%s/", filestr);
|
sprintf(dir, "%s/", filestr);
|
||||||
if(alpm_list_find_str(alpm_pkg_get_files(dbpkg),dir)) {
|
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "check if all files in %s belongs to %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"check if all files in %s belongs to %s\n",
|
||||||
dir, dbpkg->name);
|
dir, dbpkg->name);
|
||||||
resolved_conflict = dir_belongsto_pkg(filestr, dbpkg);
|
resolved_conflict = dir_belongsto_pkg(handle->root, filestr, dbpkg);
|
||||||
}
|
}
|
||||||
free(dir);
|
free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!resolved_conflict && dbpkg) {
|
/* check if a component of the filepath was a link. canonicalize the path
|
||||||
char *rpath = calloc(PATH_MAX+1, sizeof(char));
|
* and look for it in the old package. note that the actual file under
|
||||||
if(!realpath(path, rpath)) {
|
* consideration cannot itself be a link, as it might be unowned- path
|
||||||
FREE(rpath);
|
* components can be safely checked as all directories are "unowned". */
|
||||||
continue;
|
if(!resolved_conflict && dbpkg && !S_ISLNK(lsbuf.st_mode)) {
|
||||||
}
|
char *rpath = calloc(PATH_MAX, sizeof(char));
|
||||||
char *filestr = rpath + strlen(handle->root);
|
const char *relative_rpath;
|
||||||
if(alpm_list_find_str(alpm_pkg_get_files(dbpkg),filestr)) {
|
if(realpath(path, rpath)) {
|
||||||
resolved_conflict = 1;
|
relative_rpath = rpath + strlen(handle->root);
|
||||||
|
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"package contained the resolved realpath\n");
|
||||||
|
resolved_conflict = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free(rpath);
|
free(rpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* is the file unowned and in the backup list of the new package? */
|
||||||
|
if(!resolved_conflict && _alpm_needbackup(filestr, p1)) {
|
||||||
|
alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local);
|
||||||
|
int found = 0;
|
||||||
|
for(k = local_pkgs; k && !found; k = k->next) {
|
||||||
|
if(_alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) {
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"file was unowned but in new backup list\n");
|
||||||
|
resolved_conflict = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!resolved_conflict) {
|
if(!resolved_conflict) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s\n", path);
|
conflicts = add_fileconflict(handle, conflicts, path, p1, NULL);
|
||||||
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_FILESYSTEM,
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
||||||
path, p1->name, NULL);
|
FREELIST(conflicts);
|
||||||
|
if(dbpkg) {
|
||||||
|
/* only freed if it was generated from filelist_operation() */
|
||||||
|
free(tmpfiles.files);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREELIST(tmpfiles);
|
if(dbpkg) {
|
||||||
|
/* only freed if it was generated from filelist_operation() */
|
||||||
|
free(tmpfiles.files);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", 100,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
return(conflicts);
|
return conflicts;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_conflict_get_package1(pmconflict_t *conflict)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(conflict != NULL, return(NULL));
|
|
||||||
|
|
||||||
return conflict->package1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(conflict != NULL, return(NULL));
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(conflict != NULL, return(NULL));
|
|
||||||
|
|
||||||
return conflict->target;
|
|
||||||
}
|
|
||||||
|
|
||||||
pmfileconflicttype_t SYMEXPORT alpm_fileconflict_get_type(pmfileconflict_t *conflict)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(-1));
|
|
||||||
ASSERT(conflict != NULL, return(-1));
|
|
||||||
|
|
||||||
return conflict->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_fileconflict_get_file(pmfileconflict_t *conflict)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(conflict != NULL, return(NULL));
|
|
||||||
|
|
||||||
return conflict->file;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(conflict != NULL, return(NULL));
|
|
||||||
|
|
||||||
return conflict->ctarget;
|
|
||||||
}
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* conflict.h
|
* conflict.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -24,29 +24,17 @@
|
|||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
|
|
||||||
struct __pmconflict_t {
|
alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict);
|
||||||
char *package1;
|
void _alpm_conflict_free(alpm_conflict_t *conflict);
|
||||||
char *package2;
|
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages);
|
||||||
char *reason;
|
alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages);
|
||||||
};
|
alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
||||||
|
alpm_list_t *upgrade, alpm_list_t *remove);
|
||||||
|
|
||||||
struct __pmfileconflict_t {
|
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict);
|
||||||
char *target;
|
|
||||||
pmfileconflicttype_t type;
|
|
||||||
char *file;
|
|
||||||
char *ctarget;
|
|
||||||
};
|
|
||||||
|
|
||||||
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2, const char *reason);
|
const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
|
||||||
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict);
|
const char *name);
|
||||||
void _alpm_conflict_free(pmconflict_t *conflict);
|
|
||||||
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack);
|
|
||||||
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_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
|
|
||||||
alpm_list_t *upgrade, alpm_list_t *remove);
|
|
||||||
|
|
||||||
void _alpm_fileconflict_free(pmfileconflict_t *conflict);
|
|
||||||
|
|
||||||
#endif /* _ALPM_CONFLICT_H */
|
#endif /* _ALPM_CONFLICT_H */
|
||||||
|
|
||||||
|
|||||||
737
lib/libalpm/db.c
737
lib/libalpm/db.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* db.c
|
* db.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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>
|
||||||
@@ -26,12 +26,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
@@ -39,100 +35,73 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.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
|
alpm_db_t SYMEXPORT *alpm_db_register_sync(alpm_handle_t *handle,
|
||||||
* @return a pmdb_t* on success (the value), NULL on error
|
const char *treename, alpm_siglevel_t level)
|
||||||
*/
|
|
||||||
pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename)
|
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL));
|
CHECK_HANDLE(handle, return NULL);
|
||||||
ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
|
ASSERT(treename != NULL && strlen(treename) != 0,
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
|
||||||
/* Do not register a database if a transaction is on-going */
|
/* Do not register a database if a transaction is on-going */
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, NULL));
|
ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, NULL));
|
||||||
|
|
||||||
return(_alpm_db_register_sync(treename));
|
return _alpm_db_register_sync(handle, treename, level);
|
||||||
}
|
|
||||||
|
|
||||||
/** 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(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "unregistering database '%s'\n", db->treename);
|
_alpm_log(db->handle, ALPM_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(alpm_handle_t *handle)
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_unregister_all(void)
|
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
alpm_db_t *db;
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
CHECK_HANDLE(handle, return -1);
|
||||||
/* 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(handle, ALPM_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
|
int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
alpm_handle_t *handle;
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
ASSERT(db != NULL, return -1);
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
|
||||||
/* 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));
|
handle = db->handle;
|
||||||
|
handle->pm_errno = 0;
|
||||||
|
ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
if(db == handle->db_local) {
|
if(db == handle->db_local) {
|
||||||
handle->db_local = NULL;
|
handle->db_local = NULL;
|
||||||
@@ -151,233 +120,223 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!found) {
|
if(!found) {
|
||||||
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
RET_ERR(handle, ALPM_ERR_DB_NOT_FOUND, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_db_unregister(db);
|
db->ops->unregister(db);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the serverlist of a database.
|
/** Get the serverlist of a database. */
|
||||||
|
alpm_list_t SYMEXPORT *alpm_db_get_servers(const alpm_db_t *db)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
|
return db->servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set the serverlist of a database. */
|
||||||
|
int SYMEXPORT alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return -1);
|
||||||
|
if(db->servers) FREELIST(db->servers);
|
||||||
|
db->servers = servers;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *sanitize_url(const char *url)
|
||||||
|
{
|
||||||
|
char *newurl;
|
||||||
|
size_t len = strlen(url);
|
||||||
|
|
||||||
|
STRDUP(newurl, url, return NULL);
|
||||||
|
/* strip the trailing slash if one exists */
|
||||||
|
if(newurl[len - 1] == '/') {
|
||||||
|
newurl[len - 1] = '\0';
|
||||||
|
}
|
||||||
|
return newurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Add a download server to a database.
|
||||||
* @param db database pointer
|
* @param db database pointer
|
||||||
* @param url url of the server
|
* @param url url of the server
|
||||||
* @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_db_setserver(pmdb_t *db, const char *url)
|
int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
|
||||||
int found = 0;
|
|
||||||
char *newurl;
|
char *newurl;
|
||||||
int len = 0;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
ASSERT(db != NULL, return -1);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
for(i = handle->dbs_sync; i && !found; i = i->next) {
|
newurl = sanitize_url(url);
|
||||||
pmdb_t *sdb = i->data;
|
if(!newurl) {
|
||||||
if(strcmp(db->treename, sdb->treename) == 0) {
|
return -1;
|
||||||
found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!found) {
|
|
||||||
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
|
|
||||||
}
|
}
|
||||||
|
db->servers = alpm_list_add(db->servers, newurl);
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
||||||
|
db->treename, newurl);
|
||||||
|
|
||||||
if(url) {
|
return 0;
|
||||||
len = strlen(url);
|
|
||||||
}
|
|
||||||
if(len) {
|
|
||||||
newurl = strdup(url);
|
|
||||||
/* 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 {
|
|
||||||
FREELIST(db->servers);
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "serverlist flushed for '%s'\n", db->treename);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the name of a package database
|
/** Remove a download server from a database.
|
||||||
* @param db pointer to the package database
|
* @param db database pointer
|
||||||
* @return the name of the package database, NULL on error
|
* @param url url of the server
|
||||||
|
* @return 0 on success, 1 on server not present,
|
||||||
|
* -1 on error (pm_errno is set accordingly)
|
||||||
*/
|
*/
|
||||||
const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
|
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
char *newurl, *vdata = NULL;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return(NULL));
|
ASSERT(db != NULL, return -1);
|
||||||
ASSERT(db != NULL, return(NULL));
|
db->handle->pm_errno = 0;
|
||||||
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
newurl = sanitize_url(url);
|
||||||
|
if(!newurl) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
||||||
|
free(newurl);
|
||||||
|
if(vdata) {
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n",
|
||||||
|
db->treename, newurl);
|
||||||
|
free(vdata);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the name of a package database. */
|
||||||
|
const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
return db->treename;
|
return db->treename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a download URL for the package database
|
/** Get the signature verification level for a database. */
|
||||||
* @param db pointer to the package database
|
alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
|
||||||
* @return a fully-specified download URL, NULL on error
|
|
||||||
*/
|
|
||||||
const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
|
|
||||||
{
|
{
|
||||||
char *url;
|
ASSERT(db != NULL, return -1);
|
||||||
|
if(db->siglevel & ALPM_SIG_USE_DEFAULT) {
|
||||||
ALPM_LOG_FUNC;
|
return db->handle->siglevel;
|
||||||
|
} else {
|
||||||
/* Sanity checks */
|
return db->siglevel;
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(db != NULL, return(NULL));
|
|
||||||
ASSERT(db->servers != NULL, return(NULL));
|
|
||||||
|
|
||||||
url = (char*)db->servers->data;
|
|
||||||
|
|
||||||
return(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** 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)
|
|
||||||
{
|
|
||||||
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_get_pkgfromcache(db, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the package cache of a package database
|
|
||||||
* @param db pointer to the package database to get the package from
|
|
||||||
* @return the list of packages on success, NULL on error
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(db != NULL, return(NULL));
|
|
||||||
|
|
||||||
return(_alpm_db_get_pkgcache(db));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 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)
|
|
||||||
{
|
|
||||||
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_get_grpfromcache(db, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the group cache of a package database
|
|
||||||
* @param db pointer to the package database to get the group from
|
|
||||||
* @return the list of groups on success, NULL on error
|
|
||||||
*/
|
|
||||||
alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(db != NULL, return(NULL));
|
|
||||||
|
|
||||||
return(_alpm_db_get_grpcache(db));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 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_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(db != NULL, return(NULL));
|
|
||||||
|
|
||||||
return(_alpm_db_search(db, needles));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set install reason for a package in db
|
|
||||||
* @param db pointer to the package database
|
|
||||||
* @param name the name of the package
|
|
||||||
* @param reason the new install reason
|
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
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);
|
/** Check the validity of a database. */
|
||||||
/* read DESC */
|
int SYMEXPORT alpm_db_get_valid(alpm_db_t *db)
|
||||||
if(_alpm_db_read(db, pkg, INFRQ_DESC)) {
|
{
|
||||||
return(-1);
|
ASSERT(db != NULL, return -1);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
return db->ops->validate(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get a package entry from a package database. */
|
||||||
|
alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
|
||||||
|
{
|
||||||
|
alpm_pkg_t *pkg;
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
ASSERT(name != NULL && strlen(name) != 0,
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL));
|
||||||
|
|
||||||
|
pkg = _alpm_db_get_pkgfromcache(db, name);
|
||||||
|
if(!pkg) {
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_PKG_NOT_FOUND, NULL);
|
||||||
}
|
}
|
||||||
if(pkg->reason == reason) {
|
return pkg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the package cache of a package database. */
|
||||||
|
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
return _alpm_db_get_pkgcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get a group entry from a package database. */
|
||||||
|
alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
ASSERT(name != NULL && strlen(name) != 0,
|
||||||
|
RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL));
|
||||||
|
|
||||||
|
return _alpm_db_get_groupfromcache(db, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the group cache of a package database. */
|
||||||
|
alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
|
||||||
|
return _alpm_db_get_groupcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Searches a database. */
|
||||||
|
alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles)
|
||||||
|
{
|
||||||
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
|
||||||
|
return _alpm_db_search(db, needles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set install reason for a package in db. */
|
||||||
|
int SYMEXPORT alpm_db_set_pkgreason(alpm_handle_t *handle, alpm_pkg_t *pkg,
|
||||||
|
alpm_pkgreason_t reason)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(pkg->origin == PKG_FROM_LOCALDB,
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(pkg->origin_data.db == handle->db_local,
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"setting install reason %u for %s\n", reason, pkg->name);
|
||||||
|
if(alpm_pkg_get_reason(pkg) == reason) {
|
||||||
/* we are done */
|
/* we are done */
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
/* set reason (in pkgcache) */
|
/* set reason (in pkgcache) */
|
||||||
pkg->reason = reason;
|
pkg->reason = reason;
|
||||||
/* write DESC */
|
/* write DESC */
|
||||||
if(_alpm_db_write(db, pkg, INFRQ_DESC)) {
|
if(_alpm_local_db_write(handle->db_local, pkg, INFRQ_DESC)) {
|
||||||
return(-1);
|
RET_ERR(handle, ALPM_ERR_DB_WRITE, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
static pmdb_t *_alpm_db_new(const char *treename, int is_local)
|
alpm_db_t *_alpm_db_new(const char *treename, int is_local)
|
||||||
{
|
{
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
CALLOC(db, 1, sizeof(alpm_db_t), return NULL);
|
||||||
|
STRDUP(db->treename, treename, return NULL);
|
||||||
|
if(is_local) {
|
||||||
|
db->status |= DB_STATUS_LOCAL;
|
||||||
|
} else {
|
||||||
|
db->status &= ~DB_STATUS_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
CALLOC(db, 1, sizeof(pmdb_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
return db;
|
||||||
STRDUP(db->treename, treename, RET_ERR(PM_ERR_MEMORY, NULL));
|
|
||||||
db->is_local = is_local;
|
|
||||||
|
|
||||||
return(db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_db_free(pmdb_t *db)
|
void _alpm_db_free(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* cleanup pkgcache */
|
/* cleanup pkgcache */
|
||||||
_alpm_db_free_pkgcache(db);
|
_alpm_db_free_pkgcache(db);
|
||||||
/* cleanup server list */
|
/* cleanup server list */
|
||||||
@@ -389,53 +348,51 @@ void _alpm_db_free(pmdb_t *db)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *_alpm_db_path(pmdb_t *db)
|
const char *_alpm_db_path(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
if(!db) {
|
if(!db) {
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
if(!db->_path) {
|
if(!db->_path) {
|
||||||
const char *dbpath;
|
const char *dbpath;
|
||||||
size_t pathsize;
|
size_t pathsize;
|
||||||
|
|
||||||
dbpath = alpm_option_get_dbpath();
|
dbpath = db->handle->dbpath;
|
||||||
if(!dbpath) {
|
if(!dbpath) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n"));
|
||||||
RET_ERR(PM_ERR_DB_OPEN, NULL);
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(db->is_local) {
|
if(db->status & DB_STATUS_LOCAL) {
|
||||||
pathsize = strlen(dbpath) + strlen(db->treename) + 2;
|
pathsize = strlen(dbpath) + strlen(db->treename) + 2;
|
||||||
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
|
||||||
sprintf(db->_path, "%s%s/", dbpath, db->treename);
|
sprintf(db->_path, "%s%s/", dbpath, db->treename);
|
||||||
} else {
|
} else {
|
||||||
pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 2;
|
pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
|
||||||
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
|
||||||
/* all sync DBs now reside in the sync/ subdir of the dbpath */
|
/* all sync DBs now reside in the sync/ subdir of the dbpath */
|
||||||
sprintf(db->_path, "%ssync/%s/", dbpath, db->treename);
|
sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "database path for tree %s set to %s\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "database path for tree %s set to %s\n",
|
||||||
db->treename, db->_path);
|
db->treename, db->_path);
|
||||||
}
|
}
|
||||||
return(db->_path);
|
return db->_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_db_cmp(const void *d1, const void *d2)
|
int _alpm_db_cmp(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
pmdb_t *db1 = (pmdb_t *)d1;
|
const alpm_db_t *db1 = d1;
|
||||||
pmdb_t *db2 = (pmdb_t *)d2;
|
const alpm_db_t *db2 = d2;
|
||||||
return(strcmp(db1->treename, db2->treename));
|
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(alpm_db_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 */
|
/* 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_list_t *list = alpm_list_copy(_alpm_db_get_pkgcache(db));
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
for(i = needles; i; i = i->next) {
|
for(i = needles; i; i = i->next) {
|
||||||
char *targ;
|
char *targ;
|
||||||
regex_t reg;
|
regex_t reg;
|
||||||
@@ -445,16 +402,16 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
}
|
}
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
targ = i->data;
|
targ = i->data;
|
||||||
_alpm_log(PM_LOG_DEBUG, "searching for target '%s'\n", targ);
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "searching for target '%s'\n", targ);
|
||||||
|
|
||||||
if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
|
if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
|
||||||
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
|
RET_ERR(db->handle, ALPM_ERR_INVALID_REGEX, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j = list; j; j = j->next) {
|
for(j = list; j; j = j->next) {
|
||||||
pmpkg_t *pkg = j->data;
|
alpm_pkg_t *pkg = j->data;
|
||||||
const char *matched = NULL;
|
const char *matched = NULL;
|
||||||
const char *name = alpm_pkg_get_name(pkg);
|
const char *name = pkg->name;
|
||||||
const char *desc = alpm_pkg_get_desc(pkg);
|
const char *desc = alpm_pkg_get_desc(pkg);
|
||||||
|
|
||||||
/* check name as regex AND as plain text */
|
/* check name as regex AND as plain text */
|
||||||
@@ -462,7 +419,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
matched = name;
|
matched = name;
|
||||||
}
|
}
|
||||||
/* check desc */
|
/* check desc */
|
||||||
else if (desc && regexec(®, desc, 0, 0, 0) == 0) {
|
else if(desc && regexec(®, desc, 0, 0, 0) == 0) {
|
||||||
matched = desc;
|
matched = desc;
|
||||||
}
|
}
|
||||||
/* TODO: should we be doing this, and should we print something
|
/* TODO: should we be doing this, and should we print something
|
||||||
@@ -470,8 +427,9 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
if(!matched) {
|
if(!matched) {
|
||||||
/* check provides */
|
/* 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) {
|
alpm_depend_t *provide = k->data;
|
||||||
matched = k->data;
|
if(regexec(®, provide->name, 0, 0, 0) == 0) {
|
||||||
|
matched = provide->name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,7 +437,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
if(!matched) {
|
if(!matched) {
|
||||||
/* check groups */
|
/* check groups */
|
||||||
for(k = alpm_pkg_get_groups(pkg); k; k = k->next) {
|
for(k = alpm_pkg_get_groups(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;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -487,8 +445,8 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(matched != NULL) {
|
if(matched != NULL) {
|
||||||
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
targ, matched);
|
"search target '%s' matched '%s'\n", targ, matched);
|
||||||
ret = alpm_list_add(ret, pkg);
|
ret = alpm_list_add(ret, pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,55 +458,242 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
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.
|
||||||
|
*/
|
||||||
|
static int load_pkgcache(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
pmdb_t *db;
|
_alpm_db_free_pkgcache(db);
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "loading package cache for repository '%s'\n",
|
||||||
|
db->treename);
|
||||||
if(handle->db_local != NULL) {
|
if(db->ops->populate(db) == -1) {
|
||||||
_alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB\n"));
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
|
"failed to load package cache for repository '%s'\n", db->treename);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "registering local database\n");
|
db->status |= DB_STATUS_PKGCACHE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
db = _alpm_db_new("local", 1);
|
static void free_groupcache(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
alpm_list_t *lg;
|
||||||
|
|
||||||
|
if(db == NULL || !(db->status & DB_STATUS_GRPCACHE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
|
"freeing group cache for repository '%s'\n", db->treename);
|
||||||
|
|
||||||
|
for(lg = db->grpcache; lg; lg = lg->next) {
|
||||||
|
_alpm_group_free(lg->data);
|
||||||
|
lg->data = NULL;
|
||||||
|
}
|
||||||
|
FREELIST(db->grpcache);
|
||||||
|
db->status &= ~DB_STATUS_GRPCACHE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _alpm_db_free_pkgcache(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
if(db == NULL || !(db->status & DB_STATUS_PKGCACHE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
|
"freeing package cache for repository '%s'\n", db->treename);
|
||||||
|
|
||||||
|
if(db->pkgcache) {
|
||||||
|
alpm_list_free_inner(db->pkgcache->list,
|
||||||
|
(alpm_list_fn_free)_alpm_pkg_free);
|
||||||
|
_alpm_pkghash_free(db->pkgcache);
|
||||||
|
}
|
||||||
|
db->status &= ~DB_STATUS_PKGCACHE;
|
||||||
|
|
||||||
|
free_groupcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db)
|
||||||
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
RET_ERR(PM_ERR_DB_CREATE, NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->db_local = db;
|
if(!(db->status & DB_STATUS_VALID)) {
|
||||||
return(db);
|
RET_ERR(db->handle, ALPM_ERR_DB_INVALID, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(db->status & DB_STATUS_PKGCACHE)) {
|
||||||
|
load_pkgcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return db->pkgcache;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t *_alpm_db_register_sync(const char *treename)
|
alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
pmdb_t *db;
|
alpm_pkghash_t *hash = _alpm_db_get_pkgcache_hash(db);
|
||||||
alpm_list_t *i;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
if(hash == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
return hash->list;
|
||||||
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);
|
/* "duplicate" pkg then add it to pkgcache */
|
||||||
return sdb;
|
int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
alpm_pkg_t *newpkg;
|
||||||
|
|
||||||
|
if(db == NULL || pkg == NULL || !(db->status & DB_STATUS_PKGCACHE)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_alpm_pkg_dup(pkg, &newpkg)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
|
||||||
|
newpkg->name, db->treename);
|
||||||
|
db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
|
||||||
|
|
||||||
|
free_groupcache(db);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
alpm_pkg_t *data = NULL;
|
||||||
|
|
||||||
|
if(db == NULL || pkg == NULL || !(db->status & DB_STATUS_PKGCACHE)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
|
||||||
|
pkg->name, db->treename);
|
||||||
|
|
||||||
|
db->pkgcache = _alpm_pkghash_remove(db->pkgcache, pkg, &data);
|
||||||
|
if(data == NULL) {
|
||||||
|
/* package not found */
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
|
||||||
|
pkg->name, db->treename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_pkg_free(data);
|
||||||
|
|
||||||
|
free_groupcache(db);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target)
|
||||||
|
{
|
||||||
|
if(db == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_pkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db);
|
||||||
|
if(!pkgcache) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _alpm_pkghash_find(pkgcache, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns a new group cache from db.
|
||||||
|
*/
|
||||||
|
static int load_grpcache(alpm_db_t *db)
|
||||||
|
{
|
||||||
|
alpm_list_t *lp;
|
||||||
|
|
||||||
|
if(db == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(db->handle, ALPM_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;
|
||||||
|
alpm_pkg_t *pkg = lp->data;
|
||||||
|
|
||||||
|
for(i = alpm_pkg_get_groups(pkg); i; i = i->next) {
|
||||||
|
const char *grpname = i->data;
|
||||||
|
alpm_list_t *j;
|
||||||
|
alpm_group_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_group_new(grpname);
|
||||||
|
if(!grp) {
|
||||||
|
free_groupcache(db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
grp->packages = alpm_list_add(grp->packages, pkg);
|
||||||
|
db->grpcache = alpm_list_add(db->grpcache, grp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
db->status |= DB_STATUS_GRPCACHE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
db = _alpm_db_new(treename, 0);
|
alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db)
|
||||||
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
RET_ERR(PM_ERR_DB_CREATE, NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
|
if(!(db->status & DB_STATUS_VALID)) {
|
||||||
return(db);
|
RET_ERR(db->handle, ALPM_ERR_DB_INVALID, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(db->status & DB_STATUS_GRPCACHE)) {
|
||||||
|
load_grpcache(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return db->grpcache;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
if(db == NULL || target == NULL || strlen(target) == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = _alpm_db_get_groupcache(db); i; i = i->next) {
|
||||||
|
alpm_group_t *info = i->data;
|
||||||
|
|
||||||
|
if(strcmp(info->name, target) == 0) {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* db.h
|
* db.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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,50 +22,90 @@
|
|||||||
#ifndef _ALPM_DB_H
|
#ifndef _ALPM_DB_H
|
||||||
#define _ALPM_DB_H
|
#define _ALPM_DB_H
|
||||||
|
|
||||||
#include "alpm.h"
|
|
||||||
#include <limits.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "pkghash.h"
|
||||||
|
#include "signing.h"
|
||||||
|
|
||||||
/* Database entries */
|
/* Database entries */
|
||||||
typedef enum _pmdbinfrq_t {
|
typedef enum _alpm_dbinfrq_t {
|
||||||
INFRQ_BASE = 1,
|
INFRQ_BASE = 1,
|
||||||
INFRQ_DESC = (1 << 1),
|
INFRQ_DESC = (1 << 1),
|
||||||
INFRQ_DEPENDS = (1 << 2),
|
INFRQ_FILES = (1 << 2),
|
||||||
INFRQ_FILES = (1 << 3),
|
INFRQ_SCRIPTLET = (1 << 3),
|
||||||
INFRQ_SCRIPTLET = (1 << 4),
|
INFRQ_DSIZE = (1 << 4),
|
||||||
INFRQ_DELTAS = (1 << 5),
|
|
||||||
INFRQ_DSIZE = (1 << 6),
|
|
||||||
/* ALL should be info stored in the package or database */
|
/* ALL should be info stored in the package or database */
|
||||||
INFRQ_ALL = 0x3F
|
INFRQ_ALL = 0x1F,
|
||||||
} pmdbinfrq_t;
|
INFRQ_ERROR = (1 << 31)
|
||||||
|
} alpm_dbinfrq_t;
|
||||||
|
|
||||||
|
/** Database status. Bitflags. */
|
||||||
|
enum _alpm_dbstatus_t {
|
||||||
|
DB_STATUS_VALID = (1 << 0),
|
||||||
|
DB_STATUS_INVALID = (1 << 1),
|
||||||
|
DB_STATUS_EXISTS = (1 << 2),
|
||||||
|
DB_STATUS_MISSING = (1 << 3),
|
||||||
|
|
||||||
|
DB_STATUS_LOCAL = (1 << 10),
|
||||||
|
DB_STATUS_PKGCACHE = (1 << 11),
|
||||||
|
DB_STATUS_GRPCACHE = (1 << 12)
|
||||||
|
};
|
||||||
|
|
||||||
|
struct db_operations {
|
||||||
|
int (*validate) (alpm_db_t *);
|
||||||
|
int (*populate) (alpm_db_t *);
|
||||||
|
void (*unregister) (alpm_db_t *);
|
||||||
|
};
|
||||||
|
|
||||||
/* Database */
|
/* Database */
|
||||||
struct __pmdb_t {
|
struct __alpm_db_t {
|
||||||
|
alpm_handle_t *handle;
|
||||||
char *treename;
|
char *treename;
|
||||||
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
||||||
char *_path;
|
char *_path;
|
||||||
int pkgcache_loaded;
|
alpm_pkghash_t *pkgcache;
|
||||||
int grpcache_loaded;
|
|
||||||
int is_local;
|
|
||||||
alpm_list_t *pkgcache;
|
|
||||||
alpm_list_t *grpcache;
|
alpm_list_t *grpcache;
|
||||||
alpm_list_t *servers;
|
alpm_list_t *servers;
|
||||||
|
struct db_operations *ops;
|
||||||
|
/* flags determining validity, local, loaded caches, etc. */
|
||||||
|
enum _alpm_dbstatus_t status;
|
||||||
|
alpm_siglevel_t siglevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* db.c, database general calls */
|
|
||||||
void _alpm_db_free(pmdb_t *db);
|
|
||||||
const char *_alpm_db_path(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);
|
|
||||||
pmdb_t *_alpm_db_register_local(void);
|
|
||||||
pmdb_t *_alpm_db_register_sync(const char *treename);
|
|
||||||
|
|
||||||
/* be.c, backend specific calls */
|
/* db.c, database general calls */
|
||||||
int _alpm_db_populate(pmdb_t *db);
|
alpm_db_t *_alpm_db_new(const char *treename, int is_local);
|
||||||
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
void _alpm_db_free(alpm_db_t *db);
|
||||||
int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info);
|
const char *_alpm_db_path(alpm_db_t *db);
|
||||||
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
int _alpm_db_cmp(const void *d1, const void *d2);
|
||||||
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
|
alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
|
||||||
|
alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle);
|
||||||
|
alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
||||||
|
alpm_siglevel_t level);
|
||||||
|
void _alpm_db_unregister(alpm_db_t *db);
|
||||||
|
|
||||||
|
/* be_*.c, backend specific calls */
|
||||||
|
int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info);
|
||||||
|
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
|
||||||
|
int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info);
|
||||||
|
char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info, const char *filename);
|
||||||
|
|
||||||
|
/* cache bullshit */
|
||||||
|
/* packages */
|
||||||
|
void _alpm_db_free_pkgcache(alpm_db_t *db);
|
||||||
|
int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg);
|
||||||
|
int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg);
|
||||||
|
alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db);
|
||||||
|
alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db);
|
||||||
|
alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target);
|
||||||
|
/* groups */
|
||||||
|
alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db);
|
||||||
|
alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target);
|
||||||
|
|
||||||
#endif /* _ALPM_DB_H */
|
#endif /* _ALPM_DB_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* delta.c
|
* delta.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -34,51 +34,18 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
|
|
||||||
/** \addtogroup alpm_deltas Delta Functions
|
|
||||||
* @brief Functions to manipulate libalpm deltas
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_from(pmdelta_t *delta)
|
|
||||||
{
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
|
||||||
return(delta->from);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_to(pmdelta_t *delta)
|
|
||||||
{
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
|
||||||
return(delta->to);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_filename(pmdelta_t *delta)
|
|
||||||
{
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
|
||||||
return(delta->delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
|
|
||||||
{
|
|
||||||
ASSERT(delta != NULL, return(NULL));
|
|
||||||
return(delta->delta_md5);
|
|
||||||
}
|
|
||||||
|
|
||||||
off_t SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
|
|
||||||
{
|
|
||||||
ASSERT(delta != NULL, return(-1));
|
|
||||||
return(delta->delta_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *vertices = NULL;
|
alpm_list_t *vertices = NULL;
|
||||||
/* create the vertices */
|
/* create the vertices */
|
||||||
for(i = deltas; i; i = i->next) {
|
for(i = deltas; i; i = i->next) {
|
||||||
pmgraph_t *v = _alpm_graph_new();
|
alpm_graph_t *v = _alpm_graph_new();
|
||||||
pmdelta_t *vdelta = i->data;
|
if(!v) {
|
||||||
|
alpm_list_free(vertices);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
alpm_delta_t *vdelta = i->data;
|
||||||
vdelta->download_size = vdelta->delta_size;
|
vdelta->download_size = vdelta->delta_size;
|
||||||
v->weight = LONG_MAX;
|
v->weight = LONG_MAX;
|
||||||
v->data = vdelta;
|
v->data = vdelta;
|
||||||
@@ -87,12 +54,12 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
|||||||
|
|
||||||
/* compute the edges */
|
/* compute the edges */
|
||||||
for(i = vertices; i; i = i->next) {
|
for(i = vertices; i; i = i->next) {
|
||||||
pmgraph_t *v_i = i->data;
|
alpm_graph_t *v_i = i->data;
|
||||||
pmdelta_t *d_i = v_i->data;
|
alpm_delta_t *d_i = v_i->data;
|
||||||
/* loop a second time so we make all possible comparisons */
|
/* loop a second time so we make all possible comparisons */
|
||||||
for(j = vertices; j; j = j->next) {
|
for(j = vertices; j; j = j->next) {
|
||||||
pmgraph_t *v_j = j->data;
|
alpm_graph_t *v_j = j->data;
|
||||||
pmdelta_t *d_j = v_j->data;
|
alpm_delta_t *d_j = v_j->data;
|
||||||
/* We want to create a delta tree like the following:
|
/* We want to create a delta tree like the following:
|
||||||
* 1_to_2
|
* 1_to_2
|
||||||
* |
|
* |
|
||||||
@@ -108,29 +75,45 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
|||||||
}
|
}
|
||||||
v_i->childptr = v_i->children;
|
v_i->childptr = v_i->children;
|
||||||
}
|
}
|
||||||
return(vertices);
|
return vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void graph_init_size(alpm_list_t *vertices)
|
static void graph_init_size(alpm_handle_t *handle, alpm_list_t *vertices)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
for(i = vertices; i; i = i->next) {
|
for(i = vertices; i; i = i->next) {
|
||||||
char *fpath, *md5sum;
|
char *fpath, *md5sum;
|
||||||
pmgraph_t *v = i->data;
|
alpm_graph_t *v = i->data;
|
||||||
pmdelta_t *vdelta = v->data;
|
alpm_delta_t *vdelta = v->data;
|
||||||
|
|
||||||
/* determine whether the delta file already exists */
|
/* determine whether the delta file already exists */
|
||||||
fpath = _alpm_filecache_find(vdelta->delta);
|
fpath = _alpm_filecache_find(handle, vdelta->delta);
|
||||||
md5sum = alpm_compute_md5sum(fpath);
|
if(fpath) {
|
||||||
if(fpath && md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
|
md5sum = alpm_compute_md5sum(fpath);
|
||||||
vdelta->download_size = 0;
|
if(md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
|
||||||
|
vdelta->download_size = 0;
|
||||||
|
}
|
||||||
|
FREE(md5sum);
|
||||||
|
FREE(fpath);
|
||||||
|
} else {
|
||||||
|
char *fnamepart;
|
||||||
|
CALLOC(fnamepart, strlen(vdelta->delta) + 6, sizeof(char), return);
|
||||||
|
sprintf(fnamepart, "%s.part", vdelta->delta);
|
||||||
|
fpath = _alpm_filecache_find(handle, fnamepart);
|
||||||
|
if(fpath) {
|
||||||
|
struct stat st;
|
||||||
|
if(stat(fpath, &st) == 0) {
|
||||||
|
vdelta->download_size = vdelta->delta_size - st.st_size;
|
||||||
|
vdelta->download_size = vdelta->download_size < 0 ? 0 : vdelta->download_size;
|
||||||
|
}
|
||||||
|
FREE(fpath);
|
||||||
|
}
|
||||||
|
FREE(fnamepart);
|
||||||
}
|
}
|
||||||
FREE(fpath);
|
|
||||||
FREE(md5sum);
|
|
||||||
|
|
||||||
/* determine whether a base 'from' file exists */
|
/* determine whether a base 'from' file exists */
|
||||||
fpath = _alpm_filecache_find(vdelta->from);
|
fpath = _alpm_filecache_find(handle, vdelta->from);
|
||||||
if(fpath) {
|
if(fpath) {
|
||||||
v->weight = vdelta->download_size;
|
v->weight = vdelta->download_size;
|
||||||
}
|
}
|
||||||
@@ -142,12 +125,12 @@ static void graph_init_size(alpm_list_t *vertices)
|
|||||||
static void dijkstra(alpm_list_t *vertices)
|
static void dijkstra(alpm_list_t *vertices)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmgraph_t *v;
|
alpm_graph_t *v;
|
||||||
while(1) {
|
while(1) {
|
||||||
v = NULL;
|
v = NULL;
|
||||||
/* find the smallest vertice not visited yet */
|
/* find the smallest vertice not visited yet */
|
||||||
for(i = vertices; i; i = i->next) {
|
for(i = vertices; i; i = i->next) {
|
||||||
pmgraph_t *v_i = i->data;
|
alpm_graph_t *v_i = i->data;
|
||||||
|
|
||||||
if(v_i->state == -1) {
|
if(v_i->state == -1) {
|
||||||
continue;
|
continue;
|
||||||
@@ -165,8 +148,8 @@ static void dijkstra(alpm_list_t *vertices)
|
|||||||
|
|
||||||
v->childptr = v->children;
|
v->childptr = v->children;
|
||||||
while(v->childptr) {
|
while(v->childptr) {
|
||||||
pmgraph_t *v_c = v->childptr->data;
|
alpm_graph_t *v_c = v->childptr->data;
|
||||||
pmdelta_t *d_c = v_c->data;
|
alpm_delta_t *d_c = v_c->data;
|
||||||
if(v_c->weight > v->weight + d_c->download_size) {
|
if(v_c->weight > v->weight + d_c->download_size) {
|
||||||
v_c->weight = v->weight + d_c->download_size;
|
v_c->weight = v->weight + d_c->download_size;
|
||||||
v_c->parent = v;
|
v_c->parent = v;
|
||||||
@@ -181,13 +164,13 @@ static void dijkstra(alpm_list_t *vertices)
|
|||||||
static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **path)
|
static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **path)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmgraph_t *v = NULL;
|
alpm_graph_t *v = NULL;
|
||||||
off_t bestsize = 0;
|
off_t bestsize = 0;
|
||||||
alpm_list_t *rpath = NULL;
|
alpm_list_t *rpath = NULL;
|
||||||
|
|
||||||
for(i = vertices; i; i = i->next) {
|
for(i = vertices; i; i = i->next) {
|
||||||
pmgraph_t *v_i = i->data;
|
alpm_graph_t *v_i = i->data;
|
||||||
pmdelta_t *d_i = v_i->data;
|
alpm_delta_t *d_i = v_i->data;
|
||||||
|
|
||||||
if(strcmp(d_i->to, to) == 0) {
|
if(strcmp(d_i->to, to) == 0) {
|
||||||
if(v == NULL || v_i->weight < v->weight) {
|
if(v == NULL || v_i->weight < v->weight) {
|
||||||
@@ -198,54 +181,53 @@ static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **
|
|||||||
}
|
}
|
||||||
|
|
||||||
while(v != NULL) {
|
while(v != NULL) {
|
||||||
pmdelta_t *vdelta = v->data;
|
alpm_delta_t *vdelta = v->data;
|
||||||
rpath = alpm_list_add(rpath, vdelta);
|
rpath = alpm_list_add(rpath, vdelta);
|
||||||
v = v->parent;
|
v = v->parent;
|
||||||
}
|
}
|
||||||
*path = alpm_list_reverse(rpath);
|
*path = alpm_list_reverse(rpath);
|
||||||
alpm_list_free(rpath);
|
alpm_list_free(rpath);
|
||||||
|
|
||||||
return(bestsize);
|
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 handle the context handle
|
||||||
|
* @param deltas the list of alpm_delta_t * objects that a file has
|
||||||
* @param to the file to start the search at
|
* @param to the file to start the search at
|
||||||
* @param path the pointer to a list location where pmdelta_t * objects that
|
* @param path the pointer to a list location where alpm_delta_t * objects that
|
||||||
* have the smallest size are placed. NULL is set if there is no path
|
* have the smallest size are placed. NULL is set if there is no path
|
||||||
* possible with the files available.
|
* possible with the files available.
|
||||||
* @return the size of the path stored, or LONG_MAX if path is unfindable
|
* @return the size of the path stored, or LONG_MAX if path is unfindable
|
||||||
*/
|
*/
|
||||||
off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
|
off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas,
|
||||||
const char *to, alpm_list_t **path)
|
const char *to, alpm_list_t **path)
|
||||||
{
|
{
|
||||||
alpm_list_t *bestpath = NULL;
|
alpm_list_t *bestpath = NULL;
|
||||||
alpm_list_t *vertices;
|
alpm_list_t *vertices;
|
||||||
off_t bestsize = LONG_MAX;
|
off_t bestsize = LONG_MAX;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(deltas == NULL) {
|
if(deltas == NULL) {
|
||||||
*path = NULL;
|
*path = NULL;
|
||||||
return(bestsize);
|
return bestsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "started delta shortest-path search for '%s'\n", to);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "started delta shortest-path search for '%s'\n", to);
|
||||||
|
|
||||||
vertices = graph_init(deltas, 0);
|
vertices = graph_init(deltas, 0);
|
||||||
graph_init_size(vertices);
|
graph_init_size(handle, vertices);
|
||||||
dijkstra(vertices);
|
dijkstra(vertices);
|
||||||
bestsize = shortest_path(vertices, to, &bestpath);
|
bestsize = shortest_path(vertices, to, &bestpath);
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "delta shortest-path search complete : '%jd'\n", (intmax_t)bestsize);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "delta shortest-path search complete : '%jd'\n", (intmax_t)bestsize);
|
||||||
|
|
||||||
alpm_list_free_inner(vertices, _alpm_graph_free);
|
alpm_list_free_inner(vertices, _alpm_graph_free);
|
||||||
alpm_list_free(vertices);
|
alpm_list_free(vertices);
|
||||||
|
|
||||||
*path = bestpath;
|
*path = bestpath;
|
||||||
return(bestsize);
|
return bestsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota)
|
static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota)
|
||||||
@@ -256,8 +238,8 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
|
|||||||
vertices = graph_init(deltas, 1);
|
vertices = graph_init(deltas, 1);
|
||||||
|
|
||||||
for(i = vertices; i; i = i->next) {
|
for(i = vertices; i; i = i->next) {
|
||||||
pmgraph_t *v = i->data;
|
alpm_graph_t *v = i->data;
|
||||||
pmdelta_t *vdelta = v->data;
|
alpm_delta_t *vdelta = v->data;
|
||||||
if(strcmp(vdelta->to, to) == 0)
|
if(strcmp(vdelta->to, to) == 0)
|
||||||
{
|
{
|
||||||
v->weight = vdelta->download_size;
|
v->weight = vdelta->download_size;
|
||||||
@@ -265,39 +247,41 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
|
|||||||
}
|
}
|
||||||
dijkstra(vertices);
|
dijkstra(vertices);
|
||||||
for(i = vertices; i; i = i->next) {
|
for(i = vertices; i; i = i->next) {
|
||||||
pmgraph_t *v = i->data;
|
alpm_graph_t *v = i->data;
|
||||||
pmdelta_t *vdelta = v->data;
|
alpm_delta_t *vdelta = v->data;
|
||||||
if(v->weight > quota) {
|
if(v->weight > quota) {
|
||||||
unused = alpm_list_add(unused, vdelta->delta);
|
unused = alpm_list_add(unused, vdelta->delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alpm_list_free_inner(vertices, _alpm_graph_free);
|
alpm_list_free_inner(vertices, _alpm_graph_free);
|
||||||
alpm_list_free(vertices);
|
alpm_list_free(vertices);
|
||||||
return(unused);
|
return unused;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
|
/** \addtogroup alpm_deltas Delta Functions
|
||||||
|
* @brief Functions to manipulate libalpm deltas
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
off_t pkgsize = alpm_pkg_get_size(pkg);
|
ASSERT(pkg != NULL, return NULL);
|
||||||
alpm_list_t *unused = find_unused(
|
return find_unused(pkg->deltas, pkg->filename, pkg->size * MAX_DELTA_RATIO);
|
||||||
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 alpm_delta_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:
|
* This format is as follows:
|
||||||
* $deltafile $deltamd5 $deltasize $oldfile $newfile
|
* $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 alpm_delta_t object
|
||||||
*/
|
*/
|
||||||
/* TODO this does not really belong here, but in a parsing lib */
|
/* TODO this does not really belong here, but in a parsing lib */
|
||||||
pmdelta_t *_alpm_delta_parse(char *line)
|
alpm_delta_t *_alpm_delta_parse(char *line)
|
||||||
{
|
{
|
||||||
pmdelta_t *delta;
|
alpm_delta_t *delta;
|
||||||
char *tmp = line, *tmp2;
|
char *tmp = line, *tmp2;
|
||||||
regex_t reg;
|
regex_t reg;
|
||||||
|
|
||||||
@@ -308,47 +292,59 @@ pmdelta_t *_alpm_delta_parse(char *line)
|
|||||||
if(regexec(®, line, 0, 0, 0) != 0) {
|
if(regexec(®, line, 0, 0, 0) != 0) {
|
||||||
/* delta line is invalid, return NULL */
|
/* delta line is invalid, return NULL */
|
||||||
regfree(®);
|
regfree(®);
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
regfree(®);
|
regfree(®);
|
||||||
|
|
||||||
CALLOC(delta, 1, sizeof(pmdelta_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(delta, 1, sizeof(alpm_delta_t), return NULL);
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
STRDUP(delta->delta, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(delta->delta, tmp2, return NULL);
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
STRDUP(delta->delta_md5, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(delta->delta_md5, tmp2, return NULL);
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
delta->delta_size = atol(tmp2);
|
delta->delta_size = _alpm_strtoofft(tmp2);
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
tmp = strchr(tmp, ' ');
|
tmp = strchr(tmp, ' ');
|
||||||
*(tmp++) = '\0';
|
*(tmp++) = '\0';
|
||||||
STRDUP(delta->from, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(delta->from, tmp2, return NULL);
|
||||||
|
|
||||||
tmp2 = tmp;
|
tmp2 = tmp;
|
||||||
STRDUP(delta->to, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
|
STRDUP(delta->to, tmp2, return 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)
|
void _alpm_delta_free(alpm_delta_t *delta)
|
||||||
{
|
{
|
||||||
FREE(delta->from);
|
|
||||||
FREE(delta->to);
|
|
||||||
FREE(delta->delta);
|
FREE(delta->delta);
|
||||||
FREE(delta->delta_md5);
|
FREE(delta->delta_md5);
|
||||||
|
FREE(delta->from);
|
||||||
|
FREE(delta->to);
|
||||||
FREE(delta);
|
FREE(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta)
|
||||||
|
{
|
||||||
|
alpm_delta_t *newdelta;
|
||||||
|
CALLOC(newdelta, 1, sizeof(alpm_delta_t), return NULL);
|
||||||
|
STRDUP(newdelta->delta, delta->delta, return NULL);
|
||||||
|
STRDUP(newdelta->delta_md5, delta->delta_md5, return NULL);
|
||||||
|
STRDUP(newdelta->from, delta->from, return NULL);
|
||||||
|
STRDUP(newdelta->to, delta->to, return NULL);
|
||||||
|
newdelta->delta_size = delta->delta_size;
|
||||||
|
newdelta->download_size = delta->download_size;
|
||||||
|
|
||||||
|
return newdelta;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* delta.h
|
* delta.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -20,30 +20,21 @@
|
|||||||
#ifndef _ALPM_DELTA_H
|
#ifndef _ALPM_DELTA_H
|
||||||
#define _ALPM_DELTA_H
|
#define _ALPM_DELTA_H
|
||||||
|
|
||||||
|
#include "config.h" /* ensure off_t is correct length */
|
||||||
|
|
||||||
#include <sys/types.h> /* off_t */
|
#include <sys/types.h> /* off_t */
|
||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
struct __pmdelta_t {
|
alpm_delta_t *_alpm_delta_parse(char *line);
|
||||||
/** filename of the delta patch */
|
void _alpm_delta_free(alpm_delta_t *delta);
|
||||||
char *delta;
|
alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta);
|
||||||
/** md5sum of the delta file */
|
off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas,
|
||||||
char *delta_md5;
|
|
||||||
/** 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
pmdelta_t *_alpm_delta_parse(char *line);
|
|
||||||
void _alpm_delta_free(pmdelta_t *delta);
|
|
||||||
off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
|
|
||||||
const char *to, alpm_list_t **path);
|
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 */
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* deps.h
|
* deps.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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>
|
||||||
@@ -27,34 +27,17 @@
|
|||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
/* Dependency */
|
void _alpm_dep_free(alpm_depend_t *dep);
|
||||||
struct __pmdepend_t {
|
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
|
||||||
pmdepmod_t mod;
|
void _alpm_depmiss_free(alpm_depmissing_t *miss);
|
||||||
char *name;
|
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
||||||
char *version;
|
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit);
|
||||||
};
|
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg,
|
||||||
|
|
||||||
/* Missing dependency */
|
|
||||||
struct __pmdepmissing_t {
|
|
||||||
char *target;
|
|
||||||
pmdepend_t *depend;
|
|
||||||
char *causingpkg; /* this is used in case of remove dependency error only */
|
|
||||||
};
|
|
||||||
|
|
||||||
void _alpm_dep_free(pmdepend_t *dep);
|
|
||||||
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep,
|
|
||||||
const char *causinpkg);
|
|
||||||
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
|
|
||||||
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
|
||||||
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt);
|
|
||||||
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 *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
||||||
alpm_list_t **data);
|
alpm_list_t **data);
|
||||||
int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2);
|
alpm_depend_t *_alpm_splitdep(const char *depstring);
|
||||||
pmdepend_t *_alpm_splitdep(const char *depstring);
|
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep);
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
|
|
||||||
#endif /* _ALPM_DEPS_H */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
|
||||||
|
|||||||
381
lib/libalpm/diskspace.c
Normal file
381
lib/libalpm/diskspace.c
Normal file
@@ -0,0 +1,381 @@
|
|||||||
|
/*
|
||||||
|
* diskspace.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2012 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 <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if defined(HAVE_MNTENT_H)
|
||||||
|
#include <mntent.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_MNTTAB_H)
|
||||||
|
#include <sys/mnttab.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
|
||||||
|
|
||||||
|
/* 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(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
alpm_list_t *mount_points = NULL, *ptr;
|
||||||
|
alpm_mountpoint_t *mp;
|
||||||
|
|
||||||
|
#if defined(HAVE_GETMNTENT) && defined(HAVE_MNTENT_H)
|
||||||
|
/* Linux */
|
||||||
|
struct mntent *mnt;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
fp = setmntent(MOUNTED, "r");
|
||||||
|
|
||||||
|
if(fp == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while((mnt = getmntent(fp))) {
|
||||||
|
struct statvfs fsp;
|
||||||
|
if(!mnt) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("could not get filesystem information\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(statvfs(mnt->mnt_dir, &fsp) != 0) {
|
||||||
|
_alpm_log(handle, ALPM_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(handle, ALPM_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_GETMNTENT) && defined(HAVE_MNTTAB_H)
|
||||||
|
/* Solaris, Illumos */
|
||||||
|
struct mnttab mnt;
|
||||||
|
FILE *fp;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
fp = fopen("/etc/mnttab", "r");
|
||||||
|
|
||||||
|
if(fp == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while((ret = getmntent(fp, &mnt)) == 0) {
|
||||||
|
struct statvfs fsp;
|
||||||
|
if(statvfs(mnt->mnt_mountp, &fsp) != 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("could not get filesystem information for %s: %s\n"),
|
||||||
|
mnt->mnt_mountp, strerror(errno));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
|
mp->mount_dir = strdup(mnt->mnt_mountp);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
/* -1 == EOF */
|
||||||
|
if(ret != -1) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("could not get filesystem information\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
#elif defined(HAVE_GETMNTINFO)
|
||||||
|
/* FreeBSD (statfs), NetBSD (statvfs), OpenBSD (statfs), OS X (statfs) */
|
||||||
|
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(handle, ALPM_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(handle, ALPM_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(alpm_handle_t *handle,
|
||||||
|
const alpm_list_t *mount_points, alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
alpm_filelist_t *filelist = alpm_pkg_get_files(pkg);
|
||||||
|
|
||||||
|
if(!filelist->count) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < filelist->count; i++) {
|
||||||
|
const alpm_file_t *file = filelist->files + i;
|
||||||
|
alpm_mountpoint_t *mp;
|
||||||
|
struct stat st;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
const char *filename = file->name;
|
||||||
|
|
||||||
|
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(handle, ALPM_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 - 1) / mp->fsp.f_bsize;
|
||||||
|
mp->used |= USED_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int calculate_installed_size(alpm_handle_t *handle,
|
||||||
|
const alpm_list_t *mount_points, alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
alpm_filelist_t *filelist = alpm_pkg_get_files(pkg);
|
||||||
|
|
||||||
|
if(!filelist->count) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < filelist->count; i++) {
|
||||||
|
const alpm_file_t *file = filelist->files + i;
|
||||||
|
alpm_mountpoint_t *mp;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
const char *filename = file->name;
|
||||||
|
|
||||||
|
/* 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(file->mode) || S_ISLNK(file->mode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* approximate space requirements for db entries */
|
||||||
|
if(filename[0] == '.') {
|
||||||
|
filename = handle->dbpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
||||||
|
|
||||||
|
mp = match_mount_point(mount_points, path);
|
||||||
|
if(mp == NULL) {
|
||||||
|
_alpm_log(handle, ALPM_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 +=
|
||||||
|
(file->size + mp->fsp.f_bsize - 1) / mp->fsp.f_bsize;
|
||||||
|
mp->used |= USED_INSTALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_check_diskspace(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
alpm_list_t *mount_points, *i;
|
||||||
|
alpm_mountpoint_t *root_mp;
|
||||||
|
size_t replaces = 0, current = 0, numtargs;
|
||||||
|
int error = 0;
|
||||||
|
alpm_list_t *targ;
|
||||||
|
alpm_trans_t *trans = handle->trans;
|
||||||
|
|
||||||
|
numtargs = alpm_list_count(trans->add);
|
||||||
|
mount_points = mount_point_list(handle);
|
||||||
|
if(mount_points == NULL) {
|
||||||
|
_alpm_log(handle, ALPM_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(handle, ALPM_LOG_ERROR, _("could not determine root mount point %s\n"),
|
||||||
|
handle->root);
|
||||||
|
error = 1;
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
replaces = alpm_list_count(trans->remove);
|
||||||
|
if(replaces) {
|
||||||
|
numtargs += replaces;
|
||||||
|
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
||||||
|
alpm_pkg_t *local_pkg;
|
||||||
|
int percent = (current * 100) / numtargs;
|
||||||
|
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
|
local_pkg = targ->data;
|
||||||
|
calculate_removed_size(handle, mount_points, local_pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(targ = trans->add; targ; targ = targ->next, current++) {
|
||||||
|
alpm_pkg_t *pkg, *local_pkg;
|
||||||
|
int percent = (current * 100) / numtargs;
|
||||||
|
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
|
pkg = targ->data;
|
||||||
|
/* is this package already installed? */
|
||||||
|
local_pkg = _alpm_db_get_pkgfromcache(handle->db_local, pkg->name);
|
||||||
|
if(local_pkg) {
|
||||||
|
calculate_removed_size(handle, mount_points, local_pkg);
|
||||||
|
}
|
||||||
|
calculate_installed_size(handle, mount_points, pkg);
|
||||||
|
|
||||||
|
for(i = mount_points; i; i = i->next) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
if(data->blocks_needed > data->max_blocks_needed) {
|
||||||
|
data->max_blocks_needed = data->blocks_needed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", 100,
|
||||||
|
numtargs, current);
|
||||||
|
|
||||||
|
for(i = mount_points; i; i = i->next) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
if(data->used && data->read_only) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("Partition %s is mounted read only\n"),
|
||||||
|
data->mount_dir);
|
||||||
|
error = 1;
|
||||||
|
} else if(data->used & USED_INSTALL) {
|
||||||
|
/* cushion is roughly min(5% capacity, 20MiB) */
|
||||||
|
fsblkcnt_t fivepc = (data->fsp.f_blocks / 20) + 1;
|
||||||
|
fsblkcnt_t twentymb = (20 * 1024 * 1024 / data->fsp.f_bsize) + 1;
|
||||||
|
fsblkcnt_t cushion = fivepc < twentymb ? fivepc : twentymb;
|
||||||
|
blkcnt_t needed = data->max_blocks_needed + cushion;
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"partition %s, needed %jd, cushion %ju, free %ju\n",
|
||||||
|
data->mount_dir, (intmax_t)data->max_blocks_needed,
|
||||||
|
(uintmax_t)cushion, (uintmax_t)data->fsp.f_bfree);
|
||||||
|
if(needed >= 0 && (fsblkcnt_t)needed > data->fsp.f_bfree) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("Partition %s too full: %jd blocks needed, %jd blocks free\n"),
|
||||||
|
data->mount_dir, (intmax_t)needed, (uintmax_t)data->fsp.f_bfree);
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
|
for(i = mount_points; i; i = i->next) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
FREE(data->mount_dir);
|
||||||
|
}
|
||||||
|
FREELIST(mount_points);
|
||||||
|
|
||||||
|
if(error) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_DISK_SPACE, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
56
lib/libalpm/diskspace.h
Normal file
56
lib/libalpm/diskspace.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
#if defined(HAVE_SYS_TYPES_H)
|
||||||
|
#include <sys/types.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 */
|
||||||
|
blkcnt_t blocks_needed;
|
||||||
|
blkcnt_t max_blocks_needed;
|
||||||
|
enum mount_used_level used;
|
||||||
|
int read_only;
|
||||||
|
FSSTATSTYPE fsp;
|
||||||
|
} alpm_mountpoint_t;
|
||||||
|
|
||||||
|
int _alpm_check_diskspace(alpm_handle_t *handle);
|
||||||
|
|
||||||
|
#endif /* _ALPM_DISKSPACE_H */
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dload.h
|
* dload.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -25,14 +25,30 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define PM_DLBUF_LEN (1024 * 16)
|
struct dload_payload {
|
||||||
|
alpm_handle_t *handle;
|
||||||
|
const char *tempfile_openmode;
|
||||||
|
char *remote_name;
|
||||||
|
char *tempfile_name;
|
||||||
|
char *destfile_name;
|
||||||
|
char *content_disp_name;
|
||||||
|
char *fileurl;
|
||||||
|
off_t initial_size;
|
||||||
|
off_t max_size;
|
||||||
|
off_t prevprogress;
|
||||||
|
int force;
|
||||||
|
int allow_resume;
|
||||||
|
int errors_ok;
|
||||||
|
int unlink_on_fail;
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
CURLcode curlerr; /* last error produced by curl */
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
int _alpm_download_single_file(const char *filename,
|
void _alpm_dload_payload_reset(struct dload_payload *payload);
|
||||||
alpm_list_t *servers, const char *localpath,
|
|
||||||
int force);
|
|
||||||
|
|
||||||
int _alpm_download_files(alpm_list_t *files,
|
int _alpm_download(struct dload_payload *payload, const char *localpath,
|
||||||
alpm_list_t *servers, const char *localpath);
|
char **final_file);
|
||||||
|
|
||||||
#endif /* _ALPM_DLOAD_H */
|
#endif /* _ALPM_DLOAD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* error.c
|
* error.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -20,138 +20,142 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
/* TODO: needed for the libfetch stuff, unfortunately- we should kill it */
|
#ifdef HAVE_LIBCURL
|
||||||
#include <stdio.h>
|
#include <curl/curl.h>
|
||||||
#include <limits.h>
|
|
||||||
/* the following two are needed on BSD for libfetch */
|
|
||||||
#if defined(HAVE_SYS_SYSLIMITS_H)
|
|
||||||
#include <sys/syslimits.h> /* PATH_MAX */
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_SYS_PARAM_H)
|
|
||||||
#include <sys/param.h> /* MAXHOSTNAMELEN */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(INTERNAL_DOWNLOAD)
|
|
||||||
#include <fetch.h> /* fetchLastErrString */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
#include "handle.h"
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_strerrorlast(void)
|
enum _alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
return alpm_strerror(pm_errno);
|
return handle->pm_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_strerror(int err)
|
const char SYMEXPORT *alpm_strerror(enum _alpm_errno_t err)
|
||||||
{
|
{
|
||||||
switch(err) {
|
switch(err) {
|
||||||
/* System */
|
/* System */
|
||||||
case PM_ERR_MEMORY:
|
case ALPM_ERR_MEMORY:
|
||||||
return _("out of memory!");
|
return _("out of memory!");
|
||||||
case PM_ERR_SYSTEM:
|
case ALPM_ERR_SYSTEM:
|
||||||
return _("unexpected system error");
|
return _("unexpected system error");
|
||||||
case PM_ERR_BADPERMS:
|
case ALPM_ERR_BADPERMS:
|
||||||
return _("insufficient privileges");
|
return _("insufficient privileges");
|
||||||
case PM_ERR_NOT_A_FILE:
|
case ALPM_ERR_NOT_A_FILE:
|
||||||
return _("could not find or read file");
|
return _("could not find or read file");
|
||||||
case PM_ERR_NOT_A_DIR:
|
case ALPM_ERR_NOT_A_DIR:
|
||||||
return _("could not find or read directory");
|
return _("could not find or read directory");
|
||||||
case PM_ERR_WRONG_ARGS:
|
case ALPM_ERR_WRONG_ARGS:
|
||||||
return _("wrong or NULL argument passed");
|
return _("wrong or NULL argument passed");
|
||||||
|
case ALPM_ERR_DISK_SPACE:
|
||||||
|
return _("not enough free disk space");
|
||||||
/* Interface */
|
/* Interface */
|
||||||
case PM_ERR_HANDLE_NULL:
|
case ALPM_ERR_HANDLE_NULL:
|
||||||
return _("library not initialized");
|
return _("library not initialized");
|
||||||
case PM_ERR_HANDLE_NOT_NULL:
|
case ALPM_ERR_HANDLE_NOT_NULL:
|
||||||
return _("library already initialized");
|
return _("library already initialized");
|
||||||
case PM_ERR_HANDLE_LOCK:
|
case ALPM_ERR_HANDLE_LOCK:
|
||||||
return _("unable to lock database");
|
return _("unable to lock database");
|
||||||
/* Databases */
|
/* Databases */
|
||||||
case PM_ERR_DB_OPEN:
|
case ALPM_ERR_DB_OPEN:
|
||||||
return _("could not open database");
|
return _("could not open database");
|
||||||
case PM_ERR_DB_CREATE:
|
case ALPM_ERR_DB_CREATE:
|
||||||
return _("could not create database");
|
return _("could not create database");
|
||||||
case PM_ERR_DB_NULL:
|
case ALPM_ERR_DB_NULL:
|
||||||
return _("database not initialized");
|
return _("database not initialized");
|
||||||
case PM_ERR_DB_NOT_NULL:
|
case ALPM_ERR_DB_NOT_NULL:
|
||||||
return _("database already registered");
|
return _("database already registered");
|
||||||
case PM_ERR_DB_NOT_FOUND:
|
case ALPM_ERR_DB_NOT_FOUND:
|
||||||
return _("could not find database");
|
return _("could not find database");
|
||||||
case PM_ERR_DB_WRITE:
|
case ALPM_ERR_DB_INVALID:
|
||||||
|
return _("invalid or corrupted database");
|
||||||
|
case ALPM_ERR_DB_INVALID_SIG:
|
||||||
|
return _("invalid or corrupted database (PGP signature)");
|
||||||
|
case ALPM_ERR_DB_VERSION:
|
||||||
|
return _("database is incorrect version");
|
||||||
|
case ALPM_ERR_DB_WRITE:
|
||||||
return _("could not update database");
|
return _("could not update database");
|
||||||
case PM_ERR_DB_REMOVE:
|
case ALPM_ERR_DB_REMOVE:
|
||||||
return _("could not remove database entry");
|
return _("could not remove database entry");
|
||||||
/* Servers */
|
/* Servers */
|
||||||
case PM_ERR_SERVER_BAD_URL:
|
case ALPM_ERR_SERVER_BAD_URL:
|
||||||
return _("invalid url for server");
|
return _("invalid url for server");
|
||||||
case PM_ERR_SERVER_NONE:
|
case ALPM_ERR_SERVER_NONE:
|
||||||
return _("no servers configured for repository");
|
return _("no servers configured for repository");
|
||||||
/* Transactions */
|
/* Transactions */
|
||||||
case PM_ERR_TRANS_NOT_NULL:
|
case ALPM_ERR_TRANS_NOT_NULL:
|
||||||
return _("transaction already initialized");
|
return _("transaction already initialized");
|
||||||
case PM_ERR_TRANS_NULL:
|
case ALPM_ERR_TRANS_NULL:
|
||||||
return _("transaction not initialized");
|
return _("transaction not initialized");
|
||||||
case PM_ERR_TRANS_DUP_TARGET:
|
case ALPM_ERR_TRANS_DUP_TARGET:
|
||||||
return _("duplicate target");
|
return _("duplicate target");
|
||||||
case PM_ERR_TRANS_NOT_INITIALIZED:
|
case ALPM_ERR_TRANS_NOT_INITIALIZED:
|
||||||
return _("transaction not initialized");
|
return _("transaction not initialized");
|
||||||
case PM_ERR_TRANS_NOT_PREPARED:
|
case ALPM_ERR_TRANS_NOT_PREPARED:
|
||||||
return _("transaction not prepared");
|
return _("transaction not prepared");
|
||||||
case PM_ERR_TRANS_ABORT:
|
case ALPM_ERR_TRANS_ABORT:
|
||||||
return _("transaction aborted");
|
return _("transaction aborted");
|
||||||
case PM_ERR_TRANS_TYPE:
|
case ALPM_ERR_TRANS_TYPE:
|
||||||
return _("operation not compatible with the transaction type");
|
return _("operation not compatible with the transaction type");
|
||||||
case PM_ERR_TRANS_NOT_LOCKED:
|
case ALPM_ERR_TRANS_NOT_LOCKED:
|
||||||
return _("transaction commit attempt when database is not locked");
|
return _("transaction commit attempt when database is not locked");
|
||||||
/* Packages */
|
/* Packages */
|
||||||
case PM_ERR_PKG_NOT_FOUND:
|
case ALPM_ERR_PKG_NOT_FOUND:
|
||||||
return _("could not find or read package");
|
return _("could not find or read package");
|
||||||
case PM_ERR_PKG_IGNORED:
|
case ALPM_ERR_PKG_IGNORED:
|
||||||
return _("operation cancelled due to ignorepkg");
|
return _("operation cancelled due to ignorepkg");
|
||||||
case PM_ERR_PKG_INVALID:
|
case ALPM_ERR_PKG_INVALID:
|
||||||
return _("invalid or corrupted package");
|
return _("invalid or corrupted package");
|
||||||
case PM_ERR_PKG_OPEN:
|
case ALPM_ERR_PKG_INVALID_CHECKSUM:
|
||||||
|
return _("invalid or corrupted package (checksum)");
|
||||||
|
case ALPM_ERR_PKG_INVALID_SIG:
|
||||||
|
return _("invalid or corrupted package (PGP signature)");
|
||||||
|
case ALPM_ERR_PKG_OPEN:
|
||||||
return _("cannot open package file");
|
return _("cannot open package file");
|
||||||
case PM_ERR_PKG_CANT_REMOVE:
|
case ALPM_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 ALPM_ERR_PKG_INVALID_NAME:
|
||||||
return _("package filename is not valid");
|
return _("package filename is not valid");
|
||||||
case PM_ERR_PKG_INVALID_ARCH:
|
case ALPM_ERR_PKG_INVALID_ARCH:
|
||||||
return _("package architecture is not valid");
|
return _("package architecture is not valid");
|
||||||
case PM_ERR_PKG_REPO_NOT_FOUND:
|
case ALPM_ERR_PKG_REPO_NOT_FOUND:
|
||||||
return _("could not find repository for target");
|
return _("could not find repository for target");
|
||||||
|
/* Signatures */
|
||||||
|
case ALPM_ERR_SIG_MISSING:
|
||||||
|
return _("missing PGP signature");
|
||||||
|
case ALPM_ERR_SIG_INVALID:
|
||||||
|
return _("invalid PGP signature");
|
||||||
/* Deltas */
|
/* Deltas */
|
||||||
case PM_ERR_DLT_INVALID:
|
case ALPM_ERR_DLT_INVALID:
|
||||||
return _("invalid or corrupted delta");
|
return _("invalid or corrupted delta");
|
||||||
case PM_ERR_DLT_PATCHFAILED:
|
case ALPM_ERR_DLT_PATCHFAILED:
|
||||||
return _("delta patch failed");
|
return _("delta patch failed");
|
||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case ALPM_ERR_UNSATISFIED_DEPS:
|
||||||
return _("could not satisfy dependencies");
|
return _("could not satisfy dependencies");
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case ALPM_ERR_CONFLICTING_DEPS:
|
||||||
return _("conflicting dependencies");
|
return _("conflicting dependencies");
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case ALPM_ERR_FILE_CONFLICTS:
|
||||||
return _("conflicting files");
|
return _("conflicting files");
|
||||||
/* Miscellaenous */
|
/* Miscellaenous */
|
||||||
case PM_ERR_RETRIEVE:
|
case ALPM_ERR_RETRIEVE:
|
||||||
return _("failed to retrieve some files");
|
return _("failed to retrieve some files");
|
||||||
case PM_ERR_INVALID_REGEX:
|
case ALPM_ERR_INVALID_REGEX:
|
||||||
return _("invalid regular expression");
|
return _("invalid regular expression");
|
||||||
/* Errors from external libraries- our own wrapper error */
|
/* Errors from external libraries- our own wrapper error */
|
||||||
case PM_ERR_LIBARCHIVE:
|
case ALPM_ERR_LIBARCHIVE:
|
||||||
/* it would be nice to use archive_error_string() here, but that
|
/* it would be nice to use archive_error_string() here, but that
|
||||||
* requires the archive struct, so we can't. Just use a generic
|
* requires the archive struct, so we can't. Just use a generic
|
||||||
* error string instead. */
|
* error string instead. */
|
||||||
return _("libarchive error");
|
return _("libarchive error");
|
||||||
case PM_ERR_LIBFETCH:
|
case ALPM_ERR_LIBCURL:
|
||||||
#if defined(INTERNAL_DOWNLOAD)
|
|
||||||
return fetchLastErrString;
|
|
||||||
#else
|
|
||||||
/* obviously shouldn't get here... */
|
|
||||||
return _("download library error");
|
return _("download library error");
|
||||||
#endif
|
case ALPM_ERR_GPGME:
|
||||||
case PM_ERR_EXTERNAL_DOWNLOAD:
|
return _("gpgme error");
|
||||||
|
case ALPM_ERR_EXTERNAL_DOWNLOAD:
|
||||||
return _("error invoking external downloader");
|
return _("error invoking external downloader");
|
||||||
/* Unknown error! */
|
/* Unknown error! */
|
||||||
default:
|
default:
|
||||||
|
|||||||
41
lib/libalpm/graph.c
Normal file
41
lib/libalpm/graph.c
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* graph.c - helpful graph structure and setup/teardown methods
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007-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 "graph.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
alpm_graph_t *_alpm_graph_new(void)
|
||||||
|
{
|
||||||
|
alpm_graph_t *graph = NULL;
|
||||||
|
|
||||||
|
CALLOC(graph, 1, sizeof(alpm_graph_t), return NULL);
|
||||||
|
return graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _alpm_graph_free(void *data)
|
||||||
|
{
|
||||||
|
alpm_graph_t *graph = data;
|
||||||
|
alpm_list_free(graph->children);
|
||||||
|
free(graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* graph.h - helpful graph structure and setup/teardown methods
|
* graph.h - helpful graph structure and setup/teardown methods
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2007-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,43 +16,27 @@
|
|||||||
* 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_GRAPH_H
|
||||||
|
#define _ALPM_GRAPH_H
|
||||||
|
|
||||||
|
#include "config.h" /* ensure off_t is correct length */
|
||||||
|
|
||||||
#include <sys/types.h> /* off_t */
|
#include <sys/types.h> /* off_t */
|
||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h" /* MALLOC() */
|
|
||||||
#include "alpm.h"
|
|
||||||
|
|
||||||
struct __pmgraph_t {
|
typedef struct __alpm_graph_t {
|
||||||
char state; /* 0: untouched, -1: entered, other: leaving time */
|
char state; /* 0: untouched, -1: entered, other: leaving time */
|
||||||
void *data;
|
|
||||||
off_t weight; /* weight of the node */
|
off_t weight; /* weight of the node */
|
||||||
struct __pmgraph_t *parent; /* where did we come from? */
|
void *data;
|
||||||
|
struct __alpm_graph_t *parent; /* where did we come from? */
|
||||||
alpm_list_t *children;
|
alpm_list_t *children;
|
||||||
alpm_list_t *childptr; /* points to a child in children list */
|
alpm_list_t *childptr; /* points to a child in children list */
|
||||||
};
|
} alpm_graph_t;
|
||||||
typedef struct __pmgraph_t pmgraph_t;
|
|
||||||
|
|
||||||
static pmgraph_t *_alpm_graph_new(void)
|
alpm_graph_t *_alpm_graph_new(void);
|
||||||
{
|
void _alpm_graph_free(void *data);
|
||||||
pmgraph_t *graph = NULL;
|
|
||||||
|
|
||||||
MALLOC(graph, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
#endif /* _ALPM_GRAPH_H */
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
pmgraph_t *graph = data;
|
|
||||||
alpm_list_free(graph->children);
|
|
||||||
free(graph);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* group.c
|
* group.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
@@ -31,22 +30,18 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
pmgrp_t *_alpm_grp_new(const char *name)
|
alpm_group_t *_alpm_group_new(const char *name)
|
||||||
{
|
{
|
||||||
pmgrp_t* grp;
|
alpm_group_t* grp;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
CALLOC(grp, 1, sizeof(alpm_group_t), return NULL);
|
||||||
|
STRDUP(grp->name, name, free(grp); return NULL);
|
||||||
|
|
||||||
CALLOC(grp, 1, sizeof(pmgrp_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
return grp;
|
||||||
STRDUP(grp->name, name, RET_ERR(PM_ERR_MEMORY, NULL));
|
|
||||||
|
|
||||||
return(grp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_grp_free(pmgrp_t *grp)
|
void _alpm_group_free(alpm_group_t *grp)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(grp == NULL) {
|
if(grp == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -57,23 +52,4 @@ void _alpm_grp_free(pmgrp_t *grp)
|
|||||||
FREE(grp);
|
FREE(grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(grp != NULL, return(NULL));
|
|
||||||
|
|
||||||
return grp->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(const pmgrp_t *grp)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(grp != NULL, return(NULL));
|
|
||||||
|
|
||||||
return grp->packages;
|
|
||||||
}
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* group.h
|
* group.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -22,15 +22,8 @@
|
|||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
struct __pmgrp_t {
|
alpm_group_t *_alpm_group_new(const char *name);
|
||||||
/** group name */
|
void _alpm_group_free(alpm_group_t *grp);
|
||||||
char *name;
|
|
||||||
/** list of pmpkg_t packages */
|
|
||||||
alpm_list_t *packages;
|
|
||||||
};
|
|
||||||
|
|
||||||
pmgrp_t *_alpm_grp_new(const char *name);
|
|
||||||
void _alpm_grp_free(pmgrp_t *grp);
|
|
||||||
|
|
||||||
#endif /* _ALPM_GROUP_H */
|
#endif /* _ALPM_GROUP_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* handle.c
|
* handle.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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>
|
||||||
@@ -22,14 +22,14 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <time.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
@@ -39,25 +39,17 @@
|
|||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
/* global var for handle (private to libalpm) */
|
alpm_handle_t *_alpm_handle_new(void)
|
||||||
pmhandle_t *handle = NULL;
|
|
||||||
|
|
||||||
pmhandle_t *_alpm_handle_new()
|
|
||||||
{
|
{
|
||||||
pmhandle_t *handle;
|
alpm_handle_t *handle;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
|
||||||
|
|
||||||
CALLOC(handle, 1, sizeof(pmhandle_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
return handle;
|
||||||
handle->lckfd = -1;
|
|
||||||
|
|
||||||
return(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_handle_free(pmhandle_t *handle)
|
void _alpm_handle_free(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(handle == NULL) {
|
if(handle == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -72,6 +64,11 @@ void _alpm_handle_free(pmhandle_t *handle)
|
|||||||
closelog();
|
closelog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
/* release curl handle */
|
||||||
|
curl_easy_cleanup(handle->curl);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
_alpm_trans_free(handle->trans);
|
_alpm_trans_free(handle->trans);
|
||||||
FREE(handle->root);
|
FREE(handle->root);
|
||||||
@@ -80,355 +77,364 @@ void _alpm_handle_free(pmhandle_t *handle)
|
|||||||
FREE(handle->logfile);
|
FREE(handle->logfile);
|
||||||
FREE(handle->lockfile);
|
FREE(handle->lockfile);
|
||||||
FREE(handle->arch);
|
FREE(handle->arch);
|
||||||
|
FREE(handle->gpgdir);
|
||||||
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->ignoregrp);
|
FREELIST(handle->ignoregroup);
|
||||||
FREE(handle);
|
FREE(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_log SYMEXPORT alpm_option_get_logcb()
|
/** Lock the database */
|
||||||
|
int _alpm_handle_lock(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
int fd;
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
char *dir, *ptr;
|
||||||
return NULL;
|
|
||||||
|
ASSERT(handle->lockfile != NULL, return -1);
|
||||||
|
ASSERT(handle->lckstream == NULL, return 0);
|
||||||
|
|
||||||
|
/* create the dir of the lockfile first */
|
||||||
|
dir = strdup(handle->lockfile);
|
||||||
|
ptr = strrchr(dir, '/');
|
||||||
|
if(ptr) {
|
||||||
|
*ptr = '\0';
|
||||||
}
|
}
|
||||||
|
if(_alpm_makepath(dir)) {
|
||||||
|
FREE(dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
FREE(dir);
|
||||||
|
|
||||||
|
do {
|
||||||
|
fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000);
|
||||||
|
} while(fd == -1 && errno == EINTR);
|
||||||
|
if(fd >= 0) {
|
||||||
|
FILE *f = fdopen(fd, "w");
|
||||||
|
fprintf(f, "%ld\n", (long)getpid());
|
||||||
|
fflush(f);
|
||||||
|
fsync(fd);
|
||||||
|
handle->lckstream = f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Remove a lock file */
|
||||||
|
int _alpm_handle_unlock(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
ASSERT(handle->lockfile != NULL, return -1);
|
||||||
|
ASSERT(handle->lckstream != NULL, return 0);
|
||||||
|
|
||||||
|
fclose(handle->lckstream);
|
||||||
|
handle->lckstream = NULL;
|
||||||
|
|
||||||
|
if(unlink(handle->lockfile) && errno != ENOENT) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
alpm_cb_log SYMEXPORT alpm_option_get_logcb(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->logcb;
|
return handle->logcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
|
alpm_cb_download SYMEXPORT alpm_option_get_dlcb(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->dlcb;
|
return handle->dlcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb()
|
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->fetchcb;
|
return handle->fetchcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
|
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->totaldlcb;
|
return handle->totaldlcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_root()
|
alpm_cb_event SYMEXPORT alpm_option_get_eventcb(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
return handle->eventcb;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
|
alpm_cb_question SYMEXPORT alpm_option_get_questioncb(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
return handle->questioncb;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_cb_progress SYMEXPORT alpm_option_get_progresscb(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
return handle->progresscb;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_option_get_root(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->root;
|
return handle->root;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_dbpath()
|
const char SYMEXPORT *alpm_option_get_dbpath(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->dbpath;
|
return handle->dbpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs()
|
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->cachedirs;
|
return handle->cachedirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_logfile()
|
const char SYMEXPORT *alpm_option_get_logfile(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->logfile;
|
return handle->logfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_lockfile()
|
const char SYMEXPORT *alpm_option_get_lockfile(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->lockfile;
|
return handle->lockfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usesyslog()
|
const char SYMEXPORT *alpm_option_get_gpgdir(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
return handle->gpgdir;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
int SYMEXPORT alpm_option_get_usesyslog(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
return handle->usesyslog;
|
return handle->usesyslog;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_noupgrades()
|
alpm_list_t SYMEXPORT *alpm_option_get_noupgrades(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->noupgrade;
|
return handle->noupgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_noextracts()
|
alpm_list_t SYMEXPORT *alpm_option_get_noextracts(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->noextract;
|
return handle->noextract;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs()
|
alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->ignorepkg;
|
return handle->ignorepkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
alpm_list_t SYMEXPORT *alpm_option_get_ignoregroups(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
return handle->ignoregroup;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->ignoregrp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_arch()
|
const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->arch;
|
return handle->arch;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usedelta()
|
int SYMEXPORT alpm_option_get_usedelta(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return -1);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return handle->usedelta;
|
return handle->usedelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return -1);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
return handle->checkspace;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
|
alpm_db_t SYMEXPORT *alpm_option_get_localdb(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->db_local;
|
return handle->db_local;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs()
|
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return NULL);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle->dbs_sync;
|
return handle->dbs_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_logcb(alpm_cb_log cb)
|
int SYMEXPORT alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return -1);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handle->logcb = cb;
|
handle->logcb = cb;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_dlcb(alpm_cb_download cb)
|
int SYMEXPORT alpm_option_set_dlcb(alpm_handle_t *handle, alpm_cb_download cb)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return -1);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handle->dlcb = cb;
|
handle->dlcb = cb;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_fetchcb(alpm_cb_fetch cb)
|
int SYMEXPORT alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return -1);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handle->fetchcb = cb;
|
handle->fetchcb = cb;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_totaldlcb(alpm_cb_totaldl cb)
|
int SYMEXPORT alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb)
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
CHECK_HANDLE(handle, return -1);
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handle->totaldlcb = cb;
|
handle->totaldlcb = cb;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_root(const char *root)
|
int SYMEXPORT alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb)
|
||||||
{
|
{
|
||||||
struct stat st;
|
CHECK_HANDLE(handle, return -1);
|
||||||
char *realroot;
|
handle->eventcb = cb;
|
||||||
size_t rootlen;
|
return 0;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(!root) {
|
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if(stat(root, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
realroot = calloc(PATH_MAX+1, sizeof(char));
|
|
||||||
if(!realpath(root, realroot)) {
|
|
||||||
FREE(realroot);
|
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* verify root ends in a '/' */
|
|
||||||
rootlen = strlen(realroot);
|
|
||||||
if(realroot[rootlen-1] != '/') {
|
|
||||||
rootlen += 1;
|
|
||||||
}
|
|
||||||
if(handle->root) {
|
|
||||||
FREE(handle->root);
|
|
||||||
}
|
|
||||||
handle->root = calloc(rootlen + 1, sizeof(char));
|
|
||||||
strncpy(handle->root, realroot, rootlen);
|
|
||||||
handle->root[rootlen-1] = '/';
|
|
||||||
FREE(realroot);
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "option 'root' = %s\n", handle->root);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
|
int SYMEXPORT alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb)
|
||||||
{
|
{
|
||||||
struct stat st;
|
CHECK_HANDLE(handle, return -1);
|
||||||
size_t dbpathlen, lockfilelen;
|
handle->questioncb = cb;
|
||||||
const char *lf = "db.lck";
|
return 0;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
if(!dbpath) {
|
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if(stat(dbpath, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
/* verify dbpath ends in a '/' */
|
|
||||||
dbpathlen = strlen(dbpath);
|
|
||||||
if(dbpath[dbpathlen-1] != '/') {
|
|
||||||
dbpathlen += 1;
|
|
||||||
}
|
|
||||||
if(handle->dbpath) {
|
|
||||||
FREE(handle->dbpath);
|
|
||||||
}
|
|
||||||
handle->dbpath = calloc(dbpathlen+1, sizeof(char));
|
|
||||||
strncpy(handle->dbpath, dbpath, dbpathlen);
|
|
||||||
handle->dbpath[dbpathlen-1] = '/';
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "option 'dbpath' = %s\n", handle->dbpath);
|
|
||||||
|
|
||||||
if(handle->lockfile) {
|
|
||||||
FREE(handle->lockfile);
|
|
||||||
}
|
|
||||||
lockfilelen = strlen(handle->dbpath) + strlen(lf) + 1;
|
|
||||||
handle->lockfile = calloc(lockfilelen, sizeof(char));
|
|
||||||
snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf);
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "option 'lockfile' = %s\n", handle->lockfile);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
|
int SYMEXPORT alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
handle->progresscb = cb;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *canonicalize_path(const char *path) {
|
||||||
|
char *new_path;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
/* verify path ends in a '/' */
|
||||||
|
len = strlen(path);
|
||||||
|
if(path[len - 1] != '/') {
|
||||||
|
len += 1;
|
||||||
|
}
|
||||||
|
CALLOC(new_path, len + 1, sizeof(char), return NULL);
|
||||||
|
strcpy(new_path, path);
|
||||||
|
new_path[len - 1] = '/';
|
||||||
|
return new_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
||||||
|
char **storage, int must_exist)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
char *real = NULL;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
path = value;
|
||||||
|
if(!path) {
|
||||||
|
return ALPM_ERR_WRONG_ARGS;
|
||||||
|
}
|
||||||
|
if(must_exist) {
|
||||||
|
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||||
|
return ALPM_ERR_NOT_A_DIR;
|
||||||
|
}
|
||||||
|
CALLOC(real, PATH_MAX, sizeof(char), return ALPM_ERR_MEMORY);
|
||||||
|
if(!realpath(path, real)) {
|
||||||
|
free(real);
|
||||||
|
return ALPM_ERR_NOT_A_DIR;
|
||||||
|
}
|
||||||
|
path = real;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*storage) {
|
||||||
|
FREE(*storage);
|
||||||
|
}
|
||||||
|
*storage = canonicalize_path(path);
|
||||||
|
if(!*storage) {
|
||||||
|
return ALPM_ERR_MEMORY;
|
||||||
|
}
|
||||||
|
free(real);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir)
|
||||||
{
|
{
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
size_t cachedirlen;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
ASSERT(cachedir != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
if(!cachedir) {
|
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
/* don't stat the cachedir yet, as it may not even be needed. we can
|
/* don't stat the cachedir yet, as it may not even be needed. we can
|
||||||
* fail later if it is needed and the path is invalid. */
|
* fail later if it is needed and the path is invalid. */
|
||||||
|
|
||||||
/* verify cachedir ends in a '/' */
|
newcachedir = canonicalize_path(cachedir);
|
||||||
cachedirlen = strlen(cachedir);
|
if(!newcachedir) {
|
||||||
if(cachedir[cachedirlen-1] != '/') {
|
RET_ERR(handle, ALPM_ERR_MEMORY, -1);
|
||||||
cachedirlen += 1;
|
|
||||||
}
|
}
|
||||||
newcachedir = calloc(cachedirlen + 1, sizeof(char));
|
|
||||||
strncpy(newcachedir, cachedir, cachedirlen);
|
|
||||||
newcachedir[cachedirlen-1] = '/';
|
|
||||||
handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir);
|
handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir);
|
||||||
_alpm_log(PM_LOG_DEBUG, "option 'cachedir' = %s\n", newcachedir);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'cachedir' = %s\n", newcachedir);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
|
int SYMEXPORT alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs)
|
||||||
{
|
{
|
||||||
if(handle->cachedirs) FREELIST(handle->cachedirs);
|
alpm_list_t *i;
|
||||||
if(cachedirs) handle->cachedirs = cachedirs;
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
if(handle->cachedirs) {
|
||||||
|
FREELIST(handle->cachedirs);
|
||||||
|
}
|
||||||
|
for(i = cachedirs; i; i = i->next) {
|
||||||
|
int ret = alpm_option_add_cachedir(handle, i->data);
|
||||||
|
if(ret) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
|
int SYMEXPORT alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
size_t cachedirlen;
|
CHECK_HANDLE(handle, return -1);
|
||||||
/* verify cachedir ends in a '/' */
|
ASSERT(cachedir != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
cachedirlen = strlen(cachedir);
|
|
||||||
if(cachedir[cachedirlen-1] != '/') {
|
newcachedir = canonicalize_path(cachedir);
|
||||||
cachedirlen += 1;
|
if(!newcachedir) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_MEMORY, -1);
|
||||||
}
|
}
|
||||||
newcachedir = calloc(cachedirlen + 1, sizeof(char));
|
|
||||||
strncpy(newcachedir, cachedir, cachedirlen);
|
|
||||||
newcachedir[cachedirlen-1] = '/';
|
|
||||||
handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata);
|
handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata);
|
||||||
FREE(newcachedir);
|
FREE(newcachedir);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_logfile(const char *logfile)
|
int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile)
|
||||||
{
|
{
|
||||||
char *oldlogfile = handle->logfile;
|
char *oldlogfile = handle->logfile;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|
||||||
if(!logfile) {
|
if(!logfile) {
|
||||||
pm_errno = PM_ERR_WRONG_ARGS;
|
handle->pm_errno = ALPM_ERR_WRONG_ARGS;
|
||||||
return(-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->logfile = strdup(logfile);
|
handle->logfile = strdup(logfile);
|
||||||
@@ -442,112 +448,186 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
|
|||||||
fclose(handle->logstream);
|
fclose(handle->logstream);
|
||||||
handle->logstream = NULL;
|
handle->logstream = NULL;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "option 'logfile' = %s\n", handle->logfile);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'logfile' = %s\n", handle->logfile);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_usesyslog(int usesyslog)
|
int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
if(!gpgdir) {
|
||||||
|
handle->pm_errno = ALPM_ERR_WRONG_ARGS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(handle->gpgdir) {
|
||||||
|
FREE(handle->gpgdir);
|
||||||
|
}
|
||||||
|
handle->gpgdir = strdup(gpgdir);
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'gpgdir' = %s\n", handle->gpgdir);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->usesyslog = usesyslog;
|
handle->usesyslog = usesyslog;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_noupgrade(const char *pkg)
|
int SYMEXPORT alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade)
|
int SYMEXPORT alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->noupgrade) FREELIST(handle->noupgrade);
|
if(handle->noupgrade) FREELIST(handle->noupgrade);
|
||||||
if(noupgrade) handle->noupgrade = noupgrade;
|
handle->noupgrade = alpm_list_strdup(noupgrade);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg)
|
int SYMEXPORT alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &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;
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_noextract(const char *pkg)
|
int SYMEXPORT alpm_option_add_noextract(alpm_handle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract)
|
int SYMEXPORT alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->noextract) FREELIST(handle->noextract);
|
if(handle->noextract) FREELIST(handle->noextract);
|
||||||
if(noextract) handle->noextract = noextract;
|
handle->noextract = alpm_list_strdup(noextract);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_noextract(const char *pkg)
|
int SYMEXPORT alpm_option_remove_noextract(alpm_handle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &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;
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_ignorepkg(const char *pkg)
|
int SYMEXPORT alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
|
int SYMEXPORT alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
|
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
|
||||||
if(ignorepkgs) handle->ignorepkg = ignorepkgs;
|
handle->ignorepkg = alpm_list_strdup(ignorepkgs);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_ignorepkg(const char *pkg)
|
int SYMEXPORT alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
|
handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_ignoregrp(const char *grp)
|
int SYMEXPORT alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp)
|
||||||
{
|
{
|
||||||
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
handle->ignoregroup = alpm_list_add(handle->ignoregroup, strdup(grp));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
|
int SYMEXPORT alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps)
|
||||||
{
|
{
|
||||||
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(ignoregrps) handle->ignoregrp = ignoregrps;
|
if(handle->ignoregroup) FREELIST(handle->ignoregroup);
|
||||||
|
handle->ignoregroup = alpm_list_strdup(ignoregrps);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
|
int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
handle->ignoregroup = alpm_list_remove_str(handle->ignoregroup, grp, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_arch(const char *arch)
|
int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->arch) FREE(handle->arch);
|
if(handle->arch) FREE(handle->arch);
|
||||||
if(arch) handle->arch = strdup(arch);
|
if(arch) {
|
||||||
|
handle->arch = strdup(arch);
|
||||||
|
} else {
|
||||||
|
handle->arch = NULL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_usedelta(int usedelta)
|
int SYMEXPORT alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->usedelta = usedelta;
|
handle->usedelta = usedelta;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
handle->checkspace = checkspace;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle,
|
||||||
|
alpm_siglevel_t level)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
#ifdef HAVE_LIBGPGME
|
||||||
|
handle->siglevel = level;
|
||||||
|
#else
|
||||||
|
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_siglevel_t SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
return handle->siglevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* handle.h
|
* handle.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -24,49 +24,86 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "db.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "trans.h"
|
|
||||||
|
|
||||||
typedef struct _pmhandle_t {
|
#ifdef HAVE_LIBCURL
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EVENT(h, e, d1, d2) \
|
||||||
|
do { \
|
||||||
|
if((h)->eventcb) { \
|
||||||
|
(h)->eventcb(e, d1, d2); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
#define QUESTION(h, q, d1, d2, d3, r) \
|
||||||
|
do { \
|
||||||
|
if((h)->questioncb) { \
|
||||||
|
(h)->questioncb(q, d1, d2, d3, r); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
#define PROGRESS(h, e, p, per, n, r) \
|
||||||
|
do { \
|
||||||
|
if((h)->progresscb) { \
|
||||||
|
(h)->progresscb(e, p, per, n, r); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
struct __alpm_handle_t {
|
||||||
/* internal usage */
|
/* internal usage */
|
||||||
pmdb_t *db_local; /* local db pointer */
|
alpm_db_t *db_local; /* local db pointer */
|
||||||
alpm_list_t *dbs_sync; /* List of (pmdb_t *) */
|
alpm_list_t *dbs_sync; /* List of (alpm_db_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;
|
alpm_trans_t *trans;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
/* libcurl handle */
|
||||||
|
CURL *curl; /* reusable curl_easy handle */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 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_totaldl totaldlcb; /* Total download callback function */
|
||||||
alpm_cb_fetch fetchcb; /* Download file callback function */
|
alpm_cb_fetch fetchcb; /* Download file callback function */
|
||||||
|
alpm_cb_event eventcb;
|
||||||
|
alpm_cb_question questioncb;
|
||||||
|
alpm_cb_progress progresscb;
|
||||||
|
|
||||||
/* filesystem paths */
|
/* filesystem paths */
|
||||||
char *root; /* Root path, default '/' */
|
char *root; /* Root path, default '/' */
|
||||||
char *dbpath; /* Base path to pacman's DBs */
|
char *dbpath; /* Base path to pacman's DBs */
|
||||||
char *logfile; /* Name of the log file */
|
char *logfile; /* Name of the log file */
|
||||||
char *lockfile; /* Name of the lock file */
|
char *lockfile; /* Name of the lock file */
|
||||||
|
char *gpgdir; /* Directory where GnuPG files are stored */
|
||||||
alpm_list_t *cachedirs; /* Paths to pacman cache directories */
|
alpm_list_t *cachedirs; /* Paths to pacman cache directories */
|
||||||
|
|
||||||
/* 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 files NOT to extract */
|
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 *ignoregrp; /* List of groups to ignore */
|
alpm_list_t *ignoregroup; /* List of groups to ignore */
|
||||||
|
|
||||||
/* options */
|
/* options */
|
||||||
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
||||||
char *arch; /* Architecture of packages we should allow */
|
char *arch; /* Architecture of packages we should allow */
|
||||||
int usedelta; /* Download deltas if possible */
|
int usedelta; /* Download deltas if possible */
|
||||||
} pmhandle_t;
|
int checkspace; /* Check disk space before installing */
|
||||||
|
alpm_siglevel_t siglevel; /* Default signature verification level */
|
||||||
|
|
||||||
/* global handle variable */
|
/* error code */
|
||||||
extern pmhandle_t *handle;
|
enum _alpm_errno_t pm_errno;
|
||||||
|
};
|
||||||
|
|
||||||
pmhandle_t *_alpm_handle_new();
|
alpm_handle_t *_alpm_handle_new(void);
|
||||||
void _alpm_handle_free(pmhandle_t *handle);
|
void _alpm_handle_free(alpm_handle_t *handle);
|
||||||
|
|
||||||
|
int _alpm_handle_lock(alpm_handle_t *handle);
|
||||||
|
int _alpm_handle_unlock(alpm_handle_t *handle);
|
||||||
|
|
||||||
|
enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
||||||
|
char **storage, int must_exist);
|
||||||
|
|
||||||
#endif /* _ALPM_HANDLE_H */
|
#endif /* _ALPM_HANDLE_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* log.c
|
* log.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -22,10 +22,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -39,18 +36,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** A printf-like function for logging.
|
/** A printf-like function for logging.
|
||||||
|
* @param handle the context handle
|
||||||
* @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(alpm_handle_t *handle, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ASSERT(handle != NULL, return -1);
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
|
||||||
|
|
||||||
/* check if the logstream is open already, opening it if needed */
|
/* check if the logstream is open already, opening it if needed */
|
||||||
if(handle->logstream == NULL) {
|
if(handle->logstream == NULL) {
|
||||||
@@ -58,18 +53,18 @@ int SYMEXPORT alpm_logaction(char *fmt, ...)
|
|||||||
/* if we couldn't open it, we have an issue */
|
/* if we couldn't open it, we have an issue */
|
||||||
if(handle->logstream == NULL) {
|
if(handle->logstream == NULL) {
|
||||||
if(errno == EACCES) {
|
if(errno == EACCES) {
|
||||||
pm_errno = PM_ERR_BADPERMS;
|
handle->pm_errno = ALPM_ERR_BADPERMS;
|
||||||
} else if(errno == ENOENT) {
|
} else if(errno == ENOENT) {
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
handle->pm_errno = ALPM_ERR_NOT_A_DIR;
|
||||||
} else {
|
} else {
|
||||||
pm_errno = PM_ERR_SYSTEM;
|
handle->pm_errno = ALPM_ERR_SYSTEM;
|
||||||
}
|
}
|
||||||
return(-1);
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ret = _alpm_logaction(handle->usesyslog, handle->logstream, fmt, args);
|
ret = _alpm_logaction(handle, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
/* TODO We should add a prefix to log strings depending on who called us.
|
/* TODO We should add a prefix to log strings depending on who called us.
|
||||||
@@ -83,22 +78,21 @@ int SYMEXPORT alpm_logaction(char *fmt, ...)
|
|||||||
* kpacman: "KPACMAN"
|
* kpacman: "KPACMAN"
|
||||||
* This would allow us to share the log file between several frontends
|
* This would allow us to share the log file between several frontends
|
||||||
* and know who does what */
|
* and know who does what */
|
||||||
return(ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
void _alpm_log(pmloglevel_t flag, char *fmt, ...)
|
void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
alpm_cb_log logcb = alpm_option_get_logcb();
|
|
||||||
|
|
||||||
if(logcb == NULL) {
|
if(handle == NULL || handle->logcb == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
logcb(flag, fmt, args);
|
handle->logcb(flag, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* log.h
|
* log.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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
|
||||||
@@ -22,14 +22,8 @@
|
|||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
#ifdef PACMAN_DEBUG
|
void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag,
|
||||||
/* Log funtion entry points if debugging is enabled */
|
const char *fmt, ...) __attribute__((format(printf,3,4)));
|
||||||
#define ALPM_LOG_FUNC _alpm_log(PM_LOG_FUNCTION, "Enter %s\n", __func__)
|
|
||||||
#else
|
|
||||||
#define ALPM_LOG_FUNC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void _alpm_log(pmloglevel_t flag, char *fmt, ...) __attribute__((format(printf,2,3)));
|
|
||||||
|
|
||||||
#endif /* _ALPM_LOG_H */
|
#endif /* _ALPM_LOG_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* RFC 1321 compliant MD5 implementation
|
* RFC 1321 compliant MD5 implementation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2007 Christophe Devine
|
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||||
|
*
|
||||||
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||||
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -24,25 +29,18 @@
|
|||||||
/*
|
/*
|
||||||
* Pacman Notes:
|
* Pacman Notes:
|
||||||
*
|
*
|
||||||
* Taken from the XySSL project at www.xyssl.org under terms of the
|
* Taken from the PolarSSL project at http://polarssl.org under terms of the
|
||||||
* GPL. This is from version 0.9 of the library, and has been modified
|
* GPL. This is from version 1.0.0 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
|
* * remove "polarssl/config.h" include
|
||||||
* * change include from "xyssl/md5.h" to "md5.h"
|
* * change include from "polarssl/sha2.h" to "sha2.h"
|
||||||
* * removal of HMAC code
|
* * removal of HMAC code
|
||||||
* * removal of SELF_TEST code
|
* * removal of SELF_TEST code
|
||||||
* * removal of ipad and opad from the md5_context struct in md5.h
|
* * removal of ipad and opad from the md5_context struct in sha2.h
|
||||||
* * change of md5_file prototype from
|
* * increase the size of buffer for performance reasons
|
||||||
* int md5_file( char *path, unsigned char *output )
|
* * various static changes
|
||||||
* to
|
|
||||||
* int md5_file( const char *path, unsigned char *output )
|
|
||||||
* * 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
@@ -73,7 +71,7 @@
|
|||||||
/*
|
/*
|
||||||
* MD5 context setup
|
* MD5 context setup
|
||||||
*/
|
*/
|
||||||
static inline void md5_starts( md5_context *ctx )
|
static void md5_starts( md5_context *ctx )
|
||||||
{
|
{
|
||||||
ctx->total[0] = 0;
|
ctx->total[0] = 0;
|
||||||
ctx->total[1] = 0;
|
ctx->total[1] = 0;
|
||||||
@@ -84,7 +82,7 @@ static inline void md5_starts( md5_context *ctx )
|
|||||||
ctx->state[3] = 0x10325476;
|
ctx->state[3] = 0x10325476;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void md5_process( md5_context *ctx, unsigned char data[64] )
|
static void md5_process( md5_context *ctx, const unsigned char data[64] )
|
||||||
{
|
{
|
||||||
unsigned long X[16], A, B, C, D;
|
unsigned long X[16], A, B, C, D;
|
||||||
|
|
||||||
@@ -158,7 +156,7 @@ static inline void md5_process( md5_context *ctx, unsigned char data[64] )
|
|||||||
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
|
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
|
||||||
|
|
||||||
#undef F
|
#undef F
|
||||||
|
|
||||||
#define F(x,y,z) (x ^ y ^ z)
|
#define F(x,y,z) (x ^ y ^ z)
|
||||||
|
|
||||||
P( A, B, C, D, 5, 4, 0xFFFA3942 );
|
P( A, B, C, D, 5, 4, 0xFFFA3942 );
|
||||||
@@ -210,9 +208,9 @@ static inline void md5_process( md5_context *ctx, unsigned char data[64] )
|
|||||||
/*
|
/*
|
||||||
* MD5 process buffer
|
* MD5 process buffer
|
||||||
*/
|
*/
|
||||||
static inline void md5_update( md5_context *ctx, unsigned char *input, int ilen )
|
static void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen )
|
||||||
{
|
{
|
||||||
int fill;
|
size_t fill;
|
||||||
unsigned long left;
|
unsigned long left;
|
||||||
|
|
||||||
if( ilen <= 0 )
|
if( ilen <= 0 )
|
||||||
@@ -221,7 +219,7 @@ static inline void md5_update( md5_context *ctx, unsigned char *input, int ilen
|
|||||||
left = ctx->total[0] & 0x3F;
|
left = ctx->total[0] & 0x3F;
|
||||||
fill = 64 - left;
|
fill = 64 - left;
|
||||||
|
|
||||||
ctx->total[0] += ilen;
|
ctx->total[0] += (unsigned long) ilen;
|
||||||
ctx->total[0] &= 0xFFFFFFFF;
|
ctx->total[0] &= 0xFFFFFFFF;
|
||||||
|
|
||||||
if( ctx->total[0] < (unsigned long) ilen )
|
if( ctx->total[0] < (unsigned long) ilen )
|
||||||
@@ -251,7 +249,7 @@ static inline void md5_update( md5_context *ctx, unsigned char *input, int ilen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char md5_padding[64] =
|
static const unsigned char md5_padding[64] =
|
||||||
{
|
{
|
||||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
@@ -262,7 +260,7 @@ static unsigned char md5_padding[64] =
|
|||||||
/*
|
/*
|
||||||
* MD5 final digest
|
* MD5 final digest
|
||||||
*/
|
*/
|
||||||
static inline void md5_finish( md5_context *ctx, unsigned char output[16] )
|
static 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;
|
||||||
@@ -290,7 +288,7 @@ static inline void md5_finish( md5_context *ctx, unsigned char output[16] )
|
|||||||
/*
|
/*
|
||||||
* output = MD5( input buffer )
|
* output = MD5( input buffer )
|
||||||
*/
|
*/
|
||||||
void md5( unsigned char *input, int ilen, unsigned char output[16] )
|
void md5( const unsigned char *input, size_t ilen, unsigned char output[16] )
|
||||||
{
|
{
|
||||||
md5_context ctx;
|
md5_context ctx;
|
||||||
|
|
||||||
@@ -309,7 +307,7 @@ 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[4096];
|
||||||
|
|
||||||
if( ( f = fopen( path, "rb" ) ) == NULL )
|
if( ( f = fopen( path, "rb" ) ) == NULL )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
@@ -317,7 +315,7 @@ int md5_file( const char *path, unsigned char output[16] )
|
|||||||
md5_starts( &ctx );
|
md5_starts( &ctx );
|
||||||
|
|
||||||
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
||||||
md5_update( &ctx, buf, (int) n );
|
md5_update( &ctx, buf, n );
|
||||||
|
|
||||||
md5_finish( &ctx, output );
|
md5_finish( &ctx, output );
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user