mirror of
https://gitlab.archlinux.org/pacman/pacman.git
synced 2025-11-07 02:54:40 +01:00
Compare commits
1204 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a0c659a16 | ||
|
|
c81615f38c | ||
|
|
d985a62172 | ||
|
|
cd421c8383 | ||
|
|
85fde7038f | ||
|
|
31d51052e1 | ||
|
|
4283199039 | ||
|
|
1b08e26846 | ||
|
|
3e0e748b93 | ||
|
|
450be928da | ||
|
|
d080a469a0 | ||
|
|
dd62fde53e | ||
|
|
fe794ccb25 | ||
|
|
f1d74d928a | ||
|
|
7d2c7fb347 | ||
|
|
d235f54114 | ||
|
|
8335e169a6 | ||
|
|
1ed881fed3 | ||
|
|
090c4006d7 | ||
|
|
8be08f7cae | ||
|
|
72c6d19d64 | ||
|
|
a4a7336dff | ||
|
|
35289bc17e | ||
|
|
692633264a | ||
|
|
34da9d25e4 | ||
|
|
0aa9628560 | ||
|
|
91b9ea922a | ||
|
|
c5a4b35528 | ||
|
|
c1dfdd2010 | ||
|
|
99b8d78bc6 | ||
|
|
769facca22 | ||
|
|
597286eb25 | ||
|
|
695f0e443e | ||
|
|
7e0f528274 | ||
|
|
2bf2700b74 | ||
|
|
b7c994db8b | ||
|
|
3de8f8f1cc | ||
|
|
32c91e2895 | ||
|
|
95c68d26ef | ||
|
|
0f486adfec | ||
|
|
f9280a0523 | ||
|
|
0f05bfc340 | ||
|
|
7b10519835 | ||
|
|
b5a7734a7e | ||
|
|
5caf143faa | ||
|
|
e9639ad172 | ||
|
|
8d3ee29809 | ||
|
|
afc77a808d | ||
|
|
c85d155f3a | ||
|
|
950443a438 | ||
|
|
d5c0f39144 | ||
|
|
a6291858cc | ||
|
|
3f00a03db4 | ||
|
|
d413178354 | ||
|
|
a31e8bdff6 | ||
|
|
38f0a7d462 | ||
|
|
f797749c4e | ||
|
|
bf3618a7c1 | ||
|
|
6e2c15099a | ||
|
|
fb522face1 | ||
|
|
cd6ca88c49 | ||
|
|
3eee3d67af | ||
|
|
47a7ea8c86 | ||
|
|
66fe80f39b | ||
|
|
a554e1a460 | ||
|
|
aa550a85f1 | ||
|
|
a97f792d3c | ||
|
|
9cd344fb0d | ||
|
|
b2ea5f6860 | ||
|
|
e42e9ab873 | ||
|
|
0ba9b262ab | ||
|
|
342924f796 | ||
|
|
fa620685fa | ||
|
|
8c33d7f1ef | ||
|
|
f3f257405b | ||
|
|
d5a06e964c | ||
|
|
9ec049f518 | ||
|
|
0d99b54ba2 | ||
|
|
163c36bdcd | ||
|
|
62f828014f | ||
|
|
d35a7fb6f3 | ||
|
|
6c870953c5 | ||
|
|
63f04177c3 | ||
|
|
1e21aa589d | ||
|
|
0cb963df03 | ||
|
|
c5652361fb | ||
|
|
1366da57fa | ||
|
|
6a85e4a9ca | ||
|
|
b878157c78 | ||
|
|
f9be4eed42 | ||
|
|
312e9252f4 | ||
|
|
41ef7eff75 | ||
|
|
0e5c22e7a1 | ||
|
|
0d4ecae625 | ||
|
|
1b78e2bb1a | ||
|
|
8fd62a39b5 | ||
|
|
704ab17a6a | ||
|
|
8db7e0c98d | ||
|
|
e43c271650 | ||
|
|
c9b7f9b0d0 | ||
|
|
0ff57350fb | ||
|
|
43a2f63194 | ||
|
|
2259dff7f3 | ||
|
|
93fa63ee8a | ||
|
|
fcdaa46b65 | ||
|
|
06d761a020 | ||
|
|
ce9fd69eba | ||
|
|
9876d97839 | ||
|
|
51276f1ac5 | ||
|
|
08a1244f4e | ||
|
|
d90641a894 | ||
|
|
6e0c47d22f | ||
|
|
f8ed8620d0 | ||
|
|
5a67eee78c | ||
|
|
79d60f0f42 | ||
|
|
81f945e2a5 | ||
|
|
9d99914a18 | ||
|
|
2c91b991ee | ||
|
|
65650f2cdb | ||
|
|
e292b1b5a2 | ||
|
|
32f3b4304c | ||
|
|
7dd1a5a58d | ||
|
|
326345b378 | ||
|
|
46c10c5bf3 | ||
|
|
ce06e6f9b9 | ||
|
|
5dada13a1a | ||
|
|
e8130b8f2c | ||
|
|
6582f68c9d | ||
|
|
c8c7a51374 | ||
|
|
ea42d03ea1 | ||
|
|
ce5ee8a065 | ||
|
|
b4459f1e04 | ||
|
|
ef5feb15a7 | ||
|
|
098cfe516d | ||
|
|
8b03b1a877 | ||
|
|
6831a5f4b1 | ||
|
|
a03f5f55cd | ||
|
|
017184fab5 | ||
|
|
1b39653e96 | ||
|
|
a98bb96b43 | ||
|
|
e6b8d5189f | ||
|
|
8e2648bf02 | ||
|
|
3d142fe8ef | ||
|
|
63baba13ec | ||
|
|
972528c021 | ||
|
|
34749e177d | ||
|
|
19754b34a3 | ||
|
|
083ac51816 | ||
|
|
9995510dc8 | ||
|
|
4a1d93b92c | ||
|
|
0bbc406ee8 | ||
|
|
8803ae3b4d | ||
|
|
bc747fbfbf | ||
|
|
d5a5a6b512 | ||
|
|
578dfcd977 | ||
|
|
158a249a77 | ||
|
|
c1a84c03b2 | ||
|
|
0a5b79e133 | ||
|
|
540cae816a | ||
|
|
26a79cb29d | ||
|
|
8fe8233dfa | ||
|
|
87ffc648b7 | ||
|
|
1d0a69c655 | ||
|
|
3fa2830829 | ||
|
|
05b0d7e799 | ||
|
|
42b492b2fd | ||
|
|
bafee395a6 | ||
|
|
572b1a5de7 | ||
|
|
390b08f18b | ||
|
|
9aead554bc | ||
|
|
d2ce93bc54 | ||
|
|
17d4ec5ed8 | ||
|
|
711b6d3911 | ||
|
|
3068b52f9a | ||
|
|
829aeb2c2c | ||
|
|
5f5469c774 | ||
|
|
0d89c10f4b | ||
|
|
4ccf16dff5 | ||
|
|
31b9b264c1 | ||
|
|
198154962b | ||
|
|
05745089ac | ||
|
|
4ec6848f91 | ||
|
|
45b6d36cf7 | ||
|
|
c0835ff08e | ||
|
|
defa561558 | ||
|
|
fc0ec7644c | ||
|
|
2d832adf08 | ||
|
|
2f137fdd39 | ||
|
|
1631255357 | ||
|
|
ec339969d9 | ||
|
|
7956441350 | ||
|
|
5c5cdb0eb9 | ||
|
|
f170a94c13 | ||
|
|
274c3890b0 | ||
|
|
529cf928ab | ||
|
|
6617182229 | ||
|
|
7edd262a06 | ||
|
|
05d83c46fd | ||
|
|
33b3b6d9b8 | ||
|
|
3aece8f0ee | ||
|
|
e1e4bbb79d | ||
|
|
2a57c2068c | ||
|
|
266b3dd706 | ||
|
|
27067b1372 | ||
|
|
f21e1f54aa | ||
|
|
cb43bd8dfb | ||
|
|
8624eddb31 | ||
|
|
24a78fe731 | ||
|
|
66a9b53141 | ||
|
|
8308c7b320 | ||
|
|
457642231e | ||
|
|
6bbf6e8fa1 | ||
|
|
250aaefb27 | ||
|
|
a64a713fc2 | ||
|
|
89ecf8cabe | ||
|
|
e3d8197d67 | ||
|
|
801f7d1033 | ||
|
|
ad280e1b56 | ||
|
|
b27886ab59 | ||
|
|
132e1ac10c | ||
|
|
c628d649f6 | ||
|
|
4a8c2852a8 | ||
|
|
993700bc6b | ||
|
|
bb4d2b72c1 | ||
|
|
60b192e383 | ||
|
|
9c160cf3f3 | ||
|
|
7a83cd003a | ||
|
|
49c5f515e9 | ||
|
|
09295f7e40 | ||
|
|
86eefc1a3a | ||
|
|
b5709b8171 | ||
|
|
e13a3bf599 | ||
|
|
46e9afdd74 | ||
|
|
925d44bde6 | ||
|
|
b6320de4be | ||
|
|
27d9c25ee2 | ||
|
|
965e1de217 | ||
|
|
fe0586e240 | ||
|
|
b455bbc91d | ||
|
|
342f079f7e | ||
|
|
04821ea9ca | ||
|
|
241d6b884a | ||
|
|
d5a6ce8ca1 | ||
|
|
5aaf5bcf83 | ||
|
|
23f93118d0 | ||
|
|
163ba4016e | ||
|
|
495460d717 | ||
|
|
6a804d55dd | ||
|
|
dd3762edc4 | ||
|
|
2616cb5fdc | ||
|
|
038b1815d0 | ||
|
|
60d2588192 | ||
|
|
1dd3405813 | ||
|
|
5186f702d3 | ||
|
|
7d27b2b0f4 | ||
|
|
ddd2b9e6f6 | ||
|
|
01e093d0ae | ||
|
|
327c272bb4 | ||
|
|
cfd9f1cc69 | ||
|
|
18ddf90ff4 | ||
|
|
097d5a478b | ||
|
|
0445c68d9b | ||
|
|
da3a0333de | ||
|
|
ad3a26c615 | ||
|
|
f5d904d97f | ||
|
|
422a4021e4 | ||
|
|
a9ad5a75f2 | ||
|
|
1dc3de3f69 | ||
|
|
95f566d98a | ||
|
|
53d610e0a5 | ||
|
|
0c74ffd6b6 | ||
|
|
964640fbfc | ||
|
|
c8417f3386 | ||
|
|
5a5e712c74 | ||
|
|
8e736e1c9a | ||
|
|
62f1c590fc | ||
|
|
7a24f909fc | ||
|
|
d0e5cd2c7f | ||
|
|
9a24f1ffc5 | ||
|
|
63a2874fe4 | ||
|
|
eb9e74ecc7 | ||
|
|
0c2edbdd49 | ||
|
|
4a427dbc1b | ||
|
|
5a247ccbd4 | ||
|
|
927fdc0079 | ||
|
|
1c2cfc5bad | ||
|
|
9cd7ff807d | ||
|
|
948f135a73 | ||
|
|
88e7ea421e | ||
|
|
28d404f16a | ||
|
|
80bc89c147 | ||
|
|
2fad78974d | ||
|
|
c1abfeae1e | ||
|
|
6860e2f703 | ||
|
|
254329f6fb | ||
|
|
dbbe3e7cb4 | ||
|
|
13667fd4b1 | ||
|
|
7e8d9dfda2 | ||
|
|
a5e81f5599 | ||
|
|
bd4ff4a377 | ||
|
|
a53fd79632 | ||
|
|
6be96e7612 | ||
|
|
6c22ef2c82 | ||
|
|
7199fb3b1a | ||
|
|
a459156a4e | ||
|
|
d9e8197e60 | ||
|
|
8054a254cb | ||
|
|
1c0c292728 | ||
|
|
e1fdcfb145 | ||
|
|
c4c5b8ba1d | ||
|
|
6b1deedf15 | ||
|
|
3536975bbf | ||
|
|
3531533c2f | ||
|
|
86233476b0 | ||
|
|
0285c678ab | ||
|
|
3232c975c6 | ||
|
|
93148d0879 | ||
|
|
fbf96203ab | ||
|
|
fc35b16fd4 | ||
|
|
b1d614a01d | ||
|
|
b25dda737b | ||
|
|
fe8bd95092 | ||
|
|
ded25aeb98 | ||
|
|
40d6894910 | ||
|
|
768c8ba100 | ||
|
|
977489d9ab | ||
|
|
1d0ab50c05 | ||
|
|
b57ada336b | ||
|
|
2abe1f1646 | ||
|
|
3b02f80dcb | ||
|
|
ea452d0277 | ||
|
|
8b9cb8e03d | ||
|
|
306c274239 | ||
|
|
7a4f76c2af | ||
|
|
2d347132ba | ||
|
|
800799ea63 | ||
|
|
03ea8ca6a9 | ||
|
|
c926c39b04 | ||
|
|
34b52c9a60 | ||
|
|
8f5ee72974 | ||
|
|
7262f4bed4 | ||
|
|
8550680924 | ||
|
|
aa50df630c | ||
|
|
369c5aa7dd | ||
|
|
c4ab50584f | ||
|
|
f7558856b1 | ||
|
|
37de9df7c0 | ||
|
|
87f9377b32 | ||
|
|
e32d129967 | ||
|
|
ea35ce5d2e | ||
|
|
de7a5cf346 | ||
|
|
03f2e2360a | ||
|
|
140c76d328 | ||
|
|
9648887481 | ||
|
|
bad00696f3 | ||
|
|
89319b5bfd | ||
|
|
19b8298ce8 | ||
|
|
0fe562011c | ||
|
|
632912261a | ||
|
|
c52bb7030c | ||
|
|
527ae7092d | ||
|
|
a50d1bc9ab | ||
|
|
024bc44a25 | ||
|
|
0c95b294e9 | ||
|
|
8853a6f282 | ||
|
|
c9b31ad622 | ||
|
|
a818766c6e | ||
|
|
7e4aa9e524 | ||
|
|
d51902c978 | ||
|
|
062204daa1 | ||
|
|
c887ccf905 | ||
|
|
e0cd7b0293 | ||
|
|
4b129d4843 | ||
|
|
b1e75d7dd6 | ||
|
|
6c8def6ae0 | ||
|
|
7fd56118d0 | ||
|
|
b3e82ec59e | ||
|
|
2042b79bcc | ||
|
|
888020de90 | ||
|
|
cca9849fc2 | ||
|
|
aa6fe1160b | ||
|
|
682c9af846 | ||
|
|
91d119af1c | ||
|
|
57e06394dd | ||
|
|
1a04e2e11a | ||
|
|
a922d18056 | ||
|
|
e806414407 | ||
|
|
d338b3981d | ||
|
|
ec5e6d9029 | ||
|
|
d46bb6b27b | ||
|
|
72d3713cc7 | ||
|
|
70d8c2150e | ||
|
|
41dae68952 | ||
|
|
fa2eadcec7 | ||
|
|
eb87155391 | ||
|
|
6f47dfc920 | ||
|
|
e3772f7654 | ||
|
|
49dbebcc36 | ||
|
|
7193ce1ecd | ||
|
|
647b9ea6d9 | ||
|
|
eb25a18571 | ||
|
|
065b7f863a | ||
|
|
b782388f16 | ||
|
|
52550a2a0a | ||
|
|
d2669b4781 | ||
|
|
e94876089a | ||
|
|
f619bc61f5 | ||
|
|
cc6fb2e8a7 | ||
|
|
3fb934b59a | ||
|
|
a6bd14285d | ||
|
|
958b41fa5f | ||
|
|
ddbd36103d | ||
|
|
35ac4e7ef3 | ||
|
|
c5e7eeece7 | ||
|
|
8fe383860e | ||
|
|
7520c0facb | ||
|
|
e41ca0f2f6 | ||
|
|
392fffe241 | ||
|
|
e0daaea38c | ||
|
|
5c1ba2d5fd | ||
|
|
d7c3164fd5 | ||
|
|
ea3439f928 | ||
|
|
44e9fdd0e8 | ||
|
|
717fdb8ee0 | ||
|
|
d6f31dc788 | ||
|
|
0c62b36c19 | ||
|
|
47711947dd | ||
|
|
b1bb2eaa50 | ||
|
|
a98fce0896 | ||
|
|
ab8431c929 | ||
|
|
b58489d29a | ||
|
|
e183522e31 | ||
|
|
82c999a8bf | ||
|
|
377cc23a09 | ||
|
|
12866ba791 | ||
|
|
5951e9ce84 | ||
|
|
e253968b4d | ||
|
|
81dd6ddf0c | ||
|
|
d310b6f85c | ||
|
|
3a24e44206 | ||
|
|
19c2347507 | ||
|
|
da0dcc29cf | ||
|
|
c6e47cb435 | ||
|
|
9f751bf492 | ||
|
|
f556fe8b4a | ||
|
|
74274b5dc3 | ||
|
|
7245bc8e8e | ||
|
|
6a5370b634 | ||
|
|
1d32934769 | ||
|
|
9ce4f80db4 | ||
|
|
ac990b96e7 | ||
|
|
a64a8d6cea | ||
|
|
9a76a458b8 | ||
|
|
81bc390dc1 | ||
|
|
18e0a97209 | ||
|
|
7eb6dc2a9c | ||
|
|
8abef73ba9 | ||
|
|
c4ea4e017f | ||
|
|
e533478e02 | ||
|
|
363894e27b | ||
|
|
9f6a67fee7 | ||
|
|
fc9002188b | ||
|
|
9d3e59e311 | ||
|
|
c2fdc38b78 | ||
|
|
ceb2362209 | ||
|
|
5de465d63e | ||
|
|
233e5f610c | ||
|
|
26abe8f600 | ||
|
|
2671581123 | ||
|
|
951d23e3ec | ||
|
|
9e2078b179 | ||
|
|
3f202c7808 | ||
|
|
1bf05e706b | ||
|
|
9d9c12e4e2 | ||
|
|
92e20b508d | ||
|
|
7fd0d03795 | ||
|
|
d214c2347a | ||
|
|
5a9f5c60da | ||
|
|
4d31709787 | ||
|
|
678bdfb0d0 | ||
|
|
2e6cb69bf6 | ||
|
|
8c7202ca19 | ||
|
|
9dd42dc0da | ||
|
|
8a9c666a8c | ||
|
|
6d2fb6fd81 | ||
|
|
52a9a5240a | ||
|
|
82b7122542 | ||
|
|
e0afd81d18 | ||
|
|
dbc58d9386 | ||
|
|
20ff0cd40f | ||
|
|
1583a2079c | ||
|
|
953415c86a | ||
|
|
242411a1b4 | ||
|
|
22050f18f4 | ||
|
|
d38a1c02db | ||
|
|
6d10de881e | ||
|
|
ea4aa6f184 | ||
|
|
03acea832a | ||
|
|
1b494ab771 | ||
|
|
71fcb69028 | ||
|
|
b2a2a98297 | ||
|
|
ca4f8687f7 | ||
|
|
ac6ebcfe93 | ||
|
|
59dc631c9a | ||
|
|
2d0a00b409 | ||
|
|
00ab01e634 | ||
|
|
e07a2ab45e | ||
|
|
62dbf7ec43 | ||
|
|
f61f075b1c | ||
|
|
3f9cf8471f | ||
|
|
d85c71865e | ||
|
|
8679cd68d8 | ||
|
|
1eb6a9cbfe | ||
|
|
5f71570ec4 | ||
|
|
133d174e60 | ||
|
|
839953f111 | ||
|
|
70d425c1d3 | ||
|
|
0fc5aea027 | ||
|
|
b9fc709c55 | ||
|
|
d7b728591a | ||
|
|
6a8e50a69e | ||
|
|
ded66fbb62 | ||
|
|
8fb1948cd0 | ||
|
|
c27a946769 | ||
|
|
d158dde30c | ||
|
|
31091963ed | ||
|
|
468270ce4f | ||
|
|
8fe6791928 | ||
|
|
dca10b062f | ||
|
|
3a82885348 | ||
|
|
ca090e10d2 | ||
|
|
b729ed0109 | ||
|
|
a8a1b093eb | ||
|
|
ec91133e38 | ||
|
|
30ca48df4c | ||
|
|
4b95967bd0 | ||
|
|
5f77402577 | ||
|
|
793eff3704 | ||
|
|
7fcb445f35 | ||
|
|
cb5b66367d | ||
|
|
b2226ed11b | ||
|
|
059c572ca5 | ||
|
|
c5d951846d | ||
|
|
bcfc2155a0 | ||
|
|
f053141c87 | ||
|
|
569876f930 | ||
|
|
ecd6eddf13 | ||
|
|
87c4fb51a4 | ||
|
|
62e8812fb9 | ||
|
|
3be02aa27c | ||
|
|
42d408e0c2 | ||
|
|
cb5ae428b6 | ||
|
|
b5043dd6c3 | ||
|
|
923214497f | ||
|
|
1917c845f7 | ||
|
|
d11192c73a | ||
|
|
bb71d254e2 | ||
|
|
0fd477238f | ||
|
|
0666b13669 | ||
|
|
80a811ec96 | ||
|
|
6310bb5fbe | ||
|
|
4ca6590af5 | ||
|
|
3f1ea8b62f | ||
|
|
0145604728 | ||
|
|
b5b9860a2e | ||
|
|
b752561a52 | ||
|
|
3c5d5a19b3 | ||
|
|
297916e6a2 | ||
|
|
a8f03d07c7 | ||
|
|
114d121001 | ||
|
|
391769ff89 | ||
|
|
969dcddbdf | ||
|
|
72ba4fb83f | ||
|
|
d7f4e8fbcc | ||
|
|
ed353d91b7 | ||
|
|
1eeab12228 | ||
|
|
7f258619c6 | ||
|
|
be0e044404 | ||
|
|
c571bd7afb | ||
|
|
e66edf817b | ||
|
|
38c0ec868b | ||
|
|
8da489eac5 | ||
|
|
0972b7acfd | ||
|
|
e6f72c61a0 | ||
|
|
f988aa6b32 | ||
|
|
573bd80f14 | ||
|
|
44de3183ff | ||
|
|
03465ad6b6 | ||
|
|
d521f30f07 | ||
|
|
9e1a20022d | ||
|
|
56f821b72a | ||
|
|
930e93b892 | ||
|
|
89f4dd88d7 | ||
|
|
83e42dccce | ||
|
|
f41037358a | ||
|
|
952ee5e6cb | ||
|
|
47d0df6c10 | ||
|
|
5bda38196f | ||
|
|
ff58e5cb2d | ||
|
|
8de0631edb | ||
|
|
1a8c3e52d7 | ||
|
|
f34864cc9e | ||
|
|
4773c6b66e | ||
|
|
5c404268d9 | ||
|
|
bc311a24ce | ||
|
|
8d26df5ee5 | ||
|
|
708a227578 | ||
|
|
82abe079ab | ||
|
|
09a93b2e0e | ||
|
|
e85e77e6f9 | ||
|
|
00f29cbc14 | ||
|
|
6a636b2b6e | ||
|
|
1fe6cabc4d | ||
|
|
4ffa0401d2 | ||
|
|
cb64fbeac4 | ||
|
|
ea7fc8962a | ||
|
|
fbfcd86650 | ||
|
|
986e99a613 | ||
|
|
4b384b7f0b | ||
|
|
d1151b5ab9 | ||
|
|
687f7b6ba8 | ||
|
|
3849c3aec1 | ||
|
|
326c6a8eed | ||
|
|
5bbe342932 | ||
|
|
f8892b9d08 | ||
|
|
31d95b8679 | ||
|
|
78adb71f20 | ||
|
|
fe659153d5 | ||
|
|
4899b5bd86 | ||
|
|
ca41427141 | ||
|
|
242006933d | ||
|
|
85712814cd | ||
|
|
9a1ff474f1 | ||
|
|
edd81f3e8b | ||
|
|
6c78f0d560 | ||
|
|
13a1d5883c | ||
|
|
c7321a7b80 | ||
|
|
115c0381c2 | ||
|
|
48d63048f1 | ||
|
|
991be28672 | ||
|
|
e530993392 | ||
|
|
7a3f59cd66 | ||
|
|
8741551dc9 | ||
|
|
3ba5391839 | ||
|
|
20a16f55b3 | ||
|
|
b4f5a63e7f | ||
|
|
e7bc1e3c9a | ||
|
|
f8ae60bc28 | ||
|
|
294f0fdf4d | ||
|
|
31432edcbe | ||
|
|
9b1ab3d767 | ||
|
|
ea32924c62 | ||
|
|
5945241469 | ||
|
|
f55be48977 | ||
|
|
b7c06d6d67 | ||
|
|
b488f229d2 | ||
|
|
f12effc6ff | ||
|
|
d8e1c450a3 | ||
|
|
52afce0a10 | ||
|
|
216db87f99 | ||
|
|
0fdf0b19ce | ||
|
|
17e71fc908 | ||
|
|
090ea28942 | ||
|
|
e01fdc3dba | ||
|
|
e8db984ce5 | ||
|
|
47313acee4 | ||
|
|
fcbae69fe8 | ||
|
|
4f54bde439 | ||
|
|
9aa4d9a7b9 | ||
|
|
2a73f4e994 | ||
|
|
9d1e8084df | ||
|
|
7b2f600d71 | ||
|
|
5c2928aa25 | ||
|
|
9e9835f464 | ||
|
|
7ff1b945f6 | ||
|
|
41db62b77a | ||
|
|
225ee71cae | ||
|
|
be038f9cb2 | ||
|
|
ac239c54d0 | ||
|
|
e50c4a8837 | ||
|
|
825b4ff35a | ||
|
|
a03c35125e | ||
|
|
44f146f232 | ||
|
|
edd4276bbf | ||
|
|
df47136bcf | ||
|
|
de56874cc9 | ||
|
|
1eb40c8328 | ||
|
|
562109c0e8 | ||
|
|
b3612e9cc1 | ||
|
|
1b50223f82 | ||
|
|
c77cec2ffc | ||
|
|
c231c9af97 | ||
|
|
24ca6ce1f9 | ||
|
|
430b0df779 | ||
|
|
d9af1a0cf2 | ||
|
|
4e60b9646d | ||
|
|
b426488e2b | ||
|
|
7b1a86b893 | ||
|
|
be229d129e | ||
|
|
e8a2c25456 | ||
|
|
6e8ca48cbb | ||
|
|
b6209b4ba4 | ||
|
|
4f02b98338 | ||
|
|
73d0d743bd | ||
|
|
2b38f4eab7 | ||
|
|
36413aa856 | ||
|
|
102e6209c7 | ||
|
|
24c166f42a | ||
|
|
7f51ba99ae | ||
|
|
6f9ab22fd8 | ||
|
|
2d794cc031 | ||
|
|
b7ecff160e | ||
|
|
d59324c8ff | ||
|
|
a857b9c8e0 | ||
|
|
c6e1d4ddde | ||
|
|
a1437cbf1b | ||
|
|
def9e45aff | ||
|
|
6513b0ba59 | ||
|
|
f1d9b0a74a | ||
|
|
0b9cd9448c | ||
|
|
6507fd6bf0 | ||
|
|
177beb91c9 | ||
|
|
29e94dc065 | ||
|
|
eb5cb8ec02 | ||
|
|
496f7b4f64 | ||
|
|
566f5210ce | ||
|
|
2ce4f85f1e | ||
|
|
819c28bf8c | ||
|
|
627cf6bca8 | ||
|
|
39cb865e71 | ||
|
|
7113ea4e08 | ||
|
|
b264fb9e9d | ||
|
|
1b46137426 | ||
|
|
a77e638c77 | ||
|
|
cd75ae46ab | ||
|
|
c34b69b5c7 | ||
|
|
38143770a9 | ||
|
|
5b749eeee9 | ||
|
|
aac639351f | ||
|
|
a7cb150931 | ||
|
|
e28f321a48 | ||
|
|
bec0b0c823 | ||
|
|
6b29374a60 | ||
|
|
92216c5864 | ||
|
|
d95c04945f | ||
|
|
7b2f68cc21 | ||
|
|
d6ccd44390 | ||
|
|
6c1426842a | ||
|
|
ee96900605 | ||
|
|
71164b76c4 | ||
|
|
4c5e7af32f | ||
|
|
2a4df070c3 | ||
|
|
370c873be5 | ||
|
|
8c8f043717 | ||
|
|
67290441b8 | ||
|
|
3d4656c020 | ||
|
|
b75fac5be3 | ||
|
|
5f0df42303 | ||
|
|
1a1f5540a4 | ||
|
|
074cf4cb95 | ||
|
|
62fa0c7d8d | ||
|
|
781af8f91b | ||
|
|
dacda1f6b3 | ||
|
|
b5225165c0 | ||
|
|
86cb6e1f0f | ||
|
|
0e4946d559 | ||
|
|
a3a75e0a41 | ||
|
|
1038e66964 | ||
|
|
48188fbeee | ||
|
|
6a1d3948a6 | ||
|
|
17e0be9e6a | ||
|
|
d85d0ddcfe | ||
|
|
61ce2ca1bb | ||
|
|
1d98c6347c | ||
|
|
5490cd6eb2 | ||
|
|
a521cea96f | ||
|
|
15aa57d51b | ||
|
|
d7f8838294 | ||
|
|
f5820c8bd6 | ||
|
|
86b5b7aa42 | ||
|
|
77af613efc | ||
|
|
96b3ba3470 | ||
|
|
2141b7112d | ||
|
|
2f96067fe7 | ||
|
|
5ba8b83b8b | ||
|
|
cb898be887 | ||
|
|
80868b0da6 | ||
|
|
6a9ed33055 | ||
|
|
507a2d15e6 | ||
|
|
b8ef22312b | ||
|
|
2752932d19 | ||
|
|
919b604c29 | ||
|
|
dee8144ce5 | ||
|
|
c79c068fe9 | ||
|
|
ad09db3c55 | ||
|
|
9363e7dc22 | ||
|
|
f1ec3b9b10 | ||
|
|
37ff0f5658 | ||
|
|
a3f9399295 | ||
|
|
c0ce10397a | ||
|
|
fcf0a8b203 | ||
|
|
1de5070bb3 | ||
|
|
10241a6d76 | ||
|
|
902305f163 | ||
|
|
64d54f6741 | ||
|
|
42e2f8bfbf | ||
|
|
1a994bf180 | ||
|
|
e7b56f48d7 | ||
|
|
601c808b8d | ||
|
|
1953fe4368 | ||
|
|
90477f156c | ||
|
|
8b3717ef0d | ||
|
|
6df558177f | ||
|
|
ed3cd75736 | ||
|
|
ba7a056d58 | ||
|
|
a4ce3edf95 | ||
|
|
d98ff04cc9 | ||
|
|
4c259d51f7 | ||
|
|
f4875fab9b | ||
|
|
3343185473 | ||
|
|
1052709921 | ||
|
|
24881034f6 | ||
|
|
8a9ce12a27 | ||
|
|
5c1885b55e | ||
|
|
7a6b01d46c | ||
|
|
d5f0395dc1 | ||
|
|
a708e7d28e | ||
|
|
2da59e1aa9 | ||
|
|
571f2f7814 | ||
|
|
0d9e7da309 | ||
|
|
5853025137 | ||
|
|
90ddcbe71d | ||
|
|
33bb7dbd35 | ||
|
|
32327dc8c9 | ||
|
|
89edea326b | ||
|
|
d72487cc00 | ||
|
|
0b155677cf | ||
|
|
d6e3446e70 | ||
|
|
6f2faf16ba | ||
|
|
20a47aba8e | ||
|
|
9e9ecf2183 | ||
|
|
45f86ca1ca | ||
|
|
e47eb9a777 | ||
|
|
4bada45464 | ||
|
|
bac670ddc9 | ||
|
|
b633985e60 | ||
|
|
758d3403cd | ||
|
|
6e29f02e94 | ||
|
|
842c4422ed | ||
|
|
ae25167bcd | ||
|
|
bf84dc4cf1 | ||
|
|
a33424f879 | ||
|
|
020bdb4298 | ||
|
|
dbd54c0cb9 | ||
|
|
0d2600c575 | ||
|
|
185cbb8a44 | ||
|
|
8605284e0d | ||
|
|
9934052b54 | ||
|
|
53e525c4f3 | ||
|
|
5b5b250443 | ||
|
|
86bc36412e | ||
|
|
1ebe5dc197 | ||
|
|
43cad9c871 | ||
|
|
ff87046354 | ||
|
|
04fd320e97 | ||
|
|
35e6136f4b | ||
|
|
241946ccea | ||
|
|
d4c97ea2f6 | ||
|
|
12642a299b | ||
|
|
6be492d2f7 | ||
|
|
1b7d2b0cfa | ||
|
|
a27bdcfe51 | ||
|
|
2a18171afa | ||
|
|
61c6ae01b3 | ||
|
|
89fe19f3e1 | ||
|
|
980b3faea5 | ||
|
|
027a8a3260 | ||
|
|
5f3629bea0 | ||
|
|
759f435fb9 | ||
|
|
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 |
5
.mailmap
5
.mailmap
@@ -3,12 +3,16 @@ Allan McRae <allan@archlinux.org> <mcrae_allan@hotmail.com>
|
|||||||
Allan McRae <allan@archlinux.org> <mcrae_allan at hotmail.com>
|
Allan McRae <allan@archlinux.org> <mcrae_allan at hotmail.com>
|
||||||
Allan McRae <allan@archlinux.org> <allan.mcrae@qimr.edu.au>
|
Allan McRae <allan@archlinux.org> <allan.mcrae@qimr.edu.au>
|
||||||
Andres P <aepd87@gmail.com> <stderr@mail.com>
|
Andres P <aepd87@gmail.com> <stderr@mail.com>
|
||||||
|
Andrew Gregory <andrew.gregory.8@gmail.com>
|
||||||
|
Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.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>
|
||||||
|
Jan Steffens <jan.steffens@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>
|
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>
|
||||||
@@ -24,6 +28,7 @@ Roman Kyrylych <roman@archlinux.org> <roman.kyrylych@gmail.com>
|
|||||||
Sebastian Nowicki <sebnow@gmail.com> <xilonmu@gmail.com>
|
Sebastian Nowicki <sebnow@gmail.com> <xilonmu@gmail.com>
|
||||||
Vojtěch Gondžala <vojtech.gondzala@gmail.com> <vogo@seznam.cz>
|
Vojtěch Gondžala <vojtech.gondzala@gmail.com> <vogo@seznam.cz>
|
||||||
Vojtěch Gondžala <vojtech.gondzala@gmail.com> Vojtech Gondzala <vojtech.gondzala@gmail.com>
|
Vojtěch Gondžala <vojtech.gondzala@gmail.com> Vojtech Gondzala <vojtech.gondzala@gmail.com>
|
||||||
|
William Giokas <1007380@gmail.com>
|
||||||
Xavier Chantry <shiningxc@gmail.com>
|
Xavier Chantry <shiningxc@gmail.com>
|
||||||
Xavier Chantry <shiningxc@gmail.com> <chantry.xavier@gmail.com>
|
Xavier Chantry <shiningxc@gmail.com> <chantry.xavier@gmail.com>
|
||||||
Xavier Chantry <shiningxc@gmail.com> <xav@chantry.homelinux.org>
|
Xavier Chantry <shiningxc@gmail.com> <xav@chantry.homelinux.org>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.net
|
host = https://www.transifex.com
|
||||||
|
|
||||||
[archlinux-pacman.libalpm-pot]
|
[archlinux-pacman.libalpm-pot]
|
||||||
file_filter = lib/libalpm/po/<lang>.po
|
file_filter = lib/libalpm/po/<lang>.po
|
||||||
|
|||||||
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>
|
|
||||||
|
|||||||
59
HACKING
59
HACKING
@@ -90,6 +90,61 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
|
|||||||
NOT
|
NOT
|
||||||
if(!strcmp(a, b))
|
if(!strcmp(a, b))
|
||||||
|
|
||||||
|
8. Use spaces around almost all arithmetic, comparison and assignment
|
||||||
|
operators and after all ',;:' separators.
|
||||||
|
|
||||||
|
foobar[2 * size + 1] = function(a, 6);
|
||||||
|
NOT
|
||||||
|
foobar[2*size+1]=function(a,6);
|
||||||
|
|
||||||
|
for(a = 0; a < n && n > 0; a++, n--) {}
|
||||||
|
NOT
|
||||||
|
for(a=0;a<n&&n>0;a++,n--) {}
|
||||||
|
|
||||||
|
9. Declare all variables at the start of the block.
|
||||||
|
[source,C]
|
||||||
|
-------------------------------------------
|
||||||
|
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
|
{
|
||||||
|
char *newurl, *vdata = NULL;
|
||||||
|
|
||||||
|
newurl = url;
|
||||||
|
if(!newurl) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
if(vdata) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
NOT
|
||||||
|
|
||||||
|
[source,C]
|
||||||
|
-------------------------------------------
|
||||||
|
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
|
{
|
||||||
|
char *newurl = url;
|
||||||
|
|
||||||
|
if(!newurl) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *vdata = NULL;
|
||||||
|
|
||||||
|
if(vdata) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
Other Concerns
|
Other Concerns
|
||||||
--------------
|
--------------
|
||||||
@@ -103,8 +158,6 @@ general pattern, including blank lines:
|
|||||||
|
|
||||||
[source,C]
|
[source,C]
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <standardheader.h>
|
#include <standardheader.h>
|
||||||
#include <another.h>
|
#include <another.h>
|
||||||
#include <...>
|
#include <...>
|
||||||
@@ -133,6 +186,8 @@ For pacman:
|
|||||||
#include "anythingelse.h"
|
#include "anythingelse.h"
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
|
Never directly include config.h. This will always be added via Makefiles.
|
||||||
|
|
||||||
GDB and Valgrind Usage
|
GDB and Valgrind Usage
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
34
Makefile.am
34
Makefile.am
@@ -1,9 +1,12 @@
|
|||||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc test/pacman test/util contrib
|
SUBDIRS = lib/libalpm src/util src/pacman scripts etc test/pacman test/util test/scripts
|
||||||
if WANT_DOC
|
if WANT_DOC
|
||||||
SUBDIRS += doc
|
SUBDIRS += doc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS) contrib src/common
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4 --install
|
ACLOCAL_AMFLAGS = -I m4 --install
|
||||||
|
AM_MAKEFLAGS = --no-print-directory
|
||||||
|
|
||||||
# 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
|
||||||
@@ -21,19 +24,40 @@ dist_pkgdata_DATA = \
|
|||||||
proto/ChangeLog.proto
|
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-pacsort test-vercmp test-parseopts
|
||||||
$(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
|
|
||||||
|
test-pacman: test/pacman src/pacman
|
||||||
|
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 \
|
||||||
|
--scriptlet-shell $(SCRIPTLET_SHELL) \
|
||||||
|
--ldconfig $(LDCONFIG) \
|
||||||
-p $(top_builddir)/src/pacman/pacman
|
-p $(top_builddir)/src/pacman/pacman
|
||||||
$(SH) $(top_srcdir)/test/util/pacsorttest.sh \
|
|
||||||
|
test-pacsort: test/util src/util
|
||||||
|
$(BASH_SHELL) $(top_srcdir)/test/util/pacsorttest.sh \
|
||||||
$(top_builddir)/src/util/pacsort
|
$(top_builddir)/src/util/pacsort
|
||||||
$(SH) $(top_srcdir)/test/util/vercmptest.sh \
|
|
||||||
|
test-vercmp: test/util src/util
|
||||||
|
$(BASH_SHELL) $(top_srcdir)/test/util/vercmptest.sh \
|
||||||
$(top_builddir)/src/util/vercmp
|
$(top_builddir)/src/util/vercmp
|
||||||
|
|
||||||
|
test-parseopts: test/scripts scripts
|
||||||
|
$(BASH_SHELL) $(top_srcdir)/test/scripts/parseopts_test.sh \
|
||||||
|
$(top_srcdir)/scripts/library/parseopts.sh
|
||||||
|
$(BASH_SHELL) $(top_srcdir)/test/scripts/human_to_size_test.sh \
|
||||||
|
$(top_srcdir)/scripts/library/human_to_size.sh
|
||||||
|
|
||||||
# create the pacman DB and cache directories upon install
|
# create the pacman DB and cache directories upon install
|
||||||
install-data-local:
|
install-data-local:
|
||||||
for dir in "$(DESTDIR)$(localstatedir)/lib/pacman" "$(DESTDIR)$(localstatedir)/cache/pacman/pkg"; do \
|
for dir in "$(DESTDIR)$(localstatedir)/lib/pacman" "$(DESTDIR)$(localstatedir)/cache/pacman/pkg"; do \
|
||||||
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
|
||||||
|
|
||||||
|
.PHONY: test-pacman test-pacsort test-vercmp test-parseopts update-po
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
253
NEWS
253
NEWS
@@ -1,5 +1,244 @@
|
|||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
4.1.2 - validate %FILEPATH% when parsing repos to prevent arbitary
|
||||||
|
file overwrites from malicious databases
|
||||||
|
- makepkg:
|
||||||
|
- restrict package name from starting with a dot
|
||||||
|
- fix BZR source revision support (FS#35281)
|
||||||
|
- Use LOGDEST for log pipe
|
||||||
|
- fix distcc disabling (FS#35741)
|
||||||
|
- correct stat usage on BSD/Darwin (FS#35469)
|
||||||
|
- pacman-key:
|
||||||
|
- Do not reinterpret keys from revoked keyrings
|
||||||
|
- contrib:
|
||||||
|
- paccache: remove broken su privilege escalation (FS#35173)
|
||||||
|
- pacscripts: update for current pacman options
|
||||||
|
- checkupdates: be consistent with naming (FS#35755)
|
||||||
|
4.1.1 - fix bug causing negative "Total Installed Size" (FS#34616)
|
||||||
|
- report libalpm version it is pkg-config file (FS#34967)
|
||||||
|
- various translation fixes and updates (FS#34395, FS#34704,
|
||||||
|
FS#34716, FS#35097)
|
||||||
|
- makepkg:
|
||||||
|
- improve SVN VCS PKGBUILD handling (FS#34675, FS#34636)
|
||||||
|
- allow "lp:" URLs for BZR sources (FS#34650)
|
||||||
|
- prevent pkgver() capturing stderr (FS#34974)
|
||||||
|
- fix attempt to remove package twice on failure (FS#34672)
|
||||||
|
- contrib:
|
||||||
|
- fix privilege escalation in paccache (FS#34656)
|
||||||
|
4.1.0 - check file properties when using -Qkk (FS#11091)
|
||||||
|
- add color to pacman output - new configuration option "Color"
|
||||||
|
- add informational messages for optdepends installation
|
||||||
|
status (FS#13035, FS#27116)
|
||||||
|
- add number suffix to pacsave files instead of overwriting
|
||||||
|
(FS#24192)
|
||||||
|
- improve needed key importing for Upgrade (FS#26520)
|
||||||
|
- add options to specify require signature level for
|
||||||
|
Upgrade operations (FS#26729)
|
||||||
|
- directory ownership can be queried
|
||||||
|
- allow wildcards in NoUpgrade, NoExtract, IgnorePkg,
|
||||||
|
IgnoreGroup and HoldPkg (FS#20360, FS#18988)
|
||||||
|
- remove -f short option for --force
|
||||||
|
- SyncFirst option has been removed (FS#26445)
|
||||||
|
- offer to delete downloaded packages failing signature check
|
||||||
|
(FS#28014)
|
||||||
|
- configure shell for running install scriptlets (FS#20557)
|
||||||
|
- make path to ldconfig configurable
|
||||||
|
- display repo in VerbosePkgLists output
|
||||||
|
- do not check file conflicts or disk space with --dbonly
|
||||||
|
(FS#25667)
|
||||||
|
- UseDelta takes a ratio for the largest delta to use
|
||||||
|
- track how installed packages were validated (FS#28040)
|
||||||
|
- add pkg-config file for libalpm
|
||||||
|
- avoid false ownership matches for files in / (FS#30388)
|
||||||
|
- only load filesystem space information when needed
|
||||||
|
- allow leading "local/" in query options
|
||||||
|
- allow cleaning only some cachedirs
|
||||||
|
- do not remove source package and package databases from
|
||||||
|
cache (FS#25166)
|
||||||
|
- improve conflict checking with directory symlinks (FS#30681)
|
||||||
|
- remove Cygwin support
|
||||||
|
- add program prefix to pacman log entries
|
||||||
|
- add --native filter to pacman -Q
|
||||||
|
- makepkg:
|
||||||
|
- require bash>=4.0
|
||||||
|
- support for VCS URLs (git, bzr, svn and hg) (FS#7816,
|
||||||
|
FS#8890, FS#13727, FS#15895, FS#16384, FS#16872, FS#19459,
|
||||||
|
FS#19476, FS#20841, FS#21098, FS#28605)
|
||||||
|
- split debugging symbols into separate package (FS#10975)
|
||||||
|
- use SKIP in checksums to skip integrity check (FS#19735)
|
||||||
|
- add prepare() function to PKGBUILD (FS#30582)
|
||||||
|
- add pkgver() function to auto-update pkgver/pkgrel
|
||||||
|
- pkgrel must be in decimal format
|
||||||
|
- PKGBUILDs without package() functions are deprecated
|
||||||
|
- support specifying CPPFLAGS in makepkg.conf
|
||||||
|
- support PACKAGER environmental variable
|
||||||
|
- allow source renaming to work on signature files
|
||||||
|
- configurable compression options (FS#27430)
|
||||||
|
- allow multiple packages to be build when using
|
||||||
|
BUILDDIR (FS#28417)
|
||||||
|
- add makedepends/checkdepends information to .PKGINFO
|
||||||
|
- url can be overridden in split packages
|
||||||
|
- allow wildcards in PURGE_TARGETS
|
||||||
|
- pass --asdep and --needed flags to pacman when installing
|
||||||
|
- use last match in BUILDENV/OPTIONS arrays (FS#26701)
|
||||||
|
- fix "arch" handling in split packages (FS#27204)
|
||||||
|
- add LOGDEST configuration option
|
||||||
|
- install makedepends with --repackage
|
||||||
|
- repo-add:
|
||||||
|
- honor TMPDIR environmental variable
|
||||||
|
- add makedepends/checkdepends information to database
|
||||||
|
- pacman-key:
|
||||||
|
- fix importing keys with quotes in file name (FS#28445)
|
||||||
|
- allow verification of multiple sig files
|
||||||
|
- add zsh completion (FS#29062)
|
||||||
|
- pkgdelta: add ratio and package size limits
|
||||||
|
- pactree: improve output
|
||||||
|
- contrib:
|
||||||
|
- updpkgsums: update checksums in a PKGBUILD
|
||||||
|
- checkupdates: new - safely check for package updates
|
||||||
|
- pacsort: add --files option to support parsing filenames
|
||||||
|
- pacdiff: improve usability
|
||||||
|
- add zsh completion
|
||||||
|
4.0.3 - frontend database cleanup enhancements (FS#28714)
|
||||||
|
- frontend package cleanup enhancements (FS#25166)
|
||||||
|
- back out changes related to SyncFirst in 4.0.0
|
||||||
|
- remove recursive/needed automatic flags on SyncFirst
|
||||||
|
- remove poorly implemented `-S --recursive` option
|
||||||
|
- improve error messages on database locking failures
|
||||||
|
- use full delta size as max download size (FS#28345)
|
||||||
|
- improved handling and fix crash after failed downloads
|
||||||
|
- fix key lookup when using gpg 2.X as GPG program
|
||||||
|
- match only full path components in disk space checking
|
||||||
|
- skip disk space checks when using --dbonly
|
||||||
|
- scripts: unset CDPATH bash variable in all scripts
|
||||||
|
- makepkg:
|
||||||
|
- fix syntax error in remove_deps (FS#28448)
|
||||||
|
- small fixes related to multiple libdeps, parsing issues
|
||||||
|
- exit via default handler in trap_exit (FS#28491)
|
||||||
|
- attempt to work around Btrfs file/block size reporting issues
|
||||||
|
- pacman-key:
|
||||||
|
- remove signature verification in --populate
|
||||||
|
- make -e option work as advertised without arguments
|
||||||
|
- exit with correct return codes when verifying signature
|
||||||
|
- pacsysclean: fix description, fix option parsing (FS#28434)
|
||||||
|
- pkgdelta: use bsdtar -q option for better performance
|
||||||
|
- translations: various updates and corrections
|
||||||
|
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 trans 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
|
||||||
|
- file lists now have a dedicated type with metadata
|
||||||
|
- disk space 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
|
3.5.4 - fix display of lists on non-TTYs and other output fixes
|
||||||
- fix group selection entry for large inputs (FS#24253)
|
- fix group selection entry for large inputs (FS#24253)
|
||||||
- fix divide by zero when downloading zero length files
|
- fix divide by zero when downloading zero length files
|
||||||
@@ -15,7 +254,7 @@ VERSION DESCRIPTION
|
|||||||
- fix default path substitution in documentation
|
- fix default path substitution in documentation
|
||||||
- makepkg: quote variables that may contain spaces (FS#24002)
|
- makepkg: quote variables that may contain spaces (FS#24002)
|
||||||
- makepkg: fix creation of source package with -p (FS#24567)
|
- makepkg: fix creation of source package with -p (FS#24567)
|
||||||
- repo-add: include dotfiles in filelists (FS#24534)
|
- repo-add: include dotfiles in file lists (FS#24534)
|
||||||
- minor translation updates: de, fi, fr, sk, zh_CN
|
- minor translation updates: de, fi, fr, sk, zh_CN
|
||||||
3.5.2 - ensure we show correct missing dependency info (FS#23424)
|
3.5.2 - ensure we show correct missing dependency info (FS#23424)
|
||||||
- pacman usage/--help updates (FS#23433, FS#23369)
|
- pacman usage/--help updates (FS#23433, FS#23369)
|
||||||
@@ -122,7 +361,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)
|
||||||
@@ -134,7 +373,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
|
||||||
@@ -162,7 +401,7 @@ VERSION DESCRIPTION
|
|||||||
- translations:
|
- translations:
|
||||||
- zh_CN: fix positional parameter usage in makepkg (FS#16983)
|
- zh_CN: fix positional parameter usage in makepkg (FS#16983)
|
||||||
- el: fix Y/N response translation (FS#16568)
|
- el: fix Y/N response translation (FS#16568)
|
||||||
3.3.2 - fix infinite filesize download issue (FS#16359)
|
3.3.2 - fix infinite file size download issue (FS#16359)
|
||||||
- fix bogus download size on TotalDownload
|
- fix bogus download size on TotalDownload
|
||||||
- documentation updates
|
- documentation updates
|
||||||
- small translation updates
|
- small translation updates
|
||||||
@@ -433,7 +672,7 @@ VERSION DESCRIPTION
|
|||||||
- conflicts checking speedups and fixes
|
- conflicts checking speedups and fixes
|
||||||
- move lockfile location to inside the DB
|
- move lockfile location to inside the DB
|
||||||
- remove gettext calls from DEBUG messages
|
- remove gettext calls from DEBUG messages
|
||||||
- remove faulty diskspace checking
|
- remove faulty disk space checking
|
||||||
- move functions out of alpm.c to where they belong
|
- move functions out of alpm.c to where they belong
|
||||||
- rewrite of file extraction code (FS#7484)
|
- rewrite of file extraction code (FS#7484)
|
||||||
- makepkg-specific changes:
|
- makepkg-specific changes:
|
||||||
@@ -580,7 +819,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
|
||||||
@@ -698,7 +937,7 @@ VERSION DESCRIPTION
|
|||||||
- HTTP/1.1 support
|
- HTTP/1.1 support
|
||||||
- an improved progress bar with transfer rates and ETA
|
- an improved progress bar with transfer rates and ETA
|
||||||
- cleaned up warning output a bit
|
- cleaned up warning output a bit
|
||||||
2.7.2 - Supressed "No such file" messages during stripping
|
2.7.2 - Suppressed "No such file" messages during stripping
|
||||||
- Removed extra newlines in /var/log/pacman.log
|
- Removed extra newlines in /var/log/pacman.log
|
||||||
- Added a --noextract option to makepkg to skip source extraction
|
- Added a --noextract option to makepkg to skip source extraction
|
||||||
2.7.1 - Fixed a couple obscure segfaults
|
2.7.1 - Fixed a couple obscure segfaults
|
||||||
|
|||||||
162
README
162
README
@@ -53,8 +53,16 @@ library is initialized.
|
|||||||
* dlcb: The callback function for download progress of each package.
|
* dlcb: The callback function for download progress of each package.
|
||||||
* fetchcb: Callback for custom download function.
|
* fetchcb: Callback for custom download function.
|
||||||
* totaldlcb: The callback function for overall download progress.
|
* totaldlcb: The callback function for overall download progress.
|
||||||
* root: The root directory for pacman to install to (Default: /)
|
* eventcb: Callback for transaction messages.
|
||||||
* dbpath: The toplevel database directory (Default: /var/lib/pacman)
|
* questioncb: Callback for selecting amongst choices.
|
||||||
|
* progresscb: Callback to handle display of transaction progress.
|
||||||
|
* gpgdir: Directory where GnuPG files are stored.
|
||||||
|
* arch: Allowed package architecture.
|
||||||
|
* deltaratio: Download deltas if possible; a ratio value.
|
||||||
|
* checkspace: Check disk space before installing.
|
||||||
|
* default_siglevel: Default signature verification level.
|
||||||
|
* local_file_siglevel: Signature verification level for local file upgrades.
|
||||||
|
* remote_file_siglevel: Signature verification level for remote file upgrades.
|
||||||
* logfile: The base path to pacman's log file (Default: /var/log/pacman.log)
|
* logfile: The base path to pacman's log file (Default: /var/log/pacman.log)
|
||||||
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
|
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
|
||||||
|
|
||||||
@@ -71,14 +79,10 @@ alpm_option_{get,set}_noupgrades -> alpm_option_{add,remove}_noupgrade.
|
|||||||
|
|
||||||
The following options are read-only, having ONLY alpm_option_get_* functions:
|
The following options are read-only, having ONLY alpm_option_get_* functions:
|
||||||
|
|
||||||
* lockfile: The file used for locking the database
|
* root: The root directory for pacman to install to
|
||||||
(Default: <dbpath>/db.lck)
|
* dbpath: The toplevel database directory
|
||||||
* localdb: A alpm_db_t structure for the local (installed) database
|
* lockfile: The file used for locking the database (Default: <dbpath>/db.lck)
|
||||||
* 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:
|
|
||||||
|
|
||||||
* usedelta: Download delta files instead of complete packages if possible.
|
|
||||||
|
|
||||||
[Transactions]
|
[Transactions]
|
||||||
|
|
||||||
@@ -154,7 +158,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
|
||||||
@@ -365,3 +369,141 @@ API CHANGES BETWEEN 3.4 AND 3.5
|
|||||||
PM_TRANS_FLAG_NODEPVERSION, PM_TRANS_EVT_DISKSPACE_START,
|
PM_TRANS_FLAG_NODEPVERSION, PM_TRANS_EVT_DISKSPACE_START,
|
||||||
PM_TRANS_EVT_DISKSPACE_DONE, PM_TRANS_CONV_SELECT_PROVIDER,
|
PM_TRANS_EVT_DISKSPACE_DONE, PM_TRANS_CONV_SELECT_PROVIDER,
|
||||||
PM_TRANS_PROGRESS_DISKSPACE_START, PM_TRANS_PROGRESS_INTEGRITY_START
|
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
|
||||||
|
|
||||||
|
|
||||||
|
API CHANGES BETWEEN 4.0 AND 4.1
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[REMOVED]
|
||||||
|
- alpm_list_getdata()
|
||||||
|
|
||||||
|
[CHANGED]
|
||||||
|
- alpm_pkgfrom_t members are now prefixed with ALPM_
|
||||||
|
- alpm_siglevel_t - added members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
|
||||||
|
- alpm_depend_t - additional desc member
|
||||||
|
- alpm_filelist_t - additional resolved_path member
|
||||||
|
- alpm_pgpkey_t - added members length, revoked, pubkey_algo
|
||||||
|
- alpm_logaction - added caller identifier argument
|
||||||
|
- function renaming:
|
||||||
|
- alpm_option_get_localdb -> alpm_get_localdb
|
||||||
|
- alpm_option_get_syncdbs -> alpm_get_syncdbs
|
||||||
|
- alpm_db_register_sync -> alpm_register_syncdb
|
||||||
|
- alpm_db_unregister_all -> alpm_unregister_all_syncdbs
|
||||||
|
- alpm_db_readgroup -> alpm_db_get_group
|
||||||
|
- alpm_db_set_pkgreason -> alpm_pkg_set_reason (handle parameter removed)
|
||||||
|
- alpm_time_t typedef used for all times
|
||||||
|
- members of alpm_pgpkey_t
|
||||||
|
- return types of alpm_pkg_get_builddate and alpm_pkg_get_installdate
|
||||||
|
- delta options now use required ratio rather than on/off
|
||||||
|
- alpm_option_get_usedelta -> alpm_option_get_deltaratio
|
||||||
|
- alpm_option_set_usedelta -> alpm_option_set_deltaratio
|
||||||
|
|
||||||
|
[ADDED]
|
||||||
|
- tracking of how a package was validated:
|
||||||
|
- alpm_pkgvalidation_t
|
||||||
|
- alpm_pkg_get_validation()
|
||||||
|
- adjustable signature verification levels for upgrade operations:
|
||||||
|
- alpm_option_get_local_file_siglevel()
|
||||||
|
- alpm_option_set_local_file_siglevel()
|
||||||
|
- alpm_option_get_remote_file_siglevel()
|
||||||
|
- alpm_option_set_remote_file_siglevel()
|
||||||
|
- sync database usage functions:
|
||||||
|
- alpm_db_usage_t
|
||||||
|
- alpm_db_set_usage()
|
||||||
|
- alpm_db_get_usage()
|
||||||
|
- wrapper functions for reading mtree files
|
||||||
|
- alpm_pkg_mtree_open()
|
||||||
|
- alpm_pkg_mtree_next()
|
||||||
|
- alpm_pkg_mtree_close()
|
||||||
|
- utility functions
|
||||||
|
- alpm_pkg_find()
|
||||||
|
- alpm_pkg_compute_optionalfor()
|
||||||
|
- alpm_filelist_contains()
|
||||||
|
- types
|
||||||
|
- alpm_time_t
|
||||||
|
- alpm_errno_t
|
||||||
|
- flags
|
||||||
|
ALPM_EVENT_OPTDEP_REQUIRED, ALPM_EVENT_DATABASE_MISSING,
|
||||||
|
ALPM_EVENT_KEYRING_START, ALPM_EVENT_KEYRING_DONE, ALPM_EVENT_KEY_DOWNLOAD_START,
|
||||||
|
ALPM_EVENT_KEY_DOWNLOAD_DONE, ALPM_PROGRESS_KEYRING_START
|
||||||
|
|||||||
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>
|
||||||
|
|||||||
24
autoclean.sh
24
autoclean.sh
@@ -1,9 +1,9 @@
|
|||||||
#!/bin/sh -xu
|
#!/bin/sh -xu
|
||||||
|
|
||||||
[ -f Makefile ] && make distclean
|
[ -f Makefile ] && make distclean
|
||||||
|
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
rm -f {Makefile.in,Makefile}
|
rm -f config.h.in config.h
|
||||||
rm -f {config.h.in,config.h}
|
|
||||||
rm -f config.status
|
rm -f config.status
|
||||||
rm -f configure
|
rm -f configure
|
||||||
rm -f stamp*
|
rm -f stamp*
|
||||||
@@ -11,22 +11,12 @@ rm -f aclocal.m4
|
|||||||
rm -f compile
|
rm -f compile
|
||||||
rm -f libtool
|
rm -f libtool
|
||||||
|
|
||||||
rm -f lib/libalpm/{Makefile.in,Makefile}
|
|
||||||
rm -f src/util/{Makefile.in,Makefile}
|
|
||||||
rm -f src/pacman/{Makefile.in,Makefile}
|
|
||||||
rm -f scripts/{Makefile.in,Makefile}
|
|
||||||
rm -f etc/{Makefile.in,Makefile}
|
|
||||||
rm -f etc/pacman.d/{Makefile.in,Makefile}
|
|
||||||
rm -f etc/abs/{Makefile.in,Makefile}
|
|
||||||
rm -f test/{pacman,util}{,/tests}/{Makefile.in,Makefile}
|
|
||||||
rm -f contrib/{Makefile.in,Makefile}
|
|
||||||
rm -f doc/{Makefile.in,Makefile}
|
|
||||||
|
|
||||||
rm -f test/pacman/*.pyc
|
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 {lib/libalpm,scripts,src/pacman}/po/{Makefile.in,Makefile}
|
find . \( -name 'Makefile' -o \
|
||||||
rm -f {lib/libalpm,scripts,src/pacman}/po/POTFILES
|
-name 'Makefile.in' -o \
|
||||||
rm -f {lib/libalpm,scripts,src/pacman}/po/stamp-po
|
-path '*/po/POTFILES' -o \
|
||||||
rm -f {lib/libalpm,scripts,src/pacman}/po/*.gmo
|
-path '*/po/stamp-po' -o \
|
||||||
|
-path '*/po/*.gmo' \) -exec rm -f {} +
|
||||||
|
|||||||
0
config.guess → build-aux/config.guess
vendored
0
config.guess → build-aux/config.guess
vendored
0
config.sub → build-aux/config.sub
vendored
0
config.sub → build-aux/config.sub
vendored
85
ltmain.sh → build-aux/ltmain.sh
Executable file → Normal file
85
ltmain.sh → build-aux/ltmain.sh
Executable file → Normal file
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
# libtool (GNU libtool) 2.4
|
# libtool (GNU libtool) 2.4.2
|
||||||
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||||
|
|
||||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
||||||
# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
# 2007, 2008, 2009, 2010, 2011 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.
|
||||||
|
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
# --quiet, --silent don't print informational messages
|
# --quiet, --silent don't print informational messages
|
||||||
# --no-quiet, --no-silent
|
# --no-quiet, --no-silent
|
||||||
# print informational messages (default)
|
# print informational messages (default)
|
||||||
|
# --no-warn don't display warning messages
|
||||||
# --tag=TAG use configuration variables from tag TAG
|
# --tag=TAG use configuration variables from tag TAG
|
||||||
# -v, --verbose print more informational messages than default
|
# -v, --verbose print more informational messages than default
|
||||||
# --no-verbose don't print the extra informational messages
|
# --no-verbose don't print the extra informational messages
|
||||||
@@ -69,7 +70,7 @@
|
|||||||
# compiler: $LTCC
|
# compiler: $LTCC
|
||||||
# compiler flags: $LTCFLAGS
|
# compiler flags: $LTCFLAGS
|
||||||
# linker: $LD (gnu? $with_gnu_ld)
|
# linker: $LD (gnu? $with_gnu_ld)
|
||||||
# $progname: (GNU libtool) 2.4
|
# $progname: (GNU libtool) 2.4.2
|
||||||
# automake: $automake_version
|
# automake: $automake_version
|
||||||
# autoconf: $autoconf_version
|
# autoconf: $autoconf_version
|
||||||
#
|
#
|
||||||
@@ -79,9 +80,9 @@
|
|||||||
|
|
||||||
PROGRAM=libtool
|
PROGRAM=libtool
|
||||||
PACKAGE=libtool
|
PACKAGE=libtool
|
||||||
VERSION=2.4
|
VERSION=2.4.2
|
||||||
TIMESTAMP=""
|
TIMESTAMP=""
|
||||||
package_revision=1.3293
|
package_revision=1.3337
|
||||||
|
|
||||||
# Be Bourne compatible
|
# Be Bourne compatible
|
||||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||||
@@ -136,15 +137,10 @@ progpath="$0"
|
|||||||
|
|
||||||
: ${CP="cp -f"}
|
: ${CP="cp -f"}
|
||||||
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
|
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
|
||||||
: ${EGREP="grep -E"}
|
|
||||||
: ${FGREP="grep -F"}
|
|
||||||
: ${GREP="grep"}
|
|
||||||
: ${LN_S="ln -s"}
|
|
||||||
: ${MAKE="make"}
|
: ${MAKE="make"}
|
||||||
: ${MKDIR="mkdir"}
|
: ${MKDIR="mkdir"}
|
||||||
: ${MV="mv -f"}
|
: ${MV="mv -f"}
|
||||||
: ${RM="rm -f"}
|
: ${RM="rm -f"}
|
||||||
: ${SED="sed"}
|
|
||||||
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
|
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
|
||||||
: ${Xsed="$SED -e 1s/^X//"}
|
: ${Xsed="$SED -e 1s/^X//"}
|
||||||
|
|
||||||
@@ -387,7 +383,7 @@ case $progpath in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
save_IFS="$IFS"
|
save_IFS="$IFS"
|
||||||
IFS=:
|
IFS=${PATH_SEPARATOR-:}
|
||||||
for progdir in $PATH; do
|
for progdir in $PATH; do
|
||||||
IFS="$save_IFS"
|
IFS="$save_IFS"
|
||||||
test -x "$progdir/$progname" && break
|
test -x "$progdir/$progname" && break
|
||||||
@@ -771,8 +767,8 @@ func_help ()
|
|||||||
s*\$LTCFLAGS*'"$LTCFLAGS"'*
|
s*\$LTCFLAGS*'"$LTCFLAGS"'*
|
||||||
s*\$LD*'"$LD"'*
|
s*\$LD*'"$LD"'*
|
||||||
s/\$with_gnu_ld/'"$with_gnu_ld"'/
|
s/\$with_gnu_ld/'"$with_gnu_ld"'/
|
||||||
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
|
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
|
||||||
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
|
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
|
||||||
p
|
p
|
||||||
d
|
d
|
||||||
}
|
}
|
||||||
@@ -1052,6 +1048,7 @@ opt_finish=false
|
|||||||
opt_help=false
|
opt_help=false
|
||||||
opt_help_all=false
|
opt_help_all=false
|
||||||
opt_silent=:
|
opt_silent=:
|
||||||
|
opt_warning=:
|
||||||
opt_verbose=:
|
opt_verbose=:
|
||||||
opt_silent=false
|
opt_silent=false
|
||||||
opt_verbose=false
|
opt_verbose=false
|
||||||
@@ -1118,6 +1115,10 @@ esac
|
|||||||
;;
|
;;
|
||||||
--no-silent|--no-quiet)
|
--no-silent|--no-quiet)
|
||||||
opt_silent=false
|
opt_silent=false
|
||||||
|
func_append preserve_args " $opt"
|
||||||
|
;;
|
||||||
|
--no-warning|--no-warn)
|
||||||
|
opt_warning=false
|
||||||
func_append preserve_args " $opt"
|
func_append preserve_args " $opt"
|
||||||
;;
|
;;
|
||||||
--no-verbose)
|
--no-verbose)
|
||||||
@@ -2059,7 +2060,7 @@ func_mode_compile ()
|
|||||||
*.[cCFSifmso] | \
|
*.[cCFSifmso] | \
|
||||||
*.ada | *.adb | *.ads | *.asm | \
|
*.ada | *.adb | *.ads | *.asm | \
|
||||||
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
||||||
*.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
|
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
|
||||||
func_xform "$libobj"
|
func_xform "$libobj"
|
||||||
libobj=$func_xform_result
|
libobj=$func_xform_result
|
||||||
;;
|
;;
|
||||||
@@ -3201,11 +3202,13 @@ func_mode_install ()
|
|||||||
|
|
||||||
# Set up the ranlib parameters.
|
# Set up the ranlib parameters.
|
||||||
oldlib="$destdir/$name"
|
oldlib="$destdir/$name"
|
||||||
|
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
||||||
|
tool_oldlib=$func_to_tool_file_result
|
||||||
|
|
||||||
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
||||||
|
|
||||||
if test -n "$stripme" && test -n "$old_striplib"; then
|
if test -n "$stripme" && test -n "$old_striplib"; then
|
||||||
func_show_eval "$old_striplib $oldlib" 'exit $?'
|
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do each command in the postinstall commands.
|
# Do each command in the postinstall commands.
|
||||||
@@ -3470,7 +3473,7 @@ static const void *lt_preloaded_setup() {
|
|||||||
# linked before any other PIC object. But we must not use
|
# linked before any other PIC object. But we must not use
|
||||||
# pic_flag when linking with -static. The problem exists in
|
# pic_flag when linking with -static. The problem exists in
|
||||||
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
||||||
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
||||||
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
||||||
*-*-hpux*)
|
*-*-hpux*)
|
||||||
pic_flag_for_symtable=" $pic_flag" ;;
|
pic_flag_for_symtable=" $pic_flag" ;;
|
||||||
@@ -5060,9 +5063,15 @@ void lt_dump_script (FILE* f)
|
|||||||
{
|
{
|
||||||
EOF
|
EOF
|
||||||
func_emit_wrapper yes |
|
func_emit_wrapper yes |
|
||||||
$SED -e 's/\([\\"]\)/\\\1/g' \
|
$SED -n -e '
|
||||||
-e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
|
s/^\(.\{79\}\)\(..*\)/\1\
|
||||||
|
\2/
|
||||||
|
h
|
||||||
|
s/\([\\"]\)/\\\1/g
|
||||||
|
s/$/\\n/
|
||||||
|
s/\([^\n]*\).*/ fputs ("\1", f);/p
|
||||||
|
g
|
||||||
|
D'
|
||||||
cat <<"EOF"
|
cat <<"EOF"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@@ -5646,7 +5655,8 @@ func_mode_link ()
|
|||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
||||||
|
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
||||||
func_append compiler_flags " $arg"
|
func_append compiler_flags " $arg"
|
||||||
func_append compile_command " $arg"
|
func_append compile_command " $arg"
|
||||||
func_append finalize_command " $arg"
|
func_append finalize_command " $arg"
|
||||||
@@ -5790,9 +5800,12 @@ func_mode_link ()
|
|||||||
arg=$func_stripname_result
|
arg=$func_stripname_result
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-Wl,--as-needed|-Wl,--no-as-needed)
|
-Wl,*--as-needed*)
|
||||||
deplibs="$deplibs $arg"
|
deplibs="$deplibs $wl--as-needed"
|
||||||
continue
|
;;
|
||||||
|
|
||||||
|
-Wl,*--no-as-needed*)
|
||||||
|
deplibs="$deplibs $wl--no-as-needed"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-Wl,*)
|
-Wl,*)
|
||||||
@@ -6164,7 +6177,8 @@ func_mode_link ()
|
|||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
||||||
|
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
||||||
if test "$linkmode,$pass" = "prog,link"; then
|
if test "$linkmode,$pass" = "prog,link"; then
|
||||||
compile_deplibs="$deplib $compile_deplibs"
|
compile_deplibs="$deplib $compile_deplibs"
|
||||||
finalize_deplibs="$deplib $finalize_deplibs"
|
finalize_deplibs="$deplib $finalize_deplibs"
|
||||||
@@ -6848,7 +6862,7 @@ func_mode_link ()
|
|||||||
test "$hardcode_direct_absolute" = no; then
|
test "$hardcode_direct_absolute" = no; then
|
||||||
add="$dir/$linklib"
|
add="$dir/$linklib"
|
||||||
elif test "$hardcode_minus_L" = yes; then
|
elif test "$hardcode_minus_L" = yes; then
|
||||||
add_dir="-L$dir"
|
add_dir="-L$absdir"
|
||||||
# Try looking first in the location we're being installed to.
|
# Try looking first in the location we're being installed to.
|
||||||
if test -n "$inst_prefix_dir"; then
|
if test -n "$inst_prefix_dir"; then
|
||||||
case $libdir in
|
case $libdir in
|
||||||
@@ -7333,6 +7347,7 @@ func_mode_link ()
|
|||||||
# which has an extra 1 added just for fun
|
# which has an extra 1 added just for fun
|
||||||
#
|
#
|
||||||
case $version_type in
|
case $version_type in
|
||||||
|
# correct linux to gnu/linux during the next big refactor
|
||||||
darwin|linux|osf|windows|none)
|
darwin|linux|osf|windows|none)
|
||||||
func_arith $number_major + $number_minor
|
func_arith $number_major + $number_minor
|
||||||
current=$func_arith_result
|
current=$func_arith_result
|
||||||
@@ -7449,7 +7464,7 @@ func_mode_link ()
|
|||||||
versuffix="$major.$revision"
|
versuffix="$major.$revision"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
linux)
|
linux) # correct to gnu/linux during the next big refactor
|
||||||
func_arith $current - $age
|
func_arith $current - $age
|
||||||
major=.$func_arith_result
|
major=.$func_arith_result
|
||||||
versuffix="$major.$age.$revision"
|
versuffix="$major.$age.$revision"
|
||||||
@@ -8037,6 +8052,11 @@ EOF
|
|||||||
|
|
||||||
# Test again, we may have decided not to build it any more
|
# Test again, we may have decided not to build it any more
|
||||||
if test "$build_libtool_libs" = yes; then
|
if test "$build_libtool_libs" = yes; then
|
||||||
|
# Remove ${wl} instances when linking with ld.
|
||||||
|
# FIXME: should test the right _cmds variable.
|
||||||
|
case $archive_cmds in
|
||||||
|
*\$LD\ *) wl= ;;
|
||||||
|
esac
|
||||||
if test "$hardcode_into_libs" = yes; then
|
if test "$hardcode_into_libs" = yes; then
|
||||||
# Hardcode the library paths
|
# Hardcode the library paths
|
||||||
hardcode_libdirs=
|
hardcode_libdirs=
|
||||||
@@ -8067,7 +8087,7 @@ EOF
|
|||||||
elif test -n "$runpath_var"; then
|
elif test -n "$runpath_var"; then
|
||||||
case "$perm_rpath " in
|
case "$perm_rpath " in
|
||||||
*" $libdir "*) ;;
|
*" $libdir "*) ;;
|
||||||
*) func_apped perm_rpath " $libdir" ;;
|
*) func_append perm_rpath " $libdir" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -8075,11 +8095,7 @@ EOF
|
|||||||
if test -n "$hardcode_libdir_separator" &&
|
if test -n "$hardcode_libdir_separator" &&
|
||||||
test -n "$hardcode_libdirs"; then
|
test -n "$hardcode_libdirs"; then
|
||||||
libdir="$hardcode_libdirs"
|
libdir="$hardcode_libdirs"
|
||||||
if test -n "$hardcode_libdir_flag_spec_ld"; then
|
eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
|
||||||
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
|
|
||||||
else
|
|
||||||
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if test -n "$runpath_var" && test -n "$perm_rpath"; then
|
if test -n "$runpath_var" && test -n "$perm_rpath"; then
|
||||||
# We should set the runpath_var.
|
# We should set the runpath_var.
|
||||||
@@ -9169,6 +9185,8 @@ EOF
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
||||||
|
tool_oldlib=$func_to_tool_file_result
|
||||||
eval cmds=\"$old_archive_cmds\"
|
eval cmds=\"$old_archive_cmds\"
|
||||||
|
|
||||||
func_len " $cmds"
|
func_len " $cmds"
|
||||||
@@ -9278,7 +9296,8 @@ EOF
|
|||||||
*.la)
|
*.la)
|
||||||
func_basename "$deplib"
|
func_basename "$deplib"
|
||||||
name="$func_basename_result"
|
name="$func_basename_result"
|
||||||
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
func_resolve_sysroot "$deplib"
|
||||||
|
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
|
||||||
test -z "$libdir" && \
|
test -z "$libdir" && \
|
||||||
func_fatal_error "\`$deplib' is not a valid libtool archive"
|
func_fatal_error "\`$deplib' is not a valid libtool archive"
|
||||||
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
|
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
|
||||||
215
build-aux/missing
Executable file
215
build-aux/missing
Executable file
@@ -0,0 +1,215 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Common wrapper for a few potentially missing GNU programs.
|
||||||
|
|
||||||
|
scriptversion=2012-06-26.16; # UTC
|
||||||
|
|
||||||
|
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||||
|
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||||
|
|
||||||
|
# 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, 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/>.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo 1>&2 "Try '$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
|
||||||
|
--is-lightweight)
|
||||||
|
# Used by our autoconf macros to check whether the available missing
|
||||||
|
# script is modern enough.
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
--run)
|
||||||
|
# Back-compat with the calling convention used by older automake.
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-h|--h|--he|--hel|--help)
|
||||||
|
echo "\
|
||||||
|
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||||
|
|
||||||
|
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||||
|
to PROGRAM being missing or too old.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help display this help and exit
|
||||||
|
-v, --version output version information and exit
|
||||||
|
|
||||||
|
Supported PROGRAM values:
|
||||||
|
aclocal autoconf autoheader autom4te automake makeinfo
|
||||||
|
bison yacc flex lex help2man
|
||||||
|
|
||||||
|
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||||
|
'g' are ignored when checking the name.
|
||||||
|
|
||||||
|
Send bug reports to <bug-automake@gnu.org>."
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
|
||||||
|
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||||
|
echo "missing $scriptversion (GNU Automake)"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
echo 1>&2 "$0: unknown '$1' option"
|
||||||
|
echo 1>&2 "Try '$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Run the given program, remember its exit status.
|
||||||
|
"$@"; st=$?
|
||||||
|
|
||||||
|
# If it succeeded, we are done.
|
||||||
|
test $st -eq 0 && exit 0
|
||||||
|
|
||||||
|
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||||
|
# passed; such an option is passed most likely to detect whether the
|
||||||
|
# program is present and works.
|
||||||
|
case $2 in --version|--help) exit $st;; esac
|
||||||
|
|
||||||
|
# Exit code 63 means version mismatch. This often happens when the user
|
||||||
|
# tries to use an ancient version of a tool on a file that requires a
|
||||||
|
# minimum version.
|
||||||
|
if test $st -eq 63; then
|
||||||
|
msg="probably too old"
|
||||||
|
elif test $st -eq 127; then
|
||||||
|
# Program was missing.
|
||||||
|
msg="missing on your system"
|
||||||
|
else
|
||||||
|
# Program was found and executed, but failed. Give up.
|
||||||
|
exit $st
|
||||||
|
fi
|
||||||
|
|
||||||
|
perl_URL=http://www.perl.org/
|
||||||
|
flex_URL=http://flex.sourceforge.net/
|
||||||
|
gnu_software_URL=http://www.gnu.org/software
|
||||||
|
|
||||||
|
program_details ()
|
||||||
|
{
|
||||||
|
case $1 in
|
||||||
|
aclocal|automake)
|
||||||
|
echo "The '$1' program is part of the GNU Automake package:"
|
||||||
|
echo "<$gnu_software_URL/automake>"
|
||||||
|
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||||
|
echo "<$gnu_software_URL/autoconf>"
|
||||||
|
echo "<$gnu_software_URL/m4/>"
|
||||||
|
echo "<$perl_URL>"
|
||||||
|
;;
|
||||||
|
autoconf|autom4te|autoheader)
|
||||||
|
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||||
|
echo "<$gnu_software_URL/autoconf/>"
|
||||||
|
echo "It also requires GNU m4 and Perl in order to run:"
|
||||||
|
echo "<$gnu_software_URL/m4/>"
|
||||||
|
echo "<$perl_URL>"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
give_advice ()
|
||||||
|
{
|
||||||
|
# Normalize program name to check for.
|
||||||
|
normalized_program=`echo "$1" | sed '
|
||||||
|
s/^gnu-//; t
|
||||||
|
s/^gnu//; t
|
||||||
|
s/^g//; t'`
|
||||||
|
|
||||||
|
printf '%s\n' "'$1' is $msg."
|
||||||
|
|
||||||
|
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||||
|
case $normalized_program in
|
||||||
|
autoconf*)
|
||||||
|
echo "You should only need it if you modified 'configure.ac',"
|
||||||
|
echo "or m4 files included by it."
|
||||||
|
program_details 'autoconf'
|
||||||
|
;;
|
||||||
|
autoheader*)
|
||||||
|
echo "You should only need it if you modified 'acconfig.h' or"
|
||||||
|
echo "$configure_deps."
|
||||||
|
program_details 'autoheader'
|
||||||
|
;;
|
||||||
|
automake*)
|
||||||
|
echo "You should only need it if you modified 'Makefile.am' or"
|
||||||
|
echo "$configure_deps."
|
||||||
|
program_details 'automake'
|
||||||
|
;;
|
||||||
|
aclocal*)
|
||||||
|
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||||
|
echo "$configure_deps."
|
||||||
|
program_details 'aclocal'
|
||||||
|
;;
|
||||||
|
autom4te*)
|
||||||
|
echo "You might have modified some maintainer files that require"
|
||||||
|
echo "the 'automa4te' program to be rebuilt."
|
||||||
|
program_details 'autom4te'
|
||||||
|
;;
|
||||||
|
bison*|yacc*)
|
||||||
|
echo "You should only need it if you modified a '.y' file."
|
||||||
|
echo "You may want to install the GNU Bison package:"
|
||||||
|
echo "<$gnu_software_URL/bison/>"
|
||||||
|
;;
|
||||||
|
lex*|flex*)
|
||||||
|
echo "You should only need it if you modified a '.l' file."
|
||||||
|
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||||
|
echo "<$flex_URL>"
|
||||||
|
;;
|
||||||
|
help2man*)
|
||||||
|
echo "You should only need it if you modified a dependency" \
|
||||||
|
"of a man page."
|
||||||
|
echo "You may want to install the GNU Help2man package:"
|
||||||
|
echo "<$gnu_software_URL/help2man/>"
|
||||||
|
;;
|
||||||
|
makeinfo*)
|
||||||
|
echo "You should only need it if you modified a '.texi' file, or"
|
||||||
|
echo "any other file indirectly affecting the aspect of the manual."
|
||||||
|
echo "You might want to install the Texinfo package:"
|
||||||
|
echo "<$gnu_software_URL/texinfo/>"
|
||||||
|
echo "The spurious makeinfo call might also be the consequence of"
|
||||||
|
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||||
|
echo "want to install GNU make:"
|
||||||
|
echo "<$gnu_software_URL/make/>"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "You might have modified some files without having the proper"
|
||||||
|
echo "tools for further handling them. Check the 'README' file, it"
|
||||||
|
echo "often tells you about the needed prerequisites for installing"
|
||||||
|
echo "this package. You may also peek at any GNU archive site, in"
|
||||||
|
echo "case some other package contains this missing '$1' program."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||||
|
-e '2,$s/^/ /' >&2
|
||||||
|
|
||||||
|
# Propagate the correct exit status (expected to be 127 for a program
|
||||||
|
# not found, 63 for a program that failed due to version mismatch).
|
||||||
|
exit $st
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
|
# End:
|
||||||
279
configure.ac
279
configure.ac
@@ -41,13 +41,13 @@ AC_PREREQ(2.62)
|
|||||||
# Bugfix releases:
|
# Bugfix releases:
|
||||||
# pacman_version_micro += 1
|
# pacman_version_micro += 1
|
||||||
|
|
||||||
m4_define([lib_current], [7])
|
m4_define([lib_current], [8])
|
||||||
m4_define([lib_revision], [0])
|
m4_define([lib_revision], [2])
|
||||||
m4_define([lib_age], [0])
|
m4_define([lib_age], [0])
|
||||||
|
|
||||||
m4_define([pacman_version_major], [4])
|
m4_define([pacman_version_major], [4])
|
||||||
m4_define([pacman_version_minor], [0])
|
m4_define([pacman_version_minor], [1])
|
||||||
m4_define([pacman_version_micro], [0rc1])
|
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])
|
||||||
|
|
||||||
@@ -55,13 +55,22 @@ m4_define([pacman_version],
|
|||||||
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
|
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
|
||||||
AC_CONFIG_SRCDIR([config.h.in])
|
AC_CONFIG_SRCDIR([config.h.in])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE([1.11])
|
||||||
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
|
LT_INIT
|
||||||
LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
|
LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
|
||||||
LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
|
LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
|
||||||
|
|
||||||
|
# Respect empty CFLAGS during compiler tests
|
||||||
|
if test "x$CFLAGS" = "x"; then
|
||||||
|
CFLAGS=""
|
||||||
|
fi
|
||||||
|
|
||||||
# Set subsitution values for version stuff in Makefiles and anywhere else,
|
# Set subsitution values for version stuff in Makefiles and anywhere else,
|
||||||
# and put LIB_VERSION in config.h
|
# and put LIB_VERSION in config.h
|
||||||
AC_SUBST(LIB_VERSION)
|
AC_SUBST(LIB_VERSION)
|
||||||
@@ -88,6 +97,23 @@ 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 debug package suffix
|
||||||
|
AC_ARG_WITH(debug-suffix,
|
||||||
|
AS_HELP_STRING([--with-debug-suffix=name], [set the suffix for split debugging symbol packages used by makepkg]),
|
||||||
|
[DEBUGSUFFIX=$withval], [DEBUGSUFFIX=debug])
|
||||||
|
|
||||||
|
# Help line for changing shell used to run install scriptlets
|
||||||
|
AC_ARG_WITH(scriptlet-shell,
|
||||||
|
AS_HELP_STRING([--with-scriptlet-shell=shell],
|
||||||
|
[set the full path to the shell used to run install scriptlets]),
|
||||||
|
[SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh])
|
||||||
|
|
||||||
|
# Help line for ldconfig path
|
||||||
|
AC_ARG_WITH(ldconfig,
|
||||||
|
AS_HELP_STRING([--with-ldconfig=path],
|
||||||
|
[set the full path to ldconfig]),
|
||||||
|
[LDCONFIG=$withval], [LDCONFIG=/sbin/ldconfig])
|
||||||
|
|
||||||
# Help line for using OpenSSL
|
# Help line for using OpenSSL
|
||||||
AC_ARG_WITH(openssl,
|
AC_ARG_WITH(openssl,
|
||||||
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
|
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
|
||||||
@@ -98,8 +124,10 @@ AC_ARG_WITH(gpgme,
|
|||||||
AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
|
AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
|
||||||
[], [with_gpgme=check])
|
[], [with_gpgme=check])
|
||||||
|
|
||||||
# Check for useable libcurl
|
# Help line for using libcurl
|
||||||
LIBCURL_CHECK_CONFIG([yes], [7.19.4], [with_libcurl=yes], [with_libcurl=no])
|
AC_ARG_WITH(curl,
|
||||||
|
AS_HELP_STRING([--with-libcurl], [use libcurl for the internal downloader]),
|
||||||
|
[], [with_curl=check])
|
||||||
|
|
||||||
# Help line for documentation
|
# Help line for documentation
|
||||||
AC_ARG_ENABLE(doc,
|
AC_ARG_ENABLE(doc,
|
||||||
@@ -116,21 +144,43 @@ AC_ARG_ENABLE(debug,
|
|||||||
AS_HELP_STRING([--enable-debug], [enable debugging support]),
|
AS_HELP_STRING([--enable-debug], [enable debugging support]),
|
||||||
[debug=$enableval], [debug=no])
|
[debug=$enableval], [debug=no])
|
||||||
|
|
||||||
|
# Help line for compiler warning flags
|
||||||
|
AC_ARG_ENABLE(warningflags,
|
||||||
|
AS_HELP_STRING([--enable-warningflags], [enable extra compiler warning flags]),
|
||||||
|
[warningflags=$enableval], [warningflags=no])
|
||||||
|
|
||||||
# Help line for using git version in pacman version string
|
# Help line for using git version in pacman version string
|
||||||
AC_ARG_ENABLE(git-version,
|
AC_ARG_ENABLE(git-version,
|
||||||
AS_HELP_STRING([--enable-git-version],
|
AS_HELP_STRING([--enable-git-version],
|
||||||
[enable use of git version in version string if available]),
|
[enable use of git version in version string if available]),
|
||||||
[wantgitver=$enableval], [wantgitver=no])
|
[wantgitver=$enableval], [wantgitver=no])
|
||||||
|
|
||||||
|
# Enable large file support if available (must be enabled before
|
||||||
|
# testing compilation against gpgme).
|
||||||
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
AC_PROG_CC_C99
|
AC_PROG_CC_C99
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
|
||||||
AC_PROG_MAKE_SET
|
|
||||||
AC_PROG_LIBTOOL
|
|
||||||
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])
|
AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
|
||||||
|
|
||||||
|
AS_IF([test "x$BASH_SHELL" = "xfalse"],
|
||||||
|
AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
|
||||||
|
[bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
|
||||||
|
bash_version_minor=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[1]]}"'`
|
||||||
|
ok=yes
|
||||||
|
if test "$bash_version_major" -lt 4; then
|
||||||
|
ok=no
|
||||||
|
fi
|
||||||
|
if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 1; then
|
||||||
|
ok=no
|
||||||
|
fi
|
||||||
|
if test "$ok" = "no"; then
|
||||||
|
AC_MSG_ERROR([*** bash >= 4.1.0 is required for pacman scripts])
|
||||||
|
fi
|
||||||
|
unset bash_version_major bash_version_minor ok])
|
||||||
|
|
||||||
# find installed gettext
|
# find installed gettext
|
||||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||||
@@ -140,47 +190,90 @@ AC_CHECK_LIB([m], [fabs], ,
|
|||||||
AC_MSG_ERROR([libm is needed to compile pacman!]))
|
AC_MSG_ERROR([libm is needed to compile pacman!]))
|
||||||
|
|
||||||
# Check for libarchive
|
# Check for libarchive
|
||||||
AC_CHECK_LIB([archive], [archive_read_data], ,
|
PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 2.8.0], ,
|
||||||
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
|
AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to compile pacman!]))
|
||||||
|
|
||||||
# Check for OpenSSL
|
# Check for OpenSSL
|
||||||
AC_MSG_CHECKING(whether to link with libssl)
|
have_openssl=no
|
||||||
AS_IF([test "x$with_openssl" != "xno"],
|
if test "x$with_openssl" != "xno"; then
|
||||||
[AC_MSG_RESULT(yes)
|
PKG_CHECK_MODULES(LIBSSL, [libcrypto],
|
||||||
AC_CHECK_LIB([ssl], [MD5_Final], ,
|
[AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no)
|
||||||
[if test "x$with_openssl" != "xcheck"; then
|
if test "x$have_openssl" = xno -a "x$with_openssl" = xyes; then
|
||||||
AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found])
|
AC_MSG_ERROR([*** openssl support requested but libraries not found])
|
||||||
fi],
|
fi
|
||||||
[-lcrypto])
|
fi
|
||||||
with_openssl=$ac_cv_lib_ssl_MD5_Final],
|
AM_CONDITIONAL(HAVE_LIBSSL, [test "$have_openssl" = "yes"])
|
||||||
AC_MSG_RESULT(no))
|
|
||||||
AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"])
|
# Check for libcurl
|
||||||
|
have_libcurl=no
|
||||||
|
if test "x$with_libcurl" != "xno"; then
|
||||||
|
PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.19.4],
|
||||||
|
[AC_DEFINE(HAVE_LIBCURL, 1, [Define if libcurl is available]) have_libcurl=yes], have_libcurl=no)
|
||||||
|
if test "x$have_libcurl" = xno -a "x$with_libcurl" = xyes; then
|
||||||
|
AC_MSG_ERROR([*** libcurl >= 7.19.4 is required for internal downloader support])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL(HAVE_LIBCURL, [test "$have_libcurl" = "yes"])
|
||||||
|
|
||||||
# Check for gpgme
|
# Check for gpgme
|
||||||
AC_MSG_CHECKING(whether to link with libgpgme)
|
AC_MSG_CHECKING(whether to link with libgpgme)
|
||||||
AS_IF([test "x$with_gpgme" != "xno"],
|
AS_IF([test "x$with_gpgme" != "xno"],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT([yes])],
|
||||||
AC_CHECK_LIB([gpgme], [gpgme_check_version], ,
|
[AC_MSG_RESULT([no])])
|
||||||
[if test "x$with_gpgme" != "xcheck"; then
|
|
||||||
AC_MSG_FAILURE([--with-ggpme was given, but -lgpgme was not found])
|
have_gpgme=no
|
||||||
fi],
|
AS_IF([test "x$with_gpgme" != "xno"],
|
||||||
[-lgpgme])
|
[AM_PATH_GPGME([1.3.0],
|
||||||
with_gpgme=$ac_cv_lib_gpgme_gpgme_check_version],
|
[LIBS_save="$LIBS"
|
||||||
AC_MSG_RESULT(no))
|
CPPFLAGS_save="$CPPFLAGS"
|
||||||
AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"])
|
CFLAGS_save="$CFLAGS"
|
||||||
|
|
||||||
|
LIBS="$LIBS $GPGME_LIBS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $GPGME_CPPFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $GPGME_CFLAGS"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for sane gpgme])
|
||||||
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[#include <gpgme.h>]],
|
||||||
|
[[return gpgme_check_version("1.3.0");]])],
|
||||||
|
[AC_MSG_RESULT([yes])
|
||||||
|
have_gpgme=yes
|
||||||
|
AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])],
|
||||||
|
[AC_MSG_RESULT([no])
|
||||||
|
have_gpgme=no
|
||||||
|
unset GPGME_LIBS
|
||||||
|
unset GPGME_CFLAGS]
|
||||||
|
AS_IF([test "x$with_gpgme" = "xyes"],
|
||||||
|
[AC_MSG_FAILURE([*** gpgme >= 1.3.0 is needed for GPG signature support])])
|
||||||
|
)
|
||||||
|
|
||||||
|
LIBS="$LIBS_save"
|
||||||
|
CPPFLAGS="$CPPFLAGS_save"
|
||||||
|
CFLAGS="$CFLAGS_save"
|
||||||
|
unset CPPFLAGS_save
|
||||||
|
unset CFLAGS_save],)])
|
||||||
|
|
||||||
|
AS_IF([test "x$have_gpgme" = xno -a "x$with_gpgme" = xyes],
|
||||||
|
[AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])])
|
||||||
|
AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$have_gpgme" = "xyes"])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h locale.h mntent.h string.h \
|
AC_CHECK_HEADERS([fcntl.h float.h glob.h langinfo.h libintl.h limits.h \
|
||||||
sys/ioctl.h sys/mount.h sys/param.h sys/statvfs.h \
|
locale.h mntent.h netinet/in.h netinet/tcp.h \
|
||||||
sys/time.h sys/types.h sys/ucred.h syslog.h termios.h \
|
stddef.h string.h sys/ioctl.h \
|
||||||
wchar.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
|
AC_STRUCT_DIRENT_D_TYPE
|
||||||
@@ -190,54 +283,59 @@ PATH_MAX_DEFINED
|
|||||||
AC_FUNC_FORK
|
AC_FUNC_FORK
|
||||||
AC_FUNC_GETMNTENT
|
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_CHECK_FUNCS([geteuid getmntinfo realpath regcomp strcasecmp \
|
AC_FUNC_STRCOLL
|
||||||
strndup strrchr strsep swprintf tcflush \
|
AC_CHECK_FUNCS([dup2 getcwd getmntinfo gettimeofday memmove memset \
|
||||||
wcwidth uname])
|
mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
|
||||||
|
strchr strcspn strdup strerror strndup strrchr strsep strstr \
|
||||||
|
strtol swprintf tcflush wcwidth uname])
|
||||||
|
AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])
|
||||||
|
|
||||||
# For the diskspace code
|
# For the diskspace code
|
||||||
FS_STATS_TYPE
|
FS_STATS_TYPE
|
||||||
AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
|
AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
|
||||||
AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
|
AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
|
||||||
#include <sys/mount.h>]])
|
#include <sys/mount.h>]])
|
||||||
|
|
||||||
# Enable large file support if available
|
|
||||||
AC_SYS_LARGEFILE
|
|
||||||
|
|
||||||
# Check if we can use symbol visibility support in GCC
|
# Check if we can use symbol visibility support in GCC
|
||||||
GCC_VISIBILITY_CC
|
GCC_VISIBILITY_CC
|
||||||
# Check if we have -fgnu89-inline flag
|
# Check if we have -fgnu89-inline flag
|
||||||
GCC_GNU89_INLINE_CC
|
GCC_GNU89_INLINE_CC
|
||||||
|
|
||||||
# Host-dependant definitions
|
# Host-dependant definitions
|
||||||
SIZECMD="stat -L -c %s"
|
INODECMD="stat -c '%i %n'"
|
||||||
SEDINPLACE="sed -i"
|
SIZECMD="stat -c %s"
|
||||||
|
SEDINPLACE="sed --follow-symlinks -i"
|
||||||
|
DUFLAGS="-sk --apparent-size"
|
||||||
STRIP_BINARIES="--strip-all"
|
STRIP_BINARIES="--strip-all"
|
||||||
STRIP_SHARED="--strip-unneeded"
|
STRIP_SHARED="--strip-unneeded"
|
||||||
STRIP_STATIC="--strip-debug"
|
STRIP_STATIC="--strip-debug"
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
*bsd*)
|
*bsd*)
|
||||||
SIZECMD="stat -L -f %z"
|
INODECMD="stat -f '%i %N'"
|
||||||
SEDINPLACE="sed -i ''"
|
SIZECMD="stat -f %z"
|
||||||
;;
|
SEDINPLACE="sed -i \"\""
|
||||||
cygwin*)
|
DUFLAGS="-sk"
|
||||||
host_os_cygwin=yes
|
|
||||||
CFLAGS="$CFLAGS -DCYGWIN"
|
|
||||||
;;
|
;;
|
||||||
darwin*)
|
darwin*)
|
||||||
host_os_darwin=yes
|
host_os_darwin=yes
|
||||||
SIZECMD="/usr/bin/stat -L -f %z"
|
INODECMD="/usr/bin/stat -f '%i %N'"
|
||||||
|
SIZECMD="/usr/bin/stat -f %z"
|
||||||
SEDINPLACE="/usr/bin/sed -i ''"
|
SEDINPLACE="/usr/bin/sed -i ''"
|
||||||
|
DUFLAGS="-sk"
|
||||||
STRIP_BINARIES=""
|
STRIP_BINARIES=""
|
||||||
STRIP_SHARED="-S"
|
STRIP_SHARED="-S"
|
||||||
STRIP_STATIC="-S"
|
STRIP_STATIC="-S"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
|
|
||||||
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
|
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
|
||||||
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
|
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
|
||||||
|
AC_SUBST(INODECMD)
|
||||||
AC_SUBST(SIZECMD)
|
AC_SUBST(SIZECMD)
|
||||||
AC_SUBST(SEDINPLACE)
|
AC_SUBST(SEDINPLACE)
|
||||||
|
AC_SUBST(DUFLAGS)
|
||||||
AC_SUBST(STRIP_BINARIES)
|
AC_SUBST(STRIP_BINARIES)
|
||||||
AC_SUBST(STRIP_SHARED)
|
AC_SUBST(STRIP_SHARED)
|
||||||
AC_SUBST(STRIP_STATIC)
|
AC_SUBST(STRIP_STATIC)
|
||||||
@@ -287,16 +385,49 @@ AC_MSG_CHECKING(for debug mode request)
|
|||||||
if test "x$debug" = "xyes" ; then
|
if test "x$debug" = "xyes" ; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
|
AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
|
||||||
# Check for mcheck
|
|
||||||
AC_CHECK_HEADERS([mcheck.h])
|
|
||||||
# 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
|
GCC_FORTIFY_SOURCE_CC
|
||||||
CFLAGS="$CFLAGS -g -Wall -Werror"
|
WARNING_CFLAGS="-g -Wall -Werror"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
WARNING_CFLAGS="-Wall"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable or disable compiler warning flags
|
||||||
|
AC_MSG_CHECKING(for excessive compiler warning flags)
|
||||||
|
if test "x$warningflags" = "xyes" ; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
CFLAGS_ADD([-Wcast-align], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wclobbered], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wempty-body], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wfloat-equal], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wformat-nonliteral], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wformat-security], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wignored-qualifiers], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Winit-self], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wlogical-op], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wmissing-declarations], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wmissing-field-initializers], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wmissing-parameter-type], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wmissing-prototypes], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wold-style-declaration], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Woverride-init], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wpointer-arith], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wredundant-decls], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wshadow], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wsign-compare], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wstrict-aliasing], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wstrict-overflow=5], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wstrict-prototypes], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wtype-limits], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wuninitialized], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wunused-but-set-parameter], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wunused-parameter], [WARNING_CFLAGS])
|
||||||
|
CFLAGS_ADD([-Wwrite-strings], [WARNING_CFLAGS])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
CFLAGS="$CFLAGS -Wall"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable or disable use of git version in pacman version string
|
# Enable or disable use of git version in pacman version string
|
||||||
@@ -304,13 +435,9 @@ AC_MSG_CHECKING(whether to use git version if available)
|
|||||||
if test "x$wantgitver" = "xyes" ; then
|
if test "x$wantgitver" = "xyes" ; then
|
||||||
AC_CHECK_PROGS([GIT], [git])
|
AC_CHECK_PROGS([GIT], [git])
|
||||||
AC_CHECK_FILE([.git/], hasgitdir=yes)
|
AC_CHECK_FILE([.git/], hasgitdir=yes)
|
||||||
|
usegitver=$ac_cv_file__git_
|
||||||
if test $GIT -a "x$hasgitdir" = "xyes"; then
|
if test $GIT -a "x$hasgitdir" = "xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
usegitver=yes
|
|
||||||
AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
|
AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no, git or .git dir missing])
|
|
||||||
usegitver=no
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no, disabled by configure])
|
AC_MSG_RESULT([no, disabled by configure])
|
||||||
@@ -320,6 +447,7 @@ AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
|
|||||||
|
|
||||||
# Set root directory
|
# Set root directory
|
||||||
AC_SUBST(ROOTDIR)
|
AC_SUBST(ROOTDIR)
|
||||||
|
AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
|
||||||
# Set package file extension
|
# Set package file extension
|
||||||
AC_SUBST(PKGEXT)
|
AC_SUBST(PKGEXT)
|
||||||
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
|
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
|
||||||
@@ -329,11 +457,23 @@ AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman sourc
|
|||||||
# 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])
|
||||||
|
# Set makepkg split debugging symbol package suffix
|
||||||
|
AC_SUBST(DEBUGSUFFIX)
|
||||||
|
AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symbol packages used by makepkg])
|
||||||
|
# Set shell used by install scriptlets
|
||||||
|
AC_SUBST(SCRIPTLET_SHELL)
|
||||||
|
AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])
|
||||||
|
# Set ldconfig path
|
||||||
|
AC_SUBST(LDCONFIG)
|
||||||
|
AC_DEFINE_UNQUOTED([LDCONFIG], "$LDCONFIG", [The full path to ldconfig])
|
||||||
|
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
lib/libalpm/Makefile
|
lib/libalpm/Makefile
|
||||||
lib/libalpm/po/Makefile.in
|
lib/libalpm/po/Makefile.in
|
||||||
|
lib/libalpm/libalpm.pc
|
||||||
|
src/common/Makefile
|
||||||
src/pacman/Makefile
|
src/pacman/Makefile
|
||||||
src/pacman/po/Makefile.in
|
src/pacman/po/Makefile.in
|
||||||
src/util/Makefile
|
src/util/Makefile
|
||||||
@@ -343,6 +483,7 @@ doc/Makefile
|
|||||||
etc/Makefile
|
etc/Makefile
|
||||||
test/pacman/Makefile
|
test/pacman/Makefile
|
||||||
test/pacman/tests/Makefile
|
test/pacman/tests/Makefile
|
||||||
|
test/scripts/Makefile
|
||||||
test/util/Makefile
|
test/util/Makefile
|
||||||
contrib/Makefile
|
contrib/Makefile
|
||||||
Makefile
|
Makefile
|
||||||
@@ -363,13 +504,13 @@ ${PACKAGE_NAME}:
|
|||||||
|
|
||||||
compiler : ${CC}
|
compiler : ${CC}
|
||||||
preprocessor flags : ${CPPFLAGS}
|
preprocessor flags : ${CPPFLAGS}
|
||||||
compiler flags : ${CFLAGS}
|
compiler flags : ${WARNING_CFLAGS} ${CFLAGS}
|
||||||
defines : ${DEFS}
|
library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
|
||||||
library flags : ${LIBS}
|
|
||||||
linker flags : ${LDFLAGS}
|
linker flags : ${LDFLAGS}
|
||||||
|
|
||||||
Architecture : ${CARCH}
|
Architecture : ${CARCH}
|
||||||
Host Type : ${CHOST}
|
Host Type : ${CHOST}
|
||||||
|
File inode command : ${INODECMD}
|
||||||
Filesize command : ${SIZECMD}
|
Filesize command : ${SIZECMD}
|
||||||
In-place sed command : ${SEDINPLACE}
|
In-place sed command : ${SEDINPLACE}
|
||||||
|
|
||||||
@@ -385,12 +526,14 @@ ${PACKAGE_NAME}:
|
|||||||
build script name : ${BUILDSCRIPT}
|
build script name : ${BUILDSCRIPT}
|
||||||
|
|
||||||
Compilation options:
|
Compilation options:
|
||||||
Use libcurl : ${with_libcurl}
|
Use libcurl : ${have_libcurl}
|
||||||
Use GPGME : ${with_gpgme}
|
Use GPGME : ${have_gpgme}
|
||||||
Use OpenSSL : ${with_openssl}
|
Use OpenSSL : ${have_openssl}
|
||||||
Run make in doc/ dir : ${wantdoc} ${asciidoc}
|
Run make in doc/ dir : ${wantdoc} ${asciidoc}
|
||||||
Doxygen support : ${usedoxygen}
|
Doxygen support : ${usedoxygen}
|
||||||
debug support : ${debug}
|
debug support : ${debug}
|
||||||
|
extra warning flags : ${warningflags}
|
||||||
|
use git version : ${wantgitver}
|
||||||
"
|
"
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
5
contrib/.gitignore
vendored
5
contrib/.gitignore
vendored
@@ -1,10 +1,13 @@
|
|||||||
bacman
|
bacman
|
||||||
bash_completion
|
bash_completion
|
||||||
|
checkupdates
|
||||||
paccache
|
paccache
|
||||||
pacdiff
|
pacdiff
|
||||||
paclist
|
paclist
|
||||||
paclog-pkglist
|
paclog-pkglist
|
||||||
pacscripts
|
pacscripts
|
||||||
pacsearch
|
pacsearch
|
||||||
wget-xdelta.sh
|
pacsysclean
|
||||||
|
rankmirrors
|
||||||
|
updpkgsums
|
||||||
zsh_completion
|
zsh_completion
|
||||||
|
|||||||
@@ -1,26 +1,46 @@
|
|||||||
OURSCRIPTS = \
|
# enforce that all scripts have a --help and --version option
|
||||||
|
AUTOMAKE_OPTIONS = std-options
|
||||||
|
|
||||||
|
bin_SCRIPTS = \
|
||||||
|
$(OURSCRIPTS)
|
||||||
|
|
||||||
|
BASHSCRIPTS = \
|
||||||
bacman \
|
bacman \
|
||||||
|
checkupdates \
|
||||||
paccache \
|
paccache \
|
||||||
pacdiff \
|
pacdiff \
|
||||||
paclist \
|
paclist \
|
||||||
paclog-pkglist \
|
paclog-pkglist \
|
||||||
pacscripts \
|
pacscripts \
|
||||||
|
pacsysclean \
|
||||||
|
rankmirrors \
|
||||||
|
updpkgsums
|
||||||
|
|
||||||
|
OTHERSCRIPTS = \
|
||||||
pacsearch
|
pacsearch
|
||||||
|
|
||||||
|
OURSCRIPTS = \
|
||||||
|
$(BASHSCRIPTS) \
|
||||||
|
$(OTHERSCRIPTS)
|
||||||
|
|
||||||
OURFILES = \
|
OURFILES = \
|
||||||
bash_completion \
|
bash_completion \
|
||||||
zsh_completion
|
zsh_completion
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
PKGBUILD.vim \
|
PKGBUILD.vim \
|
||||||
bacman.in \
|
bacman.sh.in \
|
||||||
bash_completion.in \
|
bash_completion.in \
|
||||||
paccache.in \
|
checkupdates.sh.in \
|
||||||
paclog-pkglist.in \
|
paccache.sh.in \
|
||||||
pacdiff.in \
|
paclog-pkglist.sh.in \
|
||||||
paclist.in \
|
pacdiff.sh.in \
|
||||||
pacscripts.in \
|
paclist.sh.in \
|
||||||
|
pacscripts.sh.in \
|
||||||
pacsearch.in \
|
pacsearch.in \
|
||||||
|
pacsysclean.sh.in \
|
||||||
|
rankmirrors.sh.in \
|
||||||
|
updpkgsums.sh.in \
|
||||||
vimprojects \
|
vimprojects \
|
||||||
zsh_completion.in \
|
zsh_completion.in \
|
||||||
README
|
README
|
||||||
@@ -28,38 +48,63 @@ EXTRA_DIST = \
|
|||||||
# Files that should be removed, but which Automake does not know.
|
# Files that should be removed, but which Automake does not know.
|
||||||
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
|
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
|
||||||
|
|
||||||
|
if USE_GIT_VERSION
|
||||||
|
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
|
||||||
|
REAL_PACKAGE_VERSION = $(GIT_VERSION)
|
||||||
|
else
|
||||||
|
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
edit = sed \
|
edit = sed \
|
||||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
-e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
|
||||||
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
|
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
|
||||||
|
-e 's|@SCRIPTNAME[@]|$@|g' \
|
||||||
-e '1s|!/bin/bash|!$(BASH_SHELL)|g'
|
-e '1s|!/bin/bash|!$(BASH_SHELL)|g'
|
||||||
|
|
||||||
$(OURSCRIPTS): Makefile
|
$(OTHERSCRIPTS): Makefile
|
||||||
@echo ' ' GEN $@;
|
$(AM_V_at)$(RM) $@ $@.tmp
|
||||||
@rm -f $@ $@.tmp
|
$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
|
||||||
@$(edit) $(srcdir)/$@.in >$@.tmp
|
$(AM_V_at)chmod +x,a-w $@.tmp
|
||||||
@chmod +x $@.tmp
|
$(AM_V_at)mv $@.tmp $@
|
||||||
@chmod a-w $@.tmp
|
|
||||||
@mv $@.tmp $@
|
$(BASHSCRIPTS): Makefile
|
||||||
|
$(AM_V_at)$(RM) $@
|
||||||
|
$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
|
||||||
|
$(AM_V_at)chmod +x,a-w $@
|
||||||
|
@$(BASH_SHELL) -O extglob -n $@
|
||||||
|
|
||||||
$(OURFILES): Makefile
|
$(OURFILES): Makefile
|
||||||
@echo ' ' GEN $@;
|
$(AM_V_at)$(RM) $@ $@.tmp
|
||||||
@rm -f $@ $@.tmp
|
$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
|
||||||
@$(edit) $(srcdir)/$@.in >$@.tmp
|
$(AM_V_at)chmod a-w $@.tmp
|
||||||
@chmod a-w $@.tmp
|
$(AM_V_at)mv $@.tmp $@
|
||||||
@mv $@.tmp $@
|
|
||||||
|
|
||||||
all-am: $(OURSCRIPTS) $(OURFILES)
|
all-am: $(OURSCRIPTS) $(OURFILES)
|
||||||
|
|
||||||
bacman: $(srcdir)/bacman.in
|
install-data-local:
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
|
||||||
|
$(INSTALL_DATA) bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
|
||||||
|
$(INSTALL_DATA) zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
|
||||||
|
|
||||||
|
uninstall-local:
|
||||||
|
$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
|
||||||
|
$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
|
||||||
|
|
||||||
|
bacman: $(srcdir)/bacman.sh.in
|
||||||
bash_completion: $(srcdir)/bash_completion.in
|
bash_completion: $(srcdir)/bash_completion.in
|
||||||
paccache: $(srcdir)/paccache.in
|
checkupdates: $(srcdir)/checkupdates.sh.in
|
||||||
pacdiff: $(srcdir)/pacdiff.in
|
paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh $(top_srcdir)/scripts/library/size_to_human.sh
|
||||||
paclist: $(srcdir)/paclist.in
|
pacdiff: $(srcdir)/pacdiff.sh.in
|
||||||
paclog-pkglist: $(srcdir)/paclog-pkglist.in
|
paclist: $(srcdir)/paclist.sh.in
|
||||||
pacscripts: $(srcdir)/pacscripts.in
|
paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in
|
||||||
|
pacscripts: $(srcdir)/pacscripts.sh.in
|
||||||
pacsearch: $(srcdir)/pacsearch.in
|
pacsearch: $(srcdir)/pacsearch.in
|
||||||
pactree: $(srcdir)/pactree.in
|
pacsysclean: $(srcdir)/pacsysclean.sh.in
|
||||||
|
rankmirrors: $(srcdir)/rankmirrors.sh.in
|
||||||
|
updpkgsums: $(srcdir)/updpkgsums.sh.in
|
||||||
zsh_completion: $(srcdir)/zsh_completion.in
|
zsh_completion: $(srcdir)/zsh_completion.in
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubl
|
|||||||
" license
|
" license
|
||||||
syn keyword pb_k_license license contained
|
syn keyword pb_k_license license contained
|
||||||
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
|
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
|
||||||
syn keyword pbLicense APACHE CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RALINK RUBY ZPL contained
|
syn keyword pbLicense AGPL AGPL3 Apache APACHE Artistic2.0 CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RUBY W3C ZPL contained
|
||||||
" special cases from http://wiki.archlinux.org/index.php/Arch_Packaging_Standards
|
" special cases from https://wiki.archlinux.org/index.php/Arch_Packaging_Standards
|
||||||
syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained
|
syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained
|
||||||
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
|
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
|
||||||
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
|
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
|
||||||
@@ -108,7 +108,7 @@ 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
|
" checkdepends
|
||||||
syn keyword pb_k_ckdepends ckdepends contained
|
syn keyword pb_k_ckdepends checkdepends contained
|
||||||
syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
|
||||||
syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
|
syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
|
||||||
|
|
||||||
@@ -176,12 +176,45 @@ hi def link pbSha1Quotes Keyword
|
|||||||
hi def link pbSha1Hash Error
|
hi def link pbSha1Hash Error
|
||||||
hi def link pbValidSha1sums Number
|
hi def link pbValidSha1sums Number
|
||||||
|
|
||||||
|
" sha256sums
|
||||||
|
syn keyword pb_k_sha256sums sha256sums contained
|
||||||
|
syn match pbIllegalSha256sums /[^='"()\/ ]/ contained contains=pbValidSha256sums
|
||||||
|
syn match pbValidSha256sums /\x\{64\}/ contained
|
||||||
|
syn region pbSha256sumsGroup start=/^sha256sums/ end=/)/ contains=pb_k_sha256sums,pbSha256Quotes,pbSha256Hash,pbIllegalSha256sums keepend
|
||||||
|
syn match pbSha256Quotes /'.*'\|".*"/ contained contains=pbSha256Hash,pbIllegalSha256sums
|
||||||
|
syn match pbSha256Hash /\x\+/ contained contains=pbValidSha256sums
|
||||||
|
hi def link pbSha256Quotes Keyword
|
||||||
|
hi def link pbSha256Hash Error
|
||||||
|
hi def link pbValidSha256sums Number
|
||||||
|
|
||||||
|
" sha384sums
|
||||||
|
syn keyword pb_k_sha384sums sha384sums contained
|
||||||
|
syn match pbIllegalSha384sums /[^='"()\/ ]/ contained contains=pbValidSha384sums
|
||||||
|
syn match pbValidSha384sums /\x\{96\}/ contained
|
||||||
|
syn region pbSha384sumsGroup start=/^sha384sums/ end=/)/ contains=pb_k_sha384sums,pbSha384Quotes,pbSha384Hash,pbIllegalSha384sums keepend
|
||||||
|
syn match pbSha384Quotes /'.*'\|".*"/ contained contains=pbSha384Hash,pbIllegalSha384sums
|
||||||
|
syn match pbSha384Hash /\x\+/ contained contains=pbValidSha384sums
|
||||||
|
hi def link pbSha384Quotes Keyword
|
||||||
|
hi def link pbSha384Hash Error
|
||||||
|
hi def link pbValidSha384sums Number
|
||||||
|
|
||||||
|
" sha512sums
|
||||||
|
syn keyword pb_k_sha512sums sha512sums contained
|
||||||
|
syn match pbIllegalSha512sums /[^='"()\/ ]/ contained contains=pbValidSha512sums
|
||||||
|
syn match pbValidSha512sums /\x\{128\}/ contained
|
||||||
|
syn region pbSha512sumsGroup start=/^sha512sums/ end=/)/ contains=pb_k_sha512sums,pbSha512Quotes,pbSha512Hash,pbIllegalSha512sums keepend
|
||||||
|
syn match pbSha512Quotes /'.*'\|".*"/ contained contains=pbSha512Hash,pbIllegalSha512sums
|
||||||
|
syn match pbSha512Hash /\x\+/ contained contains=pbValidSha512sums
|
||||||
|
hi def link pbSha512Quotes Keyword
|
||||||
|
hi def link pbSha512Hash Error
|
||||||
|
hi def link pbValidSha512sums 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\|buildflags\)/ contained
|
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|purge\|upx\|fakeroot\|distcc\|color\|ccache\|check\|sign\|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
|
||||||
syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
|
syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
|
||||||
|
|
||||||
" noextract
|
" noextract
|
||||||
@@ -220,6 +253,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
|
||||||
|
|
||||||
@@ -255,6 +291,15 @@ hi def link pbIllegalMd5sums Error
|
|||||||
hi def link pb_k_sha1sums pbKeywords
|
hi def link pb_k_sha1sums pbKeywords
|
||||||
hi def link pbIllegalSha1sums Error
|
hi def link pbIllegalSha1sums Error
|
||||||
|
|
||||||
|
hi def link pb_k_sha256sums pbKeywords
|
||||||
|
hi def link pbIllegalSha256sums Error
|
||||||
|
|
||||||
|
hi def link pb_k_sha384sums pbKeywords
|
||||||
|
hi def link pbIllegalSha384sums Error
|
||||||
|
|
||||||
|
hi def link pb_k_sha512sums pbKeywords
|
||||||
|
hi def link pbIllegalSha512sums Error
|
||||||
|
|
||||||
hi def link pb_k_options pbKeywords
|
hi def link pb_k_options pbKeywords
|
||||||
hi def link pbOptionsDeprec Todo
|
hi def link pbOptionsDeprec Todo
|
||||||
hi def link pbIllegalOption Error
|
hi def link pbIllegalOption Error
|
||||||
|
|||||||
@@ -4,11 +4,17 @@ PKGBUILD.vim - a vim/gvim syntax file for PKGBUILDs. Colors known variable
|
|||||||
names, highlights common errors such as invalid characters in pkgname or
|
names, highlights common errors such as invalid characters in pkgname or
|
||||||
pkgver, etc.
|
pkgver, etc.
|
||||||
|
|
||||||
|
bacman - regenerate a pacman package based on installed files and the pacman
|
||||||
|
database entries. Useful for reuse, or possible config file extension.
|
||||||
|
|
||||||
bash_completion - a bash completion script for pacman, install in
|
bash_completion - a bash completion script for pacman, install in
|
||||||
/etc/bash_completion.d/ for use (but rename to something descriptive!).
|
/etc/bash_completion.d/ for use (but rename to something descriptive!).
|
||||||
|
|
||||||
zsh_completion - a zsh completion script, install (with a rename) to
|
checkupdates - print a list of pending updates without touching the system
|
||||||
/usr/share/zsh/site-functions/.
|
sync databases (for safety on rolling release distributions).
|
||||||
|
|
||||||
|
paccache - a flexible package cache cleaning utility that allows greater
|
||||||
|
control over which packages are removed.
|
||||||
|
|
||||||
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
|
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
|
||||||
|
|
||||||
@@ -16,6 +22,8 @@ paclist - list all packages installed from a given repository. Useful for
|
|||||||
seeing which packages you may have installed from the testing repository,
|
seeing which packages you may have installed from the testing repository,
|
||||||
for instance.
|
for instance.
|
||||||
|
|
||||||
|
paclog-pkglist - lists currently installs packages based pacman's log.
|
||||||
|
|
||||||
pacscripts - tries to print out the {pre,post}_{install,remove,upgrade}
|
pacscripts - tries to print out the {pre,post}_{install,remove,upgrade}
|
||||||
scripts of a given package.
|
scripts of a given package.
|
||||||
|
|
||||||
@@ -23,8 +31,13 @@ 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.
|
||||||
|
|
||||||
bacman - regenerate a pacman package based on installed files and the pacman
|
pacsysclean - lists installed packages sorted by size.
|
||||||
database entries. Useful for reuse, or possible config file extension.
|
|
||||||
|
rankmirrors - ranks pacman mirrors by their connection and opening speed.
|
||||||
|
|
||||||
|
updpkgsums - performs an in place update of the checksums in a PKGBUILD.
|
||||||
|
|
||||||
vimprojects - a project file for the vim project plugin.
|
vimprojects - a project file for the vim project plugin.
|
||||||
|
|
||||||
|
zsh_completion - a zsh completion script, install (with a rename) to
|
||||||
|
/usr/share/zsh/site-functions/.
|
||||||
|
|||||||
@@ -1,305 +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 @sysconfdir@/pacman.conf ]; then
|
|
||||||
echo "ERROR: unable to read @sysconfdir@/pacman.conf"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
|
|
||||||
pac_db="${DBPath:-@localstatedir@/lib/pacman/}/local"
|
|
||||||
|
|
||||||
if [ ! -r @sysconfdir@/makepkg.conf ]; then
|
|
||||||
echo "ERROR: unable to read @sysconfdir@/makepkg.conf"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "@sysconfdir@/makepkg.conf"
|
|
||||||
if [ -r ~/.makepkg.conf ]; then
|
|
||||||
source ~/.makepkg.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
pkg_arch=${CARCH:-'unknown'}
|
|
||||||
pkg_dest="${PKGDEST:-$PWD}"
|
|
||||||
pkg_pkger=${PACKAGER:-'Unknown Packager'}
|
|
||||||
|
|
||||||
pkg_name="$1"
|
|
||||||
pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)"
|
|
||||||
pkg_namver="${pkg_dir##*/}"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Checks everything is in place
|
|
||||||
#
|
|
||||||
if [ ! -d "$pac_db" ] ; then
|
|
||||||
echo "ERROR: pacman database directory ${pac_db} not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$pkg_dir" ] ; then
|
|
||||||
echo "ERROR: package ${pkg_name} not found in pacman database"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Begin
|
|
||||||
#
|
|
||||||
echo Package: ${pkg_namver}
|
|
||||||
work_dir=$(mktemp -d -p /tmp)
|
|
||||||
cd "$work_dir" || exit 1
|
|
||||||
|
|
||||||
#
|
|
||||||
# File copying
|
|
||||||
#
|
|
||||||
echo "Copying package files..."
|
|
||||||
|
|
||||||
cat "$pkg_dir"/files |
|
|
||||||
while read i; do
|
|
||||||
if [ -z "$i" ] ; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$i" =~ %[A-Z]*% ]] ; then
|
|
||||||
current=$i
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $current in
|
|
||||||
%FILES%)
|
|
||||||
ret=0
|
|
||||||
if [ -e "/$i" ]; then
|
|
||||||
bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
|
|
||||||
|
|
||||||
# Workaround to bsdtar not reporting a missing file as an error
|
|
||||||
if [ ! -e "$work_dir/$i" -a ! -L "$work_dir/$i" ]; then
|
|
||||||
echo ""
|
|
||||||
echo "ERROR: unable to add /$i to the package"
|
|
||||||
echo " If your user does not have permssion to read this file then"
|
|
||||||
echo " you will need to run $progname as root"
|
|
||||||
rm -rf "$work_dir"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "WARNING: package file /$i is missing"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
ret=$?
|
|
||||||
if [ $ret -ne 0 ]; then
|
|
||||||
rm -rf "$work_dir"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
pkg_size=$(du -sk | awk '{print $1 * 1024}')
|
|
||||||
|
|
||||||
#
|
|
||||||
# .PKGINFO stuff
|
|
||||||
#
|
|
||||||
echo Generating .PKGINFO metadata...
|
|
||||||
echo "# Generated by $progname $progver" > .PKGINFO
|
|
||||||
if [ "$INFAKEROOT" = "1" ]; then
|
|
||||||
echo "# Using $(fakeroot -v)" >> .PKGINFO
|
|
||||||
fi
|
|
||||||
echo "# $(LC_ALL=C date)" >> .PKGINFO
|
|
||||||
echo "#" >> .PKGINFO
|
|
||||||
|
|
||||||
cat "$pkg_dir"/{desc,files} |
|
|
||||||
while read i; do
|
|
||||||
if [[ -z "$i" ]]; then
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$i" =~ %[A-Z]*% ]] ; then
|
|
||||||
current=$i
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$current" in
|
|
||||||
# desc
|
|
||||||
%NAME%)
|
|
||||||
echo "pkgname = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%VERSION%)
|
|
||||||
echo "pkgver = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%DESC%)
|
|
||||||
echo "pkgdesc = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%URL%)
|
|
||||||
echo "url = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%LICENSE%)
|
|
||||||
echo "license = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%ARCH%)
|
|
||||||
echo "arch = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%BUILDDATE%)
|
|
||||||
echo "builddate = $(date -u "+%s")" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%PACKAGER%)
|
|
||||||
echo "packager = $pkg_pkger" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%SIZE%)
|
|
||||||
echo "size = $pkg_size" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%GROUPS%)
|
|
||||||
echo "group = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%REPLACES%)
|
|
||||||
echo "replaces = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%DEPENDS%)
|
|
||||||
echo "depend = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%OPTDEPENDS%)
|
|
||||||
echo "optdepend = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%CONFLICTS%)
|
|
||||||
echo "conflict = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
%PROVIDES%)
|
|
||||||
echo "provides = $i" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
|
|
||||||
# files
|
|
||||||
%BACKUP%)
|
|
||||||
# strip the md5sum after the tab
|
|
||||||
echo "backup = ${i%%$'\t'*}" >> .PKGINFO
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
comp_files=".PKGINFO"
|
|
||||||
|
|
||||||
if [ -f "$pkg_dir/install" ] ; then
|
|
||||||
cp "$pkg_dir/install" "$work_dir/.INSTALL"
|
|
||||||
comp_files+=" .INSTALL"
|
|
||||||
fi
|
|
||||||
if [ -f $pkg_dir/changelog ] ; then
|
|
||||||
cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
|
|
||||||
comp_files+=" .CHANGELOG"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
|
|
||||||
#
|
|
||||||
chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
|
|
||||||
chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
|
|
||||||
|
|
||||||
#
|
|
||||||
# Generate the package
|
|
||||||
#
|
|
||||||
echo "Generating the package..."
|
|
||||||
|
|
||||||
case "$PKGEXT" in
|
|
||||||
*tar.gz) EXT=${PKGEXT%.gz} ;;
|
|
||||||
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
|
|
||||||
*tar.xz) EXT=${PKGEXT%.xz} ;;
|
|
||||||
*tar) EXT=${PKGEXT} ;;
|
|
||||||
*) echo "WARNING: '%s' is not a valid archive extension." \
|
|
||||||
"$PKGEXT" ; EXT=$PKGEXT ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
|
|
||||||
ret=0
|
|
||||||
|
|
||||||
# when fileglobbing, we want * in an empty directory to expand to
|
|
||||||
# the null string rather than itself
|
|
||||||
shopt -s nullglob
|
|
||||||
# TODO: Maybe this can be set globally for robustness
|
|
||||||
shopt -s -o pipefail
|
|
||||||
bsdtar -cf - $comp_files * |
|
|
||||||
case "$PKGEXT" in
|
|
||||||
*tar.gz) gzip -c -f -n ;;
|
|
||||||
*tar.bz2) bzip2 -c -f ;;
|
|
||||||
*tar.xz) xz -c -z - ;;
|
|
||||||
*tar) cat ;;
|
|
||||||
esac > ${pkg_file} || ret=$?
|
|
||||||
|
|
||||||
if [ $ret -ne 0 ]; then
|
|
||||||
echo "ERROR: unable to write package to $pkg_dest"
|
|
||||||
echo " Maybe the disk is full or you do not have write access"
|
|
||||||
rm -rf "$work_dir"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf "$work_dir"
|
|
||||||
|
|
||||||
echo Done
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 noet:
|
|
||||||
|
|
||||||
313
contrib/bacman.sh.in
Normal file
313
contrib/bacman.sh.in
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
#!/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
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 locci <carlocci_at_gmail_dot_com>
|
||||||
|
# Copyright (c) 2008-2013 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/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
declare -r myname='bacman'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
USE_COLOR='y'
|
||||||
|
|
||||||
|
m4_include(../scripts/library/output_format.sh)
|
||||||
|
|
||||||
|
#
|
||||||
|
# User Friendliness
|
||||||
|
#
|
||||||
|
usage() {
|
||||||
|
echo "This program recreates a package using pacman's db and system files"
|
||||||
|
echo "Usage: $myname [--nocolor] <installed package name>"
|
||||||
|
echo "Example: $myname kernel26"
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (C) 2008 locci <carlocci_at_gmail_dot_com>'
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $1 == "--nocolor" ]]; then
|
||||||
|
USE_COLOR='n'
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
m4_include(../scripts/library/term_colors.sh)
|
||||||
|
|
||||||
|
if (( $# != 1 )); then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 = -@(h|-help) ]]; then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
elif [[ $1 = -@(V|-version) ]]; then
|
||||||
|
version
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fakeroot support
|
||||||
|
#
|
||||||
|
if (( EUID )); then
|
||||||
|
if [[ -f /usr/bin/fakeroot ]]; then
|
||||||
|
msg "Entering fakeroot environment"
|
||||||
|
export INFAKEROOT="1"
|
||||||
|
/usr/bin/fakeroot -u -- "$0" "$@"
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
warning "installing fakeroot or running $myname as root is required to"
|
||||||
|
plain " preserve the ownership permissions of files in some packages\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Setting environmental variables
|
||||||
|
#
|
||||||
|
if [[ ! -r @sysconfdir@/pacman.conf ]]; then
|
||||||
|
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
|
||||||
|
error "unable to read @sysconfdir@/makepkg.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "@sysconfdir@/makepkg.conf"
|
||||||
|
if [[ -r ~/.makepkg.conf ]]; then
|
||||||
|
source ~/.makepkg.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
error "pacman database directory ${pac_db} not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${#pkg_dir[@]} != 1 )); then
|
||||||
|
error "%d entries for package %s found in pacman database" \
|
||||||
|
${#pkg_dir[@]} "${pkg_name}"
|
||||||
|
msg2 "%s" "${pkg_dir[@]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d $pkg_dir ]]; then
|
||||||
|
error "package %s is found in pacman database," "${pkg_name}"
|
||||||
|
plain " but \`%s' is not a directory" "${pkg_dir}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Begin
|
||||||
|
#
|
||||||
|
msg "Package: ${pkg_namver}"
|
||||||
|
work_dir=$(mktemp -d --tmpdir bacman.XXXXXXXXXX)
|
||||||
|
cd "$work_dir" || exit 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# File copying
|
||||||
|
#
|
||||||
|
msg2 "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
|
||||||
|
error "unable to add /$i to the package"
|
||||||
|
plain " If your user does not have permssion to read this file then"
|
||||||
|
plain " you will need to run $myname as root"
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warning "package file /$i is missing"
|
||||||
|
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
|
||||||
|
#
|
||||||
|
msg2 "Generating .PKGINFO metadata..."
|
||||||
|
echo "# Generated by $myname $myver" > .PKGINFO
|
||||||
|
if [[ $INFAKEROOT == "1" ]]; then
|
||||||
|
echo "# Using $(fakeroot -v)" >> .PKGINFO
|
||||||
|
fi
|
||||||
|
echo "# $(LC_ALL=C date)" >> .PKGINFO
|
||||||
|
echo "#" >> .PKGINFO
|
||||||
|
|
||||||
|
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
|
||||||
|
pkg_arch="$i"
|
||||||
|
;;
|
||||||
|
%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 < <(cat "$pkg_dir"/{desc,files})
|
||||||
|
|
||||||
|
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
|
||||||
|
#
|
||||||
|
msg2 "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 ;;
|
||||||
|
*) warning "'%s' is not a valid archive extension." \
|
||||||
|
"$PKGEXT"; cat ;;
|
||||||
|
esac > "${pkg_file}"; ret=$?
|
||||||
|
|
||||||
|
if (( ret )); then
|
||||||
|
error "Unable to write package to $pkg_dest"
|
||||||
|
plain " Maybe the disk is full or you do not have write access"
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "$work_dir"
|
||||||
|
|
||||||
|
msg "Done."
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
@@ -27,15 +27,59 @@ _arch_incomp() {
|
|||||||
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
|
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pacman_keyids() {
|
||||||
|
\pacman-key --list-keys 2>/dev/null | awk '
|
||||||
|
$1 == "pub" {
|
||||||
|
# key id
|
||||||
|
split($2, a, "/"); print a[2]
|
||||||
|
}
|
||||||
|
$1 == "uid" {
|
||||||
|
# email
|
||||||
|
if (match($NF, /<[^>]+>/))
|
||||||
|
print substr($NF, RSTART + 1, RLENGTH - 2)
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
_pacman_key() {
|
||||||
|
local o cur opts prev wantfiles
|
||||||
|
COMPREPLY=()
|
||||||
|
_get_comp_words_by_ref cur prev
|
||||||
|
opts=('add config delete edit-key export finger gpgdir
|
||||||
|
help import import-trustdb init keyserver list-keys list-sigs
|
||||||
|
lsign-key nocolor populate recv-keys refresh-keys updatedb
|
||||||
|
verify version'
|
||||||
|
'a d e f h l r u v V')
|
||||||
|
|
||||||
|
# operations for which we want to complete keyids
|
||||||
|
for o in 'd delete' 'e export' 'f finger' 'l list-keys' 'r recv-keys' \
|
||||||
|
'edit-key' 'list-sigs' 'lsign-key' 'refresh-keys'; do
|
||||||
|
_arch_incomp "$o" && break
|
||||||
|
unset o
|
||||||
|
done
|
||||||
|
|
||||||
|
# options for which we want file completion
|
||||||
|
wantfiles='-@(c|-config|g|-gpgdir)'
|
||||||
|
|
||||||
|
if [[ $prev = 'pacman-key' || ( $cur = -* && $prev != $wantfiles ) ]]; then
|
||||||
|
_arch_ptr2comp opts
|
||||||
|
elif [[ $prev = @(-k|--keyserver) ]]; then
|
||||||
|
return
|
||||||
|
elif [[ $prev != $wantfiles && $o ]]; then
|
||||||
|
COMPREPLY=($(compgen -W '$(_pacman_keyids)' -- "$cur"))
|
||||||
|
fi
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
_makepkg() {
|
_makepkg() {
|
||||||
local cur opts prev
|
local cur opts prev
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
_get_comp_words_by_ref cur prev
|
_get_comp_words_by_ref cur prev
|
||||||
if [[ $cur = -* && ! $prev =~ ^-(-(config|help)$|\w*[Chp]) ]]; then
|
if [[ $cur = -* && ! $prev =~ ^-(-(config|help)$|\w*[Chp]) ]]; then
|
||||||
opts=('allsource asroot check clean config force geninteg help holdver ignorearch
|
opts=('allsource asdeps asroot check clean config force geninteg help holdver ignorearch
|
||||||
install log nobuild nocheck nocolor noconfirm nodeps noextract noprogressbar
|
install key log needed nobuild nocheck nocolor noconfirm nodeps noextract
|
||||||
nosign pkg repackage rmdeps sign skipinteg source syncdeps'
|
noprogressbar nosign pkg repackage rmdeps sign skipchecksums skipinteg
|
||||||
'A L R c d e f g h i m o p r s')
|
skippgpcheck source syncdeps verifysource version'
|
||||||
|
'A L R S c d e f g h i m o p r s')
|
||||||
_arch_ptr2comp opts
|
_arch_ptr2comp opts
|
||||||
fi
|
fi
|
||||||
true
|
true
|
||||||
@@ -44,9 +88,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
|
||||||
)"
|
)"
|
||||||
}
|
}
|
||||||
@@ -59,11 +103,11 @@ _pacman() {
|
|||||||
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 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 recursive search sysupgrade'
|
info list needed nodeps print refresh recursive search sysupgrade'
|
||||||
'c f g i l p s u w y')
|
'c g i l p s u w y')
|
||||||
upgrade=('asdeps asexplicit force needed nodeps print recursive' 'f p')
|
upgrade=('asdeps asexplicit force needed nodeps print recursive' 'p')
|
||||||
common=('arch cachedir config dbpath debug help logfile noconfirm
|
common=('arch cachedir color 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')
|
||||||
|
|
||||||
@@ -74,7 +118,7 @@ _pacman() {
|
|||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
_arch_ptr2comp core
|
_arch_ptr2comp core
|
||||||
elif [[ ! $prev =~ ^-\w*[Vbhr] &&
|
elif [[ ! $prev =~ ^-\w*[Vbhr] &&
|
||||||
! $prev = --@(cachedir|config|dbpath|help|logfile|root|version) ]]
|
! $prev = --@(cachedir|color|config|dbpath|help|logfile|root|version) ]]
|
||||||
then
|
then
|
||||||
[[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
|
[[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
|
||||||
case ${o% *} in
|
case ${o% *} in
|
||||||
@@ -96,18 +140,12 @@ _pacman() {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
else
|
|
||||||
_pacman_file() {
|
|
||||||
_filedir 'pkg.tar.*'
|
|
||||||
}
|
|
||||||
complete -F _pacman -o filenames -o default pacman
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
complete -F _pacman -o default pacman
|
||||||
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
|
||||||
|
|||||||
44
contrib/checkupdates.sh.in
Normal file
44
contrib/checkupdates.sh.in
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# checkupdates: Safely print a list of pending updates.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Kyle Keen <keenerd@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/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
if (( $# > 0 )); then
|
||||||
|
echo "checkupdates: Safely print a list of pending updates."
|
||||||
|
echo "Use: checkupdates"
|
||||||
|
echo "Export the 'CHECKUPDATES_DB' variable to change the path of the temporary database."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $CHECKUPDATES_DB ]]; then
|
||||||
|
CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT
|
||||||
|
|
||||||
|
DBPath="${DBPath:-@localstatedir@/lib/pacman/}"
|
||||||
|
eval $(awk -F' *= *' '$1 ~ /DBPath/ { print $1 "=" $2 }' @sysconfdir@/pacman.conf)
|
||||||
|
|
||||||
|
mkdir -p "$CHECKUPDATES_DB"
|
||||||
|
ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
|
||||||
|
fakeroot pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null
|
||||||
|
pacman -Qqu --dbpath "$CHECKUPDATES_DB" 2> /dev/null
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
201
contrib/paccache.in → contrib/paccache.sh.in
Executable file → Normal file
201
contrib/paccache.in → contrib/paccache.sh.in
Executable file → Normal file
@@ -20,19 +20,17 @@
|
|||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
|
declare -r myname='paccache'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
declare -a candidates=() cmdopts=() whitelist=() blacklist=()
|
declare -a candidates=() cmdopts=() whitelist=() blacklist=()
|
||||||
declare -i delete=0 dryrun=0 filecount=0 keep=3 move=0 totalsaved=0
|
declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
|
||||||
declare cachedir=@localstatedir@/cache/pacman/pkg delim=$'\n' movedir= scanarch=
|
declare cachedir=@localstatedir@/cache/pacman/pkg delim=$'\n' keep=3 movedir= scanarch=
|
||||||
|
|
||||||
msg() {
|
USE_COLOR='y'
|
||||||
local mesg=$1; shift
|
|
||||||
printf "==> $mesg\n" "$@"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
error() {
|
m4_include(../scripts/library/output_format.sh)
|
||||||
local mesg=$1; shift
|
m4_include(../scripts/library/parseopts.sh)
|
||||||
printf "==> ERROR: $mesg\n" "$@"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
error "$@"
|
error "$@"
|
||||||
@@ -95,45 +93,23 @@ pkgfilter() {
|
|||||||
# enforce architecture match if specified
|
# enforce architecture match if specified
|
||||||
if (!scanarch || scanarch == idx[2]) {
|
if (!scanarch || scanarch == idx[2]) {
|
||||||
count = split(packages[idx[1], idx[2]], pkgs, SUBSEP)
|
count = split(packages[idx[1], idx[2]], pkgs, SUBSEP)
|
||||||
if (count > keep) {
|
for(i = 1; i <= count - keep; i++) {
|
||||||
for(i = 1; i <= count - keep; i++) {
|
print pkgs[i]
|
||||||
print pkgs[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}' "${@:3}"
|
}' "${@:3}"
|
||||||
}
|
}
|
||||||
|
|
||||||
size_to_human() {
|
m4_include(../scripts/library/size_to_human.sh)
|
||||||
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() {
|
runcmd() {
|
||||||
if (( needsroot )); then
|
if (( needsroot && EUID != 0 )); then
|
||||||
msg "Privilege escalation required"
|
msg "Privilege escalation required"
|
||||||
if sudo -v &>/dev/null && sudo -l &>/dev/null; then
|
if sudo -v &>/dev/null && sudo -l &>/dev/null; then
|
||||||
sudo "$@"
|
sudo "$@"
|
||||||
else
|
else
|
||||||
printf '%s ' 'root'
|
die 'Unable to escalate privileges using sudo'
|
||||||
su -c "$(printf '%q ' "$@")"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
"$@"
|
"$@"
|
||||||
@@ -148,14 +124,15 @@ summarize() {
|
|||||||
if (( delete )); then
|
if (( delete )); then
|
||||||
printf -v output 'finished: %d packages removed' "$filecount"
|
printf -v output 'finished: %d packages removed' "$filecount"
|
||||||
elif (( move )); then
|
elif (( move )); then
|
||||||
printf -v output "finished: %d packages moved to \`%s'" "$filecount" "$movedir"
|
printf -v output "finished: %d packages moved to '%s'" "$filecount" "$movedir"
|
||||||
elif (( dryrun )); then
|
elif (( dryrun )); then
|
||||||
if (( verbose )); then
|
if (( verbose )); then
|
||||||
msg "Candidate packages:"
|
msg "Candidate packages:"
|
||||||
while read -r pkg; do
|
while read -r pkg; do
|
||||||
if (( verbose >= 3 )); then
|
if (( verbose >= 3 )); then
|
||||||
[[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
|
[[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
|
||||||
if [[ -z $seen || $seenarch != $arch || $seen != $name ]]; then
|
if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then
|
||||||
|
seen=$name seenarch=$arch
|
||||||
printf '%s (%s):\n' "$name" "$arch"
|
printf '%s (%s):\n' "$name" "$arch"
|
||||||
fi
|
fi
|
||||||
printf ' %s\n' "$pkg"
|
printf ' %s\n' "$pkg"
|
||||||
@@ -164,7 +141,7 @@ summarize() {
|
|||||||
else
|
else
|
||||||
printf "%s$delim" "$pkg"
|
printf "%s$delim" "$pkg"
|
||||||
fi
|
fi
|
||||||
done < <(printf '%s\n' "$@" | pacsort)
|
done < <(printf '%s\n' "$@" | pacsort --files)
|
||||||
fi
|
fi
|
||||||
printf -v output 'finished dry run: %d candidates' "$filecount"
|
printf -v output 'finished dry run: %d candidates' "$filecount"
|
||||||
fi
|
fi
|
||||||
@@ -175,68 +152,106 @@ summarize() {
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
usage: ${0##*/} <operation> [options] [targets...]
|
usage: $myname <operation> [options] [targets...]
|
||||||
|
|
||||||
${0##*/} is a flexible pacman cache cleaning utility, which has numerous
|
$myname is a flexible pacman cache cleaning utility, which has numerous
|
||||||
options to help control how much, and what, is deleted from any directory
|
options to help control how much, and what, is deleted from any directory
|
||||||
containing pacman package tarballs.
|
containing pacman package tarballs.
|
||||||
|
|
||||||
Operations:
|
Operations:
|
||||||
-d perform a dry run, only finding candidate packages.
|
-d, --dryrun perform a dry run, only finding candidate packages.
|
||||||
-m <movedir> move candidate packages to 'movedir'.
|
-m, --move <dir> move candidate packages to 'movedir'.
|
||||||
-r remove candidate packages.
|
-r, --remove remove candidate packages.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-a <arch> scan for 'arch' (default: all architectures).
|
-a, --arch <arch> scan for 'arch' (default: all architectures).
|
||||||
-c <cachedir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
|
-c, --cachedir <dir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
|
||||||
-f apply force to mv(1) and rm(1) operations.
|
-f, --force apply force to mv(1) and rm(1) operations.
|
||||||
-h display this help message.
|
-h, --help display this help message and exit.
|
||||||
-i <pkgs> ignore 'pkgs', which is a comma separated. Alternatively,
|
-i, --ignore <pkgs> ignore 'pkgs', comma separated. Alternatively, specify '-' to
|
||||||
specify '-' to read package names from stdin, newline delimited.
|
read package names from stdin, newline delimited.
|
||||||
-k <num> keep 'num' of each package in 'cachedir' (default: 3).
|
-k, --keep <num> keep 'num' of each package in 'cachedir' (default: 3).
|
||||||
-u target uninstalled packages.
|
--nocolor remove color from output.
|
||||||
-v increase verbosity. specify up to 3 times.
|
-u, --uninstalled target uninstalled packages.
|
||||||
-z use null delimiters for candidate names (only with -v and -vv)
|
-v, --verbose increase verbosity. specify up to 3 times.
|
||||||
|
-z, --null use null delimiters for candidate names (only with -v and -vv)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if (( ! UID )); then
|
version() {
|
||||||
error "Do not run this script as root. You will be prompted for privilege escalation."
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
exit 42
|
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
|
||||||
fi
|
}
|
||||||
|
|
||||||
while getopts ':a:c:dfhi:k:m:rsuvz' opt; do
|
OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
|
||||||
case $opt in
|
OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
|
||||||
a) scanarch=$OPTARG ;;
|
'nocolor' 'remove' 'uninstalled' 'version' 'verbose' 'null')
|
||||||
c) cachedir=$OPTARG ;;
|
|
||||||
d) dryrun=1 ;;
|
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||||
f) cmdopts=(-f) ;;
|
exit 1
|
||||||
h) usage
|
fi
|
||||||
|
set -- "${OPTRET[@]}"
|
||||||
|
unset OPT_SHORT OPT_LONG OPTRET
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
case $1 in
|
||||||
|
-a|--arch)
|
||||||
|
scanarch=$2
|
||||||
|
shift ;;
|
||||||
|
-c|--cachedir)
|
||||||
|
cachedir=$2
|
||||||
|
shift ;;
|
||||||
|
-d|--dryrun)
|
||||||
|
dryrun=1 ;;
|
||||||
|
-f|--force)
|
||||||
|
cmdopts=(-f) ;;
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i) if [[ $OPTARG = '-' ]]; then
|
-i|--ignore)
|
||||||
[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
|
if [[ $2 = '-' ]]; then
|
||||||
else
|
[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
|
||||||
IFS=',' read -r -a ign <<< "$OPTARG"
|
else
|
||||||
fi
|
IFS=',' read -r -a ign <<< "$2"
|
||||||
blacklist+=("${ign[@]}")
|
fi
|
||||||
unset i ign ;;
|
blacklist+=("${ign[@]}")
|
||||||
k) keep=$OPTARG
|
unset i ign
|
||||||
if [[ $keep != $OPTARG ]] || (( keep < 0 )); then
|
shift ;;
|
||||||
|
-k|--keep)
|
||||||
|
keep=$2
|
||||||
|
if [[ -z $keep || -n ${keep//[0-9]/} ]]; then
|
||||||
die 'argument to option -k must be a non-negative integer'
|
die 'argument to option -k must be a non-negative integer'
|
||||||
fi ;;
|
else
|
||||||
m) move=1 movedir=$OPTARG ;;
|
keep=$(( 10#$keep ))
|
||||||
r) delete=1 ;;
|
fi
|
||||||
u) IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
|
shift ;;
|
||||||
blacklist+=("${ign[@]}")
|
--nocolor)
|
||||||
unset ign ;;
|
USE_COLOR='n' ;;
|
||||||
v) (( ++verbose )) ;;
|
-m|--move)
|
||||||
z) delim='\0' ;;
|
move=1 movedir=$2
|
||||||
:) die "option '--%s' requires an argument" "$OPTARG" ;;
|
shift ;;
|
||||||
?) die "invalid option -- '%s'" "$OPTARG" ;;
|
-r|--remove)
|
||||||
|
delete=1 ;;
|
||||||
|
-u|--uninstalled)
|
||||||
|
IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
|
||||||
|
blacklist+=("${ign[@]}")
|
||||||
|
unset ign ;;
|
||||||
|
-V|--version)
|
||||||
|
version
|
||||||
|
exit 0 ;;
|
||||||
|
-v|--verbose)
|
||||||
|
(( ++verbose )) ;;
|
||||||
|
-z|--null)
|
||||||
|
delim='\0' ;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break 2 ;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
|
||||||
|
m4_include(../scripts/library/term_colors.sh)
|
||||||
|
|
||||||
# remaining args are a whitelist
|
# remaining args are a whitelist
|
||||||
whitelist=("$@")
|
whitelist=("$@")
|
||||||
@@ -248,10 +263,10 @@ case $(( dryrun+delete+move )) in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
[[ -d $cachedir ]] ||
|
[[ -d $cachedir ]] ||
|
||||||
die "cachedir \`%s' does not exist or is not a directory" "$cachedir"
|
die "cachedir '%s' does not exist or is not a directory" "$cachedir"
|
||||||
|
|
||||||
[[ $movedir && ! -d $movedir ]] &&
|
[[ $movedir && ! -d $movedir ]] &&
|
||||||
die "move-to directory \`%s' does not exist or is not a directory" "$movedir"
|
die "move-to directory '%s' does not exist or is not a directory" "$movedir"
|
||||||
|
|
||||||
if (( move || delete )); then
|
if (( move || delete )); then
|
||||||
# make it an absolute path since we're about to chdir
|
# make it an absolute path since we're about to chdir
|
||||||
@@ -260,12 +275,12 @@ if (( move || delete )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# unlikely that this will fail, but better make sure
|
# unlikely that this will fail, but better make sure
|
||||||
cd "$cachedir" || die "failed to chdir to \`%s'" "$cachedir"
|
cd "$cachedir" >/dev/null || die "failed to chdir to '%s'" "$cachedir"
|
||||||
|
|
||||||
# note that these results are returned in an arbitrary order from awk, but
|
# 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.
|
# they'll be resorted (in summarize) iff we have a verbosity level set.
|
||||||
IFS=$'\n' read -r -d '' -a candidates < \
|
IFS=$'\n' read -r -d '' -a candidates < \
|
||||||
<(printf '%s\n' *.pkg.tar?(.+([^.])) | pacsort |
|
<(printf '%s\n' *.pkg.tar?(.+([^.])) | pacsort --files |
|
||||||
pkgfilter "$keep" "$scanarch" \
|
pkgfilter "$keep" "$scanarch" \
|
||||||
"${#whitelist[*]}" "${whitelist[@]}" \
|
"${#whitelist[*]}" "${whitelist[@]}" \
|
||||||
"${#blacklist[*]}" "${blacklist[@]}")
|
"${#blacklist[*]}" "${blacklist[@]}")
|
||||||
@@ -292,9 +307,11 @@ totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }
|
|||||||
# crush. kill. destroy.
|
# crush. kill. destroy.
|
||||||
(( verbose )) && cmdopts+=(-v)
|
(( verbose )) && cmdopts+=(-v)
|
||||||
if (( delete )); then
|
if (( delete )); then
|
||||||
runcmd rm "${cmdopts[@]}" "${candidates[@]}"
|
printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}"
|
||||||
elif (( move )); then
|
elif (( move )); then
|
||||||
runcmd mv "${cmdopts[@]}" "${candidates[@]}" "$movedir"
|
printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
summarize "$pkgcount" "${candidates[@]}"
|
summarize "$pkgcount" "${candidates[@]}"
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
54
contrib/pacdiff.in → contrib/pacdiff.sh.in
Executable file → Normal file
54
contrib/pacdiff.in → contrib/pacdiff.sh.in
Executable file → Normal file
@@ -2,6 +2,7 @@
|
|||||||
# pacdiff : a simple pacnew/pacorig/pacsave updater
|
# pacdiff : a simple pacnew/pacorig/pacsave updater
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
|
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
|
||||||
|
# Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.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,17 +18,31 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
declare -r myname='pacdiff'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
diffprog=${DIFFPROG:-vimdiff}
|
diffprog=${DIFFPROG:-vimdiff}
|
||||||
diffsearchpath=${DIFFSEARCHPATH:-/etc}
|
diffsearchpath=${DIFFSEARCHPATH:-/etc}
|
||||||
locate=0
|
locate=0
|
||||||
|
USE_COLOR='y'
|
||||||
|
|
||||||
|
m4_include(../scripts/library/output_format.sh)
|
||||||
|
|
||||||
|
m4_include(../scripts/library/term_colors.sh)
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "pacdiff : a simple pacnew/pacorig/pacsave updater"
|
echo "$myname : a simple pacnew/pacorig/pacsave updater"
|
||||||
echo "Usage : pacdiff [-l]"
|
echo "Usage : $myname [-l]"
|
||||||
echo " -l/--locate makes pacdiff use locate rather than find"
|
echo " -l/--locate makes $myname use locate rather than find"
|
||||||
echo " DIFFPROG variable allows to override the default vimdiff"
|
echo " DIFFPROG variable allows to override the default vimdiff"
|
||||||
echo " DIFFSEARCHPATH allows to override the default /etc path"
|
echo " DIFFSEARCHPATH allows to override the default /etc path"
|
||||||
echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" pacdiff"
|
echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" $myname"
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (C) 2007 Aaron Griffin <aaronmgriffin@gmail.com>'
|
||||||
|
echo 'Copyright (C) 2013 Pacman Development Team <pacman-dev@archlinux.org>'
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd() {
|
cmd() {
|
||||||
@@ -42,34 +57,41 @@ if [ $# -gt 0 ]; then
|
|||||||
case $1 in
|
case $1 in
|
||||||
-l|--locate)
|
-l|--locate)
|
||||||
locate=1;;
|
locate=1;;
|
||||||
*)
|
-V|--version)
|
||||||
|
version; exit 0;;
|
||||||
|
-h|--help)
|
||||||
usage; exit 0;;
|
usage; exit 0;;
|
||||||
|
*)
|
||||||
|
usage; exit 1;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# see http://mywiki.wooledge.org/BashFAQ/020
|
# see http://mywiki.wooledge.org/BashFAQ/020
|
||||||
while IFS= read -u 3 -r -d '' pacfile; do
|
while IFS= read -u 3 -r -d '' pacfile; do
|
||||||
file="${pacfile%.pac*}"
|
file="${pacfile%.pac*}"
|
||||||
echo "File: $file"
|
file_type="pac${pacfile##*.pac}"
|
||||||
|
|
||||||
|
msg "%s file found for %s" "$file_type" "$file"
|
||||||
if [ ! -f "$file" ]; then
|
if [ ! -f "$file" ]; then
|
||||||
echo " $file does not exist"
|
warning "$file does not exist"
|
||||||
rm -i "$pacfile"
|
rm -iv "$pacfile"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
check="$(cmp "$pacfile" "$file")"
|
|
||||||
if [ -z "${check}" ]; then
|
if cmp -s "$pacfile" "$file"; then
|
||||||
echo " Files are identical, removing..."
|
msg2 "Files are identical, removing..."
|
||||||
rm "$pacfile"
|
rm -v "$pacfile"
|
||||||
else
|
else
|
||||||
echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
|
ask "(V)iew, (S)kip, (R)emove %s, (O)verwrite with %s: [v/s/r/o] " "$file_type" "$file_type"
|
||||||
while read c; do
|
while read c; do
|
||||||
case $c in
|
case $c in
|
||||||
r|R) rm "$pacfile"; break ;;
|
r|R) rm -v "$pacfile"; break ;;
|
||||||
|
o|O) mv -v "$pacfile" "$file"; break ;;
|
||||||
v|V)
|
v|V)
|
||||||
$diffprog "$pacfile" "$file"
|
$diffprog "$pacfile" "$file"
|
||||||
rm -i "$pacfile"; break ;;
|
rm -iv "$pacfile"; break ;;
|
||||||
s|S) break ;;
|
s|S) break ;;
|
||||||
*) echo -n " Invalid answer. Try again: [v/s/r] "; continue ;;
|
*) ask "Invalid answer. Try again: [v/s/r/o] "; continue ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
27
contrib/paclist.in → contrib/paclist.sh.in
Executable file → Normal file
27
contrib/paclist.in → contrib/paclist.sh.in
Executable file → Normal file
@@ -17,6 +17,9 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
|
declare -r myname='paclist'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
export TEXTDOMAIN='pacman'
|
export TEXTDOMAIN='pacman'
|
||||||
export TEXTDOMAINDIR='/usr/share/locale'
|
export TEXTDOMAINDIR='/usr/share/locale'
|
||||||
|
|
||||||
@@ -27,13 +30,31 @@ if ! type gettext &>/dev/null; then
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
printf '%s - List all packages installed from a given repo\n' "$myname"
|
||||||
|
printf 'Usage: %s <repo>\n' "$myname"
|
||||||
|
printf 'Example: %s testing\n' "$myname"
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>'
|
||||||
|
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
|
||||||
|
}
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
printf '%s - List all packages installed from a given repo\n' "${0##*/}"
|
usage
|
||||||
printf 'Usage: %s <repo>\n' "${0##*/}"
|
|
||||||
printf 'Example: %s testing\n' "${0##*/}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $1 = -@(h|-help) ]]; then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
elif [[ $1 = -@(V|-version) ]]; then
|
||||||
|
version
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
printf -v installed '[%s]' "$(gettext installed)"
|
printf -v installed '[%s]' "$(gettext installed)"
|
||||||
pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
|
pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
|
||||||
|
|
||||||
@@ -17,15 +17,30 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
|
declare -r myname='paclog-pkglist'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
export TEXTDOMAIN='pacman'
|
export TEXTDOMAIN='pacman'
|
||||||
export TEXTDOMAINDIR='/usr/share/locale'
|
export TEXTDOMAINDIR='/usr/share/locale'
|
||||||
declare logfile=${1:-@localstatedir@/log/pacman.log}
|
declare logfile=${1:-@localstatedir@/log/pacman.log}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
printf 'usage: %s [pacman log]\n' "$myname"
|
||||||
|
printf 'example: %s @localstatedir@/log/pacman.log\n' "$myname"
|
||||||
|
printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (C) 2011 Dave Reisner <dave@archlinux.org>'
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $1 ]]; then
|
if [[ $1 ]]; then
|
||||||
if [[ $1 = -@(h|-help) ]]; then
|
if [[ $1 = -@(h|-help) ]]; then
|
||||||
printf 'usage: %s [pacman log]\n' "${0##*/}"
|
usage
|
||||||
printf 'example: %s @localstatedir@/log/pacman.log\n' "${0##*/}"
|
exit 0
|
||||||
printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
|
elif [[ $1 = -@(V|-version) ]]; then
|
||||||
|
version
|
||||||
exit 0
|
exit 0
|
||||||
elif [[ ! -e $logfile ]]; then
|
elif [[ ! -e $logfile ]]; then
|
||||||
printf $"target not found: %s\n" "$1"
|
printf $"target not found: %s\n" "$1"
|
||||||
@@ -35,25 +50,35 @@ fi
|
|||||||
|
|
||||||
<"$logfile" awk '
|
<"$logfile" awk '
|
||||||
{
|
{
|
||||||
action = $3
|
if ($3 ~ /^\[.*\]$/) {
|
||||||
pkgname = $4
|
# new style with caller name
|
||||||
pkgver = $5
|
action = $4
|
||||||
upgver = $7
|
pkgname = $5
|
||||||
|
pkgver = $6
|
||||||
|
upgver = $8
|
||||||
|
nfields = NF
|
||||||
|
} else {
|
||||||
|
action = $3
|
||||||
|
pkgname = $4
|
||||||
|
pkgver = $5
|
||||||
|
upgver = $7
|
||||||
|
nfields = (NF + 1) # compensate for missing caller field
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NF == 5 && action == "installed" {
|
nfields == 6 && action == "installed" {
|
||||||
gsub(/[()]/, "", pkgver)
|
gsub(/[()]/, "", pkgver)
|
||||||
pkg[pkgname] = pkgver
|
pkg[pkgname] = pkgver
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
NF == 7 && action == "upgraded" {
|
nfields == 8 && (action == "upgraded" || action == "downgraded") {
|
||||||
sub(/\)/, "", upgver)
|
sub(/\)/, "", upgver)
|
||||||
pkg[pkgname] = upgver
|
pkg[pkgname] = upgver
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
NF == 5 && action == "removed" {
|
nfields == 6 && action == "removed" {
|
||||||
pkg[pkgname] = -1
|
pkg[pkgname] = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
25
contrib/pacscripts.in → contrib/pacscripts.sh.in
Executable file → Normal file
25
contrib/pacscripts.in → contrib/pacscripts.sh.in
Executable file → Normal file
@@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>
|
# Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>
|
||||||
# Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
|
# Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
|
||||||
|
# Copyright (c) 2009-2013 Pacman Development Team <pacman-dev@archlinux.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
|
||||||
@@ -24,8 +25,8 @@
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
progname=$(basename $0)
|
declare -r myname='pacscripts'
|
||||||
progver="0.4"
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
conf="@sysconfdir@/pacman.conf"
|
conf="@sysconfdir@/pacman.conf"
|
||||||
|
|
||||||
@@ -47,14 +48,20 @@ error() {
|
|||||||
usage() {
|
usage() {
|
||||||
echo "This program prints out the {pre,post}_{install,remove,upgrade} scripts"
|
echo "This program prints out the {pre,post}_{install,remove,upgrade} scripts"
|
||||||
echo "of a given package."
|
echo "of a given package."
|
||||||
echo "Usage: $progname pkgname|pkgfile"
|
echo "Usage: $myname pkgname|pkgfile"
|
||||||
echo
|
echo
|
||||||
echo " OPTIONS:"
|
echo " OPTIONS:"
|
||||||
echo " -h, --help Print this help message"
|
echo " -h, --help Print this help message"
|
||||||
echo " -v, --version Print program name and version"
|
echo " -v, --version Print program name and version"
|
||||||
echo
|
echo
|
||||||
echo "Example: $progname gconf-editor"
|
echo "Example: $myname gconf-editor"
|
||||||
echo "Example: $progname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
|
echo "Example: $myname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>'
|
||||||
|
echo 'Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>'
|
||||||
}
|
}
|
||||||
|
|
||||||
spacman() {
|
spacman() {
|
||||||
@@ -85,7 +92,7 @@ print_db() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_pkg() {
|
print_pkg() {
|
||||||
if ! bsdtar -xOf "$1" .INSTALL 2>/dev/null; then
|
if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
|
||||||
error "Package $1 does not include any .INSTALL script"
|
error "Package $1 does not include any .INSTALL script"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -107,10 +114,10 @@ print_scriptlet() {
|
|||||||
error "Package $1 not found"
|
error "Package $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
url=$(spacman -Sdp $1 | tail -n1)
|
url=$(pacman -Sddp $1)
|
||||||
filename=$(basename $url)
|
filename=$(basename $url)
|
||||||
if [ ! -f "$pac_cache/$filename" ]; then
|
if [ ! -f "$pac_cache/$filename" ]; then
|
||||||
if ! spacman -Sdw --noconfirm $1 >&2; then
|
if ! spacman -Sddw --noconfirm $1 >&2; then
|
||||||
error "Failed to download $1"
|
error "Failed to download $1"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -127,6 +134,6 @@ fi
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--help|-h) usage; exit 0 ;;
|
--help|-h) usage; exit 0 ;;
|
||||||
--version|-v) echo "$progname version $progver"; exit 0 ;;
|
--version|-V) version; exit 0 ;;
|
||||||
*) print_scriptlet $1 ;;
|
*) print_scriptlet $1 ;;
|
||||||
esac
|
esac
|
||||||
26
contrib/pacsearch.in
Executable file → Normal file
26
contrib/pacsearch.in
Executable file → Normal file
@@ -24,22 +24,32 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my $progname = "pacsearch";
|
my $myname = 'pacsearch';
|
||||||
my $version = "2.0";
|
my $myver = '@PACKAGE_VERSION@';
|
||||||
|
|
||||||
|
sub usage {
|
||||||
|
print "$myname - Add color and install information to a pacman -Ss search\n";
|
||||||
|
print "Usage: $myname <pattern>\n";
|
||||||
|
print "Example: $myname ^gnome\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub version {
|
||||||
|
printf "%s %s\n", $myname, $myver;
|
||||||
|
print "Copyright (C) 2008-2011 Dan McGee <dan\@archlinux.org>\n\n";
|
||||||
|
print "Based off original shell script version:\n";
|
||||||
|
print "Copyright (C) 2006-2007 Dan McGee <dan\@archlinux.org>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
|
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
|
||||||
print "$progname - Add color and install information to a pacman -Ss search\n";
|
usage;
|
||||||
print "Usage: $progname <pattern>\n";
|
|
||||||
print "Example: $progname ^gnome\n";
|
|
||||||
if ($#ARGV lt 0) {
|
if ($#ARGV lt 0) {
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
|
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-V") {
|
||||||
print "$progname version $version\n";
|
version;
|
||||||
print "Copyright (C) 2006-2011 Dan McGee\n";
|
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
64
contrib/pacsysclean.sh.in
Normal file
64
contrib/pacsysclean.sh.in
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# pacsysclean - Sort installed packages by increasing installed size. Useful for system clean-up.
|
||||||
|
|
||||||
|
declare -r myname='pacsysclean'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
|
PACMAN_OPTS=
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "$myname - Sort installed packages by increasing installed size."
|
||||||
|
echo
|
||||||
|
echo "Usage: $myname [options]"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -o <options> Specify custom pacman query options (e.g., dt)"
|
||||||
|
echo " -h, --help Show this help message and exit"
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (C) 2011 Eric Bélanger <snowmaniscool@gmail.com>'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
case "$1" in
|
||||||
|
-o) PACMAN_OPTS="${2}" ;;
|
||||||
|
-h|--help) usage; exit 0 ;;
|
||||||
|
-V|--version) version; exit 0 ;;
|
||||||
|
*) usage; exit 1 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
name="^Name.*: (.*)$"
|
||||||
|
size="^Installed Size.*: (.*) KiB$"
|
||||||
|
|
||||||
|
[[ $PACMAN_OPTS && $PACMAN_OPTS != -* ]] && PACMAN_OPTS="-$PACMAN_OPTS"
|
||||||
|
|
||||||
|
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);
|
||||||
|
}'
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
@@ -92,7 +92,8 @@ getfetchurl() {
|
|||||||
|
|
||||||
# This exists to remove the need for a separate interrupt function
|
# This exists to remove the need for a separate interrupt function
|
||||||
finaloutput() {
|
finaloutput() {
|
||||||
IFS=$'\n' sortedarray=( $(LC_COLLATE=C printf "%s\n" "${timesarray[@]}" | sort) )
|
IFS=$'\n' read -r -d '' -a sortedarray < \
|
||||||
|
<(printf '%s\n' "${timesarray[@]}" | LC_COLLATE=C sort)
|
||||||
|
|
||||||
# Final output for mirrorfile
|
# Final output for mirrorfile
|
||||||
numiterator="0"
|
numiterator="0"
|
||||||
93
contrib/updpkgsums.sh.in
Normal file
93
contrib/updpkgsums.sh.in
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# updpkgsums - update source checksums in-place in PKGBUILDs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2013 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 -r myname='updpkgsums'
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
printf 'usage: %s [buildfile]\n\n' "$myname"
|
||||||
|
printf ' -h, --help display this help message and exit\n'
|
||||||
|
printf ' -V, --version display version information and exit\n\n'
|
||||||
|
printf '%s will perform an in place update the checksums in the\n' "$myname"
|
||||||
|
printf 'path specified by [buildfile], defaulting to PKGBUILD in the current\n'
|
||||||
|
printf 'working directory.\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
printf "%s %s\n" "$myname" "$myver"
|
||||||
|
echo 'Copyright (C) 2012-2013 Dave Reisner <dreisner@archlinux.org>'
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
-h|--help) usage; exit ;;
|
||||||
|
-V|--version) version; exit ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
buildfile=${1:-PKGBUILD}
|
||||||
|
if [[ ! -f $buildfile ]]; then
|
||||||
|
printf '==> ERROR: %s not found or is not a file\n' "$buildfile"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Resolve any symlinks to avoid replacing the symlink with a file. But, we
|
||||||
|
# have to do this portably -- readlink's flags are inconsistent across OSes.
|
||||||
|
while [[ -L $buildfile ]]; do
|
||||||
|
buildfile=$(readlink "$buildfile")
|
||||||
|
if [[ $buildfile = */* ]]; then
|
||||||
|
cd "${buildfile%/*}"
|
||||||
|
buildfile=${buildfile##*/}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# cd into the directory with the build file. This avoids creating random src/
|
||||||
|
# directories scattered about the filesystem, and avoids cases where we might
|
||||||
|
# not be able to write in the $PWD.
|
||||||
|
if [[ $buildfile = */* ]]; then
|
||||||
|
cd "${buildfile%/*}"
|
||||||
|
buildfile=${buildfile##*/}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check $PWD/ for permission to unlink the $buildfile and write a new one
|
||||||
|
if [[ ! -w . ]]; then
|
||||||
|
printf $'==> ERROR: No write permission in `%s\'\n' "$PWD"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
# Generate the new sums and try to unlink the file before writing stdin back
|
||||||
|
# into it. This final precaution shouldn't fail based on the previous checks,
|
||||||
|
# but it's better to be extra careful before unlinking files.
|
||||||
|
newsums=$(makepkg -g -p "$buildfile") && rm -f "$buildfile" &&
|
||||||
|
exec awk -v newsums="$newsums" '
|
||||||
|
/^[[:blank:]]*(md|sha)[[:digit:]]+sums=/,/\)[[:blank:]]*(#.*)?$/ {
|
||||||
|
if (!w) {
|
||||||
|
print newsums
|
||||||
|
w++
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
1
|
||||||
|
END { if (!w) print newsums }
|
||||||
|
' > "$buildfile"
|
||||||
|
} < "$buildfile"
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 noet:
|
||||||
@@ -1,25 +1,29 @@
|
|||||||
#compdef pacman pacman.static=pacman
|
#compdef pacman pacman.static=pacman pacman-key makepkg
|
||||||
|
|
||||||
# copy this file to /usr/share/zsh/site-functions/_pacman
|
# copy this file to /usr/share/zsh/site-functions/_pacman
|
||||||
|
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
setopt extendedglob
|
||||||
|
|
||||||
# options for passing to _arguments: main pacman commands
|
# options for passing to _arguments: main pacman commands
|
||||||
_pacman_opts_commands=(
|
_pacman_opts_commands=(
|
||||||
'-Q[Query the package database]'
|
{-D,--database}'[Modify database]'
|
||||||
'-R[Remove a package from the system]'
|
{-Q,--query}'[Query the package database]'
|
||||||
'-S[Synchronize packages]'
|
{-R,--remove}'[Remove a package from the system]'
|
||||||
'-U[Upgrade a package]'
|
{-S,--sync}'[Synchronize packages]'
|
||||||
'-V[Display version and exit]'
|
{-T,--deptest}'[Check if dependencies are installed]'
|
||||||
'-h[Display usage]'
|
{-U,--upgrade}'[Upgrade a package]'
|
||||||
|
{-V,--version}'[Display version and exit]'
|
||||||
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: options common to all commands
|
# options for passing to _arguments: options common to all commands
|
||||||
_pacman_opts_common=(
|
_pacman_opts_common=(
|
||||||
'-b[Alternate database location]:database_location:_files -/'
|
{-b,--dbpath}'[Alternate database location]:database_location:_files -/'
|
||||||
'-h[Display syntax for the given operation]'
|
'--color[colorize the output]:color options:(always never auto)'
|
||||||
'-r[Set alternate installation root]:installation root:_files -/'
|
{-h,--help}'[Display syntax for the given operation]'
|
||||||
'-v[Be more verbose]'
|
{-r,--root}'[Set alternate installation root]:installation root:_files -/'
|
||||||
|
{-v,--verbose}'[Be more verbose]'
|
||||||
'--cachedir[Alternate package cache location]:cache_location:_files -/'
|
'--cachedir[Alternate package cache location]:cache_location:_files -/'
|
||||||
'--config[An alternate configuration file]:config file:_files'
|
'--config[An alternate configuration file]:config file:_files'
|
||||||
'--logfile[An alternate log file]:config file:_files'
|
'--logfile[An alternate log file]:config file:_files'
|
||||||
@@ -31,52 +35,59 @@ _pacman_opts_common=(
|
|||||||
|
|
||||||
# options for passing to _arguments: options for --upgrade commands
|
# options for passing to _arguments: options for --upgrade commands
|
||||||
_pacman_opts_pkgfile=(
|
_pacman_opts_pkgfile=(
|
||||||
'-d[Skip dependency checks]'
|
'*-d[Skip dependency checks]'
|
||||||
'-f[Overwrite conflicting files]'
|
'*--nodeps[Skip dependency checks]'
|
||||||
'--dbonly[Only remove database entry, do not remove files]'
|
'--dbonly[Only remove database entry, do not remove files]'
|
||||||
|
'--force[Overwrite conflicting files]'
|
||||||
'--needed[Do not reinstall up to date packages]'
|
'--needed[Do not reinstall up to date packages]'
|
||||||
'--recursive[Reinstall all dependencies of target packages]'
|
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
|
||||||
'*:package file:_files -g "*.pkg.tar.*(.)"'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: subactions for --query command
|
# options for passing to _arguments: subactions for --query command
|
||||||
_pacman_opts_query_actions=(
|
_pacman_opts_query_actions=(
|
||||||
'-g[View all members of a package group]:*:package groups:->query_group'
|
'(-Q --query)'{-Q,--query}
|
||||||
'-o[Query the package that owns a file]:file:_files'
|
{-g,--groups}'[View all members of a package group]:*:package groups:->query_group'
|
||||||
'-p[Package file to query]:*:package file:->query_file'
|
{-o,--owns}'[Query the package that owns a file]:file:_files'
|
||||||
'-s[Search package names and descriptions]:*:search text:->query_search'
|
{-p,--file}'[Package file to query]:*:package file:->query_file'
|
||||||
|
{-s,--search}'[Search package names and descriptions]:*:search text:->query_search'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: options for --query and subcommands
|
# options for passing to _arguments: options for --query and subcommands
|
||||||
_pacman_opts_query_modifiers=(
|
_pacman_opts_query_modifiers=(
|
||||||
'-c[List package changelog]'
|
{-c,--changelog}'[List package changelog]'
|
||||||
'-d[List packages installed as dependencies]'
|
{-d,--deps}'[List packages installed as dependencies]'
|
||||||
'-e[List packages explicitly installed]'
|
{-e,--explicit}'[List packages explicitly installed]'
|
||||||
'-i[View package information]'
|
{\*-i,\*--info}'[View package information]'
|
||||||
'-ii[View package information including backup files]'
|
{\*-k,\*--check}'[Check package files]'
|
||||||
'-k[Check package files]'
|
{-l,--list}'[List package contents]'
|
||||||
'-l[List package contents]'
|
{-m,--foreign}'[List installed packages not found in sync db(s)]'
|
||||||
'-m[List installed packages not found in sync db(s)]'
|
{-n,--native}'[List installed packages found in sync db(s)]'
|
||||||
'-t[List packages not required by any package]'
|
{-t,--unrequired}'[List packages not required by any package]'
|
||||||
'-u[List packages that can be upgraded]'
|
{-u,--upgrades}'[List packages that can be upgraded]'
|
||||||
)
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: options for --remove command
|
# options for passing to _arguments: options for --remove command
|
||||||
_pacman_opts_remove=(
|
_pacman_opts_remove=(
|
||||||
'-c[Remove all dependent packages]'
|
{-c,--cascade}'[Remove all dependent packages]'
|
||||||
'-d[Skip dependency checks]'
|
{*-d,*--nodeps}'[Skip dependency checks]'
|
||||||
'-n[Remove protected configuration files]'
|
{-n,--nosave}'[Remove protected configuration files]'
|
||||||
'-s[Remove dependencies not required by other packages]'
|
{\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
|
||||||
'--dbonly[Only remove database entry, do not remove files]'
|
'--dbonly[Only remove database entry, do not remove files]'
|
||||||
'*:installed package:_pacman_completions_installed_packages'
|
'*:installed package:_pacman_completions_installed_packages'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_pacman_opts_database=(
|
||||||
|
'--asdeps[mark packages as non-explicitly installed]'
|
||||||
|
'--asexplicit[mark packages as explicitly installed]'
|
||||||
|
'*:installed package:_pacman_completions_installed_packages'
|
||||||
|
)
|
||||||
|
|
||||||
# options for passing to _arguments: options for --sync command
|
# options for passing to _arguments: options for --sync command
|
||||||
_pacman_opts_sync_actions=(
|
_pacman_opts_sync_actions=(
|
||||||
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
|
'(-S --sync)'{-S,--sync}
|
||||||
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
|
{\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
|
||||||
'-g[View all members of a package group]:*:package groups:->sync_group'
|
{-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
|
||||||
'-s[Search package names and descriptions]:*:search text:->sync_search'
|
{-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
|
||||||
'--dbonly[Only remove database entry, do not remove files]'
|
'--dbonly[Only remove database entry, do not remove files]'
|
||||||
'--needed[Do not reinstall up to date packages]'
|
'--needed[Do not reinstall up to date packages]'
|
||||||
'--recursive[Reinstall all dependencies of target packages]'
|
'--recursive[Reinstall all dependencies of target packages]'
|
||||||
@@ -84,20 +95,18 @@ _pacman_opts_sync_actions=(
|
|||||||
|
|
||||||
# options for passing to _arguments: options for --sync command
|
# options for passing to _arguments: options for --sync command
|
||||||
_pacman_opts_sync_modifiers=(
|
_pacman_opts_sync_modifiers=(
|
||||||
'-d[Skip dependency checks]'
|
{\*-d,\*--nodeps}'[Skip dependency checks]'
|
||||||
'-f[Overwrite conflicting files]'
|
{\*-i,\*--info}'[View package information]'
|
||||||
'-i[View package information]'
|
{-l,--list}'[List all packages in a repository]'
|
||||||
'-l[List all packages in a repository]'
|
{-p,--print}'[Print download URIs for each package to be installed]'
|
||||||
'-p[Print download URIs for each package to be installed]'
|
{\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
|
||||||
'-u[Upgrade all out-of-date packages]'
|
{-w,--downloadonly}'[Download packages only]'
|
||||||
'-w[Download packages only]'
|
{\*-y,\*--refresh}'[Download fresh package databases]'
|
||||||
'-y[Download fresh package databases]'
|
'*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
|
||||||
'*--ignore[Ignore a package upgrade]:package:
|
'*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
|
||||||
_pacman_completions_all_packages'
|
|
||||||
'*--ignoregroup[Ignore a group upgrade]:package group:
|
|
||||||
_pacman_completions_all_groups'
|
|
||||||
'--asdeps[Install packages as non-explicitly installed]'
|
'--asdeps[Install packages as non-explicitly installed]'
|
||||||
'--asexplicit[Install packages as explicitly installed]'
|
'--asexplicit[Install packages as explicitly installed]'
|
||||||
|
'--force[Overwrite conflicting files]'
|
||||||
)
|
)
|
||||||
|
|
||||||
# handles --help subcommand
|
# handles --help subcommand
|
||||||
@@ -116,95 +125,112 @@ _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 : \
|
|
||||||
# "$_pacman_opts_common[@]" \
|
|
||||||
# "$_pacman_opts_query_actions[@]" \
|
|
||||||
# "$_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*~*.sig(.,@)"'
|
||||||
;;
|
;;
|
||||||
query_group)
|
query_group)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:groups:_pacman_completions_installed_groups'
|
'*:groups:_pacman_completions_installed_groups'
|
||||||
;;
|
;;
|
||||||
query_owner)
|
query_owner)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:file:_files'
|
'*:file:_files'
|
||||||
;;
|
;;
|
||||||
query_search)
|
query_search)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:search text: '
|
'*:search text: '
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_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[@]" \
|
||||||
'*:package:_pacman_completions_installed_packages'
|
'*:package:_pacman_completions_installed_packages'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --remove subcommand
|
# handles --remove subcommand
|
||||||
_pacman_action_remove() {
|
_pacman_action_remove() {
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
|
'(--remove -R)'{-R,--remove} \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_remove[@]"
|
"$_pacman_opts_remove[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# handles --database subcommand
|
||||||
|
_pacman_action_database() {
|
||||||
|
_arguments -s : \
|
||||||
|
'(--database -D)'{-D,--database} \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_database[@]"
|
||||||
|
}
|
||||||
|
|
||||||
|
_pacman_action_deptest () {
|
||||||
|
_arguments -s : \
|
||||||
|
'(--deptest)-T' \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
":packages:_pacman_all_packages"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# handles --sync subcommand
|
# handles --sync subcommand
|
||||||
_pacman_action_sync() {
|
_pacman_action_sync() {
|
||||||
local context state line
|
local context state line
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
if (( $+words[(r)--clean] )); then
|
||||||
# _arguments -s : \
|
state=sync_clean
|
||||||
# "$_pacman_opts_common[@]" \
|
elif (( $+words[(r)--groups] )); then
|
||||||
# "$_pacman_opts_sync_actions[@]" #\
|
state=sync_group
|
||||||
# #"$_pacman_opts_sync_modifiers[@]"
|
elif (( $+words[(r)--search] )); then
|
||||||
|
state=sync_search
|
||||||
|
fi
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
sync_clean)
|
sync_clean)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
|
{\*-c,\*--clean}'[Remove old packages from cache]' \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_sync_modifiers[@]" \
|
"$_pacman_opts_sync_modifiers[@]"
|
||||||
'*-c[Remove old packages from cache]' \
|
|
||||||
;;
|
;;
|
||||||
sync_group)
|
sync_group)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_sync_modifiers[@]" \
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'(-g --group)'{-g,--groups} \
|
||||||
'*:package group:_pacman_completions_all_groups'
|
'*:package group:_pacman_completions_all_groups'
|
||||||
;;
|
;;
|
||||||
sync_search)
|
sync_search)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_sync_modifiers[@]" \
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
'*:search text: '
|
'*:search text: '
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_actions[@]" \
|
||||||
"$_pacman_opts_sync_modifiers[@]" \
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
'*:package:_pacman_completions_all_packages'
|
'*:package:_pacman_completions_all_packages'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --upgrade subcommand
|
# handles --upgrade subcommand
|
||||||
_pacman_action_upgrade() {
|
_pacman_action_upgrade() {
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
|
'(-U --upgrade)'{-U,--upgrade} \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_pkgfile[@]"
|
"$_pacman_opts_pkgfile[@]"
|
||||||
}
|
}
|
||||||
@@ -262,6 +288,12 @@ _pacman_completions_installed_packages() {
|
|||||||
compadd "$@" -a packages
|
compadd "$@" -a packages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pacman_all_packages() {
|
||||||
|
_alternative : \
|
||||||
|
'localpkgs:local packages:_pacman_completions_installed_packages' \
|
||||||
|
'repopkgs:repository packages:_pacman_completions_all_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
|
||||||
@@ -276,7 +308,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
|
||||||
@@ -286,51 +318,343 @@ _pacman_get_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# main dispatcher
|
# main dispatcher
|
||||||
_pacman() {
|
_pacman_zsh_comp() {
|
||||||
case $words[2] in
|
local -a args cmds;
|
||||||
-Q*g*) # ipkg groups
|
local tmp
|
||||||
|
args=( ${${${(M)words:#-*}#-}:#-*} )
|
||||||
|
for tmp in $words; do
|
||||||
|
cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
|
||||||
|
done
|
||||||
|
case $args in #$words[2] in
|
||||||
|
h*)
|
||||||
|
if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
|
||||||
|
_pacman_action_help
|
||||||
|
else
|
||||||
|
_message "no more arguments"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*h*)
|
||||||
|
_message "no more arguments"
|
||||||
|
;;
|
||||||
|
D*)
|
||||||
|
_pacman_action_database
|
||||||
|
;;
|
||||||
|
Q*g*) # ipkg groups
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_query_modifiers[@]" \
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
'*:groups:_pacman_completions_installed_groups'
|
'*:groups:_pacman_completions_installed_groups'
|
||||||
;;
|
;;
|
||||||
-Q*o*) # file
|
Q*o*) # file
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_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*~*.sig(.,@)"'
|
||||||
;;
|
|
||||||
-Q*) _pacman_action_query ;;
|
|
||||||
-R*) _pacman_action_remove ;;
|
|
||||||
-S*c*) # no completion
|
|
||||||
return 0
|
|
||||||
;;
|
;;
|
||||||
-S*l*) # repos
|
T*)
|
||||||
|
_pacman_action_deptest
|
||||||
|
;;
|
||||||
|
Q*)
|
||||||
|
_pacman_action_query
|
||||||
|
;;
|
||||||
|
R*)
|
||||||
|
_pacman_action_remove
|
||||||
|
;;
|
||||||
|
S*c*) # no completion
|
||||||
|
_arguments -s : \
|
||||||
|
'(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
|
||||||
|
"$_pacman_opts_common[@]"
|
||||||
|
;;
|
||||||
|
S*l*) # repos
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_sync_modifiers[@]" \
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
'*:package repo:_pacman_completions_repositories' \
|
'*:package repo:_pacman_completions_repositories' \
|
||||||
;;
|
;;
|
||||||
-S*g*) # pkg groups
|
S*g*) # pkg groups
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_opts_common[@]" \
|
"$_pacman_opts_common[@]" \
|
||||||
"$_pacman_opts_sync_modifiers[@]" \
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
'*:package group:_pacman_completions_all_groups'
|
'*:package group:_pacman_completions_all_groups'
|
||||||
|
;;
|
||||||
|
S*s*)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'*:search text: '
|
||||||
;;
|
;;
|
||||||
-S*) _pacman_action_sync ;;
|
S*)
|
||||||
-U*) _pacman_action_upgrade ;;
|
_pacman_action_sync
|
||||||
-V*) _pacman_action_version ;;
|
;;
|
||||||
-h*) _pacman_action_help ;;
|
T*)
|
||||||
- ) _pacman_action_none ;;
|
_arguments -s : \
|
||||||
* ) return 1 ;;
|
'-T' \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
":packages:_pacman_all_packages"
|
||||||
|
;;
|
||||||
|
U*)
|
||||||
|
_pacman_action_upgrade
|
||||||
|
;;
|
||||||
|
V*)
|
||||||
|
_pacman_action_version
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
|
||||||
|
case ${(M)words:#--*} in
|
||||||
|
*--help*)
|
||||||
|
if (( ${(w)#cmds} == 1 )); then
|
||||||
|
_pacman_action_help
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*--sync*)
|
||||||
|
_pacman_action_sync
|
||||||
|
;;
|
||||||
|
*--query*)
|
||||||
|
_pacman_action_query
|
||||||
|
;;
|
||||||
|
*--remove*)
|
||||||
|
_pacman_action_remove
|
||||||
|
;;
|
||||||
|
*--deptest*)
|
||||||
|
_pacman_action_deptest
|
||||||
|
;;
|
||||||
|
*--database*)
|
||||||
|
_pacman_action_database
|
||||||
|
;;
|
||||||
|
*--version*)
|
||||||
|
_pacman_action_version
|
||||||
|
;;
|
||||||
|
*--upgrade*)
|
||||||
|
_pacman_action_upgrade
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_pacman_action_none
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# run the main dispatcher
|
_key_shortopts=(
|
||||||
_pacman "$@"
|
'-h[show help]'
|
||||||
|
'-a[Add the specified keys (empty for stdin)]: :_files'
|
||||||
|
'-d[Remove the Specified keyids]:*: :_keys'
|
||||||
|
'-e[Export the specified or all keyids]:*: :_keys'
|
||||||
|
'-f[List fingreprint for specidied or all keyids]:*: :_keys'
|
||||||
|
'-l[List the specified or all keys]:*: :_keys'
|
||||||
|
'-r[Fetch the specified keyids]:*: :_keys'
|
||||||
|
'-u[Update the trustdb of pacman]'
|
||||||
|
'-v[Verify the file specified by the signature]: :_files -g "*.sig"'
|
||||||
|
'-V[Show program version]'
|
||||||
|
)
|
||||||
|
|
||||||
|
_key_longopts=(
|
||||||
|
'--help[show help]'
|
||||||
|
'--add[Add the specified keys (empty for stdin)]: :_files'
|
||||||
|
'--delete[Remove the Specified keyids]:*: :_keys'
|
||||||
|
'--export[Export the specified or all keyids]:*: :_keys'
|
||||||
|
'--finger[List fingreprint for specidied or all keyids]:*: :_keys'
|
||||||
|
'--list-keys[List the specified or all keys]:*: :_keys'
|
||||||
|
'--recv-keys[Fetch the specified keyids]:*: :_keys'
|
||||||
|
'--updatedb[Update the trustdb of pacman]'
|
||||||
|
'--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
|
||||||
|
'--version[Show program version]'
|
||||||
|
'--edit-key[Present a menu for key management task on keyids]:*: :_keys'
|
||||||
|
'--import[Imports pubring.gpg from dir(s)]: :_files -g "*.gpg"'
|
||||||
|
'--import-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
|
||||||
|
'--init[Ensure the keyring is properly initialized]'
|
||||||
|
'--list-sigs[List keys and their signatures]:*: :_keys'
|
||||||
|
'--lsign-key[Locally sign the specified keyid]:*: :_keys'
|
||||||
|
'--populate[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings'
|
||||||
|
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
|
||||||
|
)
|
||||||
|
|
||||||
|
_pacman_key_options=(
|
||||||
|
'--config[Use an alternate config file (instead of @sysconfdir@/pacman.conf)]: :_files'
|
||||||
|
'--gpgdir[Set an alternate directory for GnuPG (instead of @sysconfdir@/pacman.d/gnupg)]: :_files -/'
|
||||||
|
'--keyserver[Specify a keyserver to use if necessary]'
|
||||||
|
)
|
||||||
|
|
||||||
|
_pacman_key() {
|
||||||
|
case $words[CURRENT] in
|
||||||
|
--*)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_key_options[@]" \
|
||||||
|
"$_key_longopts[@]"
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_key_options[@]" \
|
||||||
|
"$_key_shortopts[@]" \
|
||||||
|
"$_key_longopts[@]"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
i=$#;
|
||||||
|
while [[ $words[$i] != -* ]] && [[ $words[$i] != "pacman-key" ]];do
|
||||||
|
i=$(($i-1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
--*)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_key_options[@]" \
|
||||||
|
"$_key_longopts[@]"
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_key_options[@]" \
|
||||||
|
"$_key_shortopts[@]" \
|
||||||
|
"$_key_longopts[@]"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_keys() {
|
||||||
|
local keylist keys
|
||||||
|
keylist=$(pacman-key --list-keys 2>/dev/null | awk '
|
||||||
|
$1 == "pub" {
|
||||||
|
# key id
|
||||||
|
split($2, a, "/"); print a[2]
|
||||||
|
}
|
||||||
|
$1 == "uid" {
|
||||||
|
# email
|
||||||
|
if (match($NF, /<[^>]+>/))
|
||||||
|
print substr($NF, RSTART + 1, RLENGTH - 2)
|
||||||
|
#this adds support for names as well if that is ever added
|
||||||
|
}
|
||||||
|
$1 == "uid" {
|
||||||
|
for (i=2;i<NF;i++) {printf "%s%s",sep, $i;sep=" "}; printf "\n"
|
||||||
|
}' |sed -e 's/(.*)//g' -e 's/^\ //g' -e 's/\ *$//g' |uniq
|
||||||
|
)
|
||||||
|
keys=(${(s:/:)${keylist//$'\n'/\/}})
|
||||||
|
_describe -t modules 'keys in keyring' keys && return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_makepkg_shortopts=(
|
||||||
|
'-s[Install missing dependencies with pacman]'
|
||||||
|
'-i[Install package after successful build]'
|
||||||
|
'-A[Ignore incomplete arch field in PKGBUILD]'
|
||||||
|
'-c[Clean up work files after build]'
|
||||||
|
'-d[Skip all dependency checks]'
|
||||||
|
'-e[Do not extract source files (use existing src/ dir)]'
|
||||||
|
'-f[Overwrite existing package]'
|
||||||
|
'-g[Generate integrity checks for source files]'
|
||||||
|
'-h[Show help message and exit]'
|
||||||
|
'-L[Log package build process]'
|
||||||
|
'-m[Disable colorized output messages]'
|
||||||
|
'-o[Download and extract files only]'
|
||||||
|
'-p[Use an alternate build script (instead of 'PKGBUILD')]: :_files'
|
||||||
|
'-r[Remove installed dependencies after a successful build]'
|
||||||
|
'-R[Repackage contents of the package without rebuilding]'
|
||||||
|
'-S[Generate a source-only tarball without downloading sources]'
|
||||||
|
)
|
||||||
|
|
||||||
|
_makepkg_action_none(){
|
||||||
|
_arguments \
|
||||||
|
"$_makepkg_shortopts[@]" \
|
||||||
|
"$_makepkg_longopts[@]"
|
||||||
|
}
|
||||||
|
_makepkg_longopts=(
|
||||||
|
'--ignorearch[Ignore incomplete arch field in PKGBUILD]'
|
||||||
|
'--clean[Clean up work files after build]'
|
||||||
|
'--nodeps[Skip all dependency checks]'
|
||||||
|
'--noextract[Do not extract source files (use existing src/ dir)]'
|
||||||
|
'--force[Overwrite existing package]'
|
||||||
|
'--geninteg[Generate integrity checks for source files]'
|
||||||
|
'--help[Show help message and exit]'
|
||||||
|
'--install[Install package after successful build]'
|
||||||
|
'--log[Log package build process]'
|
||||||
|
'--nocolor[Disable colorized output messages]'
|
||||||
|
'--nobuild[Download and extract files only]'
|
||||||
|
'--rmdeps[Remove installed dependencies after a successful build]'
|
||||||
|
'--repackage[Repackage contents of the package without rebuilding]'
|
||||||
|
'--syncdeps[Install missing dependencies with pacman]'
|
||||||
|
'--source[Generate a source-only tarball without downloading sources]'
|
||||||
|
'--allsource[Generate a source-only tarball including downloaded source]'
|
||||||
|
'--asroot[Allow makepkg to run as root user]'
|
||||||
|
'--check[Run check() function in the PKGBUILD]'
|
||||||
|
'--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
|
||||||
|
'--holdver[Prevent automatic version bumping for development PKGBUILDs]'
|
||||||
|
'--key[Specify key to use for gpg signing instead of the default]: :_keys'
|
||||||
|
'--nocheck[Do not run the check() function in the PKGBUILD]'
|
||||||
|
'--nosign[Do not create a signature for the package]'
|
||||||
|
'--pkg[Only build listed packages from a split package]'
|
||||||
|
'--sign[Sign the resulting package with gpg]'
|
||||||
|
'--skipchecksums[Do not verify checksums of the source files]'
|
||||||
|
'--skipinteg[do not perform any verification checks on source files]'
|
||||||
|
'--skippgpcheck[Do not verify source files with PGP signatures]'
|
||||||
|
'--noconfirm[do not ask for confirmation when resolving dependencies]'
|
||||||
|
'--asdeps[Install packages as non-explicitly installed]'
|
||||||
|
'--noprogressbar[Do not show a progress bar when downloading files]'
|
||||||
|
'--needed[Do not reinstall up-to-date packages]'
|
||||||
|
'--verifysource[Only download sources and verify checksums]'
|
||||||
|
)
|
||||||
|
_makepkg(){
|
||||||
|
case $words[CURRENT] in
|
||||||
|
-*)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"$_makepkg_shortopts[@]" \
|
||||||
|
"$_makepkg_longopts[@]"
|
||||||
|
;;
|
||||||
|
--* )
|
||||||
|
_arguments -s \
|
||||||
|
"$_makepkg_longopts[@]"
|
||||||
|
;;
|
||||||
|
- )
|
||||||
|
_makepkg_action_none
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
i=$#
|
||||||
|
while [[ $words[i] != -* ]] && [[ $words[$i] != "makepkg" ]];do
|
||||||
|
i=$((i-1));
|
||||||
|
done
|
||||||
|
case $words[$i] in
|
||||||
|
-*)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"$_makepkg_shortopts[@]" \
|
||||||
|
"$_makepkg_longopts[@]"
|
||||||
|
;;
|
||||||
|
--* )
|
||||||
|
_arguments -s \
|
||||||
|
"$_makepkg_longopts[@]"
|
||||||
|
;;
|
||||||
|
- )
|
||||||
|
_makepkg_action_none
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
_pacman_comp() {
|
||||||
|
case "$service" in
|
||||||
|
makepkg)
|
||||||
|
_makepkg "$@"
|
||||||
|
;;
|
||||||
|
pacman-key)
|
||||||
|
_pacman_key "$@"
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
_pacman_zsh_comp "$@"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_message "Error"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_pacman_comp "$@"
|
||||||
|
|||||||
5
doc/.gitignore
vendored
5
doc/.gitignore
vendored
@@ -5,11 +5,14 @@ makepkg.conf.5
|
|||||||
pacman.8
|
pacman.8
|
||||||
pacman-key.8
|
pacman-key.8
|
||||||
pacman.conf.5
|
pacman.conf.5
|
||||||
|
pactree.8
|
||||||
pkgdelta.8
|
pkgdelta.8
|
||||||
repo-add.8
|
repo-add.8
|
||||||
repo-remove.8
|
repo-remove.8
|
||||||
vercmp.8
|
vercmp.8
|
||||||
*.css
|
asciidoc-manpage.css
|
||||||
|
asciidoc.css
|
||||||
|
asciidoc.js
|
||||||
*.html
|
*.html
|
||||||
*.xml
|
*.xml
|
||||||
man3
|
man3
|
||||||
|
|||||||
154
doc/Doxyfile
154
doc/Doxyfile
@@ -1,11 +1,13 @@
|
|||||||
# Doxyfile 1.5.5
|
# Doxyfile 1.8.2
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# 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,32 +27,41 @@ 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 =
|
||||||
|
TCL_SUBST =
|
||||||
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 =
|
||||||
|
MARKDOWN_SUPPORT = YES
|
||||||
|
AUTOLINK_SUPPORT = YES
|
||||||
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
|
||||||
|
LOOKUP_CACHE_SIZE = 0
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = NO
|
||||||
EXTRACT_PRIVATE = NO
|
EXTRACT_PRIVATE = NO
|
||||||
|
EXTRACT_PACKAGE = NO
|
||||||
EXTRACT_STATIC = NO
|
EXTRACT_STATIC = NO
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
EXTRACT_LOCAL_METHODS = NO
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
@@ -63,20 +74,26 @@ 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_FILES = YES
|
||||||
FILE_VERSION_FILTER =
|
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 +103,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 +139,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_ALIGN_MEMBERS = YES
|
HTML_EXTRA_STYLESHEET =
|
||||||
GENERATE_HTMLHELP = NO
|
HTML_EXTRA_FILES =
|
||||||
|
HTML_COLORSTYLE_HUE = 220
|
||||||
|
HTML_COLORSTYLE_SAT = 100
|
||||||
|
HTML_COLORSTYLE_GAMMA = 80
|
||||||
|
HTML_TIMESTAMP = YES
|
||||||
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
|
HTML_INDEX_NUM_ENTRIES = 100
|
||||||
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
|
|
||||||
GENERATE_TREEVIEW = NO
|
GENERATE_TREEVIEW = NO
|
||||||
|
ENUM_VALUES_PER_LINE = 4
|
||||||
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 +199,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 +216,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 +230,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 +243,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,28 +255,36 @@ 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
|
||||||
UML_LOOK = NO
|
UML_LOOK = NO
|
||||||
|
UML_LIMIT_NUM_FIELDS = 10
|
||||||
TEMPLATE_RELATIONS = NO
|
TEMPLATE_RELATIONS = NO
|
||||||
INCLUDE_GRAPH = YES
|
INCLUDE_GRAPH = YES
|
||||||
INCLUDED_BY_GRAPH = YES
|
INCLUDED_BY_GRAPH = YES
|
||||||
@@ -237,15 +293,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
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ ASCIIDOC_MANS = \
|
|||||||
vercmp.8 \
|
vercmp.8 \
|
||||||
pkgdelta.8 \
|
pkgdelta.8 \
|
||||||
pacman-key.8 \
|
pacman-key.8 \
|
||||||
|
pactree.8 \
|
||||||
PKGBUILD.5 \
|
PKGBUILD.5 \
|
||||||
makepkg.conf.5 \
|
makepkg.conf.5 \
|
||||||
pacman.conf.5 \
|
pacman.conf.5 \
|
||||||
@@ -24,6 +25,7 @@ HTML_MANPAGES = \
|
|||||||
vercmp.8.html \
|
vercmp.8.html \
|
||||||
pkgdelta.8.html \
|
pkgdelta.8.html \
|
||||||
pacman-key.8.html \
|
pacman-key.8.html \
|
||||||
|
pactree.8.html \
|
||||||
PKGBUILD.5.html \
|
PKGBUILD.5.html \
|
||||||
makepkg.conf.5.html \
|
makepkg.conf.5.html \
|
||||||
pacman.conf.5.html \
|
pacman.conf.5.html \
|
||||||
@@ -41,12 +43,14 @@ 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 \
|
vercmp.8.txt \
|
||||||
pkgdelta.8.txt \
|
pkgdelta.8.txt \
|
||||||
pacman-key.8.txt \
|
pacman-key.8.txt \
|
||||||
|
pactree.8.txt \
|
||||||
PKGBUILD.5.txt \
|
PKGBUILD.5.txt \
|
||||||
PKGBUILD-example.txt \
|
PKGBUILD-example.txt \
|
||||||
makepkg.conf.5.txt \
|
makepkg.conf.5.txt \
|
||||||
@@ -76,7 +80,7 @@ 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)
|
||||||
@@ -89,10 +93,15 @@ endif
|
|||||||
|
|
||||||
html: $(HTML_DOCS)
|
html: $(HTML_DOCS)
|
||||||
|
|
||||||
website: html
|
website: website.tar.gz
|
||||||
bsdtar czf website.tar.gz $(HTML_DOCS) \
|
|
||||||
|
.PHONY: html website
|
||||||
|
|
||||||
|
website.tar.gz: html
|
||||||
|
$(AM_V_GEN)bsdtar czf $@ $(HTML_DOCS) \
|
||||||
|
asciidoc-override.css \
|
||||||
-C /etc/asciidoc/stylesheets/ \
|
-C /etc/asciidoc/stylesheets/ \
|
||||||
asciidoc.css asciidoc-manpage.css \
|
asciidoc.css \
|
||||||
-C /etc/asciidoc/javascripts/ \
|
-C /etc/asciidoc/javascripts/ \
|
||||||
asciidoc.js \
|
asciidoc.js \
|
||||||
-C /etc/asciidoc/ \
|
-C /etc/asciidoc/ \
|
||||||
@@ -116,21 +125,21 @@ A2X_OPTS = \
|
|||||||
--destination-dir='./'
|
--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) --out-file=./$@.xml" $(srcdir)/$@.txt
|
$(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt
|
||||||
|
|
||||||
%.html: %.txt
|
%.html: %.txt
|
||||||
asciidoc $(ASCIIDOC_OPTS) $*.txt
|
$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.txt | \
|
||||||
dos2unix $@
|
sed -e 's/\r$$//' > $@
|
||||||
|
|
||||||
HACKING.html: ../HACKING
|
HACKING.html: ../HACKING
|
||||||
asciidoc $(ASCIIDOC_OPTS) -o $@ ../HACKING
|
$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - ../HACKING | \
|
||||||
dos2unix $@
|
sed -e 's/\r$$//' > $@
|
||||||
|
|
||||||
# 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
|
||||||
@@ -142,13 +151,24 @@ repo-add.8 repo-add.8.html: repo-add.8.txt
|
|||||||
vercmp.8 vercmp.8.html: vercmp.8.txt
|
vercmp.8 vercmp.8.html: vercmp.8.txt
|
||||||
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.txt
|
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.txt
|
||||||
pacman-key.8 pacman-key.8.html: pacman-key.8.txt
|
pacman-key.8 pacman-key.8.html: pacman-key.8.txt
|
||||||
|
pactree.8 pactree.8.html: pactree.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:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ pkgver=2.5.4
|
|||||||
pkgrel=3
|
pkgrel=3
|
||||||
pkgdesc="A utility to apply patch files to original sources"
|
pkgdesc="A utility to apply patch files to original sources"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url="http://www.gnu.org/software/patch/patch.html"
|
url="https://www.gnu.org/software/patch/patch.html"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
groups=('base-devel')
|
groups=('base-devel')
|
||||||
depends=('glibc' 'ed')
|
depends=('glibc' 'ed')
|
||||||
|
|||||||
@@ -40,12 +40,18 @@ similar to `$_basekernver`.
|
|||||||
|
|
||||||
*pkgname (array)*::
|
*pkgname (array)*::
|
||||||
Either the name of the package or an array of names for split packages.
|
Either the name of the package or an array of names for split packages.
|
||||||
Because it will be used in the package filename, this has to be unix-friendly.
|
Valid characters for members of this array are alphanumerics, and any of
|
||||||
Members of the array are not allowed to start with hyphens.
|
the following characters: ```@ . _ + -`''. Additionally, names are not
|
||||||
|
allowed to start with hyphens or dots.
|
||||||
|
|
||||||
*pkgver*::
|
*pkgver*::
|
||||||
The version of the software as released from the author (e.g., '2.7.1').
|
The version of the software as released from the author (e.g., '2.7.1').
|
||||||
The variable is not allowed to contain colons or hyphens.
|
The variable is not allowed to contain colons or hyphens.
|
||||||
|
+
|
||||||
|
The `pkgver` variable can be automatically updated by providing a `pkgver()` function
|
||||||
|
in the PKGBUILD that outputs the new package version. This is run after downloading
|
||||||
|
and extracting the sources so can use those files in determining the new `pkgver`.
|
||||||
|
This is most useful when used with sources from version control systems (see below).
|
||||||
|
|
||||||
*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
|
||||||
@@ -87,7 +93,7 @@ similar to `$_basekernver`.
|
|||||||
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.
|
||||||
@@ -107,6 +113,14 @@ similar to `$_basekernver`.
|
|||||||
It is also possible to change the name of the downloaded file, 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')`.
|
||||||
|
+
|
||||||
|
makepkg also supports building developmental versions of packages using sources
|
||||||
|
downloaded from version control systems (VCS). For more information, see
|
||||||
|
<<VCS,Using VCS Sources>> below.
|
||||||
|
+
|
||||||
|
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
|
||||||
@@ -116,9 +130,10 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
*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. If 'SKIP' is put in the array
|
||||||
``makepkg -g >> PKGBUILD''. If desired, move the md5sums line to an
|
in place of a normal hash, the integrity check for that source file will
|
||||||
appropriate location.
|
be skipped. To easily generate md5sums, run ``makepkg -g >> PKGBUILD''.
|
||||||
|
If desired, move the md5sums line to an appropriate location.
|
||||||
|
|
||||||
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
|
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
|
||||||
Alternative integrity checks that makepkg supports; these all behave
|
Alternative integrity checks that makepkg supports; these all behave
|
||||||
@@ -134,7 +149,7 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
*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 should use arch=('any').
|
files should use `arch=('any')`.
|
||||||
|
|
||||||
*backup (array)*::
|
*backup (array)*::
|
||||||
An array of filenames, without preceding slashes, that
|
An array of filenames, without preceding slashes, that
|
||||||
@@ -146,9 +161,9 @@ name. The syntax is: `source=('filename::url')`.
|
|||||||
An array of packages this package depends on to run. Entries 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
|
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
|
try to find a binary that depends on the library in the built package and
|
||||||
@@ -178,18 +193,19 @@ disables auto detection.
|
|||||||
*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'' 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
|
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
|
try to find the library in the built package and append the correct
|
||||||
@@ -199,9 +215,11 @@ version. Appending the version yourself disables auto detection.
|
|||||||
An array of packages this package should replace. This 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
|
||||||
@@ -225,6 +243,10 @@ version. Appending the version yourself disables auto detection.
|
|||||||
Leave libtool (.la) files in packages. Specify `!libtool` to
|
Leave libtool (.la) files in packages. Specify `!libtool` to
|
||||||
remove them.
|
remove them.
|
||||||
|
|
||||||
|
*staticlibs*;;
|
||||||
|
Leave static library (.a) files in packages. Specify `!staticlibs` to
|
||||||
|
remove them.
|
||||||
|
|
||||||
*emptydirs*;;
|
*emptydirs*;;
|
||||||
Leave empty directories in packages.
|
Leave empty directories in packages.
|
||||||
|
|
||||||
@@ -245,10 +267,10 @@ version. Appending the version yourself disables auto detection.
|
|||||||
with distcc.
|
with distcc.
|
||||||
|
|
||||||
*buildflags*;;
|
*buildflags*;;
|
||||||
Allow the use of user-specific buildflags (CFLAGS, CXXFLAGS, LDFLAGS)
|
Allow the use of user-specific buildflags (CPPFLAGS, CFLAGS, CXXFLAGS,
|
||||||
during build as specified in linkman:makepkg.conf[5]. More useful in
|
LDFLAGS) during build as specified in linkman:makepkg.conf[5]. More
|
||||||
its negative form `!buildflags` with select packages that have problems
|
useful in its negative form `!buildflags` with select packages that
|
||||||
building with custom buildflags.
|
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
|
||||||
@@ -256,53 +278,71 @@ version. Appending the version yourself disables auto detection.
|
|||||||
`!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).
|
||||||
|
|
||||||
|
*debug*;;
|
||||||
|
Add the user-specified debug flags (DEBUG_CFLAGS, DEBUG_CXXFLAGS) to
|
||||||
|
their counterpart buildflags as specified in linkman:makepkg.conf[5].
|
||||||
|
When used in combination with the `strip' option, a separate package
|
||||||
|
containing the debug symbols is created.
|
||||||
|
|
||||||
build() Function
|
|
||||||
----------------
|
|
||||||
In addition to the above directives, the optional build() function usually
|
|
||||||
comprises the remainder of the PKGBUILD. This is directly sourced and executed
|
|
||||||
by makepkg, so anything that bash or the system has available is available for
|
|
||||||
use here. The function is run in `bash -e` mode, meaning any command that exits
|
|
||||||
with a non-zero status will cause the function to exit. Be sure any exotic
|
|
||||||
commands used are covered by `makedepends`.
|
|
||||||
|
|
||||||
All of the above variables such as `$pkgname` and `$pkgver` are available for use
|
Packaging Functions
|
||||||
in the build function. In addition, makepkg defines the following three
|
-------------------
|
||||||
variables for use during the build and install process:
|
|
||||||
|
|
||||||
*startdir*::
|
In addition to the above directives, PKGBUILDs require a set of functions that
|
||||||
This contains the absolute path to the directory where the PKGBUILD is
|
provide instructions to build and install the package. As a minimum, the PKGBUILD
|
||||||
located, which is usually the output of `$(pwd)` when makepkg is started.
|
must contain a package() function which installs all the package's files into the
|
||||||
|
packaging directory, with optional prepare(), build() and check() being used to
|
||||||
|
create those files from source.
|
||||||
|
|
||||||
*srcdir*::
|
*package() Function*::
|
||||||
This contains the directory where makepkg extracts, or copies, all source
|
The package() function is used to install files into the directory that
|
||||||
files.
|
will become the root directory of the built package and is run after all
|
||||||
|
the optional functions listed below. When specified in combination with
|
||||||
|
the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
|
||||||
|
will be limited to running the packaging stage. All other functions will
|
||||||
|
be run as the user calling makepkg.
|
||||||
|
|
||||||
*pkgdir*::
|
*prepare() Function*::
|
||||||
This contains the directory where makepkg bundles the installed package
|
An optional prepare() function can be specified in which operations that
|
||||||
(this directory will become the root directory of your built package).
|
are to be run in order to prepare the sources for building (such as
|
||||||
|
patching) are performed. This function is run after the source extraction
|
||||||
|
and before the build() function and is skipped when source extraction is
|
||||||
|
skipped.
|
||||||
|
|
||||||
|
*build() Function*::
|
||||||
|
The optional build() function is use to compile and/or adjust the source
|
||||||
|
files in preparation to be installed by the package() function. This is
|
||||||
|
directly sourced and executed by makepkg, so anything that bash or the
|
||||||
|
system has available is available for use here. Be sure any exotic
|
||||||
|
commands used are covered by `makedepends`.
|
||||||
|
+
|
||||||
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
|
*check() Function*::
|
||||||
----------------
|
An optional check() function can be specified in which a package's
|
||||||
An optional check() function can be specified in which a packages test-suite
|
test-suite may be run. This function is run between the build() and
|
||||||
may be run. This function is run between the build() and package() functions.
|
package() functions. Be sure any exotic commands used are covered by
|
||||||
The function is run in `bash -e` mode, meaning any command that exits with a
|
`checkdepends`.
|
||||||
non-zero status will cause the function to exit. Be sure any exotic commands
|
|
||||||
used are covered by `checkdepends`.
|
|
||||||
|
|
||||||
package() Function
|
All of the above variables such as `$pkgname` and `$pkgver` are available for use
|
||||||
------------------
|
in the build function. In addition, makepkg defines the following variables for use
|
||||||
An optional package() function can be specified in addition to the build()
|
during the build and install process:
|
||||||
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
|
*srcdir*::
|
||||||
non-zero status will cause the function to exit. When specified in combination
|
This contains the directory where makepkg extracts, or copies, all source
|
||||||
with the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
|
files.
|
||||||
will be limited to running the packaging stage. An existing build() function
|
|
||||||
will be run as the user calling makepkg.
|
*pkgdir*::
|
||||||
|
This contains the directory where makepkg bundles the installed package
|
||||||
|
(this directory will become the root directory of your built package).
|
||||||
|
This variable should only be used in the package() function.
|
||||||
|
|
||||||
|
*startdir*::
|
||||||
|
This contains the absolute path to the directory where the PKGBUILD is
|
||||||
|
located, which is usually the output of `$(pwd)` when makepkg is started.
|
||||||
|
Use of this variable is deprecated and strongly discouraged.
|
||||||
|
|
||||||
Package Splitting
|
Package Splitting
|
||||||
-----------------
|
-----------------
|
||||||
@@ -314,9 +354,9 @@ Each split package uses a corresponding packaging function with name
|
|||||||
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 in the PKGBUILD. Nevertheless, the following ones can be overridden within
|
given in the PKGBUILD. Nevertheless, the following ones can be overridden within
|
||||||
each split package's packaging function:
|
each split package's packaging function:
|
||||||
`pkgver`, `pkgrel`, `epoch`, `pkgdesc`, `arch`, `license`, `groups`, `depends`,
|
`pkgver`, `pkgrel`, `epoch`, `pkgdesc`, `arch`, `url`, `license`, `groups`,
|
||||||
`optdepends`, `provides`, `conflicts`, `replaces`, `backup`, `options`,
|
`depends`, `optdepends`, `provides`, `conflicts`, `replaces`, `backup`,
|
||||||
`install` and `changelog`.
|
`options`, `install` and `changelog`.
|
||||||
|
|
||||||
An optional global directive is available when building a split package:
|
An optional global directive is available when building a split package:
|
||||||
|
|
||||||
@@ -373,69 +413,43 @@ The install script does not need to be specified in the source array. A
|
|||||||
template install file is available in '{pkgdatadir}' as 'proto.install' for
|
template install file is available in '{pkgdatadir}' as 'proto.install' for
|
||||||
reference with all of the available functions defined.
|
reference with all of the available functions defined.
|
||||||
|
|
||||||
|
Using VCS Sources[[VCS]]
|
||||||
|
------------------------
|
||||||
|
Building a developmental version of a package using sources from a version control
|
||||||
|
system (VCS) is enabled by specifying the source in the form
|
||||||
|
`source=('folder::url#fragment')`. Currently makepkg supports the `bzr`, `git`, `hg` and
|
||||||
|
`svn` protocols.
|
||||||
|
|
||||||
Development Directives
|
The source URL is divided into three components:
|
||||||
----------------------
|
|
||||||
makepkg supports building development versions of packages without having to
|
|
||||||
manually update the pkgver in the PKGBUILD. This was formerly done using the
|
|
||||||
separate utility 'versionpkg'. In order to utilize this functionality, your
|
|
||||||
PKGBUILD must use correct variable names depending on the SCM being fetched
|
|
||||||
from (e.g., 'makepkg-git', 'mplayer-svn').
|
|
||||||
|
|
||||||
*CVS*::
|
*folder*::
|
||||||
The generated pkgver will be the date the package is built.
|
(optional) Specifies an alternate folder name for makepkg to download the VCS
|
||||||
|
source into.
|
||||||
|
|
||||||
*_cvsroot*;;
|
*url*::
|
||||||
The root of the CVS repository.
|
The url to the VCS repo. This must include the the vcs in the URL protocol for
|
||||||
|
makepkg to recognize this as a VCS source. If the protocol does not include
|
||||||
|
the VCS name, it can be added by prefixing the URL with `vcs+`. For example,
|
||||||
|
using a git repository over `http` would have a source URL in the form
|
||||||
|
`git+http://...`.
|
||||||
|
|
||||||
*_cvsmod*;;
|
*fragment*::
|
||||||
The CVS module to fetch.
|
(optional) Allows specifying a revision number or branch for makepkg to checkout
|
||||||
|
from the VCS. For example, to checkout a given revision, the source line would
|
||||||
|
have the format `source=(url#revision=123)`. The available fragments depends on
|
||||||
|
the VCS being used:
|
||||||
|
|
||||||
*SVN*::
|
*bzr*;;
|
||||||
The generated pkgver will be the latest SVN revision number.
|
revision (see `'bzr help revisionspec'` for details)
|
||||||
|
|
||||||
*_svntrunk*;;
|
*git*;;
|
||||||
The trunk of the SVN repository.
|
branch, commit, tag
|
||||||
|
|
||||||
*_svnmod*;;
|
*hg*;;
|
||||||
The SVN module to fetch.
|
branch, revision, tag
|
||||||
|
|
||||||
*Git*::
|
|
||||||
The generated pkgver will be the date the package is built.
|
|
||||||
|
|
||||||
*_gitroot*;;
|
|
||||||
The URL (all protocols supported) to the GIT repository.
|
|
||||||
|
|
||||||
*_gitname*;;
|
|
||||||
GIT tag or branch to use.
|
|
||||||
|
|
||||||
*Mercurial*::
|
|
||||||
The generated pkgver will be the hg tip revision number.
|
|
||||||
|
|
||||||
*_hgroot*;;
|
|
||||||
The URL of the mercurial repository.
|
|
||||||
|
|
||||||
*_hgrepo*;;
|
|
||||||
The repository to follow.
|
|
||||||
|
|
||||||
*Darcs*::
|
|
||||||
The generated pkgver will be the date the package is built.
|
|
||||||
|
|
||||||
*_darcstrunk*;;
|
|
||||||
URL to the repository trunk.
|
|
||||||
|
|
||||||
*_darcsmod*;;
|
|
||||||
Darcs module to use.
|
|
||||||
|
|
||||||
*Bazaar*::
|
|
||||||
The generated pkgver will be the latest Bazaar revision number (revno).
|
|
||||||
|
|
||||||
*_bzrtrunk*;;
|
|
||||||
URL to the bazaar repository.
|
|
||||||
|
|
||||||
*_bzrmod*;;
|
|
||||||
Bazaar module to use.
|
|
||||||
|
|
||||||
|
*svn*;;
|
||||||
|
revision
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
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 https://www.archlinux.org/pacman/[] for current
|
||||||
information on pacman and its related tools.
|
information on pacman and its related tools.
|
||||||
|
|
||||||
|
|
||||||
@@ -20,12 +20,15 @@ Current maintainers:
|
|||||||
|
|
||||||
* Allan McRae <allan@archlinux.org>
|
* 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>
|
||||||
|
|
||||||
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>
|
* 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.
|
||||||
|
|||||||
205
doc/index.txt
205
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
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
@@ -50,11 +53,11 @@ configuration files dealing with pacman.
|
|||||||
Changelog
|
Changelog
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
For a good idea of what is going on in pacman development, take a look at the
|
For a good idea of what is going on in pacman development, take a look at the
|
||||||
link:http://projects.archlinux.org/pacman.git/[Git summary page] for the
|
link:https://projects.archlinux.org/pacman.git/[Git summary page] for the
|
||||||
project.
|
project.
|
||||||
|
|
||||||
See the most recent
|
See the most recent
|
||||||
link:http://projects.archlinux.org/pacman.git/tree/NEWS[NEWS]
|
link:https://projects.archlinux.org/pacman.git/tree/NEWS[NEWS]
|
||||||
file for a not-as-frequently-updated list of changes. However, this should
|
file for a not-as-frequently-updated list of changes. However, this should
|
||||||
contain the biggest changes in a format more concise than the commit log.
|
contain the biggest changes in a format more concise than the commit log.
|
||||||
|
|
||||||
@@ -62,47 +65,111 @@ 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-08-10 v3.5.4
|
[frame="topbot",grid="none",options="header,autowidth"]
|
||||||
2011-06-07 v3.5.3
|
!======
|
||||||
2011-04-18 v3.5.2
|
!Version !Date
|
||||||
2011-03-23 v3.5.1
|
!4.1.2 !2013-06-18
|
||||||
2011-03-16 v3.5.0
|
!4.1.1 !2013-05-07
|
||||||
2011-01-22 v3.4.3
|
!4.1.0 !2013-04-01
|
||||||
2010-12-29 v3.4.2
|
!4.1.0rc1 !2013-03-09
|
||||||
2010-09-03 v3.4.1
|
!4.0.3 !2012-04-07
|
||||||
2010-06-16 v3.4.0
|
!4.0.2 !2012-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
|
!======
|
||||||
2004-09-25 v2.9.2
|
|
|
||||||
2004-09-24 v2.9.1
|
[frame="topbot",grid="none",options="header,autowidth"]
|
||||||
2004-09-18 v2.9
|
!======
|
||||||
---------------------
|
!Version !Date
|
||||||
|
!3.1.0 !2008-01-09
|
||||||
|
!3.0.6 !2007-09-16
|
||||||
|
!3.0.5 !2007-06-17
|
||||||
|
!3.0.4 !2007-05-08
|
||||||
|
!3.0.3 !2007-04-28
|
||||||
|
!3.0.2 !2007-04-23
|
||||||
|
!3.0.1 !2007-04-04
|
||||||
|
!3.0.0 !2007-03-25
|
||||||
|
!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
|
||||||
|
!======
|
||||||
|
|
|
||||||
|
[frame="topbot",grid="none",options="header,autowidth"]
|
||||||
|
!======
|
||||||
|
!Version !Date
|
||||||
|
!2.7.6 !2004-04-04
|
||||||
|
!2.7.5 !2004-03-02
|
||||||
|
!2.7.4 !2004-02-18
|
||||||
|
!2.7.3 !2004-02-07
|
||||||
|
!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
|
||||||
@@ -122,8 +189,8 @@ Development
|
|||||||
Mailing List
|
Mailing List
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
There is a mailing list devoted to pacman development, hosted by Arch Linux.
|
There is a mailing list devoted to pacman development, hosted by Arch Linux.
|
||||||
link:http://mailman.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
|
link:https://mailman.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
|
||||||
link:http://mailman.archlinux.org/pipermail/pacman-dev/[view the archives].
|
link:https://mailman.archlinux.org/pipermail/pacman-dev/[view the archives].
|
||||||
|
|
||||||
Source Code
|
Source Code
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
@@ -138,7 +205,7 @@ The current development tree can be fetched with the following command:
|
|||||||
|
|
||||||
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
|
||||||
link:http://projects.archlinux.org/pacman.git/[cgit]. HTTP/HTTPS URLs are also
|
link:https://projects.archlinux.org/pacman.git/[cgit]. HTTP/HTTPS URLs are also
|
||||||
available for cloning purposes; these URLs are listed at the above page.
|
available for cloning purposes; these URLs are listed at the above page.
|
||||||
|
|
||||||
If you are interested in hacking on pacman, it is highly recommended you join
|
If you are interested in hacking on pacman, it is highly recommended you join
|
||||||
@@ -155,17 +222,17 @@ Other Utilities
|
|||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
Although the package manager itself is quite simple, many scripts have been
|
Although the package manager itself is quite simple, many scripts have been
|
||||||
developed that help automate building and installing packages. These are used
|
developed that help automate building and installing packages. These are used
|
||||||
extensively in link:http://archlinux.org/[Arch Linux]. Most of these utilities
|
extensively in link:https://www.archlinux.org/[Arch Linux]. Most of these utilities
|
||||||
are available in the Arch Linux projects
|
are available in the Arch Linux projects
|
||||||
link:http://projects.archlinux.org/[code browser].
|
link:https://projects.archlinux.org/[code browser].
|
||||||
|
|
||||||
Utilities available:
|
Utilities available:
|
||||||
|
|
||||||
* link:http://projects.archlinux.org/abs.git/[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
|
* link:https://projects.archlinux.org/abs.git/[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
|
||||||
* link:http://projects.archlinux.org/dbscripts.git/[dbscripts] - scripts used by Arch Linux to manage the main package repositories
|
* link:https://projects.archlinux.org/dbscripts.git/[dbscripts] - scripts used by Arch Linux to manage the main package repositories
|
||||||
* link:http://projects.archlinux.org/devtools.git/[devtools] - tools to assist in packaging and dependency checking
|
* link:https://projects.archlinux.org/devtools.git/[devtools] - tools to assist in packaging and dependency checking
|
||||||
* link:http://projects.archlinux.org/namcap.git/[namcap] - a package analysis utility written in python
|
* link:https://projects.archlinux.org/namcap.git/[namcap] - a package analysis utility written in python
|
||||||
* link:http://projects.archlinux.org/srcpac.git/[srcpac] - a bash build-from-source pacman wrapper
|
* link:https://projects.archlinux.org/srcpac.git/[srcpac] - a bash build-from-source pacman wrapper
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
----
|
----
|
||||||
@@ -175,34 +242,12 @@ such as your commandline, the nature of the bug, and even the package database
|
|||||||
if it helps.
|
if it helps.
|
||||||
|
|
||||||
You can also post a bug to the Arch Linux bug tracker
|
You can also post a bug to the Arch Linux bug tracker
|
||||||
link:http://bugs.archlinux.org/index.php?project=3[Flyspray]. Be sure to file
|
link:https://bugs.archlinux.org/index.php?project=3[Flyspray]. Be sure to file
|
||||||
bugs under the Pacman project.
|
bugs under the Pacman project.
|
||||||
|
|
||||||
Pacman/libalpm in the Wild
|
|
||||||
--------------------------
|
|
||||||
Although Arch Linux is the primary user of pacman and libalpm, other
|
|
||||||
distributions and projects also use pacman as a package management tool. In
|
|
||||||
addition, there have been several projects started to provide a frontend GUI to
|
|
||||||
pacman and/or libalpm.
|
|
||||||
|
|
||||||
Arch derivatives:
|
|
||||||
|
|
||||||
* link:http://archie.dotsrc.org/[Archie] - Arch Live on steroids
|
|
||||||
* link:http://www.faunos.com/[FaunOS] - A portable, fully integrated operating system based on Arch Linux
|
|
||||||
* link:http://larch.berlios.de/[larch] - A live CD/DVD/USB-stick construction kit for Arch Linux
|
|
||||||
|
|
||||||
Other distributions:
|
|
||||||
|
|
||||||
* link:http://www.delilinux.org/[DeLi Linux] - "Desktop Light" Linux, a Linux distribution for old computers
|
|
||||||
* link:http://www.frugalware.org/[Frugalware Linux] - A general purpose Linux distribution for intermediate users (pacman is forked and maintained separately)
|
|
||||||
|
|
||||||
Pacman/libalpm frontends:
|
|
||||||
|
|
||||||
* link:http://shaman.iskrembilen.com/[Shaman] - A GUI frontend using Qt and libalpm
|
|
||||||
|
|
||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
pacman is Copyright (C) 2006-2011 Pacman Development Team
|
pacman is Copyright (C) 2006-2013 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.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Synopsis
|
|||||||
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.
|
||||||
|
|
||||||
@@ -59,11 +59,16 @@ Options
|
|||||||
installed.
|
installed.
|
||||||
|
|
||||||
*-e, \--noextract*::
|
*-e, \--noextract*::
|
||||||
Do not extract source files; use whatever source already exists in the
|
Do not extract source files or run the prepare() function (if present);
|
||||||
src/ directory. This is handy if you want to go into src/ and manually
|
use whatever source already exists in the $srcdir/ directory. This is
|
||||||
patch or tweak code, then make a package out of the result. Keep in mind
|
handy if you want to go into $srcdir/ and manually patch or tweak code,
|
||||||
that creating a patch may be a better solution to allow others to use
|
then make a package out of the result. Keep in mind that creating a
|
||||||
your PKGBUILD.
|
patch may be a better solution to allow others to use your PKGBUILD.
|
||||||
|
|
||||||
|
*\--verifysource*::
|
||||||
|
For each source file in the source array of PKGBUILD, download the file
|
||||||
|
if required and perform the integrity checks. No extraction or build is
|
||||||
|
performed. Useful for performing subsequent offline builds.
|
||||||
|
|
||||||
*-f, \--force*::
|
*-f, \--force*::
|
||||||
makepkg will not build a package if a built package already exists in
|
makepkg will not build a package if a built package already exists in
|
||||||
@@ -71,11 +76,6 @@ Options
|
|||||||
default to the current directory. This allows the built package to be
|
default to the current directory. This allows the built package to be
|
||||||
overwritten.
|
overwritten.
|
||||||
|
|
||||||
*--forcever*::
|
|
||||||
This is a hidden option that should *not* be used unless you really know
|
|
||||||
what you are doing. makepkg uses this internally when calling itself to
|
|
||||||
set the new development pkgver of the package.
|
|
||||||
|
|
||||||
*-g, \--geninteg*::
|
*-g, \--geninteg*::
|
||||||
For each source file in the source array of PKGBUILD, download the file
|
For each source file in the source array of PKGBUILD, download the file
|
||||||
if required and generate integrity checks. The integrity checks generated
|
if required and generate integrity checks. The integrity checks generated
|
||||||
@@ -96,10 +96,9 @@ Options
|
|||||||
*-h, \--help*::
|
*-h, \--help*::
|
||||||
Output syntax and command line options.
|
Output syntax and command line options.
|
||||||
|
|
||||||
*\--holdver*::
|
*--holdver*::
|
||||||
Useful when building development versions of packages. Prevents makepkg
|
When using VCS sources (linkman:PKGBUILD[5]) any currently checked out source
|
||||||
from automatically bumping the pkgver to the latest revision number in
|
will not be updated to the latest revision.
|
||||||
the package's development tree.
|
|
||||||
|
|
||||||
*-i, \--install*::
|
*-i, \--install*::
|
||||||
Install or upgrade the package after a successful build using
|
Install or upgrade the package after a successful build using
|
||||||
@@ -116,9 +115,9 @@ Options
|
|||||||
Disable color in output messages.
|
Disable color in output messages.
|
||||||
|
|
||||||
*-o, \--nobuild*::
|
*-o, \--nobuild*::
|
||||||
Download and extract files only, but do not build them. Useful with the
|
Download and extract files, run the prepare() function, but do not build
|
||||||
`\--noextract` option if you wish to tweak the files in src/ before
|
them. Useful with the '\--noextract' option if you wish to tweak the files
|
||||||
building.
|
in $srcdir/ before 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;
|
||||||
@@ -138,6 +137,16 @@ 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.
|
||||||
|
|
||||||
|
*-V, \--version*::
|
||||||
|
Display version information.
|
||||||
|
|
||||||
*\--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
|
||||||
@@ -145,15 +154,9 @@ 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. Multiple packages should
|
||||||
does not include sources that can be fetched via a download URL. This is
|
be comma separated in the list. This option can be specified multiple times.
|
||||||
useful for passing a single tarball to another program such as a chroot,
|
|
||||||
remote builder, or a tarball upload. Because integrity checks are verified,
|
|
||||||
all source files of the package need to be present or downloadable.
|
|
||||||
|
|
||||||
*\--pkg <list>*::
|
|
||||||
Only build listed packages from a split package.
|
|
||||||
|
|
||||||
*\--check*::
|
*\--check*::
|
||||||
Run the check() function in the PKGBUILD, overriding the setting in
|
Run the check() function in the PKGBUILD, overriding the setting in
|
||||||
@@ -178,6 +181,14 @@ Options
|
|||||||
(Passed to pacman) Prevent pacman from waiting for user input before
|
(Passed to pacman) Prevent pacman from waiting for user input before
|
||||||
proceeding with operations.
|
proceeding with operations.
|
||||||
|
|
||||||
|
*\--needed*::
|
||||||
|
(Passed to pacman) Tell pacman not to reinstall a target if it is already
|
||||||
|
up to date. (used with -i / --install).
|
||||||
|
|
||||||
|
*\--asdeps*::
|
||||||
|
(Passed to pacman) Install packages as non-explicitly installed (used
|
||||||
|
with -i / --install).
|
||||||
|
|
||||||
*\--noprogressbar*::
|
*\--noprogressbar*::
|
||||||
(Passed to pacman) Prevent pacman from displaying a progress bar;
|
(Passed to pacman) Prevent pacman from displaying a progress bar;
|
||||||
useful if you are redirecting makepkg output to file.
|
useful if you are redirecting makepkg output to file.
|
||||||
@@ -207,6 +218,10 @@ 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].
|
||||||
|
|
||||||
|
**PACKAGER=**"John Doe <john@doe.com>"::
|
||||||
|
String to identify the creator of the resulting package. Overrides
|
||||||
|
the corresponding value defined in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
**BUILDDIR=**"/path/to/folder"::
|
**BUILDDIR=**"/path/to/folder"::
|
||||||
Folder where the package will be built. Overrides the corresponding
|
Folder where the package will be built. Overrides the corresponding
|
||||||
value defined in linkman:makepkg.conf[5].
|
value defined in linkman:makepkg.conf[5].
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ build environment.
|
|||||||
NOTE: This does not guarantee that all package Makefiles will use your exported
|
NOTE: This does not guarantee that all package Makefiles will use your exported
|
||||||
variables. Some of them are non-standard.
|
variables. Some of them are non-standard.
|
||||||
|
|
||||||
|
The system-wide configuration file is found in {sysconfdir}/makepkg.conf.
|
||||||
|
Individual options can be overridden (or added to) on a per user basis in
|
||||||
|
~/.makepkg.conf.
|
||||||
|
|
||||||
The default file is fairly well commented, so it may be easiest to simply
|
The default file is fairly well commented, so it may be easiest to simply
|
||||||
follow directions given there for customization.
|
follow directions given there for customization.
|
||||||
|
|
||||||
@@ -51,6 +55,9 @@ Options
|
|||||||
A string such as ``i686-pc-linux-gnu'', do not touch unless you know what
|
A string such as ``i686-pc-linux-gnu'', do not touch unless you know what
|
||||||
you are doing. This can be commented out by most users if desired.
|
you are doing. This can be commented out by most users if desired.
|
||||||
|
|
||||||
|
**CPPFLAGS=**"cppflags"::
|
||||||
|
Flags used for the C preprocessor; see CFLAGS for more info.
|
||||||
|
|
||||||
**CFLAGS=**"cflags"::
|
**CFLAGS=**"cflags"::
|
||||||
Flags used for the C compiler. This is a key part to the use of makepkg.
|
Flags used for the C compiler. This is a key part to the use of makepkg.
|
||||||
Usually several options are specified, and the most common string resembles
|
Usually several options are specified, and the most common string resembles
|
||||||
@@ -70,11 +77,20 @@ 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.
|
||||||
|
|
||||||
|
**DEBUG_CFLAGS=**"debug_cflags"::
|
||||||
|
Additional compiler flags appended to CFLAGS for use in debugging. Usually
|
||||||
|
this would include: ``-g''. Read gcc(1) for more details on the wide
|
||||||
|
variety of compiler flags available.
|
||||||
|
|
||||||
|
**DEBUG_CXXFLAGS=**"debug_cxxflags"::
|
||||||
|
Debug flags used for the C++ compiler; see DEBUG_CFLAGS for more info.
|
||||||
|
|
||||||
**BUILDENV=(**fakeroot !distcc color !ccache check !sign**)**::
|
**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
|
||||||
option. Each works as follows:
|
option. If an option is specified multiple times, the final value takes
|
||||||
|
precedence. Each option works as follows:
|
||||||
|
|
||||||
*fakeroot*;;
|
*fakeroot*;;
|
||||||
Allow building packages as a non-root user. This is highly recommended.
|
Allow building packages as a non-root user. This is highly recommended.
|
||||||
@@ -96,7 +112,7 @@ Options
|
|||||||
*check*;;
|
*check*;;
|
||||||
Run the check() function if present in the PKGBUILD. This can be
|
Run the check() function if present in the PKGBUILD. This can be
|
||||||
enabled or disabled for individual packages through the use of
|
enabled or disabled for individual packages through the use of
|
||||||
makepkg's `--check` and `--nocheck` options respectively.
|
makepkg's '\--check' and '\--nocheck' options respectively.
|
||||||
|
|
||||||
*sign*;;
|
*sign*;;
|
||||||
Generate a PGP signature file using GnuPG. This will execute `gpg
|
Generate a PGP signature file using GnuPG. This will execute `gpg
|
||||||
@@ -120,14 +136,15 @@ Options
|
|||||||
|
|
||||||
**GPGKEY=**""::
|
**GPGKEY=**""::
|
||||||
Specify a key to use for gpg signing instead of the default key in the
|
Specify a key to use for gpg signing instead of the default key in the
|
||||||
keyring. Can be overridden with makepkg's `--key` option.
|
keyring. Can be overridden with makepkg's '\--key' option.
|
||||||
|
|
||||||
**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**::
|
**OPTIONS=(**strip docs libtool staticlibs 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
|
||||||
disable an option simply remove or place an ``!'' at the front of the
|
disable an option simply remove or place an ``!'' at the front of the
|
||||||
option. Each works as follows:
|
option. If an option is specified multiple times, the final value takes
|
||||||
|
precedence. Each option works as follows:
|
||||||
|
|
||||||
*strip*;;
|
*strip*;;
|
||||||
Strip symbols from binaries and libraries. If you frequently use a
|
Strip symbols from binaries and libraries. If you frequently use a
|
||||||
@@ -143,6 +160,10 @@ Options
|
|||||||
Leave libtool (.la) files in packages. Specify `!libtool` to remove
|
Leave libtool (.la) files in packages. Specify `!libtool` to remove
|
||||||
them.
|
them.
|
||||||
|
|
||||||
|
*staticlibs*;;
|
||||||
|
Leave static library (.a) files in packages. Specify `!staticlibs` to
|
||||||
|
remove them.
|
||||||
|
|
||||||
*emptydirs*;;
|
*emptydirs*;;
|
||||||
Leave empty directories in packages.
|
Leave empty directories in packages.
|
||||||
|
|
||||||
@@ -158,6 +179,11 @@ Options
|
|||||||
Compress binary executable files using UPX. Additional options
|
Compress binary executable files using UPX. Additional options
|
||||||
can be passed to UPX by specifying the `UPXFLAGS` variable.
|
can be passed to UPX by specifying the `UPXFLAGS` variable.
|
||||||
|
|
||||||
|
*debug*;;
|
||||||
|
Add the user-specified debug flags as specified in DEBUG_CFLAGS and
|
||||||
|
DEBUG_CXXFLAGS to their counterpart buildflags. Creates a separate
|
||||||
|
package containing the debug symbols when used with `strip'.
|
||||||
|
|
||||||
**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:
|
||||||
@@ -209,14 +235,28 @@ Options
|
|||||||
in the current directory. Many people like to keep all source package files
|
in the current directory. Many people like to keep all source package files
|
||||||
in a central location for easy cleanup, so this path can be set here.
|
in a central location for easy cleanup, so this path can be set here.
|
||||||
|
|
||||||
|
**LOGDEST=**"/path/to/folder"::
|
||||||
|
If this value is not set, log files are written to the current
|
||||||
|
directory. This centralizes the log location, facilitating cleanup
|
||||||
|
and compression.
|
||||||
|
|
||||||
**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.
|
||||||
|
|
||||||
|
**COMPRESSGZ=**"(gzip -c -f -n)"::
|
||||||
|
**COMPRESSBZ2=**"(bzip2 -c -f)"::
|
||||||
|
**COMPRESSXZ=**"(xz -c -z -)"::
|
||||||
|
**COMPRESSLZO**"(lzop -q)"::
|
||||||
|
**COMPRESSLRZ=**"(lrzip -q)"::
|
||||||
|
**COMPRESSZ=**"(compress -c -f)"::
|
||||||
|
Sets the command and options used when compressing compiled or source
|
||||||
|
packages in the named format.
|
||||||
|
|
||||||
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
|
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
|
||||||
Sets the compression used when making compiled or source packages. The
|
Sets the compression used when making compiled or source packages. The
|
||||||
current valid suffixes are `.tar`, `.tar.gz`, `.tar,bz2`, `.tar.xz`, and
|
current valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`,
|
||||||
`.tar.Z`.
|
`.tar.lzo`, `.tar.lrz` 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
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pacman-key - manage pacman's list of trusted keys
|
|||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
'pacman-key' [options]
|
'pacman-key' [options] operation [targets]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@@ -23,74 +23,120 @@ provides the ability to import and export keys, fetch keys from keyservers and
|
|||||||
update the key trust database.
|
update the key trust database.
|
||||||
|
|
||||||
More complex keyring management can be achieved using GnuPG directly combined with
|
More complex keyring management can be achieved using GnuPG directly combined with
|
||||||
the `--homedir` option pointing at the pacman keyring (located in
|
the '\--homedir' option pointing at the pacman keyring (located in
|
||||||
+{sysconfdir}/pacman.d/gnupg+ by default).
|
+{sysconfdir}/pacman.d/gnupg+ by default).
|
||||||
|
|
||||||
|
Invoking pacman-key consists of supplying an operation with any potential
|
||||||
|
options and targets to operate on. Depending on the operation, a 'target' may
|
||||||
|
be a valid key identifier, filename, or directory.
|
||||||
|
|
||||||
Options
|
Operations
|
||||||
-------
|
----------
|
||||||
*-a, \--add* [file(s)]::
|
*-a, \--add*::
|
||||||
Add the key(s) contained in the specified file or files to pacman's
|
Add the key(s) contained in the specified file or files to pacman's
|
||||||
keyring. If a key already exists, update it.
|
keyring. If a key already exists, update it.
|
||||||
|
|
||||||
*\--config* <file>::
|
*-d, \--delete*::
|
||||||
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
|
Remove the key(s) identified by the specified keyid(s) from pacman's
|
||||||
keyring.
|
keyring.
|
||||||
|
|
||||||
*-e, \--export* [keyid(s)]::
|
*-e, \--export*::
|
||||||
Export key(s) identified by the specified keyid(s) to 'stdout'. If no keyid
|
Export key(s) identified by the specified keyid(s) to 'stdout'. If no keyid
|
||||||
is specified, all keys will be exported.
|
is specified, all keys will be exported.
|
||||||
|
|
||||||
*\--edit-key * <keyid(s)>::
|
*\--edit-key*::
|
||||||
Present a menu for key management task on the specified keyids. Useful for
|
Present a menu for key management task on the specified keyid(s). Useful
|
||||||
adjusting a keys trust level.
|
for adjusting a keys trust level.
|
||||||
|
|
||||||
*-f, \--finger* [keyid(s)]::
|
*-f, \--finger*::
|
||||||
List a fingerprint for each specified keyid, or for all known keys if no
|
List a fingerprint for each specified keyid, or for all known keys if no
|
||||||
keyids are specified.
|
keyids are specified.
|
||||||
|
|
||||||
|
*-h, \--help*::
|
||||||
|
Output syntax and command line options.
|
||||||
|
|
||||||
|
*\--import*::
|
||||||
|
Imports keys from `pubring.gpg` into the public keyring from the specified
|
||||||
|
directories.
|
||||||
|
|
||||||
|
*\--import-trustdb*::
|
||||||
|
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.
|
||||||
|
|
||||||
|
*-l, \--list-keys*::
|
||||||
|
Lists all or specified keys from the public keyring.
|
||||||
|
|
||||||
|
*\--list-sigs*::
|
||||||
|
Same as '\--list-keys', but the signatures are listed too.
|
||||||
|
|
||||||
|
*\--lsign-key*::
|
||||||
|
Locally sign the given key. This is primarily used to root the web of trust
|
||||||
|
in the local private key generated by '\--init'.
|
||||||
|
|
||||||
|
*\--nocolor*::
|
||||||
|
Disable colored output from pacman-key.
|
||||||
|
|
||||||
|
*-r, \--recv-keys*::
|
||||||
|
Equivalent to '\--recv-keys' in GnuPG.
|
||||||
|
|
||||||
|
*\--refresh-keys*::
|
||||||
|
Equivalent to '\--refresh-keys' in GnuPG.
|
||||||
|
|
||||||
|
*\--populate*::
|
||||||
|
Reload the default keys from the (optionally provided) keyrings in
|
||||||
|
+{pkgdatadir}/keyrings+. For more information, see
|
||||||
|
<<PK,Providing a Keyring for Import>> below.
|
||||||
|
|
||||||
|
*-u, \--updatedb*::
|
||||||
|
Equivalent to '\--check-trustdb' in GnuPG. This operation can be specified with
|
||||||
|
other operations.
|
||||||
|
|
||||||
|
*-V, \--version*::
|
||||||
|
Displays the program version.
|
||||||
|
|
||||||
|
*-v, \--verify*::
|
||||||
|
Verify the file(s) specified by the signature(s).
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
*\--config* <file>::
|
||||||
|
Use an alternate config file instead of the +{sysconfdir}/pacman.conf+
|
||||||
|
default.
|
||||||
|
|
||||||
*\--gpgdir* <dir>::
|
*\--gpgdir* <dir>::
|
||||||
Set an alternate home directory for GnuPG. If unspecified, the value is
|
Set an alternate home directory for GnuPG. If unspecified, the value is
|
||||||
read from +{sysconfdir}/pacman.conf+.
|
read from +{sysconfdir}/pacman.conf+.
|
||||||
|
|
||||||
*-h, \--help*::
|
*\--keyserver* <keyserver>::
|
||||||
Output syntax and command line options.
|
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.
|
||||||
|
|
||||||
*--import* <dir(s)>::
|
|
||||||
Adds keys from pubring.gpg into pacman's keyring and imports ownertrust
|
|
||||||
values from trustdb.gpg in the specified directories.
|
|
||||||
|
|
||||||
*--import-dirs* <dir(s)> ::
|
Providing a Keyring for Import[[PK]]
|
||||||
Imports ownertrust values from trustdb.gpg in the specified directories.
|
------------------------------------
|
||||||
|
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+.
|
||||||
|
|
||||||
*--init*::
|
Optionally, the file `foo-trusted` can be provided containing a list of trusted
|
||||||
Ensure the keyring is properly initialized and has the required access
|
key IDs for that keyring. This is a file in a format compatible with 'gpg
|
||||||
permissions.
|
\--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.
|
||||||
|
|
||||||
*-l, \--list-keys* [keyid(s)]::
|
Also optionally, the file `foo-revoked` can be provided containing a list of
|
||||||
Lists all or specified keys from the public keyring.
|
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
|
||||||
*--list-sigs* [keyid(s)]::
|
will be disabled in the keyring and no longer treated as valid, so this always
|
||||||
Same as --list-keys, but the signatures are listed too.
|
takes priority over it's trusted state in any other keyring.
|
||||||
|
|
||||||
*-r, \--receive* <keyserver> <keyid(s)>::
|
|
||||||
Fetch the specified keyids from the specified key server URL.
|
|
||||||
|
|
||||||
*\--reload*::
|
|
||||||
Reloads the keys from the keyring package.
|
|
||||||
|
|
||||||
*-u, \--updatedb*::
|
|
||||||
Equivalent to \--check-trustdb in GnuPG.
|
|
||||||
|
|
||||||
* -v, \--verify* <signature>::
|
|
||||||
Verify the given signature file.
|
|
||||||
|
|
||||||
*-V, \--version*::
|
|
||||||
Displays the program version.
|
|
||||||
|
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ front ends to be written (for instance, a GUI front end).
|
|||||||
Invoking pacman involves specifying an operation with any potential options and
|
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
|
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.
|
a search string. Targets can be provided as command line arguments.
|
||||||
Additionally, if a single dash (-) is passed as an argument, targets will be
|
Additionally, if stdin is not from a terminal and a single dash (-) is passed
|
||||||
read from stdin.
|
as an argument, targets will be read from stdin.
|
||||||
|
|
||||||
|
|
||||||
Operations
|
Operations
|
||||||
@@ -70,10 +70,10 @@ Operations
|
|||||||
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 provide a
|
gnome is a defined package group, then `pacman -S gnome` will provide a
|
||||||
prompt allowing you to select which packages to install from a numbered list.
|
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
|
The package selection is specified using a space and/or comma separated list of
|
||||||
numbers. Sequential packages may be selected by specifying the first and last
|
package numbers. Sequential packages may be selected by specifying the first
|
||||||
package numbers separated by a hyphen (`-`). Excluding packages is achieved by
|
and last package numbers separated by a hyphen (`-`). Excluding packages is
|
||||||
prefixing a number or range of numbers with a caret (`^`).
|
achieved by prefixing a number or range of numbers with a caret (`^`).
|
||||||
+
|
+
|
||||||
Packages that 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 that
|
foo` will first look for a foo package. If foo is not found, packages that
|
||||||
@@ -86,7 +86,7 @@ You can also use `pacman -Su` to upgrade all packages that are out of date. See
|
|||||||
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
|
||||||
+
|
+
|
||||||
@@ -146,6 +146,11 @@ Options
|
|||||||
and they are tried in the order they are passed to pacman. *NOTE*: this
|
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.
|
is an absolute path, the root path is not automatically prepended.
|
||||||
|
|
||||||
|
*\--color* <when>::
|
||||||
|
Specify when to enable coloring, can be 'always', 'never' or 'auto'. Always
|
||||||
|
forces colours on, never forces colours off, and auto only automatically enables
|
||||||
|
colours when outputting onto a tty.
|
||||||
|
|
||||||
*\--config* <file>::
|
*\--config* <file>::
|
||||||
Specify an alternate configuration file.
|
Specify an alternate configuration file.
|
||||||
|
|
||||||
@@ -201,10 +206,12 @@ Transaction Options (apply to '-S', '-R' and '-U')
|
|||||||
|
|
||||||
Upgrade Options (apply to '-S' and '-U')[[UO]]
|
Upgrade Options (apply to '-S' and '-U')[[UO]]
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
*-f, \--force*::
|
*\--force*::
|
||||||
Bypass file conflict checks and overwrite conflicting files. If the
|
Bypass file conflict checks and overwrite conflicting files. If the
|
||||||
package that is about to be installed contains files that are already
|
package that is about to be installed contains files that are already
|
||||||
installed, this option will cause all those files to be overwritten.
|
installed, this option will cause all those files to be overwritten.
|
||||||
|
Using '--force' will not allow overwriting a directory with a file or
|
||||||
|
installing packages with conflicting files and directories.
|
||||||
This option should be used with care, ideally not at all.
|
This option should be used with care, ideally not at all.
|
||||||
|
|
||||||
*\--asdeps*::
|
*\--asdeps*::
|
||||||
@@ -232,13 +239,6 @@ Upgrade Options (apply to '-S' and '-U')[[UO]]
|
|||||||
*\--needed*::
|
*\--needed*::
|
||||||
Do not reinstall the targets that are already up to date.
|
Do not reinstall the targets that are already up to date.
|
||||||
|
|
||||||
*\--recursive*::
|
|
||||||
Recursively reinstall all dependencies of the targets. This forces upgrades
|
|
||||||
or reinstalls of all dependencies without requiring explicit version
|
|
||||||
requirements. This is most useful in combination with the '\--needed' flag,
|
|
||||||
which will induce a deep dependency upgrade without any unnecessary
|
|
||||||
reinstalls.
|
|
||||||
|
|
||||||
|
|
||||||
Query Options[[QO]]
|
Query Options[[QO]]
|
||||||
-------------------
|
-------------------
|
||||||
@@ -269,7 +269,9 @@ Query Options[[QO]]
|
|||||||
*-k \--check*::
|
*-k \--check*::
|
||||||
Check that all files owned by the given package(s) are present on the
|
Check that all files owned by the given package(s) are present on the
|
||||||
system. If packages are not specified or filter flags are not provided,
|
system. If packages are not specified or filter flags are not provided,
|
||||||
check all installed packages.
|
check all installed packages. Specifying this option twice will perform
|
||||||
|
more detailed file checking (including permissions, file sizes and
|
||||||
|
modification times) for packages that contain the needed mtree file.
|
||||||
|
|
||||||
*-l, \--list*::
|
*-l, \--list*::
|
||||||
List all files owned by a given package. Multiple packages can be
|
List all files owned by a given package. Multiple packages can be
|
||||||
@@ -280,6 +282,10 @@ 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'.
|
||||||
|
|
||||||
|
*-n, \--native*::
|
||||||
|
Restrict or filter output to packages that are found in the sync
|
||||||
|
database(s). This is the inverse filter of '\--foreign'.
|
||||||
|
|
||||||
*-o, \--owns* <file>::
|
*-o, \--owns* <file>::
|
||||||
Search for packages that own the specified file(s). The path can be
|
Search for packages that own the specified file(s). The path can be
|
||||||
relative or absolute and one or more files can be specified.
|
relative or absolute and one or more files can be specified.
|
||||||
@@ -349,7 +355,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.
|
||||||
+
|
+
|
||||||
@@ -408,16 +414,6 @@ system upgrade and install/upgrade the foo package in the same operation.
|
|||||||
will force a refresh of all package lists even if they appear to be up
|
will force a refresh of all package lists even if they appear to be up
|
||||||
to date.
|
to date.
|
||||||
|
|
||||||
*\--needed*::
|
|
||||||
Do not reinstall the targets that are already up to date.
|
|
||||||
|
|
||||||
*\--recursive*::
|
|
||||||
Recursively reinstall all dependencies of the targets. This forces upgrades
|
|
||||||
or reinstalls of all dependencies without requiring explicit version
|
|
||||||
requirements. This is most useful in combination with the '\--needed' flag,
|
|
||||||
which will induce a deep dependency upgrade without any unnecessary
|
|
||||||
reinstalls.
|
|
||||||
|
|
||||||
|
|
||||||
Handling Config Files[[HCF]]
|
Handling Config Files[[HCF]]
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|||||||
@@ -79,31 +79,24 @@ Options
|
|||||||
*NOTE*: this is an absolute path, the root path is not automatically
|
*NOTE*: this is an absolute path, the root path is not automatically
|
||||||
prepended.
|
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 +{localstatedir}/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 ...::
|
||||||
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
|
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
|
||||||
pacman will ask for confirmation before proceeding.
|
pacman will ask for confirmation before proceeding. Shell-style glob
|
||||||
|
patterns are allowed.
|
||||||
|
|
||||||
*IgnorePkg =* package ...::
|
*IgnorePkg =* package ...::
|
||||||
Instructs pacman to ignore any upgrades for this package when performing
|
Instructs pacman to ignore any upgrades for this package when performing
|
||||||
a '\--sysupgrade'.
|
a '\--sysupgrade'. Shell-style glob patterns are allowed.
|
||||||
|
|
||||||
*SyncFirst =* package ...::
|
|
||||||
Instructs pacman to check for newer version of these packages before any
|
|
||||||
sync operation. The user will have the choice to either cancel the current
|
|
||||||
operation and upgrade these packages first or go on with the current
|
|
||||||
operation. This option is typically used with the 'pacman' package.
|
|
||||||
*NOTE*: when a `SyncFirst` transaction takes place, no command line flags
|
|
||||||
(e.g. '\--force') are honored. If this is not ideal, disabling `SyncFirst`
|
|
||||||
and performing a manual sync of the involved packages may be required.
|
|
||||||
|
|
||||||
*IgnoreGroup =* group ...::
|
*IgnoreGroup =* group ...::
|
||||||
Instructs pacman to ignore any upgrades for all packages in this
|
Instructs pacman to ignore any upgrades for all packages in this
|
||||||
group when performing a '\--sysupgrade'.
|
group when performing a '\--sysupgrade'. Shell-style glob patterns are
|
||||||
|
allowed.
|
||||||
|
|
||||||
*Include =* path::
|
*Include =* path::
|
||||||
Include another config file. This file can include repositories or
|
Include another config file. This file can include repositories or
|
||||||
@@ -134,7 +127,8 @@ Options
|
|||||||
a package install/upgrade, and the new files will be installed with a
|
a package install/upgrade, and the new files will be installed with a
|
||||||
'.pacnew' extension.
|
'.pacnew' extension.
|
||||||
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. Shell-style glob patterns
|
||||||
|
are allowed.
|
||||||
|
|
||||||
*NoExtract =* file ...::
|
*NoExtract =* file ...::
|
||||||
All files listed with a `NoExtract` directive will never be extracted from
|
All files listed with a `NoExtract` directive will never be extracted from
|
||||||
@@ -143,7 +137,8 @@ Options
|
|||||||
'index.php', then you would not want the 'index.html' file to be extracted
|
'index.php', then you would not want the 'index.html' file to be extracted
|
||||||
from the 'apache' package.
|
from the 'apache' package.
|
||||||
These files refer to files in the package archive, so do not include the
|
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. Shell-style glob patterns
|
||||||
|
are allowed.
|
||||||
|
|
||||||
*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
|
||||||
@@ -160,13 +155,28 @@ Options
|
|||||||
Set the default signature verification level. For more information, see
|
Set the default signature verification level. For more information, see
|
||||||
<<SC,Package and Database Signature Checking>> below.
|
<<SC,Package and Database Signature Checking>> below.
|
||||||
|
|
||||||
|
*LocalFileSigLevel =* ...::
|
||||||
|
Set the signature verification level for installing packages using the "-U"
|
||||||
|
operation on a local file. Uses the value from SigLevel as the default.
|
||||||
|
|
||||||
|
*RemoteFileSigLevel =* ...::
|
||||||
|
Set the signature verification level for installing packages using the "-U"
|
||||||
|
operation on a remote file URL. Uses the value from SigLevel as the default.
|
||||||
|
|
||||||
*UseSyslog*::
|
*UseSyslog*::
|
||||||
Log action messages through syslog(). This will insert log entries into
|
Log action messages through syslog(). This will insert log entries into
|
||||||
+{localstatedir}/log/messages+ or equivalent.
|
+{localstatedir}/log/messages+ or equivalent.
|
||||||
|
|
||||||
*UseDelta*::
|
*Color*::
|
||||||
Download delta files instead of complete packages if possible. Requires
|
Automatically enable colors only when pacman's output is on a tty.
|
||||||
the xdelta3 program to be installed.
|
|
||||||
|
*UseDelta* [= ratio]::
|
||||||
|
Download delta files instead of complete packages if possible. Requires
|
||||||
|
the `xdelta3` program to be installed. If a ratio is specified (e.g.,
|
||||||
|
`0.5`), then it is used as a cutoff for determining whether to use deltas.
|
||||||
|
Allowed values are between `0.0` and `2.0`; sensible values are between
|
||||||
|
`0.2` and `0.9`. Using a value above `1.0` is not recommended. The
|
||||||
|
default is `0.7` if left unspecified.
|
||||||
|
|
||||||
*TotalDownload*::
|
*TotalDownload*::
|
||||||
When downloading, display the amount downloaded, download rate, ETA,
|
When downloading, display the amount downloaded, download rate, ETA,
|
||||||
@@ -227,8 +237,8 @@ even be used for different architectures.
|
|||||||
Set the signature verification level for this repository. For more
|
Set the signature verification level for this repository. For more
|
||||||
information, see <<SC,Package and Database Signature Checking>> below.
|
information, see <<SC,Package and Database Signature Checking>> below.
|
||||||
|
|
||||||
Package and Database Signature Checking
|
Package and Database Signature Checking[[SC]]
|
||||||
---------------------------------------
|
---------------------------------------------
|
||||||
The 'SigLevel' directive is valid in both the `[options]` and repository
|
The 'SigLevel' directive is valid in both the `[options]` and repository
|
||||||
sections. If used in `[options]`, it sets a default value for any repository
|
sections. If used in `[options]`, it sets a default value for any repository
|
||||||
that does not provide the setting.
|
that does not provide the setting.
|
||||||
|
|||||||
66
doc/pactree.8.txt
Normal file
66
doc/pactree.8.txt
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/////
|
||||||
|
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
|
||||||
|
/////
|
||||||
|
pactree(8)
|
||||||
|
=========
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
pactree - package dependency tree viewer
|
||||||
|
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
'pactree' [options] package
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
Pactree produces a dependency tree for a package.
|
||||||
|
|
||||||
|
By default a tree like output is generated, but with the -g option a graphviz
|
||||||
|
description is generated.
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
*-a, \--ascii*::
|
||||||
|
Use ascii characters for tree formatting. By default, pactree will use unicode
|
||||||
|
line drawing characters if it is able to detect that the locale supports them.
|
||||||
|
|
||||||
|
*-b, \--dbpath*::
|
||||||
|
Specify an alternative database location.
|
||||||
|
|
||||||
|
*-c, \--color*::
|
||||||
|
Colorize output.
|
||||||
|
|
||||||
|
*-d, \--depth <num>*::
|
||||||
|
Limits the number of levels of dependency to show. A zero means
|
||||||
|
show the named package only, one shows the packages that are directly
|
||||||
|
required.
|
||||||
|
|
||||||
|
*-g, \--graph*::
|
||||||
|
Generate graphviz description. If this option is given, the -c and -l
|
||||||
|
options are ignored.
|
||||||
|
|
||||||
|
*-h, \--help*::
|
||||||
|
Output syntax and command line options.
|
||||||
|
|
||||||
|
*-l, \--linear*::
|
||||||
|
Prints package names at the start of each line, one per line.
|
||||||
|
|
||||||
|
*-r, \--reverse*::
|
||||||
|
Show packages that depend on the named package.
|
||||||
|
|
||||||
|
*-s, \--sync*::
|
||||||
|
Read package data from sync databases instead of local database.
|
||||||
|
|
||||||
|
*-u, \--unique*::
|
||||||
|
List dependent packages once. Implies --linear.
|
||||||
|
|
||||||
|
*\--config <file>*::
|
||||||
|
Specify an alternate pacman configuration file.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
linkman:pacman[8], linkman:pacman.conf[5], linkman:makepkg[8]
|
||||||
|
|
||||||
|
include::footer.txt[]
|
||||||
@@ -11,7 +11,7 @@ pkgdelta - package delta generation utility
|
|||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
'pkgdelta' [-q] <package1> <package2>
|
'pkgdelta' [options] <package1> <package2>
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@@ -27,6 +27,17 @@ significantly.
|
|||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
*--max-delta-size <ratio>*::
|
||||||
|
Only create delta files if the delta is smaller than ratio * package_size.
|
||||||
|
Possible values: 0.0 to 2.0.
|
||||||
|
Recommended values: 0.2 to 0.9.
|
||||||
|
Default value: 0.7
|
||||||
|
|
||||||
|
*--min-pkg-size <size>*::
|
||||||
|
Minimal size of the package file in bytes to be considered for delta creation.
|
||||||
|
Default value: 1048576 bytes = 1MiB. This may be any absolute size in bytes, or
|
||||||
|
a human readable value such as `4 MiB` or `3.5MB`.
|
||||||
|
|
||||||
*-q, \--quiet*::
|
*-q, \--quiet*::
|
||||||
Be quiet. Do not output anything but warnings and errors.
|
Be quiet. Do not output anything but warnings and errors.
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ Common Options
|
|||||||
If the signature is invalid, an error is produced and the update does not
|
If the signature is invalid, an error is produced and the update does not
|
||||||
proceed.
|
proceed.
|
||||||
|
|
||||||
|
*\--nocolor*::
|
||||||
|
Remove color from repo-add and repo-remove output.
|
||||||
|
|
||||||
repo-add Options
|
repo-add Options
|
||||||
----------------
|
----------------
|
||||||
*-d, \--delta*::
|
*-d, \--delta*::
|
||||||
@@ -68,6 +71,10 @@ repo-add Options
|
|||||||
specified packages. This is useful for creating databases listing all files
|
specified packages. This is useful for creating databases listing all files
|
||||||
in a given sync repository for tools that may use this information.
|
in a given sync repository for tools that may use this information.
|
||||||
|
|
||||||
|
*-n, \--new*::
|
||||||
|
Only add packages that are not already in the database. Warnings will be
|
||||||
|
printed upon detection of existing packages, but they will not be re-added.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ Patches need to be submitted in GIT format and are best if they are against the
|
|||||||
latest version of the code. There are several helpful tutorials for getting
|
latest version of the code. There are several helpful tutorials for getting
|
||||||
started with GIT if you have not worked with it before.
|
started with GIT if you have not worked with it before.
|
||||||
|
|
||||||
* http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
|
* https://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
|
||||||
* http://wiki.archlinux.org/index.php/Super_Quick_Git_Guide
|
* https://wiki.archlinux.org/index.php/Super_Quick_Git_Guide
|
||||||
|
|
||||||
The pacman code can be fetched using the following command:
|
The pacman code can be fetched using the following command:
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ http://www.transifex.net/projects/p/archlinux-pacman/[pacman project page].
|
|||||||
NOTE: This may be old information due to our switch to Transifex, but the
|
NOTE: This may be old information due to our switch to Transifex, but the
|
||||||
gettext website is a very useful guide to read before embarking on translation
|
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:
|
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
|
https://www.gnu.org/software/gettext/manual/html_node/gettext.html[]. In
|
||||||
addition, this site presents a small tutorial that I found useful:
|
addition, this site presents a small tutorial that I found useful:
|
||||||
http://oriya.sarovar.org/docs/gettext/[].
|
http://oriya.sarovar.org/docs/gettext/[].
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ source, please contact the pacman-dev mailing list at
|
|||||||
mailto:pacman-dev@archlinux.org[].
|
mailto:pacman-dev@archlinux.org[].
|
||||||
|
|
||||||
Some community efforts have been made to translate manpages, and these can be
|
Some community efforts have been made to translate manpages, and these can be
|
||||||
found in the link:http://aur.archlinux.org[AUR] (Arch User Repository). Please
|
found in the link:https://aur.archlinux.org[AUR] (Arch User Repository). Please
|
||||||
check there first before undergoing a translation effort to ensure you are not
|
check there first before undergoing a translation effort to ensure you are not
|
||||||
duplicating efforts.
|
duplicating efforts.
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ vercmp(8)
|
|||||||
|
|
||||||
Name
|
Name
|
||||||
----
|
----
|
||||||
vercmp - version comparsion utility
|
vercmp - version comparison utility
|
||||||
|
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
@@ -23,10 +23,10 @@ numbers. It outputs values as follows:
|
|||||||
* = 0 : if ver1 == ver2
|
* = 0 : if ver1 == ver2
|
||||||
* > 0 : if ver1 > ver2
|
* > 0 : if ver1 > ver2
|
||||||
|
|
||||||
Version comparsion operates as follows:
|
Version comparison 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
|
||||||
|
|
||||||
@@ -35,6 +35,11 @@ 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
|
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
|
||||||
greater than `1:3.6-1`.
|
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
|
Options
|
||||||
-------
|
-------
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ EXTRA_DIST = makepkg.conf.in pacman.conf.in
|
|||||||
# Files that should be removed, but which Automake does not know.
|
# Files that should be removed, but which Automake does not know.
|
||||||
MOSTLYCLEANFILES = $(dist_sysconf_DATA)
|
MOSTLYCLEANFILES = $(dist_sysconf_DATA)
|
||||||
|
|
||||||
#### Taken from the autoconf scripts Makefile.am ####
|
SED_PROCESS = \
|
||||||
edit = sed \
|
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
|
||||||
|
$(SED) \
|
||||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||||
-e 's|@prefix[@]|$(prefix)|g' \
|
-e 's|@prefix[@]|$(prefix)|g' \
|
||||||
@@ -19,15 +20,10 @@ 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|@ROOTDIR[@]|$(ROOTDIR)|g'
|
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g' \
|
||||||
|
< $< > $@
|
||||||
|
|
||||||
$(dist_sysconf_DATA): Makefile
|
%.conf: %.conf.in Makefile
|
||||||
@echo ' ' GEN $@;
|
$(SED_PROCESS)
|
||||||
@rm -f $@ $@.tmp
|
|
||||||
@$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
|
|
||||||
@mv $@.tmp $@
|
|
||||||
|
|
||||||
makepkg.conf: $(srcdir)/makepkg.conf.in
|
|
||||||
pacman.conf: $(srcdir)/pacman.conf.in
|
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 noet:
|
# vim:set ts=2 sw=2 noet:
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
#
|
#
|
||||||
#-- 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/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
DLAGENTS=('ftp::/usr/bin/curl -qfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
'http::/usr/bin/curl -qb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
'https::/usr/bin/curl -qb "" -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:
|
||||||
@@ -27,11 +27,15 @@ CARCH="@CARCH@"
|
|||||||
CHOST="@CHOST@"
|
CHOST="@CHOST@"
|
||||||
|
|
||||||
#-- Compiler and Linker Flags
|
#-- Compiler and Linker Flags
|
||||||
|
#CPPFLAGS=""
|
||||||
#CFLAGS="-O2 -pipe"
|
#CFLAGS="-O2 -pipe"
|
||||||
#CXXFLAGS="-O2 -pipe"
|
#CXXFLAGS="-O2 -pipe"
|
||||||
#LDFLAGS=""
|
#LDFLAGS=""
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
|
#-- Debugging flags
|
||||||
|
#DEBUG_CFLAGS="-g"
|
||||||
|
#DEBUG_CXXFLAGS="-g"
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# BUILD ENVIRONMENT
|
# BUILD ENVIRONMENT
|
||||||
@@ -61,18 +65,20 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge !upx)
|
# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
#-- docs: Save doc 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
|
#-- staticlibs: Leave static library (.a) files in packages
|
||||||
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
#-- emptydirs: Leave empty directories in packages
|
||||||
#-- purge: Remove files specified by PURGE_TARGETS
|
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||||
#-- upx: Compress binary executable files using UPX
|
#-- purge: Remove files specified by PURGE_TARGETS
|
||||||
|
#-- upx: Compress binary executable files using UPX
|
||||||
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool emptydirs zipman purge !upx)
|
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
||||||
|
|
||||||
#-- 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)
|
||||||
@@ -101,11 +107,24 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
|||||||
#SRCDEST=/home/sources
|
#SRCDEST=/home/sources
|
||||||
#-- Source packages: specify a fixed directory where all src packages will be placed
|
#-- Source packages: specify a fixed directory where all src packages will be placed
|
||||||
#SRCPKGDEST=/home/srcpackages
|
#SRCPKGDEST=/home/srcpackages
|
||||||
|
#-- Log files: specify a fixed directory where all log files will be placed
|
||||||
|
#LOGDEST=/home/makepkglogs
|
||||||
#-- 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
|
#-- Specify a key to use for package signing
|
||||||
#GPGKEY=""
|
#GPGKEY=""
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# COMPRESSION DEFAULTS
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
COMPRESSGZ=(gzip -c -f -n)
|
||||||
|
COMPRESSBZ2=(bzip2 -c -f)
|
||||||
|
COMPRESSXZ=(xz -c -z -)
|
||||||
|
COMPRESSLRZ=(lrzip -q)
|
||||||
|
COMPRESSLZO=(lzop -q)
|
||||||
|
COMPRESSZ=(compress -c -f)
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# EXTENSION DEFAULTS
|
# EXTENSION DEFAULTS
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|||||||
@@ -15,11 +15,10 @@
|
|||||||
#LogFile = @localstatedir@/log/pacman.log
|
#LogFile = @localstatedir@/log/pacman.log
|
||||||
#GPGDir = @sysconfdir@/pacman.d/gnupg/
|
#GPGDir = @sysconfdir@/pacman.d/gnupg/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
# If upgrades are available for these packages they will be asked for first
|
|
||||||
SyncFirst = pacman
|
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
#CleanMethod = KeepInstalled
|
#CleanMethod = KeepInstalled
|
||||||
|
#UseDelta = 0.7
|
||||||
Architecture = auto
|
Architecture = auto
|
||||||
|
|
||||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||||
@@ -29,13 +28,18 @@ Architecture = auto
|
|||||||
#NoUpgrade =
|
#NoUpgrade =
|
||||||
#NoExtract =
|
#NoExtract =
|
||||||
|
|
||||||
# Misc options (all disabled by default)
|
# Misc options
|
||||||
#UseSyslog
|
#UseSyslog
|
||||||
#UseDelta
|
#Color
|
||||||
#TotalDownload
|
#TotalDownload
|
||||||
#CheckSpace
|
CheckSpace
|
||||||
#VerbosePkgLists
|
#VerbosePkgLists
|
||||||
|
|
||||||
|
# PGP signature checking
|
||||||
|
#SigLevel = Optional
|
||||||
|
#LocalFileSigLevel = Optional
|
||||||
|
#RemoteFileSigLevel = Optional
|
||||||
|
|
||||||
#
|
#
|
||||||
# REPOSITORIES
|
# REPOSITORIES
|
||||||
# - can be defined here or included from another file
|
# - can be defined here or included from another file
|
||||||
@@ -60,6 +64,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
|
||||||
@@ -67,5 +72,5 @@ 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
|
||||||
|
|
||||||
|
|||||||
1
lib/libalpm/.gitignore
vendored
1
lib/libalpm/.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
.libs
|
.libs
|
||||||
*.lo
|
*.lo
|
||||||
*.la
|
*.la
|
||||||
|
libalpm.pc
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ SUBDIRS = po
|
|||||||
lib_LTLIBRARIES = libalpm.la
|
lib_LTLIBRARIES = libalpm.la
|
||||||
include_HEADERS = alpm_list.h alpm.h
|
include_HEADERS = alpm_list.h alpm.h
|
||||||
|
|
||||||
DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
|
AM_CPPFLAGS = \
|
||||||
|
-imacros $(top_builddir)/config.h \
|
||||||
|
-DLOCALEDIR=\"@localedir@\"
|
||||||
|
|
||||||
AM_CFLAGS = -pedantic -D_GNU_SOURCE
|
AM_CFLAGS = -pedantic -D_GNU_SOURCE $(WARNING_CFLAGS)
|
||||||
|
|
||||||
if ENABLE_VISIBILITY_CC
|
if ENABLE_VISIBILITY_CC
|
||||||
if DARWIN
|
if DARWIN
|
||||||
@@ -20,6 +22,9 @@ if ENABLE_GNU89_INLINE_CC
|
|||||||
AM_CFLAGS += -fgnu89-inline
|
AM_CFLAGS += -fgnu89-inline
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = libalpm.pc
|
||||||
|
|
||||||
libalpm_la_SOURCES = \
|
libalpm_la_SOURCES = \
|
||||||
add.h add.c \
|
add.h add.c \
|
||||||
alpm.h alpm.c \
|
alpm.h alpm.c \
|
||||||
@@ -35,9 +40,11 @@ libalpm_la_SOURCES = \
|
|||||||
diskspace.h diskspace.c \
|
diskspace.h diskspace.c \
|
||||||
dload.h dload.c \
|
dload.h dload.c \
|
||||||
error.c \
|
error.c \
|
||||||
|
filelist.h filelist.c \
|
||||||
graph.h graph.c \
|
graph.h graph.c \
|
||||||
group.h group.c \
|
group.h group.c \
|
||||||
handle.h handle.c \
|
handle.h handle.c \
|
||||||
|
libarchive-compat.h \
|
||||||
log.h log.c \
|
log.h log.c \
|
||||||
package.h package.c \
|
package.h package.c \
|
||||||
pkghash.h pkghash.c \
|
pkghash.h pkghash.c \
|
||||||
@@ -47,11 +54,13 @@ libalpm_la_SOURCES = \
|
|||||||
sync.h sync.c \
|
sync.h sync.c \
|
||||||
trans.h trans.c \
|
trans.h trans.c \
|
||||||
util.h util.c \
|
util.h util.c \
|
||||||
|
util-common.h util-common.c \
|
||||||
version.c
|
version.c
|
||||||
|
|
||||||
if !HAVE_LIBSSL
|
if !HAVE_LIBSSL
|
||||||
libalpm_la_SOURCES += \
|
libalpm_la_SOURCES += \
|
||||||
md5.h md5.c
|
md5.h md5.c \
|
||||||
|
sha2.h sha2.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_LIBGPGME
|
if HAVE_LIBGPGME
|
||||||
@@ -59,7 +68,20 @@ libalpm_la_SOURCES += \
|
|||||||
base64.h base64.c
|
base64.h base64.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@
|
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
|
||||||
libalpm_la_LIBADD = $(LTLIBINTL)
|
|
||||||
|
libalpm_la_CFLAGS = \
|
||||||
|
$(AM_CFLAGS) \
|
||||||
|
$(GPGME_CFLAGS) \
|
||||||
|
$(LIBARCHIVE_CFLAGS) \
|
||||||
|
$(LIBCURL_CFLAGS) \
|
||||||
|
$(LIBSSL_CFLAGS)
|
||||||
|
|
||||||
|
libalpm_la_LIBADD = \
|
||||||
|
$(LTLIBINTL) \
|
||||||
|
$(GPGME_LIBS) \
|
||||||
|
$(LIBARCHIVE_LIBS) \
|
||||||
|
$(LIBCURL_LIBS) \
|
||||||
|
$(LIBSSL_LIBS)
|
||||||
|
|
||||||
# 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-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,18 +18,15 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.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>
|
||||||
#include <inttypes.h> /* int64_t */
|
#include <stdint.h> /* int64_t */
|
||||||
#include <stdint.h> /* intmax_t */
|
|
||||||
|
|
||||||
/* libarchive */
|
/* libarchive */
|
||||||
#include <archive.h>
|
#include <archive.h>
|
||||||
@@ -40,6 +37,7 @@
|
|||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -70,14 +68,14 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
|||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);
|
||||||
|
|
||||||
if(_alpm_pkg_find(trans->add, pkgname)) {
|
if(alpm_pkg_find(trans->add, pkgname)) {
|
||||||
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
|
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname);
|
local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname);
|
||||||
if(local) {
|
if(local) {
|
||||||
const char *localpkgname = alpm_pkg_get_name(local);
|
const char *localpkgname = local->name;
|
||||||
const char *localpkgver = alpm_pkg_get_version(local);
|
const char *localpkgver = local->version;
|
||||||
int cmp = _alpm_pkg_compare_versions(pkg, local);
|
int cmp = _alpm_pkg_compare_versions(pkg, local);
|
||||||
|
|
||||||
if(cmp == 0) {
|
if(cmp == 0) {
|
||||||
@@ -124,13 +122,26 @@ static int perform_extraction(alpm_handle_t *handle, struct archive *archive,
|
|||||||
} else if(ret != ARCHIVE_OK) {
|
} else if(ret != ARCHIVE_OK) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not extract %s (%s)\n"),
|
||||||
origname, archive_error_string(archive));
|
origname, archive_error_string(archive));
|
||||||
alpm_logaction(handle, "error: could not extract %s (%s)\n",
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"error: could not extract %s (%s)\n",
|
||||||
origname, archive_error_string(archive));
|
origname, archive_error_string(archive));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int try_rename(alpm_handle_t *handle, const char *src, const char *dest)
|
||||||
|
{
|
||||||
|
if(rename(src, dest)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
|
src, dest, strerror(errno));
|
||||||
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"error: could not rename %s to %s (%s)\n", src, dest, strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
||||||
struct archive_entry *entry, alpm_pkg_t *newpkg, alpm_pkg_t *oldpkg)
|
struct archive_entry *entry, alpm_pkg_t *newpkg, alpm_pkg_t *oldpkg)
|
||||||
{
|
{
|
||||||
@@ -145,8 +156,6 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
entryname = archive_entry_pathname(entry);
|
entryname = archive_entry_pathname(entry);
|
||||||
entrymode = archive_entry_mode(entry);
|
entrymode = archive_entry_mode(entry);
|
||||||
|
|
||||||
memset(filename, 0, PATH_MAX); /* just to be sure */
|
|
||||||
|
|
||||||
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",
|
||||||
@@ -157,6 +166,11 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
snprintf(filename, PATH_MAX, "%s%s-%s/changelog",
|
snprintf(filename, PATH_MAX, "%s%s-%s/changelog",
|
||||||
_alpm_db_path(handle->db_local), 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, ".MTREE") == 0) {
|
||||||
|
/* the mtree file goes inside the db */
|
||||||
|
snprintf(filename, PATH_MAX, "%s%s-%s/mtree",
|
||||||
|
_alpm_db_path(handle->db_local), newpkg->name, newpkg->version);
|
||||||
|
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) */
|
||||||
@@ -169,11 +183,12 @@ static int extract_single_file(alpm_handle_t *handle, 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(handle->noextract, entryname, _alpm_fnmatch)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoExtract, skipping extraction\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoExtract,"
|
||||||
entryname);
|
" skipping extraction of %s\n",
|
||||||
alpm_logaction(handle, "note: %s is in NoExtract, skipping extraction\n",
|
entryname, filename);
|
||||||
entryname);
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"note: %s is in NoExtract, skipping extraction\n", entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -210,20 +225,21 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
/* 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(handle, ALPM_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"), filename, lsbuf.st_mode & mask,
|
||||||
entrymode & mask);
|
entrymode & mask);
|
||||||
alpm_logaction(handle, "warning: directory permissions differ on %s\n"
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
"filesystem: %o package: %o\n", entryname, lsbuf.st_mode & mask,
|
"warning: directory permissions differ on %s\n"
|
||||||
|
"filesystem: %o package: %o\n", filename, lsbuf.st_mode & mask,
|
||||||
entrymode & mask);
|
entrymode & mask);
|
||||||
}
|
}
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
|
||||||
entryname);
|
filename);
|
||||||
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(handle, ALPM_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);
|
filename);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -232,24 +248,24 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
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(handle, ALPM_LOG_DEBUG, "extract: skipping symlink overwrite of %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping symlink overwrite of %s\n",
|
||||||
entryname);
|
filename);
|
||||||
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(handle, ALPM_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);
|
filename);
|
||||||
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(handle, ALPM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
|
||||||
entryname);
|
filename);
|
||||||
} else if(S_ISREG(entrymode)) {
|
} else if(S_ISREG(entrymode)) {
|
||||||
/* case 4,7: */
|
/* case 4,7: */
|
||||||
/* if file is in NoUpgrade, don't touch it */
|
/* if file is in NoUpgrade, don't touch it */
|
||||||
if(alpm_list_find_str(handle->noupgrade, entryname)) {
|
if(alpm_list_find(handle->noupgrade, entryname, _alpm_fnmatch)) {
|
||||||
notouch = 1;
|
notouch = 1;
|
||||||
} else {
|
} else {
|
||||||
alpm_backup_t *backup;
|
alpm_backup_t *backup;
|
||||||
@@ -281,23 +297,24 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
STRDUP(entryname_orig, entryname, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
STRDUP(entryname_orig, entryname, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
|
|
||||||
if(needbackup) {
|
if(needbackup) {
|
||||||
char checkfile[PATH_MAX];
|
char *checkfile;
|
||||||
char *hash_local = NULL, *hash_pkg = NULL;
|
char *hash_local = NULL, *hash_pkg = NULL;
|
||||||
int ret;
|
size_t len;
|
||||||
|
|
||||||
snprintf(checkfile, PATH_MAX, "%s.paccheck", filename);
|
len = strlen(filename) + 10;
|
||||||
|
MALLOC(checkfile, len,
|
||||||
|
errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
|
||||||
|
snprintf(checkfile, len, "%s.paccheck", filename);
|
||||||
|
|
||||||
ret = perform_extraction(handle, archive, entry, checkfile, entryname_orig);
|
if(perform_extraction(handle, archive, entry, checkfile, entryname_orig)) {
|
||||||
if(ret == 1) {
|
errors++;
|
||||||
/* error */
|
goto needbackup_cleanup;
|
||||||
FREE(entryname_orig);
|
|
||||||
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);
|
||||||
|
|
||||||
/* update the md5 hash in newpkg's backup (it will be the new orginal) */
|
/* update the md5 hash in newpkg's backup (it will be the new original) */
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) {
|
for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) {
|
||||||
alpm_backup_t *backup = i->data;
|
alpm_backup_t *backup = i->data;
|
||||||
@@ -319,29 +336,27 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
if(hash_local && hash_pkg && 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;
|
||||||
snprintf(newpath, PATH_MAX, "%s.pacorig", filename);
|
size_t newlen = strlen(filename) + 9;
|
||||||
|
MALLOC(newpath, newlen,
|
||||||
|
errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
|
||||||
|
snprintf(newpath, newlen, "%s.pacorig", filename);
|
||||||
|
|
||||||
/* move the existing file to the "pacorig" */
|
/* move the existing file to the "pacorig" */
|
||||||
if(rename(filename, newpath)) {
|
if(try_rename(handle, filename, newpath)) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
errors++;
|
||||||
filename, newpath, strerror(errno));
|
|
||||||
alpm_logaction(handle, "error: could not rename %s to %s (%s)\n",
|
|
||||||
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(try_rename(handle, checkfile, filename)) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
|
||||||
checkfile, filename, strerror(errno));
|
|
||||||
alpm_logaction(handle, "error: could not rename %s to %s (%s)\n",
|
|
||||||
checkfile, filename, strerror(errno));
|
|
||||||
errors++;
|
errors++;
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
|
||||||
alpm_logaction(handle, "warning: %s saved as %s\n", filename, newpath);
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"warning: %s saved as %s\n", filename, newpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(newpath);
|
||||||
} else {
|
} else {
|
||||||
/* local file is identical to pkg one, so just remove pkg one */
|
/* local file is identical to pkg one, so just remove pkg one */
|
||||||
unlink(checkfile);
|
unlink(checkfile);
|
||||||
@@ -355,11 +370,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
_alpm_log(handle, ALPM_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(try_rename(handle, checkfile, filename)) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
|
||||||
checkfile, filename, strerror(errno));
|
|
||||||
alpm_logaction(handle, "error: could not rename %s to %s (%s)\n",
|
|
||||||
checkfile, filename, strerror(errno));
|
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -381,35 +392,37 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
_alpm_log(handle, ALPM_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;
|
||||||
|
size_t newlen = strlen(filename) + 8;
|
||||||
_alpm_log(handle, ALPM_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);
|
MALLOC(newpath, newlen,
|
||||||
if(rename(checkfile, newpath)) {
|
errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not install %s as %s (%s)\n"),
|
snprintf(newpath, newlen, "%s.pacnew", filename);
|
||||||
filename, newpath, strerror(errno));
|
if(try_rename(handle, checkfile, newpath)) {
|
||||||
alpm_logaction(handle, "error: could not install %s as %s (%s)\n",
|
errors++;
|
||||||
filename, newpath, strerror(errno));
|
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("%s installed as %s\n"),
|
_alpm_log(handle, ALPM_LOG_WARNING, _("%s installed as %s\n"),
|
||||||
filename, newpath);
|
filename, newpath);
|
||||||
alpm_logaction(handle, "warning: %s installed as %s\n",
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
filename, newpath);
|
"warning: %s installed as %s\n", filename, newpath);
|
||||||
}
|
}
|
||||||
|
free(newpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(hash_local);
|
needbackup_cleanup:
|
||||||
FREE(hash_pkg);
|
free(checkfile);
|
||||||
|
free(hash_local);
|
||||||
|
free(hash_pkg);
|
||||||
} else {
|
} else {
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* we didn't need a backup */
|
/* we didn't need a backup */
|
||||||
if(notouch) {
|
if(notouch) {
|
||||||
/* change the path to a .pacnew extension */
|
/* change the path to a .pacnew extension */
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename);
|
||||||
_alpm_log(handle, ALPM_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(handle, "warning: extracting %s as %s.pacnew\n", filename, filename);
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"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(handle, ALPM_LOG_DEBUG, "extracting %s\n", filename);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extracting %s\n", filename);
|
||||||
@@ -422,11 +435,11 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
unlink(filename);
|
unlink(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = perform_extraction(handle, archive, entry, filename, entryname_orig);
|
if(perform_extraction(handle, archive, entry, filename, entryname_orig)) {
|
||||||
if(ret == 1) {
|
|
||||||
/* error */
|
/* error */
|
||||||
FREE(entryname_orig);
|
free(entryname_orig);
|
||||||
return 1;
|
errors++;
|
||||||
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate an hash if this is in newpkg's backup */
|
/* calculate an hash if this is in newpkg's backup */
|
||||||
@@ -443,7 +456,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
|||||||
backup->hash = newhash;
|
backup->hash = newhash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(entryname_orig);
|
free(entryname_orig);
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,50 +464,62 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
size_t pkg_current, size_t pkg_count)
|
size_t pkg_current, size_t pkg_count)
|
||||||
{
|
{
|
||||||
int i, ret = 0, errors = 0;
|
int i, ret = 0, errors = 0;
|
||||||
char scriptlet[PATH_MAX];
|
|
||||||
int is_upgrade = 0;
|
int is_upgrade = 0;
|
||||||
alpm_pkg_t *oldpkg = NULL;
|
alpm_pkg_t *oldpkg = NULL;
|
||||||
alpm_db_t *db = handle->db_local;
|
alpm_db_t *db = handle->db_local;
|
||||||
alpm_trans_t *trans = handle->trans;
|
alpm_trans_t *trans = handle->trans;
|
||||||
|
alpm_progress_t event = ALPM_PROGRESS_ADD_START;
|
||||||
|
alpm_event_t done = ALPM_EVENT_ADD_DONE, start = ALPM_EVENT_ADD_START;
|
||||||
|
const char *log_msg = "adding";
|
||||||
|
const char *pkgfile;
|
||||||
|
|
||||||
ASSERT(trans != NULL, return -1);
|
ASSERT(trans != NULL, return -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 */
|
||||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
|
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
|
||||||
if(local) {
|
if(local) {
|
||||||
|
int cmp = _alpm_pkg_compare_versions(newpkg, local);
|
||||||
|
if(cmp < 0) {
|
||||||
|
log_msg = "downgrading";
|
||||||
|
event = ALPM_PROGRESS_DOWNGRADE_START;
|
||||||
|
start = ALPM_EVENT_DOWNGRADE_START;
|
||||||
|
done = ALPM_EVENT_DOWNGRADE_DONE;
|
||||||
|
} else if(cmp == 0) {
|
||||||
|
log_msg = "reinstalling";
|
||||||
|
event = ALPM_PROGRESS_REINSTALL_START;
|
||||||
|
start = ALPM_EVENT_REINSTALL_START;
|
||||||
|
done = ALPM_EVENT_REINSTALL_DONE;
|
||||||
|
} else {
|
||||||
|
log_msg = "upgrading";
|
||||||
|
event = ALPM_PROGRESS_UPGRADE_START;
|
||||||
|
start = ALPM_EVENT_UPGRADE_START;
|
||||||
|
done = ALPM_EVENT_UPGRADE_DONE;
|
||||||
|
}
|
||||||
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) {
|
||||||
|
ret = -1;
|
||||||
EVENT(trans, ALPM_TRANS_EVT_UPGRADE_START, newpkg, oldpkg);
|
goto cleanup;
|
||||||
_alpm_log(handle, ALPM_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, start, newpkg, local);
|
||||||
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
|
|
||||||
_alpm_runscriptlet(handle, newpkg->origin_data.file,
|
|
||||||
"pre_upgrade", newpkg->version, oldpkg->version);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
is_upgrade = 0;
|
|
||||||
|
|
||||||
EVENT(trans, ALPM_TRANS_EVT_ADD_START, newpkg, NULL);
|
pkgfile = newpkg->origin_data.file;
|
||||||
_alpm_log(handle, ALPM_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 & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
|
log_msg, newpkg->name, newpkg->version);
|
||||||
_alpm_runscriptlet(handle, newpkg->origin_data.file,
|
/* pre_install/pre_upgrade scriptlet */
|
||||||
"pre_install", newpkg->version, NULL);
|
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, oldpkg ? oldpkg->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 */
|
||||||
@@ -516,8 +541,9 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
/* 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_local_db_prepare(db, newpkg)) {
|
if(_alpm_local_db_prepare(db, newpkg)) {
|
||||||
alpm_logaction(handle, "error: could not create database entry %s-%s\n",
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
"error: could not create database entry %s-%s\n",
|
||||||
|
newpkg->name, newpkg->version);
|
||||||
handle->pm_errno = ALPM_ERR_DB_WRITE;
|
handle->pm_errno = ALPM_ERR_DB_WRITE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -526,51 +552,36 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
if(!(trans->flags & ALPM_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] = "";
|
struct stat buf;
|
||||||
int restore_cwd = 0;
|
int fd, cwdfd;
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n");
|
||||||
|
|
||||||
if((archive = archive_read_new()) == NULL) {
|
fd = _alpm_open_archive(db->handle, pkgfile, &buf,
|
||||||
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
&archive, ALPM_ERR_PKG_OPEN);
|
||||||
ret = -1;
|
if(fd < 0) {
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
archive_read_support_compression_all(archive);
|
|
||||||
archive_read_support_format_all(archive);
|
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "archive: %s\n", newpkg->origin_data.file);
|
|
||||||
if(archive_read_open_filename(archive, newpkg->origin_data.file,
|
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
|
||||||
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) {
|
OPEN(cwdfd, ".", O_RDONLY);
|
||||||
|
if(cwdfd < 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n"));
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n"));
|
||||||
} else {
|
|
||||||
restore_cwd = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* libarchive requires this for extracting hard links */
|
/* libarchive requires this for extracting hard links */
|
||||||
if(chdir(handle->root) != 0) {
|
if(chdir(handle->root) != 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
|
||||||
handle->root, strerror(errno));
|
handle->root, strerror(errno));
|
||||||
|
_alpm_archive_read_free(archive);
|
||||||
|
CLOSE(fd);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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) {
|
PROGRESS(handle, event, newpkg->name, 0, pkg_count, pkg_current);
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_UPGRADE_START,
|
|
||||||
alpm_pkg_get_name(newpkg), 0, pkg_count, pkg_current);
|
|
||||||
} else {
|
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_ADD_START,
|
|
||||||
alpm_pkg_get_name(newpkg), 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++) {
|
||||||
int percent;
|
int percent;
|
||||||
@@ -579,11 +590,8 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
/* 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 = _alpm_archive_compressed_ftell(archive);
|
||||||
percent = (pos * 100) / newpkg->size;
|
percent = (pos * 100) / newpkg->size;
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "decompression progress: "
|
|
||||||
"%d%% (%"PRId64" / %jd)\n",
|
|
||||||
percent, pos, (intmax_t)newpkg->size);
|
|
||||||
if(percent >= 100) {
|
if(percent >= 100) {
|
||||||
percent = 100;
|
percent = 100;
|
||||||
}
|
}
|
||||||
@@ -591,24 +599,21 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
percent = 0;
|
percent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_upgrade) {
|
PROGRESS(handle, event, newpkg->name, percent, pkg_count, pkg_current);
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_UPGRADE_START,
|
|
||||||
alpm_pkg_get_name(newpkg), percent, pkg_count,
|
|
||||||
pkg_current);
|
|
||||||
} else {
|
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_ADD_START,
|
|
||||||
alpm_pkg_get_name(newpkg), percent, pkg_count,
|
|
||||||
pkg_current);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* extract the next file from the archive */
|
/* extract the next file from the archive */
|
||||||
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
|
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
|
||||||
}
|
}
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
|
CLOSE(fd);
|
||||||
|
|
||||||
/* restore the old cwd if we have it */
|
/* restore the old cwd if we have it */
|
||||||
if(restore_cwd && chdir(cwd) != 0) {
|
if(cwdfd >= 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno));
|
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) {
|
||||||
@@ -616,12 +621,14 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
if(is_upgrade) {
|
if(is_upgrade) {
|
||||||
_alpm_log(handle, ALPM_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(handle, "error: problem occurred while upgrading %s\n",
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"error: problem occurred while upgrading %s\n",
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_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(handle, "error: problem occurred while installing %s\n",
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
|
"error: problem occurred while installing %s\n",
|
||||||
newpkg->name);
|
newpkg->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -635,9 +642,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
|
|
||||||
if(_alpm_local_db_write(db, newpkg, INFRQ_ALL)) {
|
if(_alpm_local_db_write(db, newpkg, INFRQ_ALL)) {
|
||||||
_alpm_log(handle, ALPM_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(handle, "error: could not update database entry %s-%s\n",
|
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
"error: could not update database entry %s-%s\n",
|
||||||
|
newpkg->name, newpkg->version);
|
||||||
handle->pm_errno = ALPM_ERR_DB_WRITE;
|
handle->pm_errno = ALPM_ERR_DB_WRITE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -645,35 +653,23 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||||||
|
|
||||||
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
|
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
|
||||||
_alpm_log(handle, ALPM_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) {
|
PROGRESS(handle, event, newpkg->name, 100, pkg_count, pkg_current);
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_UPGRADE_START,
|
|
||||||
alpm_pkg_get_name(newpkg), 100, pkg_count, pkg_current);
|
|
||||||
} else {
|
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_ADD_START,
|
|
||||||
alpm_pkg_get_name(newpkg), 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 & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
|
&& !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
|
||||||
if(is_upgrade) {
|
char *scriptlet = _alpm_local_db_pkgpath(db, newpkg, "install");
|
||||||
_alpm_runscriptlet(handle, 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);
|
_alpm_runscriptlet(handle, scriptlet, scriptlet_name,
|
||||||
} else {
|
newpkg->version, oldpkg ? oldpkg->version : NULL, 0);
|
||||||
_alpm_runscriptlet(handle, scriptlet, "post_install",
|
free(scriptlet);
|
||||||
alpm_pkg_get_version(newpkg), NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_upgrade) {
|
EVENT(handle, done, newpkg, oldpkg);
|
||||||
EVENT(trans, ALPM_TRANS_EVT_UPGRADE_DONE, newpkg, oldpkg);
|
|
||||||
} else {
|
|
||||||
EVENT(trans, ALPM_TRANS_EVT_ADD_DONE, newpkg, oldpkg);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
_alpm_pkg_free(oldpkg);
|
_alpm_pkg_free(oldpkg);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* add.h
|
* add.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm.c
|
* alpm.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -39,17 +37,18 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Initializes the library. This must be called before any other
|
/** Initializes the library.
|
||||||
* functions are called.
|
* Creates handle, connects to database and creates lockfile.
|
||||||
|
* This must be called before any other functions are called.
|
||||||
* @param root the root path for all filesystem operations
|
* @param root the root path for all filesystem operations
|
||||||
* @param dbpath the absolute path to the libalpm database
|
* @param dbpath the absolute path to the libalpm database
|
||||||
* @param err an optional variable to hold any error return codes
|
* @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
|
* @return a context handle on success, NULL on error, err will be set if provided
|
||||||
*/
|
*/
|
||||||
alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
||||||
enum _alpm_errno_t *err)
|
alpm_errno_t *err)
|
||||||
{
|
{
|
||||||
enum _alpm_errno_t myerr;
|
alpm_errno_t myerr;
|
||||||
const char *lf = "db.lck";
|
const char *lf = "db.lck";
|
||||||
size_t lockfilelen;
|
size_t lockfilelen;
|
||||||
alpm_handle_t *myhandle = _alpm_handle_new();
|
alpm_handle_t *myhandle = _alpm_handle_new();
|
||||||
@@ -78,11 +77,6 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
|||||||
bindtextdomain("libalpm", LOCALEDIR);
|
bindtextdomain("libalpm", LOCALEDIR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
|
||||||
curl_global_init(CURL_GLOBAL_SSL);
|
|
||||||
myhandle->curl = curl_easy_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return myhandle;
|
return myhandle;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@@ -93,10 +87,12 @@ cleanup:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Release the library. This should be the last alpm call you make.
|
/** Release the library.
|
||||||
|
* Disconnects from the database, removes handle and lockfile
|
||||||
|
* This should be the last alpm call you make.
|
||||||
* After this returns, handle should be considered invalid and cannot be reused
|
* After this returns, handle should be considered invalid and cannot be reused
|
||||||
* in any way.
|
* in any way.
|
||||||
* @param handle the context handle
|
* @param myhandle the context handle
|
||||||
* @return 0 on success, -1 on error
|
* @return 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
||||||
@@ -113,7 +109,7 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
|||||||
myhandle->db_local = NULL;
|
myhandle->db_local = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(alpm_db_unregister_all(myhandle) == -1) {
|
if(alpm_unregister_all_syncdbs(myhandle) == -1) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,9 +129,30 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
|||||||
* @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"
|
||||||
|
* */
|
||||||
|
const char SYMEXPORT *alpm_version(void)
|
||||||
|
{
|
||||||
return LIB_VERSION;
|
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: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm.h
|
* alpm.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -27,14 +27,16 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h> /* for off_t */
|
#include <stdint.h> /* int64_t */
|
||||||
#include <time.h> /* for time_t */
|
#include <sys/types.h> /* off_t */
|
||||||
#include <stdarg.h> /* for va_list */
|
#include <stdarg.h> /* va_list */
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
#include <alpm_list.h>
|
#include <alpm_list.h>
|
||||||
|
|
||||||
#define DEPRECATED __attribute__((deprecated))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arch Linux Package Management library
|
* Arch Linux Package Management library
|
||||||
*/
|
*/
|
||||||
@@ -44,15 +46,14 @@ extern "C" {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef int64_t alpm_time_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enumerations
|
* Enumerations
|
||||||
* These ones are used in multiple contexts, so are forward-declared.
|
* These ones are used in multiple contexts, so are forward-declared.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/** Package install reasons. */
|
||||||
* Install reasons.
|
|
||||||
* Why the package was installed.
|
|
||||||
*/
|
|
||||||
typedef enum _alpm_pkgreason_t {
|
typedef enum _alpm_pkgreason_t {
|
||||||
/** Explicitly requested by the user. */
|
/** Explicitly requested by the user. */
|
||||||
ALPM_PKG_REASON_EXPLICIT = 0,
|
ALPM_PKG_REASON_EXPLICIT = 0,
|
||||||
@@ -60,6 +61,22 @@ typedef enum _alpm_pkgreason_t {
|
|||||||
ALPM_PKG_REASON_DEPEND = 1
|
ALPM_PKG_REASON_DEPEND = 1
|
||||||
} alpm_pkgreason_t;
|
} alpm_pkgreason_t;
|
||||||
|
|
||||||
|
/** Location a package object was loaded from. */
|
||||||
|
typedef enum _alpm_pkgfrom_t {
|
||||||
|
ALPM_PKG_FROM_FILE = 1,
|
||||||
|
ALPM_PKG_FROM_LOCALDB,
|
||||||
|
ALPM_PKG_FROM_SYNCDB
|
||||||
|
} alpm_pkgfrom_t;
|
||||||
|
|
||||||
|
/** Method used to validate a package. */
|
||||||
|
typedef enum _alpm_pkgvalidation_t {
|
||||||
|
ALPM_PKG_VALIDATION_UNKNOWN = 0,
|
||||||
|
ALPM_PKG_VALIDATION_NONE = (1 << 0),
|
||||||
|
ALPM_PKG_VALIDATION_MD5SUM = (1 << 1),
|
||||||
|
ALPM_PKG_VALIDATION_SHA256SUM = (1 << 2),
|
||||||
|
ALPM_PKG_VALIDATION_SIGNATURE = (1 << 3)
|
||||||
|
} alpm_pkgvalidation_t;
|
||||||
|
|
||||||
/** Types of version constraints in dependency specs. */
|
/** Types of version constraints in dependency specs. */
|
||||||
typedef enum _alpm_depmod_t {
|
typedef enum _alpm_depmod_t {
|
||||||
/** No version constraint */
|
/** No version constraint */
|
||||||
@@ -86,9 +103,7 @@ typedef enum _alpm_fileconflicttype_t {
|
|||||||
ALPM_FILECONFLICT_FILESYSTEM
|
ALPM_FILECONFLICT_FILESYSTEM
|
||||||
} alpm_fileconflicttype_t;
|
} alpm_fileconflicttype_t;
|
||||||
|
|
||||||
/**
|
/** PGP signature verification options */
|
||||||
* PGP signature verification options
|
|
||||||
*/
|
|
||||||
typedef enum _alpm_siglevel_t {
|
typedef enum _alpm_siglevel_t {
|
||||||
ALPM_SIG_PACKAGE = (1 << 0),
|
ALPM_SIG_PACKAGE = (1 << 0),
|
||||||
ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1),
|
ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1),
|
||||||
@@ -100,23 +115,23 @@ typedef enum _alpm_siglevel_t {
|
|||||||
ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12),
|
ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12),
|
||||||
ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13),
|
ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13),
|
||||||
|
|
||||||
|
ALPM_SIG_PACKAGE_SET = (1 << 27),
|
||||||
|
ALPM_SIG_PACKAGE_TRUST_SET = (1 << 28),
|
||||||
|
|
||||||
ALPM_SIG_USE_DEFAULT = (1 << 31)
|
ALPM_SIG_USE_DEFAULT = (1 << 31)
|
||||||
} alpm_siglevel_t;
|
} alpm_siglevel_t;
|
||||||
|
|
||||||
/**
|
/** PGP signature verification status return codes */
|
||||||
* PGP signature verification status return codes
|
|
||||||
*/
|
|
||||||
typedef enum _alpm_sigstatus_t {
|
typedef enum _alpm_sigstatus_t {
|
||||||
ALPM_SIGSTATUS_VALID,
|
ALPM_SIGSTATUS_VALID,
|
||||||
ALPM_SIGSTATUS_KEY_EXPIRED,
|
ALPM_SIGSTATUS_KEY_EXPIRED,
|
||||||
ALPM_SIGSTATUS_SIG_EXPIRED,
|
ALPM_SIGSTATUS_SIG_EXPIRED,
|
||||||
ALPM_SIGSTATUS_KEY_UNKNOWN,
|
ALPM_SIGSTATUS_KEY_UNKNOWN,
|
||||||
|
ALPM_SIGSTATUS_KEY_DISABLED,
|
||||||
ALPM_SIGSTATUS_INVALID
|
ALPM_SIGSTATUS_INVALID
|
||||||
} alpm_sigstatus_t;
|
} alpm_sigstatus_t;
|
||||||
|
|
||||||
/**
|
/** PGP signature verification status return codes */
|
||||||
* PGP signature verification status return codes
|
|
||||||
*/
|
|
||||||
typedef enum _alpm_sigvalidity_t {
|
typedef enum _alpm_sigvalidity_t {
|
||||||
ALPM_SIGVALIDITY_FULL,
|
ALPM_SIGVALIDITY_FULL,
|
||||||
ALPM_SIGVALIDITY_MARGINAL,
|
ALPM_SIGVALIDITY_MARGINAL,
|
||||||
@@ -137,6 +152,7 @@ typedef struct __alpm_trans_t alpm_trans_t;
|
|||||||
typedef struct _alpm_depend_t {
|
typedef struct _alpm_depend_t {
|
||||||
char *name;
|
char *name;
|
||||||
char *version;
|
char *version;
|
||||||
|
char *desc;
|
||||||
unsigned long name_hash;
|
unsigned long name_hash;
|
||||||
alpm_depmod_t mod;
|
alpm_depmod_t mod;
|
||||||
} alpm_depend_t;
|
} alpm_depend_t;
|
||||||
@@ -145,7 +161,7 @@ typedef struct _alpm_depend_t {
|
|||||||
typedef struct _alpm_depmissing_t {
|
typedef struct _alpm_depmissing_t {
|
||||||
char *target;
|
char *target;
|
||||||
alpm_depend_t *depend;
|
alpm_depend_t *depend;
|
||||||
/* this is used in case of remove dependency error only */
|
/* this is used only in the case of a remove dependency error */
|
||||||
char *causingpkg;
|
char *causingpkg;
|
||||||
} alpm_depmissing_t;
|
} alpm_depmissing_t;
|
||||||
|
|
||||||
@@ -155,7 +171,7 @@ typedef struct _alpm_conflict_t {
|
|||||||
unsigned long package2_hash;
|
unsigned long package2_hash;
|
||||||
char *package1;
|
char *package1;
|
||||||
char *package2;
|
char *package2;
|
||||||
char *reason;
|
alpm_depend_t *reason;
|
||||||
} alpm_conflict_t;
|
} alpm_conflict_t;
|
||||||
|
|
||||||
/** File conflict */
|
/** File conflict */
|
||||||
@@ -201,6 +217,7 @@ typedef struct _alpm_file_t {
|
|||||||
typedef struct _alpm_filelist_t {
|
typedef struct _alpm_filelist_t {
|
||||||
size_t count;
|
size_t count;
|
||||||
alpm_file_t *files;
|
alpm_file_t *files;
|
||||||
|
char **resolved_path;
|
||||||
} alpm_filelist_t;
|
} alpm_filelist_t;
|
||||||
|
|
||||||
/** Local package or package file backup entry */
|
/** Local package or package file backup entry */
|
||||||
@@ -209,23 +226,43 @@ typedef struct _alpm_backup_t {
|
|||||||
char *hash;
|
char *hash;
|
||||||
} alpm_backup_t;
|
} alpm_backup_t;
|
||||||
|
|
||||||
/** Signature result. Contains the number of signatures found and pointers to
|
typedef struct _alpm_pgpkey_t {
|
||||||
* arrays containing key and status info. All contained arrays have size
|
void *data;
|
||||||
* #count.*/
|
char *fingerprint;
|
||||||
|
char *uid;
|
||||||
|
char *name;
|
||||||
|
char *email;
|
||||||
|
alpm_time_t created;
|
||||||
|
alpm_time_t expires;
|
||||||
|
unsigned int length;
|
||||||
|
unsigned int revoked;
|
||||||
|
char pubkey_algo;
|
||||||
|
} alpm_pgpkey_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signature result. Contains the key, status, and validity of a given
|
||||||
|
* signature.
|
||||||
|
*/
|
||||||
typedef struct _alpm_sigresult_t {
|
typedef struct _alpm_sigresult_t {
|
||||||
int count;
|
alpm_pgpkey_t key;
|
||||||
alpm_sigstatus_t *status;
|
alpm_sigstatus_t status;
|
||||||
alpm_sigvalidity_t *validity;
|
alpm_sigvalidity_t validity;
|
||||||
char **uid;
|
|
||||||
} alpm_sigresult_t;
|
} alpm_sigresult_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signature list. Contains the number of signatures found and a pointer to an
|
||||||
|
* array of results. The array is of size count.
|
||||||
|
*/
|
||||||
|
typedef struct _alpm_siglist_t {
|
||||||
|
size_t count;
|
||||||
|
alpm_sigresult_t *results;
|
||||||
|
} alpm_siglist_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Logging facilities
|
* Logging facilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/** Logging Levels */
|
||||||
* Logging Levels
|
|
||||||
*/
|
|
||||||
typedef enum _alpm_loglevel_t {
|
typedef enum _alpm_loglevel_t {
|
||||||
ALPM_LOG_ERROR = 1,
|
ALPM_LOG_ERROR = 1,
|
||||||
ALPM_LOG_WARNING = (1 << 1),
|
ALPM_LOG_WARNING = (1 << 1),
|
||||||
@@ -234,7 +271,165 @@ typedef enum _alpm_loglevel_t {
|
|||||||
} alpm_loglevel_t;
|
} alpm_loglevel_t;
|
||||||
|
|
||||||
typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);
|
typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);
|
||||||
int alpm_logaction(alpm_handle_t *handle, const char *fmt, ...);
|
|
||||||
|
int alpm_logaction(alpm_handle_t *handle, const char *prefix,
|
||||||
|
const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Events.
|
||||||
|
* NULL parameters are passed to in all events unless specified otherwise.
|
||||||
|
*/
|
||||||
|
typedef enum _alpm_event_t {
|
||||||
|
/** Dependencies will be computed for a package. */
|
||||||
|
ALPM_EVENT_CHECKDEPS_START = 1,
|
||||||
|
/** Dependencies were computed for a package. */
|
||||||
|
ALPM_EVENT_CHECKDEPS_DONE,
|
||||||
|
/** File conflicts will be computed for a package. */
|
||||||
|
ALPM_EVENT_FILECONFLICTS_START,
|
||||||
|
/** File conflicts were computed for a package. */
|
||||||
|
ALPM_EVENT_FILECONFLICTS_DONE,
|
||||||
|
/** Dependencies will be resolved for target package. */
|
||||||
|
ALPM_EVENT_RESOLVEDEPS_START,
|
||||||
|
/** Dependencies were resolved for target package. */
|
||||||
|
ALPM_EVENT_RESOLVEDEPS_DONE,
|
||||||
|
/** Inter-conflicts will be checked for target package. */
|
||||||
|
ALPM_EVENT_INTERCONFLICTS_START,
|
||||||
|
/** Inter-conflicts were checked for target package. */
|
||||||
|
ALPM_EVENT_INTERCONFLICTS_DONE,
|
||||||
|
/** Package will be installed.
|
||||||
|
* A pointer to the target package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_ADD_START,
|
||||||
|
/** Package was installed.
|
||||||
|
* A pointer to the new package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_ADD_DONE,
|
||||||
|
/** Package will be removed.
|
||||||
|
* A pointer to the target package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_REMOVE_START,
|
||||||
|
/** Package was removed.
|
||||||
|
* A pointer to the removed package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_REMOVE_DONE,
|
||||||
|
/** Package will be upgraded.
|
||||||
|
* A pointer to the upgraded package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_UPGRADE_START,
|
||||||
|
/** Package was upgraded.
|
||||||
|
* A pointer to the new package, and a pointer to the old package is passed
|
||||||
|
* to the callback, respectively.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_UPGRADE_DONE,
|
||||||
|
/** Package will be downgraded.
|
||||||
|
* A pointer to the downgraded package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_DOWNGRADE_START,
|
||||||
|
/** Package was downgraded.
|
||||||
|
* A pointer to the new package, and a pointer to the old package is passed
|
||||||
|
* to the callback, respectively.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_DOWNGRADE_DONE,
|
||||||
|
/** Package will be reinstalled.
|
||||||
|
* A pointer to the reinstalled package is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_REINSTALL_START,
|
||||||
|
/** Package was reinstalled.
|
||||||
|
* A pointer to the new package, and a pointer to the old package is passed
|
||||||
|
* to the callback, respectively.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_REINSTALL_DONE,
|
||||||
|
/** Target package's integrity will be checked. */
|
||||||
|
ALPM_EVENT_INTEGRITY_START,
|
||||||
|
/** Target package's integrity was checked. */
|
||||||
|
ALPM_EVENT_INTEGRITY_DONE,
|
||||||
|
/** Target package will be loaded. */
|
||||||
|
ALPM_EVENT_LOAD_START,
|
||||||
|
/** Target package is finished loading. */
|
||||||
|
ALPM_EVENT_LOAD_DONE,
|
||||||
|
/** Target delta's integrity will be checked. */
|
||||||
|
ALPM_EVENT_DELTA_INTEGRITY_START,
|
||||||
|
/** Target delta's integrity was checked. */
|
||||||
|
ALPM_EVENT_DELTA_INTEGRITY_DONE,
|
||||||
|
/** Deltas will be applied to packages. */
|
||||||
|
ALPM_EVENT_DELTA_PATCHES_START,
|
||||||
|
/** Deltas were applied to packages. */
|
||||||
|
ALPM_EVENT_DELTA_PATCHES_DONE,
|
||||||
|
/** Delta patch will be applied to target package.
|
||||||
|
* The filename of the package and the filename of the patch is passed to the
|
||||||
|
* callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_DELTA_PATCH_START,
|
||||||
|
/** Delta patch was applied to target package. */
|
||||||
|
ALPM_EVENT_DELTA_PATCH_DONE,
|
||||||
|
/** Delta patch failed to apply to target package. */
|
||||||
|
ALPM_EVENT_DELTA_PATCH_FAILED,
|
||||||
|
/** Scriptlet has printed information.
|
||||||
|
* A line of text is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_SCRIPTLET_INFO,
|
||||||
|
/** Files will be downloaded from a repository.
|
||||||
|
* The repository's tree name is passed to the callback.
|
||||||
|
*/
|
||||||
|
ALPM_EVENT_RETRIEVE_START,
|
||||||
|
/** Disk space usage will be computed for a package */
|
||||||
|
ALPM_EVENT_DISKSPACE_START,
|
||||||
|
/** Disk space usage was computed for a package */
|
||||||
|
ALPM_EVENT_DISKSPACE_DONE,
|
||||||
|
/** An optdepend for another package is being removed
|
||||||
|
* The requiring package and its dependency are passed to the callback */
|
||||||
|
ALPM_EVENT_OPTDEP_REQUIRED,
|
||||||
|
/** A configured repository database is missing */
|
||||||
|
ALPM_EVENT_DATABASE_MISSING,
|
||||||
|
/** Checking keys used to create signatures are in keyring. */
|
||||||
|
ALPM_EVENT_KEYRING_START,
|
||||||
|
/** Keyring checking is finished. */
|
||||||
|
ALPM_EVENT_KEYRING_DONE,
|
||||||
|
/** Downloading missing keys into keyring. */
|
||||||
|
ALPM_EVENT_KEY_DOWNLOAD_START,
|
||||||
|
/** Key downloading is finished. */
|
||||||
|
ALPM_EVENT_KEY_DOWNLOAD_DONE
|
||||||
|
} alpm_event_t;
|
||||||
|
|
||||||
|
/** Event callback */
|
||||||
|
typedef void (*alpm_cb_event)(alpm_event_t, void *, void *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Questions.
|
||||||
|
* Unlike the events or progress enumerations, this enum has bitmask values
|
||||||
|
* so a frontend can use a bitmask map to supply preselected answers to the
|
||||||
|
* different types of questions.
|
||||||
|
*/
|
||||||
|
typedef enum _alpm_question_t {
|
||||||
|
ALPM_QUESTION_INSTALL_IGNOREPKG = 1,
|
||||||
|
ALPM_QUESTION_REPLACE_PKG = (1 << 1),
|
||||||
|
ALPM_QUESTION_CONFLICT_PKG = (1 << 2),
|
||||||
|
ALPM_QUESTION_CORRUPTED_PKG = (1 << 3),
|
||||||
|
ALPM_QUESTION_LOCAL_NEWER = (1 << 4),
|
||||||
|
ALPM_QUESTION_REMOVE_PKGS = (1 << 5),
|
||||||
|
ALPM_QUESTION_SELECT_PROVIDER = (1 << 6),
|
||||||
|
ALPM_QUESTION_IMPORT_KEY = (1 << 7)
|
||||||
|
} alpm_question_t;
|
||||||
|
|
||||||
|
/** Question callback */
|
||||||
|
typedef void (*alpm_cb_question)(alpm_question_t, void *, void *, void *, int *);
|
||||||
|
|
||||||
|
/** Progress */
|
||||||
|
typedef enum _alpm_progress_t {
|
||||||
|
ALPM_PROGRESS_ADD_START,
|
||||||
|
ALPM_PROGRESS_UPGRADE_START,
|
||||||
|
ALPM_PROGRESS_DOWNGRADE_START,
|
||||||
|
ALPM_PROGRESS_REINSTALL_START,
|
||||||
|
ALPM_PROGRESS_REMOVE_START,
|
||||||
|
ALPM_PROGRESS_CONFLICTS_START,
|
||||||
|
ALPM_PROGRESS_DISKSPACE_START,
|
||||||
|
ALPM_PROGRESS_INTEGRITY_START,
|
||||||
|
ALPM_PROGRESS_LOAD_START,
|
||||||
|
ALPM_PROGRESS_KEYRING_START
|
||||||
|
} alpm_progress_t;
|
||||||
|
|
||||||
|
/** Progress callback */
|
||||||
|
typedef void (*alpm_cb_progress)(alpm_progress_t, const char *, int, size_t, size_t);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Downloading
|
* Downloading
|
||||||
@@ -292,6 +487,21 @@ alpm_cb_totaldl alpm_option_get_totaldlcb(alpm_handle_t *handle);
|
|||||||
/** Sets the callback used to report total download size. */
|
/** Sets the callback used to report total download size. */
|
||||||
int alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb);
|
int alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb);
|
||||||
|
|
||||||
|
/** Returns the callback used for events. */
|
||||||
|
alpm_cb_event alpm_option_get_eventcb(alpm_handle_t *handle);
|
||||||
|
/** Sets the callback used for events. */
|
||||||
|
int alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb);
|
||||||
|
|
||||||
|
/** Returns the callback used for questions. */
|
||||||
|
alpm_cb_question alpm_option_get_questioncb(alpm_handle_t *handle);
|
||||||
|
/** Sets the callback used for questions. */
|
||||||
|
int alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb);
|
||||||
|
|
||||||
|
/** Returns the callback used for operation progress. */
|
||||||
|
alpm_cb_progress alpm_option_get_progresscb(alpm_handle_t *handle);
|
||||||
|
/** Sets the callback used for operation progress. */
|
||||||
|
int alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb);
|
||||||
|
|
||||||
/** Returns the root of the destination filesystem. Read-only. */
|
/** Returns the root of the destination filesystem. Read-only. */
|
||||||
const char *alpm_option_get_root(alpm_handle_t *handle);
|
const char *alpm_option_get_root(alpm_handle_t *handle);
|
||||||
|
|
||||||
@@ -375,8 +585,8 @@ const char *alpm_option_get_arch(alpm_handle_t *handle);
|
|||||||
/** Sets the targeted architecture. */
|
/** Sets the targeted architecture. */
|
||||||
int alpm_option_set_arch(alpm_handle_t *handle, const char *arch);
|
int alpm_option_set_arch(alpm_handle_t *handle, const char *arch);
|
||||||
|
|
||||||
int alpm_option_get_usedelta(alpm_handle_t *handle);
|
double alpm_option_get_deltaratio(alpm_handle_t *handle);
|
||||||
int alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta);
|
int alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio);
|
||||||
|
|
||||||
int alpm_option_get_checkspace(alpm_handle_t *handle);
|
int alpm_option_get_checkspace(alpm_handle_t *handle);
|
||||||
int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
|
int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
|
||||||
@@ -384,6 +594,12 @@ int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
|
|||||||
alpm_siglevel_t alpm_option_get_default_siglevel(alpm_handle_t *handle);
|
alpm_siglevel_t alpm_option_get_default_siglevel(alpm_handle_t *handle);
|
||||||
int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
|
int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
|
||||||
|
|
||||||
|
alpm_siglevel_t alpm_option_get_local_file_siglevel(alpm_handle_t *handle);
|
||||||
|
int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
|
||||||
|
|
||||||
|
alpm_siglevel_t alpm_option_get_remote_file_siglevel(alpm_handle_t *handle);
|
||||||
|
int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** @addtogroup alpm_api_databases Database Functions
|
/** @addtogroup alpm_api_databases Database Functions
|
||||||
@@ -397,7 +613,7 @@ int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t leve
|
|||||||
* libalpm functions.
|
* libalpm functions.
|
||||||
* @return a reference to the local database
|
* @return a reference to the local database
|
||||||
*/
|
*/
|
||||||
alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle);
|
alpm_db_t *alpm_get_localdb(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Get the list of sync databases.
|
/** Get the list of sync databases.
|
||||||
* Returns a list of alpm_db_t structures, one for each registered
|
* Returns a list of alpm_db_t structures, one for each registered
|
||||||
@@ -405,7 +621,7 @@ alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle);
|
|||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @return a reference to an internal list of alpm_db_t structures
|
* @return a reference to an internal list of alpm_db_t structures
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
|
alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Register a sync database of packages.
|
/** Register a sync database of packages.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
@@ -414,21 +630,21 @@ alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
|
|||||||
* database; note that this must be a '.sig' file type verification
|
* database; note that this must be a '.sig' file type verification
|
||||||
* @return an alpm_db_t* on success (the value), NULL on error
|
* @return an alpm_db_t* on success (the value), NULL on error
|
||||||
*/
|
*/
|
||||||
alpm_db_t *alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename,
|
||||||
alpm_siglevel_t level);
|
alpm_siglevel_t level);
|
||||||
|
|
||||||
|
/** Unregister all package databases.
|
||||||
|
* @param handle the context handle
|
||||||
|
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||||
|
*/
|
||||||
|
int alpm_unregister_all_syncdbs(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Unregister a package database.
|
/** Unregister a package database.
|
||||||
* @param db pointer to the package database to unregister
|
* @param db pointer to the package database to unregister
|
||||||
* @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 alpm_db_unregister(alpm_db_t *db);
|
int alpm_db_unregister(alpm_db_t *db);
|
||||||
|
|
||||||
/** Unregister all package databases.
|
|
||||||
* @param handle the context handle
|
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int alpm_db_unregister_all(alpm_handle_t *handle);
|
|
||||||
|
|
||||||
/** Get the name of a package database.
|
/** Get the name of a package database.
|
||||||
* @param db pointer to the package database
|
* @param db pointer to the package database
|
||||||
* @return the name of the package database, NULL on error
|
* @return the name of the package database, NULL on error
|
||||||
@@ -460,7 +676,7 @@ int alpm_db_add_server(alpm_db_t *db, const char *url);
|
|||||||
int alpm_db_remove_server(alpm_db_t *db, const char *url);
|
int alpm_db_remove_server(alpm_db_t *db, const char *url);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
int alpm_db_update(int level, alpm_db_t *db);
|
int alpm_db_update(int force, alpm_db_t *db);
|
||||||
|
|
||||||
/** Get a package entry from a package database.
|
/** Get a package entry from a package database.
|
||||||
* @param db pointer to the package database to get the package from
|
* @param db pointer to the package database to get the package from
|
||||||
@@ -480,7 +696,7 @@ alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db);
|
|||||||
* @param name of the group
|
* @param name of the group
|
||||||
* @return the groups entry on success, NULL on error
|
* @return the groups entry on success, NULL on error
|
||||||
*/
|
*/
|
||||||
alpm_group_t *alpm_db_readgroup(alpm_db_t *db, const char *name);
|
alpm_group_t *alpm_db_get_group(alpm_db_t *db, const char *name);
|
||||||
|
|
||||||
/** Get the group cache of a package database.
|
/** Get the group cache of a package database.
|
||||||
* @param db pointer to the package database to get the group from
|
* @param db pointer to the package database to get the group from
|
||||||
@@ -493,16 +709,7 @@ alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db);
|
|||||||
* @param needles a list of regular expressions to search for
|
* @param needles a list of regular expressions to search for
|
||||||
* @return the list of packages matching all regular expressions on success, NULL on error
|
* @return the list of packages matching all regular expressions on success, NULL on error
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles);
|
alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
|
||||||
|
|
||||||
/** Set install reason for a package in db.
|
|
||||||
* @param handle the context handle
|
|
||||||
* @param pkg the package to update
|
|
||||||
* @param reason the new install reason
|
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
|
||||||
*/
|
|
||||||
int alpm_db_set_pkgreason(alpm_handle_t *handle, alpm_pkg_t *pkg,
|
|
||||||
alpm_pkgreason_t reason);
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -526,7 +733,14 @@ int alpm_db_set_pkgreason(alpm_handle_t *handle, alpm_pkg_t *pkg,
|
|||||||
* @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 alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
|
int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
|
||||||
alpm_siglevel_t, alpm_pkg_t **pkg);
|
alpm_siglevel_t level, alpm_pkg_t **pkg);
|
||||||
|
|
||||||
|
/** Find a package in a list by name.
|
||||||
|
* @param haystack a list of alpm_pkg_t
|
||||||
|
* @param needle the package name
|
||||||
|
* @return a pointer to the package if found or NULL
|
||||||
|
*/
|
||||||
|
alpm_pkg_t *alpm_pkg_find(alpm_list_t *haystack, const char *needle);
|
||||||
|
|
||||||
/** Free a package.
|
/** Free a package.
|
||||||
* @param pkg package pointer to free
|
* @param pkg package pointer to free
|
||||||
@@ -551,6 +765,14 @@ int alpm_pkg_vercmp(const char *a, const char *b);
|
|||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Computes the list of packages optionally requiring a given package.
|
||||||
|
* The return value of this function is a newly allocated
|
||||||
|
* list of package names (char*), it should be freed by the caller.
|
||||||
|
* @param pkg a package
|
||||||
|
* @return the list of packages optionally requiring pkg
|
||||||
|
*/
|
||||||
|
alpm_list_t *alpm_pkg_compute_optionalfor(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** @name Package Property Accessors
|
/** @name Package Property Accessors
|
||||||
* Any pointer returned by these functions points to internal structures
|
* Any pointer returned by these functions points to internal structures
|
||||||
* allocated by libalpm. They should not be freed nor modified in any
|
* allocated by libalpm. They should not be freed nor modified in any
|
||||||
@@ -578,6 +800,11 @@ const char *alpm_pkg_get_name(alpm_pkg_t *pkg);
|
|||||||
*/
|
*/
|
||||||
const char *alpm_pkg_get_version(alpm_pkg_t *pkg);
|
const char *alpm_pkg_get_version(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Returns the origin of the package.
|
||||||
|
* @return an alpm_pkgfrom_t constant, -1 on error
|
||||||
|
*/
|
||||||
|
alpm_pkgfrom_t alpm_pkg_get_origin(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the package description.
|
/** Returns the package description.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal string
|
* @return a reference to an internal string
|
||||||
@@ -594,13 +821,13 @@ const char *alpm_pkg_get_url(alpm_pkg_t *pkg);
|
|||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return the timestamp of the build time
|
* @return the timestamp of the build time
|
||||||
*/
|
*/
|
||||||
time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg);
|
alpm_time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the install timestamp of the package.
|
/** Returns the install timestamp of the package.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return the timestamp of the install time
|
* @return the timestamp of the install time
|
||||||
*/
|
*/
|
||||||
time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
|
alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the packager's name.
|
/** Returns the packager's name.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
@@ -609,19 +836,27 @@ time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
|
|||||||
const char *alpm_pkg_get_packager(alpm_pkg_t *pkg);
|
const char *alpm_pkg_get_packager(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the package's MD5 checksum as a string.
|
/** Returns the package's MD5 checksum as a string.
|
||||||
* The returned string is a sequence of lowercase hexadecimal digits.
|
* The returned string is a sequence of 32 lowercase hexadecimal digits.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal string
|
* @return a reference to an internal string
|
||||||
*/
|
*/
|
||||||
const char *alpm_pkg_get_md5sum(alpm_pkg_t *pkg);
|
const char *alpm_pkg_get_md5sum(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Returns the package's SHA256 checksum as a string.
|
||||||
|
* The returned string is a sequence of 64 lowercase hexadecimal digits.
|
||||||
|
* @param pkg a pointer to package
|
||||||
|
* @return a reference to an internal string
|
||||||
|
*/
|
||||||
|
const char *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the architecture for which the package was built.
|
/** Returns the architecture for which the package was built.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal string
|
* @return a reference to an internal string
|
||||||
*/
|
*/
|
||||||
const char *alpm_pkg_get_arch(alpm_pkg_t *pkg);
|
const char *alpm_pkg_get_arch(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the size of the package.
|
/** Returns the size of the package. This is only available for sync database
|
||||||
|
* packages and package files, not those loaded from the local database.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return the size of the package in bytes.
|
* @return the size of the package in bytes.
|
||||||
*/
|
*/
|
||||||
@@ -659,19 +894,19 @@ alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg);
|
|||||||
|
|
||||||
/** Returns the list of package optional dependencies.
|
/** Returns the list of package optional dependencies.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal list of strings.
|
* @return a reference to an internal list of alpm_depend_t structures.
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the list of package names conflicting with pkg.
|
/** Returns the list of packages conflicting with pkg.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal list of strings.
|
* @return a reference to an internal list of alpm_depend_t structures.
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_conflicts(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_conflicts(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the list of package names provided by pkg.
|
/** Returns the list of packages provided by pkg.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal list of strings.
|
* @return a reference to an internal list of alpm_depend_t structures.
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_provides(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_provides(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
@@ -683,7 +918,7 @@ alpm_list_t *alpm_pkg_get_deltas(alpm_pkg_t *pkg);
|
|||||||
|
|
||||||
/** Returns the list of packages to be replaced by pkg.
|
/** Returns the list of packages to be replaced by pkg.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal list of strings.
|
* @return a reference to an internal list of alpm_depend_t structures.
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_replaces(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_replaces(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
@@ -701,7 +936,7 @@ alpm_filelist_t *alpm_pkg_get_files(alpm_pkg_t *pkg);
|
|||||||
* "<filename>\t<md5sum>", where the given md5sum is that of
|
* "<filename>\t<md5sum>", where the given md5sum is that of
|
||||||
* the file as provided by the package.
|
* the file as provided by the package.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal list of strings.
|
* @return a reference to a list of alpm_backup_t objects
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_backup(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_backup(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
@@ -713,6 +948,18 @@ alpm_list_t *alpm_pkg_get_backup(alpm_pkg_t *pkg);
|
|||||||
*/
|
*/
|
||||||
alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg);
|
alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Returns the base64 encoded package signature.
|
||||||
|
* @param pkg a pointer to package
|
||||||
|
* @return a reference to an internal string
|
||||||
|
*/
|
||||||
|
const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Returns the method used to validate a package during install.
|
||||||
|
* @param pkg a pointer to package
|
||||||
|
* @return an enum member giving the validation method
|
||||||
|
*/
|
||||||
|
alpm_pkgvalidation_t alpm_pkg_get_validation(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/* End of alpm_pkg_t accessors */
|
/* End of alpm_pkg_t accessors */
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
@@ -735,12 +982,27 @@ void *alpm_pkg_changelog_open(alpm_pkg_t *pkg);
|
|||||||
* error occurred.
|
* error occurred.
|
||||||
*/
|
*/
|
||||||
size_t alpm_pkg_changelog_read(void *ptr, size_t size,
|
size_t alpm_pkg_changelog_read(void *ptr, size_t size,
|
||||||
const alpm_pkg_t *pkg, const void *fp);
|
const alpm_pkg_t *pkg, void *fp);
|
||||||
|
|
||||||
/*int alpm_pkg_changelog_feof(const alpm_pkg_t *pkg, void *fp);*/
|
|
||||||
|
|
||||||
int alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp);
|
int alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp);
|
||||||
|
|
||||||
|
/** Open a package mtree file for reading.
|
||||||
|
* @param pkg the local package to read the changelog of
|
||||||
|
* @return a archive structure for the package mtree file
|
||||||
|
*/
|
||||||
|
struct archive *alpm_pkg_mtree_open(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Read next entry from a package mtree file.
|
||||||
|
* @param pkg the package that the mtree file is being read from
|
||||||
|
* @param archive the archive structure reading from the mtree file
|
||||||
|
* @param entry an archive_entry to store the entry header information
|
||||||
|
* @return 0 if end of archive is reached, non-zero otherwise.
|
||||||
|
*/
|
||||||
|
int alpm_pkg_mtree_next(const alpm_pkg_t *pkg, struct archive *archive,
|
||||||
|
struct archive_entry **entry);
|
||||||
|
|
||||||
|
int alpm_pkg_mtree_close(const alpm_pkg_t *pkg, struct archive *archive);
|
||||||
|
|
||||||
/** Returns whether the package has an install scriptlet.
|
/** Returns whether the package has an install scriptlet.
|
||||||
* @return 0 if FALSE, TRUE otherwise
|
* @return 0 if FALSE, TRUE otherwise
|
||||||
*/
|
*/
|
||||||
@@ -756,18 +1018,42 @@ off_t alpm_pkg_download_size(alpm_pkg_t *newpkg);
|
|||||||
|
|
||||||
alpm_list_t *alpm_pkg_unused_deltas(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_unused_deltas(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
/** Set install reason for a package in the local database.
|
||||||
|
* The provided package object must be from the local database or this method
|
||||||
|
* will fail. The write to the local database is performed immediately.
|
||||||
|
* @param pkg the package to update
|
||||||
|
* @param reason the new install reason
|
||||||
|
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||||
|
*/
|
||||||
|
int alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason);
|
||||||
|
|
||||||
|
|
||||||
/* End of alpm_pkg */
|
/* End of alpm_pkg */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Filelists
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Determines whether a package filelist contains a given path.
|
||||||
|
* The provided path should be relative to the install root with no leading
|
||||||
|
* slashes, e.g. "etc/localtime". When searching for directories, the path must
|
||||||
|
* have a trailing slash.
|
||||||
|
* @param filelist a pointer to a package filelist
|
||||||
|
* @param path the path to search for in the package
|
||||||
|
* @return a pointer to the matching file or NULL if not found
|
||||||
|
*/
|
||||||
|
char *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Signatures
|
* Signatures
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_sigresult_t *result);
|
int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist);
|
||||||
|
|
||||||
int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_sigresult_t *result);
|
int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist);
|
||||||
|
|
||||||
int alpm_sigresult_cleanup(alpm_sigresult_t *result);
|
int alpm_siglist_cleanup(alpm_siglist_t *siglist);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Groups
|
* Groups
|
||||||
@@ -824,117 +1110,6 @@ typedef enum _alpm_transflag_t {
|
|||||||
ALPM_TRANS_FLAG_NOLOCK = (1 << 17)
|
ALPM_TRANS_FLAG_NOLOCK = (1 << 17)
|
||||||
} alpm_transflag_t;
|
} alpm_transflag_t;
|
||||||
|
|
||||||
/** Transaction events.
|
|
||||||
* NULL parameters are passed to in all events unless specified otherwise.
|
|
||||||
*/
|
|
||||||
typedef enum _alpm_transevt_t {
|
|
||||||
/** Dependencies will be computed for a package. */
|
|
||||||
ALPM_TRANS_EVT_CHECKDEPS_START = 1,
|
|
||||||
/** Dependencies were computed for a package. */
|
|
||||||
ALPM_TRANS_EVT_CHECKDEPS_DONE,
|
|
||||||
/** File conflicts will be computed for a package. */
|
|
||||||
ALPM_TRANS_EVT_FILECONFLICTS_START,
|
|
||||||
/** File conflicts were computed for a package. */
|
|
||||||
ALPM_TRANS_EVT_FILECONFLICTS_DONE,
|
|
||||||
/** Dependencies will be resolved for target package. */
|
|
||||||
ALPM_TRANS_EVT_RESOLVEDEPS_START,
|
|
||||||
/** Dependencies were resolved for target package. */
|
|
||||||
ALPM_TRANS_EVT_RESOLVEDEPS_DONE,
|
|
||||||
/** Inter-conflicts will be checked for target package. */
|
|
||||||
ALPM_TRANS_EVT_INTERCONFLICTS_START,
|
|
||||||
/** Inter-conflicts were checked for target package. */
|
|
||||||
ALPM_TRANS_EVT_INTERCONFLICTS_DONE,
|
|
||||||
/** Package will be installed.
|
|
||||||
* A pointer to the target package is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_ADD_START,
|
|
||||||
/** Package was installed.
|
|
||||||
* A pointer to the new package is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_ADD_DONE,
|
|
||||||
/** Package will be removed.
|
|
||||||
* A pointer to the target package is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_REMOVE_START,
|
|
||||||
/** Package was removed.
|
|
||||||
* A pointer to the removed package is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_REMOVE_DONE,
|
|
||||||
/** Package will be upgraded.
|
|
||||||
* A pointer to the upgraded package is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_UPGRADE_START,
|
|
||||||
/** Package was upgraded.
|
|
||||||
* A pointer to the new package, and a pointer to the old package is passed
|
|
||||||
* to the callback, respectively.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_UPGRADE_DONE,
|
|
||||||
/** Target package's integrity will be checked. */
|
|
||||||
ALPM_TRANS_EVT_INTEGRITY_START,
|
|
||||||
/** Target package's integrity was checked. */
|
|
||||||
ALPM_TRANS_EVT_INTEGRITY_DONE,
|
|
||||||
/** Target deltas's integrity will be checked. */
|
|
||||||
ALPM_TRANS_EVT_DELTA_INTEGRITY_START,
|
|
||||||
/** Target delta's integrity was checked. */
|
|
||||||
ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE,
|
|
||||||
/** Deltas will be applied to packages. */
|
|
||||||
ALPM_TRANS_EVT_DELTA_PATCHES_START,
|
|
||||||
/** Deltas were applied to packages. */
|
|
||||||
ALPM_TRANS_EVT_DELTA_PATCHES_DONE,
|
|
||||||
/** Delta patch will be applied to target package.
|
|
||||||
* The filename of the package and the filename of the patch is passed to the
|
|
||||||
* callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_DELTA_PATCH_START,
|
|
||||||
/** Delta patch was applied to target package. */
|
|
||||||
ALPM_TRANS_EVT_DELTA_PATCH_DONE,
|
|
||||||
/** Delta patch failed to apply to target package. */
|
|
||||||
ALPM_TRANS_EVT_DELTA_PATCH_FAILED,
|
|
||||||
/** Scriptlet has printed information.
|
|
||||||
* A line of text is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_SCRIPTLET_INFO,
|
|
||||||
/** Files will be downloaded from a repository.
|
|
||||||
* The repository's tree name is passed to the callback.
|
|
||||||
*/
|
|
||||||
ALPM_TRANS_EVT_RETRIEVE_START,
|
|
||||||
/** Disk space usage will be computed for a package */
|
|
||||||
ALPM_TRANS_EVT_DISKSPACE_START,
|
|
||||||
/** Disk space usage was computed for a package */
|
|
||||||
ALPM_TRANS_EVT_DISKSPACE_DONE,
|
|
||||||
} alpm_transevt_t;
|
|
||||||
|
|
||||||
/** Transaction Conversations (ie, questions) */
|
|
||||||
typedef enum _alpm_transconv_t {
|
|
||||||
ALPM_TRANS_CONV_INSTALL_IGNOREPKG = 1,
|
|
||||||
ALPM_TRANS_CONV_REPLACE_PKG = (1 << 1),
|
|
||||||
ALPM_TRANS_CONV_CONFLICT_PKG = (1 << 2),
|
|
||||||
ALPM_TRANS_CONV_CORRUPTED_PKG = (1 << 3),
|
|
||||||
ALPM_TRANS_CONV_LOCAL_NEWER = (1 << 4),
|
|
||||||
ALPM_TRANS_CONV_REMOVE_PKGS = (1 << 5),
|
|
||||||
ALPM_TRANS_CONV_SELECT_PROVIDER = (1 << 6),
|
|
||||||
} alpm_transconv_t;
|
|
||||||
|
|
||||||
/** Transaction Progress */
|
|
||||||
typedef enum _alpm_transprog_t {
|
|
||||||
ALPM_TRANS_PROGRESS_ADD_START,
|
|
||||||
ALPM_TRANS_PROGRESS_UPGRADE_START,
|
|
||||||
ALPM_TRANS_PROGRESS_REMOVE_START,
|
|
||||||
ALPM_TRANS_PROGRESS_CONFLICTS_START,
|
|
||||||
ALPM_TRANS_PROGRESS_DISKSPACE_START,
|
|
||||||
ALPM_TRANS_PROGRESS_INTEGRITY_START,
|
|
||||||
} alpm_transprog_t;
|
|
||||||
|
|
||||||
/** Transaction Event callback */
|
|
||||||
typedef void (*alpm_trans_cb_event)(alpm_transevt_t, void *, void *);
|
|
||||||
|
|
||||||
/** Transaction Conversation callback */
|
|
||||||
typedef void (*alpm_trans_cb_conv)(alpm_transconv_t, void *, void *,
|
|
||||||
void *, int *);
|
|
||||||
|
|
||||||
/** Transaction Progress callback */
|
|
||||||
typedef void (*alpm_trans_cb_progress)(alpm_transprog_t, const char *, int, size_t, size_t);
|
|
||||||
|
|
||||||
/** Returns the bitfield of flags for the current transaction.
|
/** Returns the bitfield of flags for the current transaction.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @return the bitfield of transaction flags
|
* @return the bitfield of transaction flags
|
||||||
@@ -945,25 +1120,20 @@ alpm_transflag_t alpm_trans_get_flags(alpm_handle_t *handle);
|
|||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @return a list of alpm_pkg_t structures
|
* @return a list of alpm_pkg_t structures
|
||||||
*/
|
*/
|
||||||
alpm_list_t * alpm_trans_get_add(alpm_handle_t *handle);
|
alpm_list_t *alpm_trans_get_add(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Returns the list of packages removed by the transaction.
|
/** Returns the list of packages removed by the transaction.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @return a list of alpm_pkg_t structures
|
* @return a list of alpm_pkg_t structures
|
||||||
*/
|
*/
|
||||||
alpm_list_t * alpm_trans_get_remove(alpm_handle_t *handle);
|
alpm_list_t *alpm_trans_get_remove(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Initialize the transaction.
|
/** Initialize the transaction.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @param flags flags of the transaction (like nodeps, etc)
|
* @param flags flags of the transaction (like nodeps, etc)
|
||||||
* @param event event callback function pointer
|
|
||||||
* @param conv question callback function pointer
|
|
||||||
* @param progress progress callback function pointer
|
|
||||||
* @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 alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags,
|
int alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags);
|
||||||
alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
|
|
||||||
alpm_trans_cb_progress cb_progress);
|
|
||||||
|
|
||||||
/** Prepare a transaction.
|
/** Prepare a transaction.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
@@ -976,7 +1146,7 @@ int alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data);
|
|||||||
/** Commit a transaction.
|
/** Commit a transaction.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @param data the address of an alpm_list where detailed description
|
* @param data the address of an alpm_list where detailed description
|
||||||
* of an error can be dumped (ie. list of conflicting files)
|
* of an error can be dumped (i.e. list of conflicting files)
|
||||||
* @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 alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data);
|
int alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data);
|
||||||
@@ -1051,12 +1221,13 @@ char *alpm_dep_compute_string(const alpm_depend_t *dep);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* checksums */
|
/* checksums */
|
||||||
char *alpm_compute_md5sum(const char *name);
|
char *alpm_compute_md5sum(const char *filename);
|
||||||
|
char *alpm_compute_sha256sum(const char *filename);
|
||||||
|
|
||||||
/** @addtogroup alpm_api_errors Error Codes
|
/** @addtogroup alpm_api_errors Error Codes
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
enum _alpm_errno_t {
|
typedef enum _alpm_errno_t {
|
||||||
ALPM_ERR_MEMORY = 1,
|
ALPM_ERR_MEMORY = 1,
|
||||||
ALPM_ERR_SYSTEM,
|
ALPM_ERR_SYSTEM,
|
||||||
ALPM_ERR_BADPERMS,
|
ALPM_ERR_BADPERMS,
|
||||||
@@ -1120,21 +1291,29 @@ enum _alpm_errno_t {
|
|||||||
ALPM_ERR_LIBCURL,
|
ALPM_ERR_LIBCURL,
|
||||||
ALPM_ERR_EXTERNAL_DOWNLOAD,
|
ALPM_ERR_EXTERNAL_DOWNLOAD,
|
||||||
ALPM_ERR_GPGME
|
ALPM_ERR_GPGME
|
||||||
};
|
} alpm_errno_t;
|
||||||
|
|
||||||
/** Returns the current error code from the handle. */
|
/** Returns the current error code from the handle. */
|
||||||
enum _alpm_errno_t alpm_errno(alpm_handle_t *handle);
|
alpm_errno_t alpm_errno(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Returns the string corresponding to an error number. */
|
/** Returns the string corresponding to an error number. */
|
||||||
const char *alpm_strerror(enum _alpm_errno_t err);
|
const char *alpm_strerror(alpm_errno_t err);
|
||||||
|
|
||||||
/* End of alpm_api_errors */
|
/* End of alpm_api_errors */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
alpm_handle_t *alpm_initialize(const char *root, const char *dbpath,
|
alpm_handle_t *alpm_initialize(const char *root, const char *dbpath,
|
||||||
enum _alpm_errno_t *err);
|
alpm_errno_t *err);
|
||||||
int alpm_release(alpm_handle_t *handle);
|
int alpm_release(alpm_handle_t *handle);
|
||||||
|
|
||||||
|
enum alpm_caps {
|
||||||
|
ALPM_CAPABILITY_NLS = (1 << 0),
|
||||||
|
ALPM_CAPABILITY_DOWNLOADER = (1 << 1),
|
||||||
|
ALPM_CAPABILITY_SIGNATURES = (1 << 2)
|
||||||
|
};
|
||||||
|
|
||||||
const char *alpm_version(void);
|
const char *alpm_version(void);
|
||||||
|
enum alpm_caps alpm_capabilities(void);
|
||||||
|
|
||||||
/* End of alpm_api */
|
/* End of alpm_api */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm_list.c
|
* alpm_list.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -89,7 +89,7 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_
|
|||||||
} 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;
|
||||||
}
|
}
|
||||||
@@ -204,14 +204,21 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
|
|||||||
*
|
*
|
||||||
* @return the resultant list
|
* @return the resultant list
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save tail node pointers for future use */
|
||||||
|
left_tail_ptr = left->prev;
|
||||||
|
right_tail_ptr = right->prev;
|
||||||
|
|
||||||
if(fn(left->data, right->data) <= 0) {
|
if(fn(left->data, right->data) <= 0) {
|
||||||
newlist = left;
|
newlist = left;
|
||||||
@@ -242,19 +249,18 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -268,17 +274,26 @@ 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, size_t 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;
|
size_t half = n / 2;
|
||||||
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
|
size_t i = half - 1;
|
||||||
alpm_list_t *right = lastleft->next;
|
alpm_list_t *left = list, *lastleft = list, *right;
|
||||||
/* terminate first list */
|
|
||||||
lastleft->next = NULL;
|
|
||||||
|
|
||||||
left = alpm_list_msort(left, n/2, fn);
|
while(i--) {
|
||||||
right = alpm_list_msort(right, n - (n/2), fn);
|
lastleft = lastleft->next;
|
||||||
|
}
|
||||||
|
right = lastleft->next;
|
||||||
|
|
||||||
|
/* tidy new lists */
|
||||||
|
lastleft->next = NULL;
|
||||||
|
right->prev = left->prev;
|
||||||
|
left->prev = lastleft;
|
||||||
|
|
||||||
|
left = alpm_list_msort(left, half, fn);
|
||||||
|
right = alpm_list_msort(right, n - half, fn);
|
||||||
list = alpm_list_mmerge(left, right, fn);
|
list = alpm_list_mmerge(left, right, fn);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
@@ -465,7 +480,7 @@ 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);
|
||||||
@@ -543,7 +558,6 @@ inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
|
|||||||
* @brief Get the previous element of a list.
|
* @brief Get the previous element of a list.
|
||||||
*
|
*
|
||||||
* @param list the list head
|
* @param list the list head
|
||||||
* @param node the list node
|
|
||||||
*
|
*
|
||||||
* @return the previous element, or NULL when no previous element exist
|
* @return the previous element, or NULL when no previous element exist
|
||||||
*/
|
*/
|
||||||
@@ -572,19 +586,6 @@ alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the data member of a list node.
|
|
||||||
*
|
|
||||||
* @param node the list node
|
|
||||||
*
|
|
||||||
* @return the contained data, or NULL if none
|
|
||||||
*/
|
|
||||||
void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
|
|
||||||
{
|
|
||||||
if(node == NULL) return NULL;
|
|
||||||
return node->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -771,7 +772,7 @@ void SYMEXPORT *alpm_list_to_array(const alpm_list_t *list, size_t n,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
array = calloc(n, size);
|
array = malloc(n * size);
|
||||||
if(array == NULL) {
|
if(array == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alpm_list.h
|
* alpm_list.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -71,7 +71,6 @@ alpm_list_t *alpm_list_nth(const alpm_list_t *list, size_t n);
|
|||||||
alpm_list_t *alpm_list_next(const alpm_list_t *list);
|
alpm_list_t *alpm_list_next(const alpm_list_t *list);
|
||||||
alpm_list_t *alpm_list_previous(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);
|
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
size_t alpm_list_count(const alpm_list_t *list);
|
size_t alpm_list_count(const alpm_list_t *list);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* backup.c
|
* backup.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* backup.h
|
* backup.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
* * removal of SELF_TEST code
|
* * removal of SELF_TEST code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
|
|
||||||
static const unsigned char base64_enc_map[64] =
|
static const unsigned char base64_enc_map[64] =
|
||||||
@@ -62,13 +64,14 @@ static const unsigned char base64_dec_map[128] =
|
|||||||
49, 50, 51, 127, 127, 127, 127, 127
|
49, 50, 51, 127, 127, 127, 127, 127
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
* Encode a buffer into base64 format
|
* Encode a buffer into base64 format
|
||||||
*/
|
*/
|
||||||
int base64_encode( unsigned char *dst, int *dlen,
|
int base64_encode( unsigned char *dst, size_t *dlen,
|
||||||
const unsigned char *src, int slen )
|
const unsigned char *src, size_t slen )
|
||||||
{
|
{
|
||||||
int i, n;
|
size_t i, n;
|
||||||
int C1, C2, C3;
|
int C1, C2, C3;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
@@ -124,15 +127,16 @@ int base64_encode( unsigned char *dst, int *dlen,
|
|||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decode a base64-formatted buffer
|
* Decode a base64-formatted buffer
|
||||||
*/
|
*/
|
||||||
int base64_decode( unsigned char *dst, int *dlen,
|
int base64_decode( unsigned char *dst, size_t *dlen,
|
||||||
const unsigned char *src, int slen )
|
const unsigned char *src, size_t slen )
|
||||||
{
|
{
|
||||||
int i, j, n;
|
size_t i, n;
|
||||||
unsigned long x;
|
uint32_t j, x;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
for( i = j = n = 0; i < slen; i++ )
|
for( i = j = n = 0; i < slen; i++ )
|
||||||
|
|||||||
@@ -25,9 +25,12 @@
|
|||||||
#ifndef _BASE64_H
|
#ifndef _BASE64_H
|
||||||
#define _BASE64_H
|
#define _BASE64_H
|
||||||
|
|
||||||
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL 0x0010
|
#include <string.h>
|
||||||
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER 0x0012
|
|
||||||
|
|
||||||
|
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010 /**< Output buffer too small. */
|
||||||
|
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012 /**< Invalid character in input. */
|
||||||
|
|
||||||
|
#if 0
|
||||||
/**
|
/**
|
||||||
* \brief Encode a buffer into base64 format
|
* \brief Encode a buffer into base64 format
|
||||||
*
|
*
|
||||||
@@ -43,8 +46,9 @@
|
|||||||
* \note Call this function with *dlen = 0 to obtain the
|
* \note Call this function with *dlen = 0 to obtain the
|
||||||
* required buffer size in *dlen
|
* required buffer size in *dlen
|
||||||
*/
|
*/
|
||||||
int base64_encode( unsigned char *dst, int *dlen,
|
int base64_encode( unsigned char *dst, size_t *dlen,
|
||||||
const unsigned char *src, int slen );
|
const unsigned char *src, size_t slen );
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Decode a base64-formatted buffer
|
* \brief Decode a base64-formatted buffer
|
||||||
@@ -62,7 +66,7 @@ int base64_encode( unsigned char *dst, int *dlen,
|
|||||||
* \note Call this function with *dlen = 0 to obtain the
|
* \note Call this function with *dlen = 0 to obtain the
|
||||||
* required buffer size in *dlen
|
* required buffer size in *dlen
|
||||||
*/
|
*/
|
||||||
int base64_decode( unsigned char *dst, int *dlen,
|
int base64_decode( unsigned char *dst, size_t *dlen,
|
||||||
const unsigned char *src, int slen );
|
const unsigned char *src, size_t slen );
|
||||||
|
|
||||||
#endif /* base64.h */
|
#endif /* base64.h */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* be_local.c : backend for the local database
|
* be_local.c : backend for the local database
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -28,18 +26,23 @@
|
|||||||
#include <stdint.h> /* intmax_t */
|
#include <stdint.h> /* intmax_t */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <time.h>
|
|
||||||
#include <limits.h> /* PATH_MAX */
|
#include <limits.h> /* PATH_MAX */
|
||||||
|
|
||||||
|
/* libarchive */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "deps.h"
|
#include "deps.h"
|
||||||
|
#include "filelist.h"
|
||||||
|
|
||||||
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
|
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
|
||||||
|
|
||||||
@@ -57,12 +60,6 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
|
|||||||
* initialized.
|
* initialized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char *_cache_get_filename(alpm_pkg_t *pkg)
|
|
||||||
{
|
|
||||||
LAZY_LOAD(INFRQ_DESC, NULL);
|
|
||||||
return pkg->filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *_cache_get_desc(alpm_pkg_t *pkg)
|
static const char *_cache_get_desc(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_DESC, NULL);
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
@@ -75,13 +72,13 @@ static const char *_cache_get_url(alpm_pkg_t *pkg)
|
|||||||
return pkg->url;
|
return pkg->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
static time_t _cache_get_builddate(alpm_pkg_t *pkg)
|
static alpm_time_t _cache_get_builddate(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_DESC, 0);
|
LAZY_LOAD(INFRQ_DESC, 0);
|
||||||
return pkg->builddate;
|
return pkg->builddate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static time_t _cache_get_installdate(alpm_pkg_t *pkg)
|
static alpm_time_t _cache_get_installdate(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_DESC, 0);
|
LAZY_LOAD(INFRQ_DESC, 0);
|
||||||
return pkg->installdate;
|
return pkg->installdate;
|
||||||
@@ -93,24 +90,12 @@ static const char *_cache_get_packager(alpm_pkg_t *pkg)
|
|||||||
return pkg->packager;
|
return pkg->packager;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *_cache_get_md5sum(alpm_pkg_t *pkg)
|
|
||||||
{
|
|
||||||
LAZY_LOAD(INFRQ_DESC, NULL);
|
|
||||||
return pkg->md5sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *_cache_get_arch(alpm_pkg_t *pkg)
|
static const char *_cache_get_arch(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_DESC, NULL);
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
return pkg->arch;
|
return pkg->arch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static off_t _cache_get_size(alpm_pkg_t *pkg)
|
|
||||||
{
|
|
||||||
LAZY_LOAD(INFRQ_DESC, -1);
|
|
||||||
return pkg->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static off_t _cache_get_isize(alpm_pkg_t *pkg)
|
static off_t _cache_get_isize(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_DESC, -1);
|
LAZY_LOAD(INFRQ_DESC, -1);
|
||||||
@@ -123,6 +108,12 @@ static alpm_pkgreason_t _cache_get_reason(alpm_pkg_t *pkg)
|
|||||||
return pkg->reason;
|
return pkg->reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static alpm_pkgvalidation_t _cache_get_validation(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
LAZY_LOAD(INFRQ_DESC, -1);
|
||||||
|
return pkg->validation;
|
||||||
|
}
|
||||||
|
|
||||||
static alpm_list_t *_cache_get_licenses(alpm_pkg_t *pkg)
|
static alpm_list_t *_cache_get_licenses(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_DESC, NULL);
|
LAZY_LOAD(INFRQ_DESC, NULL);
|
||||||
@@ -171,12 +162,6 @@ static alpm_list_t *_cache_get_replaces(alpm_pkg_t *pkg)
|
|||||||
return pkg->replaces;
|
return pkg->replaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* local packages can not have deltas */
|
|
||||||
static alpm_list_t *_cache_get_deltas(alpm_pkg_t UNUSED *pkg)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static alpm_filelist_t *_cache_get_files(alpm_pkg_t *pkg)
|
static alpm_filelist_t *_cache_get_files(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
LAZY_LOAD(INFRQ_FILES, NULL);
|
LAZY_LOAD(INFRQ_FILES, NULL);
|
||||||
@@ -197,13 +182,11 @@ static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg)
|
|||||||
*/
|
*/
|
||||||
static void *_cache_changelog_open(alpm_pkg_t *pkg)
|
static void *_cache_changelog_open(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
char clfile[PATH_MAX];
|
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||||
snprintf(clfile, PATH_MAX, "%s/%s/%s-%s/changelog",
|
char *clfile = _alpm_local_db_pkgpath(db, pkg, "changelog");
|
||||||
alpm_option_get_dbpath(pkg->handle),
|
FILE *f = fopen(clfile, "r");
|
||||||
alpm_db_get_name(alpm_pkg_get_db(pkg)),
|
free(clfile);
|
||||||
alpm_pkg_get_name(pkg),
|
return f;
|
||||||
alpm_pkg_get_version(pkg));
|
|
||||||
return fopen(clfile, "r");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,7 +199,7 @@ static void *_cache_changelog_open(alpm_pkg_t *pkg)
|
|||||||
* @return the number of characters read, or 0 if there is no more data
|
* @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,
|
static size_t _cache_changelog_read(void *ptr, size_t size,
|
||||||
const alpm_pkg_t UNUSED *pkg, const void *fp)
|
const alpm_pkg_t UNUSED *pkg, void *fp)
|
||||||
{
|
{
|
||||||
return fread(ptr, 1, size, (FILE *)fp);
|
return fread(ptr, 1, size, (FILE *)fp);
|
||||||
}
|
}
|
||||||
@@ -233,6 +216,73 @@ static int _cache_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
|||||||
return fclose((FILE *)fp);
|
return fclose((FILE *)fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a package mtree file for reading.
|
||||||
|
* @param pkg the local package to read the changelog of
|
||||||
|
* @return a archive structure for the package mtree file
|
||||||
|
*/
|
||||||
|
static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
struct archive *mtree;
|
||||||
|
|
||||||
|
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||||
|
char *mtfile = _alpm_local_db_pkgpath(db, pkg, "mtree");
|
||||||
|
|
||||||
|
if(access(mtfile, F_OK) != 0) {
|
||||||
|
/* there is no mtree file for this package */
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((mtree = archive_read_new()) == NULL) {
|
||||||
|
pkg->handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_archive_read_support_filter_all(mtree);
|
||||||
|
archive_read_support_format_mtree(mtree);
|
||||||
|
|
||||||
|
if((r = _alpm_archive_read_open_file(mtree, mtfile, ALPM_BUFFER_SIZE))) {
|
||||||
|
_alpm_log(pkg->handle, ALPM_LOG_ERROR, _("error while reading file %s: %s\n"),
|
||||||
|
mtfile, archive_error_string(mtree));
|
||||||
|
pkg->handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
|
_alpm_archive_read_free(mtree);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(mtfile);
|
||||||
|
return mtree;
|
||||||
|
|
||||||
|
error:
|
||||||
|
free(mtfile);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read next entry from a package mtree file.
|
||||||
|
* @param pkg the package that the mtree file is being read from
|
||||||
|
* @param archive the archive structure reading from the mtree file
|
||||||
|
* @param entry an archive_entry to store the entry header information
|
||||||
|
* @return 0 if end of archive is reached, non-zero otherwise.
|
||||||
|
*/
|
||||||
|
static int _cache_mtree_next(const alpm_pkg_t UNUSED *pkg,
|
||||||
|
struct archive *mtree, struct archive_entry **entry)
|
||||||
|
{
|
||||||
|
return archive_read_next_header(mtree, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close a package mtree file for reading.
|
||||||
|
* @param pkg the package that the mtree file was read from
|
||||||
|
* @param mtree the archive structure use for reading from the mtree file
|
||||||
|
* @return whether closing the package changelog stream was successful
|
||||||
|
*/
|
||||||
|
static int _cache_mtree_close(const alpm_pkg_t UNUSED *pkg,
|
||||||
|
struct archive *mtree)
|
||||||
|
{
|
||||||
|
return _alpm_archive_read_free(mtree);
|
||||||
|
}
|
||||||
|
|
||||||
static int _cache_force_load(alpm_pkg_t *pkg)
|
static int _cache_force_load(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
return local_db_read(pkg, INFRQ_ALL);
|
return local_db_read(pkg, INFRQ_ALL);
|
||||||
@@ -244,17 +294,15 @@ static int _cache_force_load(alpm_pkg_t *pkg)
|
|||||||
* logic.
|
* logic.
|
||||||
*/
|
*/
|
||||||
static struct pkg_operations local_pkg_ops = {
|
static struct pkg_operations local_pkg_ops = {
|
||||||
.get_filename = _cache_get_filename,
|
|
||||||
.get_desc = _cache_get_desc,
|
.get_desc = _cache_get_desc,
|
||||||
.get_url = _cache_get_url,
|
.get_url = _cache_get_url,
|
||||||
.get_builddate = _cache_get_builddate,
|
.get_builddate = _cache_get_builddate,
|
||||||
.get_installdate = _cache_get_installdate,
|
.get_installdate = _cache_get_installdate,
|
||||||
.get_packager = _cache_get_packager,
|
.get_packager = _cache_get_packager,
|
||||||
.get_md5sum = _cache_get_md5sum,
|
|
||||||
.get_arch = _cache_get_arch,
|
.get_arch = _cache_get_arch,
|
||||||
.get_size = _cache_get_size,
|
|
||||||
.get_isize = _cache_get_isize,
|
.get_isize = _cache_get_isize,
|
||||||
.get_reason = _cache_get_reason,
|
.get_reason = _cache_get_reason,
|
||||||
|
.get_validation = _cache_get_validation,
|
||||||
.has_scriptlet = _cache_has_scriptlet,
|
.has_scriptlet = _cache_has_scriptlet,
|
||||||
.get_licenses = _cache_get_licenses,
|
.get_licenses = _cache_get_licenses,
|
||||||
.get_groups = _cache_get_groups,
|
.get_groups = _cache_get_groups,
|
||||||
@@ -263,7 +311,6 @@ static struct pkg_operations local_pkg_ops = {
|
|||||||
.get_conflicts = _cache_get_conflicts,
|
.get_conflicts = _cache_get_conflicts,
|
||||||
.get_provides = _cache_get_provides,
|
.get_provides = _cache_get_provides,
|
||||||
.get_replaces = _cache_get_replaces,
|
.get_replaces = _cache_get_replaces,
|
||||||
.get_deltas = _cache_get_deltas,
|
|
||||||
.get_files = _cache_get_files,
|
.get_files = _cache_get_files,
|
||||||
.get_backup = _cache_get_backup,
|
.get_backup = _cache_get_backup,
|
||||||
|
|
||||||
@@ -271,6 +318,10 @@ static struct pkg_operations local_pkg_ops = {
|
|||||||
.changelog_read = _cache_changelog_read,
|
.changelog_read = _cache_changelog_read,
|
||||||
.changelog_close = _cache_changelog_close,
|
.changelog_close = _cache_changelog_close,
|
||||||
|
|
||||||
|
.mtree_open = _cache_mtree_open,
|
||||||
|
.mtree_next = _cache_mtree_next,
|
||||||
|
.mtree_close = _cache_mtree_close,
|
||||||
|
|
||||||
.force_load = _cache_force_load,
|
.force_load = _cache_force_load,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -325,6 +376,9 @@ static int local_db_validate(alpm_db_t *db)
|
|||||||
if(db->status & DB_STATUS_VALID) {
|
if(db->status & DB_STATUS_VALID) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if(db->status & DB_STATUS_INVALID) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
dbpath = _alpm_db_path(db);
|
dbpath = _alpm_db_path(db);
|
||||||
if(dbpath == NULL) {
|
if(dbpath == NULL) {
|
||||||
@@ -335,11 +389,16 @@ static int local_db_validate(alpm_db_t *db)
|
|||||||
if(errno == ENOENT) {
|
if(errno == ENOENT) {
|
||||||
/* database dir doesn't exist yet */
|
/* database dir doesn't exist yet */
|
||||||
db->status |= DB_STATUS_VALID;
|
db->status |= DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status |= DB_STATUS_MISSING;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
db->status |= DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
|
|
||||||
while((ent = readdir(dbdir)) != NULL) {
|
while((ent = readdir(dbdir)) != NULL) {
|
||||||
const char *name = ent->d_name;
|
const char *name = ent->d_name;
|
||||||
@@ -355,12 +414,15 @@ static int local_db_validate(alpm_db_t *db)
|
|||||||
snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
|
snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
|
||||||
if(access(path, F_OK) == 0) {
|
if(access(path, F_OK) == 0) {
|
||||||
/* we found a depends file- bail */
|
/* we found a depends file- bail */
|
||||||
|
db->status &= ~DB_STATUS_VALID;
|
||||||
|
db->status |= DB_STATUS_INVALID;
|
||||||
db->handle->pm_errno = ALPM_ERR_DB_VERSION;
|
db->handle->pm_errno = ALPM_ERR_DB_VERSION;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* we found no depends file after full scan */
|
/* we found no depends file after full scan */
|
||||||
db->status |= DB_STATUS_VALID;
|
db->status |= DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@@ -380,6 +442,11 @@ static int local_db_populate(alpm_db_t *db)
|
|||||||
const char *dbpath;
|
const char *dbpath;
|
||||||
DIR *dbdir;
|
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);
|
dbpath = _alpm_db_path(db);
|
||||||
if(dbpath == NULL) {
|
if(dbpath == NULL) {
|
||||||
/* pm_errno set in _alpm_db_path() */
|
/* pm_errno set in _alpm_db_path() */
|
||||||
@@ -390,6 +457,8 @@ static int local_db_populate(alpm_db_t *db)
|
|||||||
if(dbdir == NULL) {
|
if(dbdir == NULL) {
|
||||||
if(errno == ENOENT) {
|
if(errno == ENOENT) {
|
||||||
/* no database existing yet is not an error */
|
/* no database existing yet is not an error */
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status |= DB_STATUS_MISSING;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
@@ -397,6 +466,8 @@ static int local_db_populate(alpm_db_t *db)
|
|||||||
if(fstat(dirfd(dbdir), &buf) != 0) {
|
if(fstat(dirfd(dbdir), &buf) != 0) {
|
||||||
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
}
|
}
|
||||||
|
db->status |= DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
if(buf.st_nlink >= 2) {
|
if(buf.st_nlink >= 2) {
|
||||||
est_count = buf.st_nlink;
|
est_count = buf.st_nlink;
|
||||||
} else {
|
} else {
|
||||||
@@ -411,12 +482,11 @@ static int local_db_populate(alpm_db_t *db)
|
|||||||
rewinddir(dbdir);
|
rewinddir(dbdir);
|
||||||
}
|
}
|
||||||
if(est_count >= 2) {
|
if(est_count >= 2) {
|
||||||
/* subtract the two extra pointers to get # of children */
|
/* subtract the '.' and '..' pointers to get # of children */
|
||||||
est_count -= 2;
|
est_count -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize hash at 50% full */
|
db->pkgcache = _alpm_pkghash_create(est_count);
|
||||||
db->pkgcache = _alpm_pkghash_create(est_count * 2);
|
|
||||||
if(db->pkgcache == NULL){
|
if(db->pkgcache == NULL){
|
||||||
closedir(dbdir);
|
closedir(dbdir);
|
||||||
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
||||||
@@ -455,7 +525,7 @@ static int local_db_populate(alpm_db_t *db)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg->origin = PKG_FROM_LOCALDB;
|
pkg->origin = ALPM_PKG_FROM_LOCALDB;
|
||||||
pkg->origin_data.db = db;
|
pkg->origin_data.db = db;
|
||||||
pkg->ops = &local_pkg_ops;
|
pkg->ops = &local_pkg_ops;
|
||||||
pkg->handle = db->handle;
|
pkg->handle = db->handle;
|
||||||
@@ -485,7 +555,8 @@ static int local_db_populate(alpm_db_t *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Note: the return value must be freed by the caller */
|
/* Note: the return value must be freed by the caller */
|
||||||
static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info)
|
char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info,
|
||||||
|
const char *filename)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *pkgpath;
|
char *pkgpath;
|
||||||
@@ -493,14 +564,16 @@ static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info)
|
|||||||
|
|
||||||
dbpath = _alpm_db_path(db);
|
dbpath = _alpm_db_path(db);
|
||||||
len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3;
|
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));
|
MALLOC(pkgpath, len, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
|
||||||
sprintf(pkgpath, "%s%s-%s/", dbpath, info->name, info->version);
|
sprintf(pkgpath, "%s%s-%s/%s", dbpath, info->name, info->version,
|
||||||
|
filename ? filename : "");
|
||||||
return pkgpath;
|
return pkgpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_NEXT() do { \
|
#define READ_NEXT() do { \
|
||||||
if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) goto error; \
|
if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) goto error; \
|
||||||
_alpm_strip_newline(line); \
|
_alpm_strip_newline(line, 0); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define READ_AND_STORE(f) do { \
|
#define READ_AND_STORE(f) do { \
|
||||||
@@ -510,18 +583,26 @@ static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info)
|
|||||||
|
|
||||||
#define READ_AND_STORE_ALL(f) do { \
|
#define READ_AND_STORE_ALL(f) do { \
|
||||||
char *linedup; \
|
char *linedup; \
|
||||||
if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) goto error; \
|
if(fgets(line, sizeof(line), fp) == NULL) {\
|
||||||
if(_alpm_strip_newline(line) == 0) break; \
|
if(!feof(fp)) goto error; else break; \
|
||||||
|
} \
|
||||||
|
if(_alpm_strip_newline(line, 0) == 0) break; \
|
||||||
STRDUP(linedup, line, goto error); \
|
STRDUP(linedup, line, goto error); \
|
||||||
f = alpm_list_add(f, linedup); \
|
f = alpm_list_add(f, linedup); \
|
||||||
} while(1) /* note the while(1) and not (0) */
|
} 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) == 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)
|
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char path[PATH_MAX];
|
|
||||||
char line[1024];
|
char line[1024];
|
||||||
char *pkgpath = NULL;
|
|
||||||
alpm_db_t *db = info->origin_data.db;
|
alpm_db_t *db = info->origin_data.db;
|
||||||
|
|
||||||
/* bitmask logic here:
|
/* bitmask logic here:
|
||||||
@@ -540,30 +621,30 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
|
_alpm_log(db->handle, ALPM_LOG_FUNCTION,
|
||||||
|
"loading package data for %s : level=0x%x\n",
|
||||||
info->name, inforeq);
|
info->name, inforeq);
|
||||||
|
|
||||||
/* clear out 'line', to be certain - and to make valgrind happy */
|
/* clear out 'line', to be certain - and to make valgrind happy */
|
||||||
memset(line, 0, sizeof(line));
|
memset(line, 0, sizeof(line));
|
||||||
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
|
||||||
|
|
||||||
if(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DESC */
|
/* DESC */
|
||||||
if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) {
|
if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) {
|
||||||
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
|
char *path = _alpm_local_db_pkgpath(db, info, "desc");
|
||||||
if((fp = fopen(path, "r")) == NULL) {
|
if(!path || (fp = fopen(path, "r")) == NULL) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
||||||
|
free(path);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
while(!feof(fp)) {
|
while(!feof(fp)) {
|
||||||
READ_NEXT();
|
if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if(_alpm_strip_newline(line, 0) == 0) {
|
||||||
|
/* length of stripped line was zero */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(strcmp(line, "%NAME%") == 0) {
|
if(strcmp(line, "%NAME%") == 0) {
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
if(strcmp(line, info->name) != 0) {
|
if(strcmp(line, info->name) != 0) {
|
||||||
@@ -596,32 +677,40 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
|||||||
READ_AND_STORE(info->packager);
|
READ_AND_STORE(info->packager);
|
||||||
} else if(strcmp(line, "%REASON%") == 0) {
|
} else if(strcmp(line, "%REASON%") == 0) {
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
info->reason = (alpm_pkgreason_t)atol(line);
|
info->reason = (alpm_pkgreason_t)atoi(line);
|
||||||
} else if(strcmp(line, "%SIZE%") == 0) {
|
} else if(strcmp(line, "%VALIDATION%") == 0) {
|
||||||
/* NOTE: the CSIZE and SIZE fields both share the "size" field
|
alpm_list_t *i, *v = NULL;
|
||||||
* in the pkginfo_t struct. This can be done b/c CSIZE
|
READ_AND_STORE_ALL(v);
|
||||||
* is currently only used in sync databases, and SIZE is
|
for(i = v; i; i = alpm_list_next(i))
|
||||||
* only used in local databases.
|
{
|
||||||
*/
|
if(strcmp(i->data, "none") == 0) {
|
||||||
READ_NEXT();
|
info->validation |= ALPM_PKG_VALIDATION_NONE;
|
||||||
info->size = atol(line);
|
} else if(strcmp(i->data, "md5") == 0) {
|
||||||
/* also store this value to isize */
|
info->validation |= ALPM_PKG_VALIDATION_MD5SUM;
|
||||||
info->isize = info->size;
|
} else if(strcmp(i->data, "sha256") == 0) {
|
||||||
} else if(strcmp(line, "%REPLACES%") == 0) {
|
info->validation |= ALPM_PKG_VALIDATION_SHA256SUM;
|
||||||
READ_AND_STORE_ALL(info->replaces);
|
} else if(strcmp(i->data, "pgp") == 0) {
|
||||||
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
info->validation |= ALPM_PKG_VALIDATION_SIGNATURE;
|
||||||
/* Different than the rest because of the _alpm_splitdep call. */
|
} else {
|
||||||
while(1) {
|
_alpm_log(db->handle, ALPM_LOG_WARNING,
|
||||||
READ_NEXT();
|
_("unknown validation type for package %s: %s\n"),
|
||||||
if(strlen(line) == 0) break;
|
info->name, (const char *)i->data);
|
||||||
info->depends = alpm_list_add(info->depends, _alpm_splitdep(line));
|
}
|
||||||
}
|
}
|
||||||
|
FREELIST(v);
|
||||||
|
} 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) {
|
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||||
READ_AND_STORE_ALL(info->optdepends);
|
READ_AND_SPLITDEP(info->optdepends);
|
||||||
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||||
READ_AND_STORE_ALL(info->conflicts);
|
READ_AND_SPLITDEP(info->conflicts);
|
||||||
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||||
READ_AND_STORE_ALL(info->provides);
|
READ_AND_SPLITDEP(info->provides);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -631,18 +720,21 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
|||||||
|
|
||||||
/* FILES */
|
/* FILES */
|
||||||
if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) {
|
if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) {
|
||||||
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
|
char *path = _alpm_local_db_pkgpath(db, info, "files");
|
||||||
if((fp = fopen(path, "r")) == NULL) {
|
if(!path || (fp = fopen(path, "r")) == NULL) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
|
||||||
|
free(path);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
while(fgets(line, sizeof(line), fp)) {
|
while(fgets(line, sizeof(line), fp)) {
|
||||||
_alpm_strip_newline(line);
|
_alpm_strip_newline(line, 0);
|
||||||
if(strcmp(line, "%FILES%") == 0) {
|
if(strcmp(line, "%FILES%") == 0) {
|
||||||
size_t files_count = 0, files_size = 0;
|
size_t files_count = 0, files_size = 0, len;
|
||||||
alpm_file_t *files = NULL;
|
alpm_file_t *files = NULL;
|
||||||
|
|
||||||
while(fgets(line, sizeof(line), fp) && _alpm_strip_newline(line)) {
|
while(fgets(line, sizeof(line), fp) &&
|
||||||
|
(len = _alpm_strip_newline(line, 0))) {
|
||||||
if(files_count >= files_size) {
|
if(files_count >= files_size) {
|
||||||
size_t old_size = files_size;
|
size_t old_size = files_size;
|
||||||
if(files_size == 0) {
|
if(files_size == 0) {
|
||||||
@@ -652,7 +744,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
|||||||
}
|
}
|
||||||
files = realloc(files, sizeof(alpm_file_t) * files_size);
|
files = realloc(files, sizeof(alpm_file_t) * files_size);
|
||||||
if(!files) {
|
if(!files) {
|
||||||
ALLOC_FAIL(sizeof(alpm_file_t) * files_size);
|
_alpm_alloc_fail(sizeof(alpm_file_t) * files_size);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* ensure all new memory is zeroed out, in both the initial
|
/* ensure all new memory is zeroed out, in both the initial
|
||||||
@@ -660,16 +752,25 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
|||||||
memset(files + old_size, 0,
|
memset(files + old_size, 0,
|
||||||
sizeof(alpm_file_t) * (files_size - old_size));
|
sizeof(alpm_file_t) * (files_size - old_size));
|
||||||
}
|
}
|
||||||
STRDUP(files[files_count].name, line, goto error);
|
/* since we know the length of the file string already,
|
||||||
/* TODO: lstat file, get mode/size */
|
* we can do malloc + memcpy rather than strdup */
|
||||||
|
len += 1;
|
||||||
|
files[files_count].name = malloc(len);
|
||||||
|
if(files[files_count].name == NULL) {
|
||||||
|
_alpm_alloc_fail(len);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
memcpy(files[files_count].name, line, len);
|
||||||
files_count++;
|
files_count++;
|
||||||
}
|
}
|
||||||
/* attempt to hand back any memory we don't need */
|
/* attempt to hand back any memory we don't need */
|
||||||
files = realloc(files, sizeof(alpm_file_t) * files_count);
|
files = realloc(files, sizeof(alpm_file_t) * files_count);
|
||||||
|
/* make sure the list is sorted */
|
||||||
|
qsort(files, files_count, sizeof(alpm_file_t), _alpm_files_cmp);
|
||||||
info->files.count = files_count;
|
info->files.count = files_count;
|
||||||
info->files.files = files;
|
info->files.files = files;
|
||||||
} else if(strcmp(line, "%BACKUP%") == 0) {
|
} else if(strcmp(line, "%BACKUP%") == 0) {
|
||||||
while(fgets(line, sizeof(line), fp) && _alpm_strip_newline(line)) {
|
while(fgets(line, sizeof(line), fp) && _alpm_strip_newline(line, 0)) {
|
||||||
alpm_backup_t *backup;
|
alpm_backup_t *backup;
|
||||||
CALLOC(backup, 1, sizeof(alpm_backup_t), goto error);
|
CALLOC(backup, 1, sizeof(alpm_backup_t), goto error);
|
||||||
if(_alpm_split_backup(line, &backup)) {
|
if(_alpm_split_backup(line, &backup)) {
|
||||||
@@ -686,19 +787,18 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
|||||||
|
|
||||||
/* INSTALL */
|
/* INSTALL */
|
||||||
if(inforeq & INFRQ_SCRIPTLET && !(info->infolevel & INFRQ_SCRIPTLET)) {
|
if(inforeq & INFRQ_SCRIPTLET && !(info->infolevel & INFRQ_SCRIPTLET)) {
|
||||||
snprintf(path, PATH_MAX, "%sinstall", pkgpath);
|
char *path = _alpm_local_db_pkgpath(db, info, "install");
|
||||||
if(access(path, F_OK) == 0) {
|
if(access(path, F_OK) == 0) {
|
||||||
info->scriptlet = 1;
|
info->scriptlet = 1;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
info->infolevel |= INFRQ_SCRIPTLET;
|
info->infolevel |= INFRQ_SCRIPTLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pkgpath);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
info->infolevel |= INFRQ_ERROR;
|
info->infolevel |= INFRQ_ERROR;
|
||||||
free(pkgpath);
|
|
||||||
if(fp) {
|
if(fp) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
@@ -709,14 +809,14 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info)
|
|||||||
{
|
{
|
||||||
mode_t oldmask;
|
mode_t oldmask;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
char *pkgpath = NULL;
|
char *pkgpath;
|
||||||
|
|
||||||
if(checkdbdir(db) != 0) {
|
if(checkdbdir(db) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldmask = umask(0000);
|
oldmask = umask(0000);
|
||||||
pkgpath = get_pkgpath(db, info);
|
pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
|
||||||
|
|
||||||
if((retval = mkdir(pkgpath, 0755)) != 0) {
|
if((retval = mkdir(pkgpath, 0755)) != 0) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"),
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"),
|
||||||
@@ -729,81 +829,73 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void write_deps(FILE *fp, const char *header, alpm_list_t *deplist)
|
||||||
|
{
|
||||||
|
alpm_list_t *lp;
|
||||||
|
if(!deplist) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fputs(header, fp);
|
||||||
|
fputc('\n', fp);
|
||||||
|
for(lp = deplist; lp; lp = lp->next) {
|
||||||
|
char *depstring = alpm_dep_compute_string(lp->data);
|
||||||
|
fputs(depstring, fp);
|
||||||
|
fputc('\n', fp);
|
||||||
|
free(depstring);
|
||||||
|
}
|
||||||
|
fputc('\n', fp);
|
||||||
|
}
|
||||||
|
|
||||||
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char path[PATH_MAX];
|
|
||||||
mode_t oldmask;
|
mode_t oldmask;
|
||||||
alpm_list_t *lp = NULL;
|
alpm_list_t *lp;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
char *pkgpath = NULL;
|
|
||||||
|
|
||||||
if(db == NULL || info == NULL) {
|
if(db == NULL || info == NULL || !(db->status & DB_STATUS_LOCAL)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
|
||||||
|
|
||||||
/* make sure we have a sane umask */
|
/* make sure we have a sane umask */
|
||||||
oldmask = umask(0022);
|
oldmask = umask(0022);
|
||||||
|
|
||||||
if(strcmp(db->treename, "local") != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DESC */
|
/* DESC */
|
||||||
if(inforeq & INFRQ_DESC) {
|
if(inforeq & INFRQ_DESC) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
|
char *path;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
|
"writing %s-%s DESC information back to db\n",
|
||||||
info->name, info->version);
|
info->name, info->version);
|
||||||
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
|
path = _alpm_local_db_pkgpath(db, info, "desc");
|
||||||
if((fp = fopen(path, "w")) == NULL) {
|
if(!path || (fp = fopen(path, "w")) == NULL) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
free(path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
fprintf(fp, "%%NAME%%\n%s\n\n"
|
fprintf(fp, "%%NAME%%\n%s\n\n"
|
||||||
"%%VERSION%%\n%s\n\n", info->name, info->version);
|
"%%VERSION%%\n%s\n\n", info->name, info->version);
|
||||||
if(info->desc) {
|
if(info->desc) {
|
||||||
fprintf(fp, "%%DESC%%\n"
|
fprintf(fp, "%%DESC%%\n"
|
||||||
"%s\n\n", info->desc);
|
"%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(info->url) {
|
if(info->url) {
|
||||||
fprintf(fp, "%%URL%%\n"
|
fprintf(fp, "%%URL%%\n"
|
||||||
"%s\n\n", info->url);
|
"%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) {
|
if(info->arch) {
|
||||||
fprintf(fp, "%%ARCH%%\n"
|
fprintf(fp, "%%ARCH%%\n"
|
||||||
"%s\n\n", info->arch);
|
"%s\n\n", info->arch);
|
||||||
}
|
}
|
||||||
if(info->builddate) {
|
if(info->builddate) {
|
||||||
fprintf(fp, "%%BUILDDATE%%\n"
|
fprintf(fp, "%%BUILDDATE%%\n"
|
||||||
"%ld\n\n", info->builddate);
|
"%jd\n\n", (intmax_t)info->builddate);
|
||||||
}
|
}
|
||||||
if(info->installdate) {
|
if(info->installdate) {
|
||||||
fprintf(fp, "%%INSTALLDATE%%\n"
|
fprintf(fp, "%%INSTALLDATE%%\n"
|
||||||
"%ld\n\n", info->installdate);
|
"%jd\n\n", (intmax_t)info->installdate);
|
||||||
}
|
}
|
||||||
if(info->packager) {
|
if(info->packager) {
|
||||||
fprintf(fp, "%%PACKAGER%%\n"
|
fprintf(fp, "%%PACKAGER%%\n"
|
||||||
@@ -818,68 +910,81 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
|
|||||||
fprintf(fp, "%%REASON%%\n"
|
fprintf(fp, "%%REASON%%\n"
|
||||||
"%u\n\n", info->reason);
|
"%u\n\n", info->reason);
|
||||||
}
|
}
|
||||||
if(info->depends) {
|
if(info->groups) {
|
||||||
fputs("%DEPENDS%\n", fp);
|
fputs("%GROUPS%\n", fp);
|
||||||
for(lp = info->depends; lp; lp = lp->next) {
|
for(lp = info->groups; lp; lp = lp->next) {
|
||||||
char *depstring = alpm_dep_compute_string(lp->data);
|
fputs(lp->data, fp);
|
||||||
fprintf(fp, "%s\n", depstring);
|
fputc('\n', fp);
|
||||||
free(depstring);
|
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
if(info->optdepends) {
|
if(info->licenses) {
|
||||||
fputs("%OPTDEPENDS%\n", fp);
|
fputs("%LICENSE%\n", fp);
|
||||||
for(lp = info->optdepends; lp; lp = lp->next) {
|
for(lp = info->licenses; lp; lp = lp->next) {
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
fputs(lp->data, fp);
|
||||||
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
if(info->conflicts) {
|
if(info->validation) {
|
||||||
fputs("%CONFLICTS%\n", fp);
|
fputs("%VALIDATION%\n", fp);
|
||||||
for(lp = info->conflicts; lp; lp = lp->next) {
|
if(info->validation & ALPM_PKG_VALIDATION_NONE) {
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
fputs("none\n", fp);
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
if(info->validation & ALPM_PKG_VALIDATION_MD5SUM) {
|
||||||
}
|
fputs("md5\n", fp);
|
||||||
if(info->provides) {
|
|
||||||
fputs("%PROVIDES%\n", fp);
|
|
||||||
for(lp = info->provides; lp; lp = lp->next) {
|
|
||||||
fprintf(fp, "%s\n", (char *)lp->data);
|
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
if(info->validation & ALPM_PKG_VALIDATION_SHA256SUM) {
|
||||||
|
fputs("sha256\n", fp);
|
||||||
|
}
|
||||||
|
if(info->validation & ALPM_PKG_VALIDATION_SIGNATURE) {
|
||||||
|
fputs("pgp\n", fp);
|
||||||
|
}
|
||||||
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_deps(fp, "%REPLACES%", info->replaces);
|
||||||
|
write_deps(fp, "%DEPENDS%", info->depends);
|
||||||
|
write_deps(fp, "%OPTDEPENDS%", info->optdepends);
|
||||||
|
write_deps(fp, "%CONFLICTS%", info->conflicts);
|
||||||
|
write_deps(fp, "%PROVIDES%", info->provides);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FILES */
|
/* FILES */
|
||||||
if(inforeq & INFRQ_FILES) {
|
if(inforeq & INFRQ_FILES) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
|
char *path;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
|
"writing %s-%s FILES information back to db\n",
|
||||||
info->name, info->version);
|
info->name, info->version);
|
||||||
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
|
path = _alpm_local_db_pkgpath(db, info, "files");
|
||||||
if((fp = fopen(path, "w")) == NULL) {
|
if(!path || (fp = fopen(path, "w")) == NULL) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
free(path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
if(info->files.count) {
|
if(info->files.count) {
|
||||||
size_t i;
|
size_t i;
|
||||||
fprintf(fp, "%%FILES%%\n");
|
fputs("%FILES%\n", fp);
|
||||||
for(i = 0; i < info->files.count; i++) {
|
for(i = 0; i < info->files.count; i++) {
|
||||||
const alpm_file_t *file = info->files.files + i;
|
const alpm_file_t *file = info->files.files + i;
|
||||||
fprintf(fp, "%s\n", file->name);
|
fputs(file->name, fp);
|
||||||
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
if(info->backup) {
|
if(info->backup) {
|
||||||
fprintf(fp, "%%BACKUP%%\n");
|
fputs("%BACKUP%\n", fp);
|
||||||
for(lp = info->backup; lp; lp = lp->next) {
|
for(lp = info->backup; lp; lp = lp->next) {
|
||||||
const alpm_backup_t *backup = lp->data;
|
const alpm_backup_t *backup = lp->data;
|
||||||
fprintf(fp, "%s\t%s\n", backup->name, backup->hash);
|
fprintf(fp, "%s\t%s\n", backup->name, backup->hash);
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
@@ -890,7 +995,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
free(pkgpath);
|
|
||||||
|
|
||||||
if(fp) {
|
if(fp) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -902,18 +1006,72 @@ cleanup:
|
|||||||
int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info)
|
int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *pkgpath = NULL;
|
DIR *dirp;
|
||||||
|
struct dirent *dp;
|
||||||
|
char *pkgpath;
|
||||||
|
size_t pkgpath_len;
|
||||||
|
|
||||||
pkgpath = get_pkgpath(db, info);
|
pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
|
||||||
|
if(!pkgpath) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
pkgpath_len = strlen(pkgpath);
|
||||||
|
|
||||||
ret = _alpm_rmrf(pkgpath);
|
dirp = opendir(pkgpath);
|
||||||
free(pkgpath);
|
if(!dirp) {
|
||||||
if(ret != 0) {
|
free(pkgpath);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* go through the local DB entry, removing the files within, which we know
|
||||||
|
* are not nested directories of any kind. */
|
||||||
|
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
||||||
|
if(strcmp(dp->d_name, "..") != 0 && strcmp(dp->d_name, ".") != 0) {
|
||||||
|
char name[PATH_MAX];
|
||||||
|
if(pkgpath_len + strlen(dp->d_name) + 2 > PATH_MAX) {
|
||||||
|
/* file path is too long to remove, hmm. */
|
||||||
|
ret = -1;
|
||||||
|
} else {
|
||||||
|
sprintf(name, "%s/%s", pkgpath, dp->d_name);
|
||||||
|
if(unlink(name)) {
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dirp);
|
||||||
|
|
||||||
|
/* after removing all enclosed files, we can remove the directory itself. */
|
||||||
|
if(rmdir(pkgpath)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
free(pkgpath);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason)
|
||||||
|
{
|
||||||
|
ASSERT(pkg != NULL, return -1);
|
||||||
|
ASSERT(pkg->origin == ALPM_PKG_FROM_LOCALDB,
|
||||||
|
RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(pkg->origin_data.db == pkg->handle->db_local,
|
||||||
|
RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
_alpm_log(pkg->handle, ALPM_LOG_DEBUG,
|
||||||
|
"setting install reason %u for %s\n", reason, pkg->name);
|
||||||
|
if(alpm_pkg_get_reason(pkg) == reason) {
|
||||||
|
/* we are done */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* set reason (in pkgcache) */
|
||||||
|
pkg->reason = reason;
|
||||||
|
/* write DESC */
|
||||||
|
if(_alpm_local_db_write(pkg->handle->db_local, pkg, INFRQ_DESC)) {
|
||||||
|
RET_ERR(pkg->handle, ALPM_ERR_DB_WRITE, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct db_operations local_db_ops = {
|
struct db_operations local_db_ops = {
|
||||||
.validate = local_db_validate,
|
.validate = local_db_validate,
|
||||||
.populate = local_db_populate,
|
.populate = local_db_populate,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* be_package.c : backend for packages
|
* be_package.c : backend for packages
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,11 +18,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
/* libarchive */
|
/* libarchive */
|
||||||
#include <archive.h>
|
#include <archive.h>
|
||||||
@@ -31,11 +32,18 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "deps.h" /* _alpm_splitdep */
|
#include "deps.h"
|
||||||
|
#include "filelist.h"
|
||||||
|
|
||||||
|
struct package_changelog {
|
||||||
|
struct archive *archive;
|
||||||
|
int fd;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a package changelog for reading. Similar to fopen in functionality,
|
* Open a package changelog for reading. Similar to fopen in functionality,
|
||||||
@@ -47,31 +55,38 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
|
|||||||
{
|
{
|
||||||
ASSERT(pkg != NULL, return NULL);
|
ASSERT(pkg != NULL, return NULL);
|
||||||
|
|
||||||
struct archive *archive = NULL;
|
struct package_changelog *changelog;
|
||||||
|
struct archive *archive;
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
const char *pkgfile = pkg->origin_data.file;
|
const char *pkgfile = pkg->origin_data.file;
|
||||||
|
struct stat buf;
|
||||||
|
int fd;
|
||||||
|
|
||||||
if((archive = archive_read_new()) == NULL) {
|
fd = _alpm_open_archive(pkg->handle, pkgfile, &buf,
|
||||||
RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, NULL);
|
&archive, ALPM_ERR_PKG_OPEN);
|
||||||
}
|
if(fd < 0) {
|
||||||
|
return NULL;
|
||||||
archive_read_support_compression_all(archive);
|
|
||||||
archive_read_support_format_all(archive);
|
|
||||||
|
|
||||||
if(archive_read_open_filename(archive, pkgfile,
|
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
|
||||||
RET_ERR(pkg->handle, ALPM_ERR_PKG_OPEN, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
const char *entry_name = archive_entry_pathname(entry);
|
const char *entry_name = archive_entry_pathname(entry);
|
||||||
|
|
||||||
if(strcmp(entry_name, ".CHANGELOG") == 0) {
|
if(strcmp(entry_name, ".CHANGELOG") == 0) {
|
||||||
return archive;
|
changelog = malloc(sizeof(struct package_changelog));
|
||||||
|
if(!changelog) {
|
||||||
|
pkg->handle->pm_errno = ALPM_ERR_MEMORY;
|
||||||
|
_alpm_archive_read_free(archive);
|
||||||
|
CLOSE(fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
changelog->archive = archive;
|
||||||
|
changelog->fd = fd;
|
||||||
|
return changelog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* we didn't find a changelog */
|
/* we didn't find a changelog */
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
|
CLOSE(fd);
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -87,9 +102,10 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
|
|||||||
* @return the number of characters read, or 0 if there is no more data
|
* @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,
|
static size_t _package_changelog_read(void *ptr, size_t size,
|
||||||
const alpm_pkg_t UNUSED *pkg, const void *fp)
|
const alpm_pkg_t UNUSED *pkg, void *fp)
|
||||||
{
|
{
|
||||||
ssize_t sret = archive_read_data((struct archive *)fp, ptr, size);
|
struct package_changelog *changelog = fp;
|
||||||
|
ssize_t sret = archive_read_data(changelog->archive, ptr, size);
|
||||||
/* Report error (negative values) */
|
/* Report error (negative values) */
|
||||||
if(sret < 0) {
|
if(sret < 0) {
|
||||||
RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, 0);
|
RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, 0);
|
||||||
@@ -107,7 +123,12 @@ static size_t _package_changelog_read(void *ptr, size_t size,
|
|||||||
*/
|
*/
|
||||||
static int _package_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
static int _package_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
||||||
{
|
{
|
||||||
return archive_read_finish((struct archive *)fp);
|
int ret;
|
||||||
|
struct package_changelog *changelog = fp;
|
||||||
|
ret = _alpm_archive_read_free(changelog->archive);
|
||||||
|
CLOSE(changelog->fd);
|
||||||
|
free(changelog);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Package file operations struct accessor. We implement this as a method
|
/** Package file operations struct accessor. We implement this as a method
|
||||||
@@ -149,21 +170,24 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
|
|||||||
|
|
||||||
/* loop until we reach EOF or other error */
|
/* loop until we reach EOF or other error */
|
||||||
while((ret = _alpm_archive_fgets(a, &buf)) == ARCHIVE_OK) {
|
while((ret = _alpm_archive_fgets(a, &buf)) == ARCHIVE_OK) {
|
||||||
size_t len = _alpm_strip_newline(buf.line);
|
size_t len = _alpm_strip_newline(buf.line, buf.real_line_size);
|
||||||
|
|
||||||
linenum++;
|
linenum++;
|
||||||
if(len == 0 || buf.line[0] == '#') {
|
key = buf.line;
|
||||||
|
if(len == 0 || key[0] == '#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ptr = buf.line;
|
/* line is always in this format: "key = value"
|
||||||
key = strsep(&ptr, "=");
|
* we can be sure the " = " exists, so look for that */
|
||||||
if(key == NULL || ptr == NULL) {
|
ptr = memchr(key, ' ', len);
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
|
if(!ptr || (size_t)(ptr - key + 2) > len || memcmp(ptr, " = ", 3) != 0) {
|
||||||
newpkg->name ? newpkg->name : "error", linenum);
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"%s: syntax error in description file line %d\n",
|
||||||
|
newpkg->name ? newpkg->name : "error", linenum);
|
||||||
} else {
|
} else {
|
||||||
key = _alpm_strtrim(key);
|
/* NULL the end of the key portion, move ptr to start of value */
|
||||||
while(*ptr == ' ') ptr++;
|
*ptr = '\0';
|
||||||
ptr = _alpm_strtrim(ptr);
|
ptr += 3;
|
||||||
if(strcmp(key, "pkgname") == 0) {
|
if(strcmp(key, "pkgname") == 0) {
|
||||||
STRDUP(newpkg->name, ptr, return -1);
|
STRDUP(newpkg->name, ptr, return -1);
|
||||||
newpkg->name_hash = _alpm_hash_sdbm(newpkg->name);
|
newpkg->name_hash = _alpm_hash_sdbm(newpkg->name);
|
||||||
@@ -187,18 +211,22 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
|
|||||||
STRDUP(newpkg->arch, ptr, return -1);
|
STRDUP(newpkg->arch, ptr, return -1);
|
||||||
} else if(strcmp(key, "size") == 0) {
|
} else if(strcmp(key, "size") == 0) {
|
||||||
/* size in the raw package is uncompressed (installed) size */
|
/* size in the raw package is uncompressed (installed) size */
|
||||||
newpkg->isize = atol(ptr);
|
newpkg->isize = _alpm_strtoofft(ptr);
|
||||||
} else if(strcmp(key, "depend") == 0) {
|
} else if(strcmp(key, "depend") == 0) {
|
||||||
alpm_depend_t *dep = _alpm_splitdep(ptr);
|
alpm_depend_t *dep = _alpm_splitdep(ptr);
|
||||||
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
||||||
} else if(strcmp(key, "optdepend") == 0) {
|
} else if(strcmp(key, "optdepend") == 0) {
|
||||||
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));
|
alpm_depend_t *optdep = _alpm_splitdep(ptr);
|
||||||
|
newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep);
|
||||||
} else if(strcmp(key, "conflict") == 0) {
|
} else if(strcmp(key, "conflict") == 0) {
|
||||||
newpkg->conflicts = alpm_list_add(newpkg->conflicts, strdup(ptr));
|
alpm_depend_t *conflict = _alpm_splitdep(ptr);
|
||||||
|
newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);
|
||||||
} else if(strcmp(key, "replaces") == 0) {
|
} else if(strcmp(key, "replaces") == 0) {
|
||||||
newpkg->replaces = alpm_list_add(newpkg->replaces, strdup(ptr));
|
alpm_depend_t *replace = _alpm_splitdep(ptr);
|
||||||
|
newpkg->replaces = alpm_list_add(newpkg->replaces, replace);
|
||||||
} else if(strcmp(key, "provides") == 0) {
|
} else if(strcmp(key, "provides") == 0) {
|
||||||
newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr));
|
alpm_depend_t *provide = _alpm_splitdep(ptr);
|
||||||
|
newpkg->provides = alpm_list_add(newpkg->provides, provide);
|
||||||
} else if(strcmp(key, "backup") == 0) {
|
} else if(strcmp(key, "backup") == 0) {
|
||||||
alpm_backup_t *backup;
|
alpm_backup_t *backup;
|
||||||
CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
|
CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
|
||||||
@@ -222,51 +250,98 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void files_merge(alpm_file_t a[], alpm_file_t b[], alpm_file_t c[],
|
/**
|
||||||
size_t m, size_t n)
|
* 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
|
||||||
|
* @param validation successful validations performed on the package file
|
||||||
|
* @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, alpm_pkgvalidation_t *validation)
|
||||||
{
|
{
|
||||||
size_t i = 0, j = 0, k = 0;
|
int has_sig;
|
||||||
while(i < m && j < n) {
|
handle->pm_errno = 0;
|
||||||
if(strcmp(a[i].name, b[j].name) < 0) {
|
|
||||||
c[k++] = a[i++];
|
if(pkgfile == NULL || strlen(pkgfile) == 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* attempt to access the package file, ensure it exists */
|
||||||
|
if(_alpm_access(handle, NULL, pkgfile, R_OK) != 0) {
|
||||||
|
if(errno == ENOENT) {
|
||||||
|
handle->pm_errno = ALPM_ERR_PKG_NOT_FOUND;
|
||||||
|
} else if(errno == EACCES) {
|
||||||
|
handle->pm_errno = ALPM_ERR_BADPERMS;
|
||||||
} else {
|
} else {
|
||||||
c[k++] = b[j++];
|
handle->pm_errno = ALPM_ERR_PKG_OPEN;
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
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)
|
/* can we get away with skipping checksums? */
|
||||||
{
|
has_sig = 0;
|
||||||
alpm_file_t *work;
|
if(level & ALPM_SIG_PACKAGE) {
|
||||||
size_t blocksize = 1;
|
if(syncpkg && syncpkg->base64_sig) {
|
||||||
|
has_sig = 1;
|
||||||
CALLOC(work, n, sizeof(alpm_file_t), return NULL);
|
} else {
|
||||||
|
char *sigpath = _alpm_sigpath(handle, pkgfile);
|
||||||
for(blocksize = 1; blocksize < n; blocksize *= 2) {
|
if(sigpath && !_alpm_access(handle, NULL, sigpath, R_OK)) {
|
||||||
size_t i, max_extent = 0;
|
has_sig = 1;
|
||||||
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,
|
free(sigpath);
|
||||||
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;
|
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_PKG_VALIDATION_MD5SUM) != 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
|
||||||
|
}
|
||||||
|
if(validation) {
|
||||||
|
*validation |= ALPM_PKG_VALIDATION_MD5SUM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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_PKG_VALIDATION_SHA256SUM) != 0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
|
||||||
|
}
|
||||||
|
if(validation) {
|
||||||
|
*validation |= ALPM_PKG_VALIDATION_SHA256SUM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
if(validation && has_sig) {
|
||||||
|
*validation |= ALPM_PKG_VALIDATION_SIGNATURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(validation && !*validation) {
|
||||||
|
*validation = ALPM_PKG_VALIDATION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -274,78 +349,48 @@ static alpm_file_t *files_msort(alpm_file_t *files, size_t n)
|
|||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @param pkgfile path to the package file
|
* @param pkgfile path to the package file
|
||||||
* @param full whether to stop the load after metadata is read or continue
|
* @param full whether to stop the load after metadata is read or continue
|
||||||
* through the full archive
|
* through the full archive
|
||||||
* @return An information filled alpm_pkg_t struct
|
|
||||||
*/
|
*/
|
||||||
alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
|
alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
||||||
int full, const char *md5sum, const char *base64_sig,
|
const char *pkgfile, int full)
|
||||||
alpm_siglevel_t level)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, fd, config = 0;
|
||||||
int config = 0;
|
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
alpm_pkg_t *newpkg = NULL;
|
alpm_pkg_t *newpkg;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
size_t files_count = 0, files_size = 0;
|
size_t files_size = 0;
|
||||||
alpm_file_t *files = NULL;
|
|
||||||
|
|
||||||
if(pkgfile == NULL || strlen(pkgfile) == 0) {
|
if(pkgfile == NULL || strlen(pkgfile) == 0) {
|
||||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attempt to stat the package file, ensure it exists */
|
fd = _alpm_open_archive(handle, pkgfile, &st, &archive, ALPM_ERR_PKG_OPEN);
|
||||||
if(stat(pkgfile, &st) == 0) {
|
if(fd < 0) {
|
||||||
newpkg = _alpm_pkg_new();
|
if(errno == ENOENT) {
|
||||||
if(newpkg == NULL) {
|
handle->pm_errno = ALPM_ERR_PKG_NOT_FOUND;
|
||||||
RET_ERR(handle, ALPM_ERR_MEMORY, NULL);
|
} else if(errno == EACCES) {
|
||||||
|
handle->pm_errno = ALPM_ERR_BADPERMS;
|
||||||
|
} else {
|
||||||
|
handle->pm_errno = ALPM_ERR_PKG_OPEN;
|
||||||
}
|
}
|
||||||
newpkg->filename = strdup(pkgfile);
|
|
||||||
newpkg->size = st.st_size;
|
|
||||||
} else {
|
|
||||||
/* couldn't stat the pkgfile, return an error */
|
|
||||||
RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* first steps- validate the package file */
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "md5sum: %s\n", md5sum);
|
|
||||||
if(md5sum) {
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile);
|
|
||||||
if(_alpm_test_md5sum(pkgfile, md5sum) != 0) {
|
|
||||||
alpm_pkg_free(newpkg);
|
|
||||||
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "base64_sig: %s\n", base64_sig);
|
|
||||||
if(level & ALPM_SIG_PACKAGE &&
|
|
||||||
_alpm_check_pgp_helper(handle, pkgfile, base64_sig,
|
|
||||||
level & ALPM_SIG_PACKAGE_OPTIONAL, level & ALPM_SIG_PACKAGE_MARGINAL_OK,
|
|
||||||
level & ALPM_SIG_PACKAGE_UNKNOWN_OK, ALPM_ERR_PKG_INVALID_SIG)) {
|
|
||||||
_alpm_pkg_free(newpkg);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* next- try to create an archive object to read in the package */
|
newpkg = _alpm_pkg_new();
|
||||||
if((archive = archive_read_new()) == NULL) {
|
if(newpkg == NULL) {
|
||||||
alpm_pkg_free(newpkg);
|
handle->pm_errno = ALPM_ERR_MEMORY;
|
||||||
RET_ERR(handle, ALPM_ERR_LIBARCHIVE, NULL);
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
archive_read_support_compression_all(archive);
|
|
||||||
archive_read_support_format_all(archive);
|
|
||||||
|
|
||||||
if(archive_read_open_filename(archive, pkgfile,
|
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
|
||||||
alpm_pkg_free(newpkg);
|
|
||||||
RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL);
|
|
||||||
}
|
}
|
||||||
|
STRDUP(newpkg->filename, pkgfile,
|
||||||
|
handle->pm_errno = ALPM_ERR_MEMORY; goto error);
|
||||||
|
newpkg->size = st.st_size;
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
|
_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
|
||||||
* as a verfication of integrity and allows us to create the filelist. */
|
* as a verification of integrity and allows us to create the filelist. */
|
||||||
while((ret = archive_read_next_header(archive, &entry)) == ARCHIVE_OK) {
|
while((ret = archive_read_next_header(archive, &entry)) == ARCHIVE_OK) {
|
||||||
const char *entry_name = archive_entry_pathname(entry);
|
const char *entry_name = archive_entry_pathname(entry);
|
||||||
|
|
||||||
@@ -372,28 +417,34 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
|
|||||||
/* 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 if(full) {
|
} else if(full) {
|
||||||
|
const size_t files_count = newpkg->files.count;
|
||||||
|
alpm_file_t *current_file;
|
||||||
/* Keep track of all files for filelist generation */
|
/* Keep track of all files for filelist generation */
|
||||||
if(files_count >= files_size) {
|
if(files_count >= files_size) {
|
||||||
size_t old_size = files_size;
|
size_t old_size = files_size;
|
||||||
|
alpm_file_t *newfiles;
|
||||||
if(files_size == 0) {
|
if(files_size == 0) {
|
||||||
files_size = 4;
|
files_size = 4;
|
||||||
} else {
|
} else {
|
||||||
files_size *= 2;
|
files_size *= 2;
|
||||||
}
|
}
|
||||||
files = realloc(files, sizeof(alpm_file_t) * files_size);
|
newfiles = realloc(newpkg->files.files,
|
||||||
if(!files) {
|
sizeof(alpm_file_t) * files_size);
|
||||||
ALLOC_FAIL(sizeof(alpm_file_t) * files_size);
|
if(!newfiles) {
|
||||||
|
_alpm_alloc_fail(sizeof(alpm_file_t) * files_size);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* ensure all new memory is zeroed out, in both the initial
|
/* ensure all new memory is zeroed out, in both the initial
|
||||||
* allocation and later reallocs */
|
* allocation and later reallocs */
|
||||||
memset(files + old_size, 0,
|
memset(newfiles + old_size, 0,
|
||||||
sizeof(alpm_file_t) * (files_size - old_size));
|
sizeof(alpm_file_t) * (files_size - old_size));
|
||||||
|
newpkg->files.files = newfiles;
|
||||||
}
|
}
|
||||||
STRDUP(files[files_count].name, entry_name, goto error);
|
current_file = newpkg->files.files + files_count;
|
||||||
files[files_count].size = archive_entry_size(entry);
|
STRDUP(current_file->name, entry_name, goto error);
|
||||||
files[files_count].mode = archive_entry_mode(entry);
|
current_file->size = archive_entry_size(entry);
|
||||||
files_count++;
|
current_file->mode = archive_entry_mode(entry);
|
||||||
|
newpkg->files.count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(archive_read_data_skip(archive)) {
|
if(archive_read_data_skip(archive)) {
|
||||||
@@ -409,7 +460,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
|
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occurred */
|
||||||
_alpm_log(handle, ALPM_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));
|
||||||
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
@@ -421,24 +472,30 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
|
|||||||
goto pkg_invalid;
|
goto pkg_invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
|
CLOSE(fd);
|
||||||
|
|
||||||
/* internal fields for package struct */
|
/* internal fields for package struct */
|
||||||
newpkg->origin = PKG_FROM_FILE;
|
newpkg->origin = ALPM_PKG_FROM_FILE;
|
||||||
newpkg->origin_data.file = strdup(pkgfile);
|
newpkg->origin_data.file = strdup(pkgfile);
|
||||||
newpkg->ops = get_file_pkg_ops();
|
newpkg->ops = get_file_pkg_ops();
|
||||||
newpkg->handle = handle;
|
newpkg->handle = handle;
|
||||||
|
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_SCRIPTLET;
|
||||||
|
newpkg->validation = ALPM_PKG_VALIDATION_NONE;
|
||||||
|
|
||||||
if(full) {
|
if(full) {
|
||||||
/* attempt to hand back any memory we don't need */
|
if(newpkg->files.files) {
|
||||||
files = realloc(files, sizeof(alpm_file_t) * files_count);
|
/* attempt to hand back any memory we don't need */
|
||||||
/* "checking for conflicts" requires a sorted list, ensure that here */
|
newpkg->files.files = realloc(newpkg->files.files,
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
|
sizeof(alpm_file_t) * newpkg->files.count);
|
||||||
newpkg->files.files = files_msort(files, files_count);
|
/* "checking for conflicts" requires a sorted list, ensure that here */
|
||||||
newpkg->files.count = files_count;
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_FILES | INFRQ_SCRIPTLET;
|
"sorting package filelist for %s\n", pkgfile);
|
||||||
} else {
|
|
||||||
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_SCRIPTLET;
|
qsort(newpkg->files.files, newpkg->files.count,
|
||||||
|
sizeof(alpm_file_t), _alpm_files_cmp);
|
||||||
|
}
|
||||||
|
newpkg->infolevel |= INFRQ_FILES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newpkg;
|
return newpkg;
|
||||||
@@ -447,22 +504,98 @@ pkg_invalid:
|
|||||||
handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
||||||
error:
|
error:
|
||||||
_alpm_pkg_free(newpkg);
|
_alpm_pkg_free(newpkg);
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
|
if(fd >= 0) {
|
||||||
|
CLOSE(fd);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int read_sigfile(const char *sigpath, unsigned char **sig)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
if(stat(sigpath, &st) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
MALLOC(*sig, st.st_size, return -1);
|
||||||
|
|
||||||
|
if((fp = fopen(sigpath, "rb")) == NULL) {
|
||||||
|
free(*sig);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fread(*sig, st.st_size, 1, fp) != 1) {
|
||||||
|
free(*sig);
|
||||||
|
fclose(fp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
return st.st_size;
|
||||||
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
|
int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
|
||||||
alpm_siglevel_t level, alpm_pkg_t **pkg)
|
alpm_siglevel_t level, alpm_pkg_t **pkg)
|
||||||
{
|
{
|
||||||
|
alpm_pkgvalidation_t validation = 0;
|
||||||
|
char *sigpath;
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
*pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, level);
|
sigpath = _alpm_sigpath(handle, filename);
|
||||||
|
if(sigpath && !_alpm_access(handle, NULL, sigpath, R_OK)) {
|
||||||
|
if(level & ALPM_SIG_PACKAGE) {
|
||||||
|
alpm_list_t *keys = NULL;
|
||||||
|
int fail = 0;
|
||||||
|
unsigned char *sig = NULL;
|
||||||
|
int len = read_sigfile(sigpath, &sig);
|
||||||
|
|
||||||
|
if(len == -1) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("failed to read signature file: %s\n"), sigpath);
|
||||||
|
free(sigpath);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_alpm_extract_keyid(handle, filename, sig, len, &keys) == 0) {
|
||||||
|
alpm_list_t *k;
|
||||||
|
for(k = keys; k; k = k->next) {
|
||||||
|
char *key = k->data;
|
||||||
|
if(_alpm_key_in_keychain(handle, key) == 0) {
|
||||||
|
if(_alpm_key_import(handle, key) == -1) {
|
||||||
|
fail = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FREELIST(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(sig);
|
||||||
|
|
||||||
|
if(fail) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("required key missing from keyring\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(sigpath);
|
||||||
|
|
||||||
|
if(_alpm_pkg_validate_internal(handle, filename, NULL, level, NULL,
|
||||||
|
&validation) == -1) {
|
||||||
|
/* pm_errno is set by pkg_validate */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*pkg = _alpm_pkg_load_internal(handle, 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;
|
||||||
}
|
}
|
||||||
|
(*pkg)->validation = validation;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* be_sync.c : backend for sync databases
|
* be_sync.c : backend for sync databases
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/* libarchive */
|
/* libarchive */
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
@@ -41,13 +42,12 @@
|
|||||||
|
|
||||||
static char *get_sync_dir(alpm_handle_t *handle)
|
static char *get_sync_dir(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
const char *dbpath = alpm_option_get_dbpath(handle);
|
size_t len = strlen(handle->dbpath) + 6;
|
||||||
size_t len = strlen(dbpath) + 6;
|
|
||||||
char *syncpath;
|
char *syncpath;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
sprintf(syncpath, "%s%s", dbpath, "sync/");
|
sprintf(syncpath, "%s%s", handle->dbpath, "sync/");
|
||||||
|
|
||||||
if(stat(syncpath, &buf) != 0) {
|
if(stat(syncpath, &buf) != 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
||||||
@@ -70,37 +70,64 @@ static char *get_sync_dir(alpm_handle_t *handle)
|
|||||||
static int sync_db_validate(alpm_db_t *db)
|
static int sync_db_validate(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
alpm_siglevel_t level;
|
alpm_siglevel_t level;
|
||||||
|
const char *dbpath;
|
||||||
|
|
||||||
if(db->status & DB_STATUS_VALID) {
|
if(db->status & DB_STATUS_VALID || db->status & DB_STATUS_MISSING) {
|
||||||
return 0;
|
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(_alpm_access(db->handle, NULL, dbpath, R_OK) != 0 && errno == ENOENT) {
|
||||||
|
db->status &= ~DB_STATUS_EXISTS;
|
||||||
|
db->status |= DB_STATUS_MISSING;
|
||||||
|
EVENT(db->handle, ALPM_EVENT_DATABASE_MISSING, db->treename, NULL);
|
||||||
|
goto valid;
|
||||||
|
}
|
||||||
|
db->status |= DB_STATUS_EXISTS;
|
||||||
|
db->status &= ~DB_STATUS_MISSING;
|
||||||
|
|
||||||
/* this takes into account the default verification level if UNKNOWN
|
/* this takes into account the default verification level if UNKNOWN
|
||||||
* was assigned to this db */
|
* was assigned to this db */
|
||||||
level = alpm_db_get_siglevel(db);
|
level = alpm_db_get_siglevel(db);
|
||||||
|
|
||||||
if(level & ALPM_SIG_DATABASE) {
|
if(level & ALPM_SIG_DATABASE) {
|
||||||
const char *dbpath = _alpm_db_path(db);
|
int retry, ret;
|
||||||
if(!dbpath) {
|
do {
|
||||||
/* pm_errno set in _alpm_db_path() */
|
retry = 0;
|
||||||
return -1;
|
alpm_siglist_t *siglist;
|
||||||
}
|
ret = _alpm_check_pgp_helper(db->handle, dbpath, NULL,
|
||||||
|
|
||||||
/* we can skip any validation if the database doesn't exist */
|
|
||||||
if(access(dbpath, R_OK) != 0 && errno == ENOENT) {
|
|
||||||
goto valid;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_alpm_check_pgp_helper(db->handle, dbpath, NULL,
|
|
||||||
level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
|
level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
|
||||||
level & ALPM_SIG_DATABASE_UNKNOWN_OK, ALPM_ERR_DB_INVALID_SIG)) {
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
valid:
|
valid:
|
||||||
db->status |= DB_STATUS_VALID;
|
db->status |= DB_STATUS_VALID;
|
||||||
|
db->status &= ~DB_STATUS_INVALID;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +142,7 @@ valid:
|
|||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* @code
|
* @code
|
||||||
* alpm_list_t *syncs = alpm_option_get_syncdbs();
|
* alpm_list_t *syncs = alpm_get_syncdbs();
|
||||||
* for(i = syncs; i; i = alpm_list_next(i)) {
|
* for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
* alpm_db_t *db = alpm_list_getdata(i);
|
* alpm_db_t *db = alpm_list_getdata(i);
|
||||||
* result = alpm_db_update(0, db);
|
* result = alpm_db_update(0, db);
|
||||||
@@ -167,32 +194,37 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
|
|||||||
|
|
||||||
/* attempt to grab a lock */
|
/* attempt to grab a lock */
|
||||||
if(_alpm_handle_lock(handle)) {
|
if(_alpm_handle_lock(handle)) {
|
||||||
|
free(syncpath);
|
||||||
|
umask(oldmask);
|
||||||
RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
|
RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = db->servers; i; i = i->next) {
|
for(i = db->servers; i; i = i->next) {
|
||||||
const char *server = i->data;
|
const char *server = i->data;
|
||||||
struct dload_payload *payload;
|
struct dload_payload payload;
|
||||||
size_t len;
|
size_t len;
|
||||||
int sig_ret = 0;
|
int sig_ret = 0;
|
||||||
|
|
||||||
CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
memset(&payload, 0, sizeof(struct dload_payload));
|
||||||
|
|
||||||
/* set hard upper limit of 25MiB */
|
/* set hard upper limit of 25MiB */
|
||||||
payload->max_size = 25 * 1024 * 1024;
|
payload.max_size = 25 * 1024 * 1024;
|
||||||
|
|
||||||
/* print server + filename into a buffer (leave space for .sig) */
|
/* print server + filename into a buffer */
|
||||||
len = strlen(server) + strlen(db->treename) + 9;
|
len = strlen(server) + strlen(db->treename) + 5;
|
||||||
CALLOC(payload->fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
/* TODO fix leak syncpath and umask unset */
|
||||||
snprintf(payload->fileurl, len, "%s/%s.db", server, db->treename);
|
MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
payload->handle = handle;
|
snprintf(payload.fileurl, len, "%s/%s.db", server, db->treename);
|
||||||
payload->force = force;
|
payload.handle = handle;
|
||||||
|
payload.force = force;
|
||||||
|
payload.unlink_on_fail = 1;
|
||||||
|
|
||||||
ret = _alpm_download(payload, syncpath, NULL);
|
ret = _alpm_download(&payload, syncpath, NULL, NULL);
|
||||||
|
_alpm_dload_payload_reset(&payload);
|
||||||
|
|
||||||
if(ret == 0 && (level & ALPM_SIG_DATABASE)) {
|
if(ret == 0 && (level & ALPM_SIG_DATABASE)) {
|
||||||
/* an existing sig file is no good at this point */
|
/* an existing sig file is no good at this point */
|
||||||
char *sigpath = _alpm_db_sig_path(db);
|
char *sigpath = _alpm_sigpath(handle, _alpm_db_path(db));
|
||||||
if(!sigpath) {
|
if(!sigpath) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
@@ -201,20 +233,24 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
|
|||||||
free(sigpath);
|
free(sigpath);
|
||||||
|
|
||||||
/* if we downloaded a DB, we want the .sig from the same server */
|
/* if we downloaded a DB, we want the .sig from the same server */
|
||||||
snprintf(payload->fileurl, len, "%s/%s.db.sig", server, db->treename);
|
/* print server + filename into a buffer (leave space for .sig) */
|
||||||
payload->handle = handle;
|
len = strlen(server) + strlen(db->treename) + 9;
|
||||||
payload->force = 1;
|
/* TODO fix leak syncpath and umask unset */
|
||||||
payload->errors_ok = (level & ALPM_SIG_DATABASE_OPTIONAL);
|
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 */
|
/* set hard upper limit of 16KiB */
|
||||||
payload->max_size = 16 * 1024;
|
payload.max_size = 16 * 1024;
|
||||||
|
|
||||||
sig_ret = _alpm_download(payload, syncpath, NULL);
|
sig_ret = _alpm_download(&payload, syncpath, NULL, NULL);
|
||||||
/* errors_ok suppresses error messages, but not the return code */
|
/* errors_ok suppresses error messages, but not the return code */
|
||||||
sig_ret = payload->errors_ok ? 0 : sig_ret;
|
sig_ret = payload.errors_ok ? 0 : sig_ret;
|
||||||
|
_alpm_dload_payload_reset(&payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_dload_payload_free(payload);
|
|
||||||
if(ret != -1 && sig_ret != -1) {
|
if(ret != -1 && sig_ret != -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -234,7 +270,12 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
|
|||||||
/* Cache needs to be rebuilt */
|
/* Cache needs to be rebuilt */
|
||||||
_alpm_db_free_pkgcache(db);
|
_alpm_db_free_pkgcache(db);
|
||||||
|
|
||||||
|
/* clear all status flags regarding validity/existence */
|
||||||
db->status &= ~DB_STATUS_VALID;
|
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)) {
|
if(sync_db_validate(db)) {
|
||||||
/* pm_errno should be set */
|
/* pm_errno should be set */
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -244,7 +285,7 @@ cleanup:
|
|||||||
|
|
||||||
if(_alpm_handle_unlock(handle)) {
|
if(_alpm_handle_unlock(handle)) {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
|
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
|
||||||
alpm_option_get_lockfile(handle));
|
handle->lockfile);
|
||||||
}
|
}
|
||||||
free(syncpath);
|
free(syncpath);
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
@@ -255,6 +296,29 @@ cleanup:
|
|||||||
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
struct archive_entry *entry, alpm_pkg_t **likely_pkg);
|
struct archive_entry *entry, alpm_pkg_t **likely_pkg);
|
||||||
|
|
||||||
|
static alpm_pkgvalidation_t _sync_get_validation(alpm_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
if(pkg->validation) {
|
||||||
|
return pkg->validation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pkg->md5sum) {
|
||||||
|
pkg->validation |= ALPM_PKG_VALIDATION_MD5SUM;
|
||||||
|
}
|
||||||
|
if(pkg->sha256sum) {
|
||||||
|
pkg->validation |= ALPM_PKG_VALIDATION_SHA256SUM;
|
||||||
|
}
|
||||||
|
if(pkg->base64_sig) {
|
||||||
|
pkg->validation |= ALPM_PKG_VALIDATION_SIGNATURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!pkg->validation) {
|
||||||
|
pkg->validation |= ALPM_PKG_VALIDATION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkg->validation;
|
||||||
|
}
|
||||||
|
|
||||||
static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
||||||
const char **entry_filename, alpm_pkg_t *likely_pkg)
|
const char **entry_filename, alpm_pkg_t *likely_pkg)
|
||||||
{
|
{
|
||||||
@@ -277,7 +341,8 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(likely_pkg && strcmp(likely_pkg->name, pkgname) == 0) {
|
if(likely_pkg && pkgname_hash == likely_pkg->name_hash
|
||||||
|
&& strcmp(likely_pkg->name, pkgname) == 0) {
|
||||||
pkg = likely_pkg;
|
pkg = likely_pkg;
|
||||||
} else {
|
} else {
|
||||||
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);
|
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);
|
||||||
@@ -292,9 +357,10 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
|||||||
pkg->version = pkgver;
|
pkg->version = pkgver;
|
||||||
pkg->name_hash = pkgname_hash;
|
pkg->name_hash = pkgname_hash;
|
||||||
|
|
||||||
pkg->origin = PKG_FROM_SYNCDB;
|
pkg->origin = ALPM_PKG_FROM_SYNCDB;
|
||||||
pkg->origin_data.db = db;
|
pkg->origin_data.db = db;
|
||||||
pkg->ops = &default_pkg_ops;
|
pkg->ops = &default_pkg_ops;
|
||||||
|
pkg->ops->get_validation = _sync_get_validation;
|
||||||
pkg->handle = db->handle;
|
pkg->handle = db->handle;
|
||||||
|
|
||||||
/* add to the collection */
|
/* add to the collection */
|
||||||
@@ -309,61 +375,38 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
|||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* This function doesn't work as well as one might think, as size of database
|
||||||
* This is the data table used to generate the estimating function below.
|
* entries varies considerably. Adding signatures nearly doubles the size of a
|
||||||
* "Weighted Avg" means averaging the bottom table values; thus each repo, big
|
* single entry; deltas also can make for large variations in size. These
|
||||||
* or small, will have equal influence. "Unweighted Avg" means averaging the
|
* current values are heavily influenced by Arch Linux; databases with no
|
||||||
* sums of the top table columns, thus each package has equal influence. The
|
* deltas and a single signature per package. */
|
||||||
* 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)
|
static size_t estimate_package_count(struct stat *st, struct archive *archive)
|
||||||
{
|
{
|
||||||
unsigned int per_package;
|
int per_package;
|
||||||
|
|
||||||
switch(archive_compression(archive)) {
|
switch(_alpm_archive_filter_code(archive)) {
|
||||||
case ARCHIVE_COMPRESSION_NONE:
|
case ARCHIVE_COMPRESSION_NONE:
|
||||||
per_package = 2564;
|
per_package = 3015;
|
||||||
break;
|
break;
|
||||||
case ARCHIVE_COMPRESSION_GZIP:
|
case ARCHIVE_COMPRESSION_GZIP:
|
||||||
per_package = 191;
|
case ARCHIVE_COMPRESSION_COMPRESS:
|
||||||
|
per_package = 464;
|
||||||
break;
|
break;
|
||||||
case ARCHIVE_COMPRESSION_BZIP2:
|
case ARCHIVE_COMPRESSION_BZIP2:
|
||||||
per_package = 124;
|
per_package = 394;
|
||||||
break;
|
|
||||||
case ARCHIVE_COMPRESSION_COMPRESS:
|
|
||||||
per_package = 193;
|
|
||||||
break;
|
break;
|
||||||
case ARCHIVE_COMPRESSION_LZMA:
|
case ARCHIVE_COMPRESSION_LZMA:
|
||||||
case ARCHIVE_COMPRESSION_XZ:
|
case ARCHIVE_COMPRESSION_XZ:
|
||||||
per_package = 143;
|
per_package = 400;
|
||||||
break;
|
break;
|
||||||
#ifdef ARCHIVE_COMPRESSION_UU
|
#ifdef ARCHIVE_COMPRESSION_UU
|
||||||
case ARCHIVE_COMPRESSION_UU:
|
case ARCHIVE_COMPRESSION_UU:
|
||||||
per_package = 3543;
|
per_package = 3015 * 4 / 3;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
/* assume it is at least somewhat compressed */
|
/* assume it is at least somewhat compressed */
|
||||||
per_package = 200;
|
per_package = 500;
|
||||||
}
|
}
|
||||||
return (size_t)((st->st_size / per_package) + 1);
|
return (size_t)((st->st_size / per_package) + 1);
|
||||||
}
|
}
|
||||||
@@ -372,51 +415,41 @@ static int sync_db_populate(alpm_db_t *db)
|
|||||||
{
|
{
|
||||||
const char *dbpath;
|
const char *dbpath;
|
||||||
size_t est_count;
|
size_t est_count;
|
||||||
int count = 0;
|
int count, fd;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
alpm_pkg_t *pkg = NULL;
|
alpm_pkg_t *pkg = NULL;
|
||||||
|
|
||||||
if((archive = archive_read_new()) == NULL) {
|
if(db->status & DB_STATUS_INVALID) {
|
||||||
RET_ERR(db->handle, ALPM_ERR_LIBARCHIVE, -1);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_support_compression_all(archive);
|
|
||||||
archive_read_support_format_all(archive);
|
|
||||||
|
|
||||||
dbpath = _alpm_db_path(db);
|
dbpath = _alpm_db_path(db);
|
||||||
if(!dbpath) {
|
if(!dbpath) {
|
||||||
/* pm_errno set in _alpm_db_path() */
|
/* pm_errno set in _alpm_db_path() */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "opening database archive %s\n", dbpath);
|
fd = _alpm_open_archive(db->handle, dbpath, &buf,
|
||||||
|
&archive, ALPM_ERR_DB_OPEN);
|
||||||
if(archive_read_open_filename(archive, dbpath,
|
if(fd < 0) {
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
return -1;
|
||||||
_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);
|
est_count = estimate_package_count(&buf, archive);
|
||||||
|
|
||||||
/* initialize hash at 66% full */
|
db->pkgcache = _alpm_pkghash_create(est_count);
|
||||||
db->pkgcache = _alpm_pkghash_create(est_count * 3 / 2);
|
|
||||||
if(db->pkgcache == NULL) {
|
if(db->pkgcache == NULL) {
|
||||||
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
db->handle->pm_errno = ALPM_ERR_MEMORY;
|
||||||
|
count = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||||
const struct stat *st;
|
mode_t mode = archive_entry_mode(entry);
|
||||||
|
if(S_ISDIR(mode)) {
|
||||||
st = archive_entry_stat(entry);
|
|
||||||
|
|
||||||
if(S_ISDIR(st->st_mode)) {
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
/* we have desc, depends or deltas - parse it */
|
/* we have desc, depends or deltas - parse it */
|
||||||
@@ -430,21 +463,53 @@ static int sync_db_populate(alpm_db_t *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
count = alpm_list_count(db->pkgcache->list);
|
count = alpm_list_count(db->pkgcache->list);
|
||||||
|
|
||||||
if(count > 0) {
|
if(count > 0) {
|
||||||
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
|
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,
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
|
"added %d packages to package cache for db '%s'\n",
|
||||||
count, db->treename);
|
count, db->treename);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
_alpm_archive_read_free(archive);
|
||||||
|
if(fd >= 0) {
|
||||||
|
CLOSE(fd);
|
||||||
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function validates %FILENAME%. filename must be between 3 and
|
||||||
|
* PATH_MAX characters and cannot be contain a path */
|
||||||
|
static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
|
||||||
|
const char *filename)
|
||||||
|
{
|
||||||
|
size_t len = strlen(filename);
|
||||||
|
|
||||||
|
if(filename[0] == '.') {
|
||||||
|
errno = EINVAL;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
|
||||||
|
"of package %s is illegal\n"), db->treename, pkgname);
|
||||||
|
return -1;
|
||||||
|
} else if(memchr(filename, '/', len) != NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
|
||||||
|
"of package %s is illegal\n"), db->treename, pkgname);
|
||||||
|
return -1;
|
||||||
|
} else if(len > PATH_MAX) {
|
||||||
|
errno = EINVAL;
|
||||||
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
|
||||||
|
"of package %s is too long\n"), db->treename, pkgname);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#define READ_NEXT() do { \
|
#define READ_NEXT() do { \
|
||||||
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
line = buf.line; \
|
line = buf.line; \
|
||||||
_alpm_strip_newline(line); \
|
_alpm_strip_newline(line, buf.real_line_size); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define READ_AND_STORE(f) do { \
|
#define READ_AND_STORE(f) do { \
|
||||||
@@ -455,11 +520,17 @@ static int sync_db_populate(alpm_db_t *db)
|
|||||||
#define READ_AND_STORE_ALL(f) do { \
|
#define READ_AND_STORE_ALL(f) do { \
|
||||||
char *linedup; \
|
char *linedup; \
|
||||||
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
if(_alpm_strip_newline(buf.line) == 0) break; \
|
if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
|
||||||
STRDUP(linedup, buf.line, goto error); \
|
STRDUP(linedup, buf.line, goto error); \
|
||||||
f = alpm_list_add(f, linedup); \
|
f = alpm_list_add(f, linedup); \
|
||||||
} while(1) /* note the while(1) and not (0) */
|
} 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, buf.real_line_size) == 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,
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
struct archive_entry *entry, alpm_pkg_t **likely_pkg)
|
struct archive_entry *entry, alpm_pkg_t **likely_pkg)
|
||||||
{
|
{
|
||||||
@@ -491,11 +562,14 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
|
if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
|
||||||
|| strcmp(filename, "deltas") == 0) {
|
|| (strcmp(filename, "deltas") == 0 && db->handle->deltaratio > 0.0) ) {
|
||||||
int ret;
|
int ret;
|
||||||
while((ret = _alpm_archive_fgets(archive, &buf)) == ARCHIVE_OK) {
|
while((ret = _alpm_archive_fgets(archive, &buf)) == ARCHIVE_OK) {
|
||||||
char *line = buf.line;
|
char *line = buf.line;
|
||||||
_alpm_strip_newline(line);
|
if(_alpm_strip_newline(line, buf.real_line_size) == 0) {
|
||||||
|
/* length of stripped line was zero */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(strcmp(line, "%NAME%") == 0) {
|
if(strcmp(line, "%NAME%") == 0) {
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
@@ -511,6 +585,9 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
|||||||
}
|
}
|
||||||
} else if(strcmp(line, "%FILENAME%") == 0) {
|
} else if(strcmp(line, "%FILENAME%") == 0) {
|
||||||
READ_AND_STORE(pkg->filename);
|
READ_AND_STORE(pkg->filename);
|
||||||
|
if(_alpm_validate_filename(db, pkg->name, pkg->filename) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
} else if(strcmp(line, "%DESC%") == 0) {
|
} else if(strcmp(line, "%DESC%") == 0) {
|
||||||
READ_AND_STORE(pkg->desc);
|
READ_AND_STORE(pkg->desc);
|
||||||
} else if(strcmp(line, "%GROUPS%") == 0) {
|
} else if(strcmp(line, "%GROUPS%") == 0) {
|
||||||
@@ -527,47 +604,46 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
|||||||
} else if(strcmp(line, "%PACKAGER%") == 0) {
|
} else if(strcmp(line, "%PACKAGER%") == 0) {
|
||||||
READ_AND_STORE(pkg->packager);
|
READ_AND_STORE(pkg->packager);
|
||||||
} else if(strcmp(line, "%CSIZE%") == 0) {
|
} else if(strcmp(line, "%CSIZE%") == 0) {
|
||||||
/* Note: the CSIZE and SIZE fields both share the "size" field in the
|
|
||||||
* pkginfo_t struct. This can be done b/c CSIZE is currently only used
|
|
||||||
* in sync databases, and SIZE is only used in local databases.
|
|
||||||
*/
|
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
pkg->size = atol(line);
|
pkg->size = _alpm_strtoofft(line);
|
||||||
/* also store this value to isize if isize is unset */
|
|
||||||
if(pkg->isize == 0) {
|
|
||||||
pkg->isize = pkg->size;
|
|
||||||
}
|
|
||||||
} else if(strcmp(line, "%ISIZE%") == 0) {
|
} else if(strcmp(line, "%ISIZE%") == 0) {
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
pkg->isize = atol(line);
|
pkg->isize = _alpm_strtoofft(line);
|
||||||
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
||||||
READ_AND_STORE(pkg->md5sum);
|
READ_AND_STORE(pkg->md5sum);
|
||||||
} else if(strcmp(line, "%SHA256SUM%") == 0) {
|
} else if(strcmp(line, "%SHA256SUM%") == 0) {
|
||||||
/* we don't do anything with this value right now */
|
READ_AND_STORE(pkg->sha256sum);
|
||||||
READ_NEXT();
|
|
||||||
} else if(strcmp(line, "%PGPSIG%") == 0) {
|
} else if(strcmp(line, "%PGPSIG%") == 0) {
|
||||||
READ_AND_STORE(pkg->base64_sig);
|
READ_AND_STORE(pkg->base64_sig);
|
||||||
} else if(strcmp(line, "%REPLACES%") == 0) {
|
} else if(strcmp(line, "%REPLACES%") == 0) {
|
||||||
READ_AND_STORE_ALL(pkg->replaces);
|
READ_AND_SPLITDEP(pkg->replaces);
|
||||||
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
||||||
/* Different than the rest because of the _alpm_splitdep call. */
|
READ_AND_SPLITDEP(pkg->depends);
|
||||||
|
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||||
|
READ_AND_SPLITDEP(pkg->optdepends);
|
||||||
|
} else if(strcmp(line, "%MAKEDEPENDS%") == 0) {
|
||||||
|
/* currently unused */
|
||||||
|
while(1) {
|
||||||
|
READ_NEXT();
|
||||||
|
if(strlen(line) == 0) break;
|
||||||
|
}
|
||||||
|
} else if(strcmp(line, "%CHECKDEPENDS%") == 0) {
|
||||||
|
/* currently unused */
|
||||||
while(1) {
|
while(1) {
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
if(strlen(line) == 0) break;
|
if(strlen(line) == 0) break;
|
||||||
pkg->depends = alpm_list_add(pkg->depends, _alpm_splitdep(line));
|
|
||||||
}
|
}
|
||||||
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
|
||||||
READ_AND_STORE_ALL(pkg->optdepends);
|
|
||||||
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||||
READ_AND_STORE_ALL(pkg->conflicts);
|
READ_AND_SPLITDEP(pkg->conflicts);
|
||||||
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||||
READ_AND_STORE_ALL(pkg->provides);
|
READ_AND_SPLITDEP(pkg->provides);
|
||||||
} else if(strcmp(line, "%DELTAS%") == 0) {
|
} else if(strcmp(line, "%DELTAS%") == 0) {
|
||||||
/* Different than the rest because of the _alpm_delta_parse call. */
|
/* Different than the rest because of the _alpm_delta_parse call. */
|
||||||
while(1) {
|
while(1) {
|
||||||
READ_NEXT();
|
READ_NEXT();
|
||||||
if(strlen(line) == 0) break;
|
if(strlen(line) == 0) break;
|
||||||
pkg->deltas = alpm_list_add(pkg->deltas, _alpm_delta_parse(line));
|
pkg->deltas = alpm_list_add(pkg->deltas,
|
||||||
|
_alpm_delta_parse(db->handle, line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -575,6 +651,8 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
*likely_pkg = pkg;
|
*likely_pkg = pkg;
|
||||||
|
} else if(strcmp(filename, "deltas") == 0) {
|
||||||
|
/* skip reading delta files if UseDelta is unset */
|
||||||
} else if(strcmp(filename, "files") == 0) {
|
} else if(strcmp(filename, "files") == 0) {
|
||||||
/* currently do nothing with this file */
|
/* currently do nothing with this file */
|
||||||
} else {
|
} else {
|
||||||
@@ -603,7 +681,7 @@ alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
|||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
||||||
|
|
||||||
#ifndef HAVE_LIBGPGME
|
#ifndef HAVE_LIBGPGME
|
||||||
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
if((level &= ~ALPM_SIG_PACKAGE_SET) != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* conflict.c
|
* conflict.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -22,8 +22,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -40,9 +38,13 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "deps.h"
|
#include "deps.h"
|
||||||
|
#include "filelist.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a new conflict.
|
||||||
|
*/
|
||||||
static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
|
static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
|
||||||
const char *reason)
|
alpm_depend_t *reason)
|
||||||
{
|
{
|
||||||
alpm_conflict_t *conflict;
|
alpm_conflict_t *conflict;
|
||||||
|
|
||||||
@@ -52,19 +54,24 @@ static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
|
|||||||
conflict->package2_hash = pkg2->name_hash;
|
conflict->package2_hash = pkg2->name_hash;
|
||||||
STRDUP(conflict->package1, pkg1->name, return NULL);
|
STRDUP(conflict->package1, pkg1->name, return NULL);
|
||||||
STRDUP(conflict->package2, pkg2->name, return NULL);
|
STRDUP(conflict->package2, pkg2->name, return NULL);
|
||||||
STRDUP(conflict->reason, reason, return NULL);
|
conflict->reason = reason;
|
||||||
|
|
||||||
return conflict;
|
return conflict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Free a conflict and its members.
|
||||||
|
*/
|
||||||
void _alpm_conflict_free(alpm_conflict_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a copy of a conflict.
|
||||||
|
*/
|
||||||
alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
||||||
{
|
{
|
||||||
alpm_conflict_t *newconflict;
|
alpm_conflict_t *newconflict;
|
||||||
@@ -74,11 +81,19 @@ alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
|||||||
newconflict->package2_hash = conflict->package2_hash;
|
newconflict->package2_hash = conflict->package2_hash;
|
||||||
STRDUP(newconflict->package1, conflict->package1, return NULL);
|
STRDUP(newconflict->package1, conflict->package1, return NULL);
|
||||||
STRDUP(newconflict->package2, conflict->package2, return NULL);
|
STRDUP(newconflict->package2, conflict->package2, return NULL);
|
||||||
STRDUP(newconflict->reason, conflict->reason, return NULL);
|
newconflict->reason = conflict->reason;
|
||||||
|
|
||||||
return newconflict;
|
return newconflict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Searches for a conflict in a list.
|
||||||
|
*
|
||||||
|
* @param needle conflict to search for
|
||||||
|
* @param haystack list of conflicts to search
|
||||||
|
*
|
||||||
|
* @return 1 if needle is in haystack, 0 otherwise
|
||||||
|
*/
|
||||||
static int conflict_isin(alpm_conflict_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;
|
||||||
@@ -95,35 +110,43 @@ static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds the pkg1/pkg2 conflict to the baddeps list.
|
/**
|
||||||
|
* @brief Adds the pkg1/pkg2 conflict to the baddeps list.
|
||||||
|
*
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @param baddeps list to add conflict to
|
* @param baddeps list to add conflict to
|
||||||
* @param pkg1 first package
|
* @param pkg1 first package
|
||||||
* @param pkg2 package causing conflict
|
* @param pkg2 package causing conflict
|
||||||
* @param reason reason for this conflict
|
* @param reason reason for this conflict
|
||||||
|
*
|
||||||
|
* @return 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps,
|
static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps,
|
||||||
alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, const char *reason)
|
alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, alpm_depend_t *reason)
|
||||||
{
|
{
|
||||||
alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason);
|
alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason);
|
||||||
if(!conflict) {
|
if(!conflict) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
|
|
||||||
pkg1->name, pkg2->name, reason);
|
|
||||||
if(!conflict_isin(conflict, *baddeps)) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if packages from list1 conflict with packages from list2.
|
/**
|
||||||
* This looks at the conflicts fields of all packages from list1, and sees
|
* @brief Check if packages from list1 conflict with packages from list2.
|
||||||
* if they match packages from list2.
|
*
|
||||||
* If a conflict (pkg1, pkg2) is found, it is added to the baddeps list
|
* @details This looks at the conflicts fields of all packages from list1, and
|
||||||
* in this order if order >= 0, or reverse order (pkg2,pkg1) otherwise.
|
* sees if they match packages from list2. 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.
|
||||||
*
|
*
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @param list1 first list of packages
|
* @param list1 first list of packages
|
||||||
@@ -133,7 +156,8 @@ static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps,
|
|||||||
*/
|
*/
|
||||||
static void check_conflict(alpm_handle_t *handle,
|
static void check_conflict(alpm_handle_t *handle,
|
||||||
alpm_list_t *list1, alpm_list_t *list2,
|
alpm_list_t *list1, alpm_list_t *list2,
|
||||||
alpm_list_t **baddeps, int order) {
|
alpm_list_t **baddeps, int order)
|
||||||
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
if(!baddeps) {
|
if(!baddeps) {
|
||||||
@@ -144,9 +168,8 @@ static void check_conflict(alpm_handle_t *handle,
|
|||||||
alpm_list_t *j;
|
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;
|
alpm_list_t *k;
|
||||||
alpm_depend_t *parsed_conflict = _alpm_splitdep(conflict);
|
|
||||||
|
|
||||||
for(k = list2; k; k = k->next) {
|
for(k = list2; k; k = k->next) {
|
||||||
alpm_pkg_t *pkg2 = k->data;
|
alpm_pkg_t *pkg2 = k->data;
|
||||||
@@ -157,7 +180,7 @@ static void check_conflict(alpm_handle_t *handle,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_alpm_depcmp(pkg2, parsed_conflict)) {
|
if(_alpm_depcmp(pkg2, conflict)) {
|
||||||
if(order >= 0) {
|
if(order >= 0) {
|
||||||
add_conflict(handle, baddeps, pkg1, pkg2, conflict);
|
add_conflict(handle, baddeps, pkg1, pkg2, conflict);
|
||||||
} else {
|
} else {
|
||||||
@@ -165,12 +188,18 @@ static void check_conflict(alpm_handle_t *handle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_alpm_dep_free(parsed_conflict);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for inter-conflicts */
|
/**
|
||||||
|
* @brief Check for inter-conflicts in a list of packages.
|
||||||
|
*
|
||||||
|
* @param handle the context handle
|
||||||
|
* @param packages list of packages to check
|
||||||
|
*
|
||||||
|
* @return list of conflicts
|
||||||
|
*/
|
||||||
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, 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;
|
||||||
@@ -181,9 +210,8 @@ alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages)
|
|||||||
return baddeps;
|
return baddeps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for target vs (db - target) conflicts
|
/**
|
||||||
* In case of conflict the package1 field of pmdepconflict_t contains
|
* @brief Returns a list of conflicts between a db and a list of packages.
|
||||||
* the target package, package2 field contains the local package
|
|
||||||
*/
|
*/
|
||||||
alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages)
|
alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages)
|
||||||
{
|
{
|
||||||
@@ -206,10 +234,12 @@ alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages)
|
|||||||
return baddeps;
|
return baddeps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check the package conflicts in a database
|
/**
|
||||||
|
* @brief Check the package conflicts in a database
|
||||||
*
|
*
|
||||||
* @param handle the context handle
|
* @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 alpm_conflict_t
|
* @return an alpm_list_t of alpm_conflict_t
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle,
|
alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle,
|
||||||
@@ -219,91 +249,37 @@ alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle,
|
|||||||
return _alpm_innerconflicts(handle, pkglist);
|
return _alpm_innerconflicts(handle, pkglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int DIFFERENCE = 0;
|
/**
|
||||||
static const int INTERSECT = 1;
|
* @brief Creates and adds a file conflict to a conflict list.
|
||||||
/* 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:
|
* @param handle the context handle
|
||||||
* DIFFERENCE - a difference operation is performed. filesA - filesB.
|
* @param conflicts the list of conflicts to append to
|
||||||
* INTERSECT - an intersection operation is performed. filesA & filesB.
|
* @param filestr the conflicting file path
|
||||||
*/
|
* @param pkg1 package that wishes to install the file
|
||||||
static alpm_list_t *filelist_operation(alpm_filelist_t *filesA,
|
* @param pkg2 package that currently owns the file, or NULL if unowned
|
||||||
alpm_filelist_t *filesB, int operation)
|
*
|
||||||
{
|
* @return the updated conflict list
|
||||||
alpm_list_t *ret = NULL;
|
|
||||||
size_t ctrA = 0, ctrB = 0;
|
|
||||||
|
|
||||||
while(ctrA < filesA->count && ctrB < filesB->count) {
|
|
||||||
alpm_file_t *fileA = filesA->files + ctrA;
|
|
||||||
alpm_file_t *fileB = filesB->files + ctrB;
|
|
||||||
const char *strA = fileA->name;
|
|
||||||
const char *strB = fileB->name;
|
|
||||||
/* skip directories, we don't care about them */
|
|
||||||
if(strA[strlen(strA)-1] == '/') {
|
|
||||||
ctrA++;
|
|
||||||
} else if(strB[strlen(strB)-1] == '/') {
|
|
||||||
ctrB++;
|
|
||||||
} else {
|
|
||||||
int cmp = strcmp(strA, strB);
|
|
||||||
if(cmp < 0) {
|
|
||||||
if(operation == DIFFERENCE) {
|
|
||||||
/* item only in filesA, qualifies as a difference */
|
|
||||||
ret = alpm_list_add(ret, fileA);
|
|
||||||
}
|
|
||||||
ctrA++;
|
|
||||||
} else if(cmp > 0) {
|
|
||||||
ctrB++;
|
|
||||||
} else {
|
|
||||||
if(operation == INTERSECT) {
|
|
||||||
/* item in both, qualifies as an intersect */
|
|
||||||
ret = alpm_list_add(ret, fileA);
|
|
||||||
}
|
|
||||||
ctrA++;
|
|
||||||
ctrB++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if doing a difference, ensure we have completely emptied pA */
|
|
||||||
while(operation == DIFFERENCE && ctrA < filesA->count) {
|
|
||||||
alpm_file_t *fileA = filesA->files + ctrA;
|
|
||||||
const char *strA = fileA->name;
|
|
||||||
/* skip directories */
|
|
||||||
if(strA[strlen(strA)-1] != '/') {
|
|
||||||
ret = alpm_list_add(ret, fileA);
|
|
||||||
}
|
|
||||||
ctrA++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adds alpm_fileconflict_t to a conflicts list. Pass the conflicts list, type
|
|
||||||
* (either ALPM_FILECONFLICT_TARGET or ALPM_FILECONFLICT_FILESYSTEM), a file
|
|
||||||
* string, and either 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_handle_t *handle,
|
static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
|
||||||
alpm_list_t *conflicts, alpm_fileconflicttype_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)
|
||||||
{
|
{
|
||||||
alpm_fileconflict_t *conflict;
|
alpm_fileconflict_t *conflict;
|
||||||
MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error);
|
MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error);
|
||||||
|
|
||||||
conflict->type = type;
|
STRDUP(conflict->target, pkg1->name, goto error);
|
||||||
STRDUP(conflict->target, name1, goto error);
|
|
||||||
STRDUP(conflict->file, filestr, goto error);
|
STRDUP(conflict->file, filestr, goto error);
|
||||||
if(name2) {
|
if(pkg2) {
|
||||||
STRDUP(conflict->ctarget, name2, goto error);
|
conflict->type = ALPM_FILECONFLICT_TARGET;
|
||||||
|
STRDUP(conflict->ctarget, pkg2->name, goto error);
|
||||||
} else {
|
} else {
|
||||||
|
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
|
||||||
STRDUP(conflict->ctarget, "", goto error);
|
STRDUP(conflict->ctarget, "", goto error);
|
||||||
}
|
}
|
||||||
|
|
||||||
conflicts = alpm_list_add(conflicts, conflict);
|
conflicts = alpm_list_add(conflicts, conflict);
|
||||||
_alpm_log(handle, ALPM_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;
|
||||||
|
|
||||||
@@ -311,6 +287,9 @@ error:
|
|||||||
RET_ERR(handle, ALPM_ERR_MEMORY, conflicts);
|
RET_ERR(handle, ALPM_ERR_MEMORY, conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Frees a conflict and its members.
|
||||||
|
*/
|
||||||
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
||||||
{
|
{
|
||||||
FREE(conflict->ctarget);
|
FREE(conflict->ctarget);
|
||||||
@@ -319,29 +298,58 @@ void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
|||||||
FREE(conflict);
|
FREE(conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
|
/**
|
||||||
const char *name)
|
* @brief Recursively checks if a package owns all subdirectories and files in
|
||||||
{
|
* a directory.
|
||||||
size_t i;
|
*
|
||||||
const alpm_file_t *file = filelist->files;
|
* @param handle the context handle
|
||||||
for(i = 0; i < filelist->count; i++) {
|
* @param dirpath path of the directory to check
|
||||||
if(strcmp(file->name, name) == 0) {
|
* @param pkg package being checked against
|
||||||
return file;
|
*
|
||||||
}
|
* @return 1 if a package owns all subdirectories and files or a directory
|
||||||
file++;
|
* cannot be opened, 0 otherwise
|
||||||
}
|
*/
|
||||||
return NULL;
|
static int dir_belongsto_pkg(alpm_handle_t *handle, const char *dirpath,
|
||||||
}
|
|
||||||
|
|
||||||
static int dir_belongsto_pkg(const char *root, const char *dirpath,
|
|
||||||
alpm_pkg_t *pkg)
|
alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
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;
|
||||||
|
struct dirent *ent = NULL;
|
||||||
|
const char *root = handle->root;
|
||||||
|
|
||||||
|
/* check directory is actually in package - used for subdirectory checks */
|
||||||
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(pkg));
|
||||||
|
if(!alpm_filelist_contains(alpm_pkg_get_files(pkg), dirpath)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"directory %s not in package %s\n", dirpath, pkg->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: this is an overly strict check but currently pacman will not
|
||||||
|
* overwrite a directory with a file (case 10/11 in add.c). Adjusting that
|
||||||
|
* is not simple as even if the directory is being unowned by a conflicting
|
||||||
|
* package, pacman does not sort this to ensure all required directory
|
||||||
|
* "removals" happen before installation of file/symlink */
|
||||||
|
|
||||||
|
/* check that no other _installed_ package owns the directory */
|
||||||
|
for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
|
||||||
|
if(pkg == i->data) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(i->data));
|
||||||
|
if(alpm_filelist_contains(alpm_pkg_get_files(i->data), dirpath)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"file %s also in package %s\n", dirpath,
|
||||||
|
((alpm_pkg_t*)i->data)->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check all files in directory are owned by the package */
|
||||||
snprintf(abspath, PATH_MAX, "%s%s", root, dirpath);
|
snprintf(abspath, PATH_MAX, "%s%s", root, dirpath);
|
||||||
dir = opendir(abspath);
|
dir = opendir(abspath);
|
||||||
if(dir == NULL) {
|
if(dir == NULL) {
|
||||||
@@ -354,23 +362,26 @@ static int dir_belongsto_pkg(const char *root, const char *dirpath,
|
|||||||
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
snprintf(path, PATH_MAX, "%s/%s", dirpath, name);
|
snprintf(path, PATH_MAX, "%s%s", dirpath, name);
|
||||||
snprintf(abspath, PATH_MAX, "%s%s", 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(root, path, pkg)) {
|
if(dir_belongsto_pkg(handle, path, pkg)) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(_alpm_filelist_contains(alpm_pkg_get_files(pkg), path)) {
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(pkg));
|
||||||
|
if(alpm_filelist_contains(alpm_pkg_get_files(pkg), path)) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"unowned file %s found in directory\n", path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,21 +390,38 @@ static int dir_belongsto_pkg(const char *root, const char *dirpath,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find file conflicts that may occur during the transaction with two checks:
|
/**
|
||||||
* 1: check every target against every target
|
* @brief Find file conflicts that may occur during the transaction.
|
||||||
* 2: check every target against the filesystem */
|
*
|
||||||
|
* @details Performs two checks:
|
||||||
|
* 1. check every target against every target
|
||||||
|
* 2. check every target against the filesystem
|
||||||
|
*
|
||||||
|
* @param handle the context handle
|
||||||
|
* @param upgrade list of packages being installed
|
||||||
|
* @param rem list of packages being removed
|
||||||
|
*
|
||||||
|
* @return list of file conflicts
|
||||||
|
*/
|
||||||
alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
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 *rem)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *conflicts = NULL;
|
alpm_list_t *i, *conflicts = NULL;
|
||||||
size_t numtargs = alpm_list_count(upgrade);
|
size_t numtargs = alpm_list_count(upgrade);
|
||||||
size_t current;
|
size_t current;
|
||||||
alpm_trans_t *trans = handle->trans;
|
size_t rootlen;
|
||||||
|
|
||||||
if(!upgrade) {
|
if(!upgrade) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootlen = strlen(handle->root);
|
||||||
|
|
||||||
|
/* make sure all files to be installed have been resolved */
|
||||||
|
for(i = upgrade; i; i = i->next) {
|
||||||
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(i->data));
|
||||||
|
}
|
||||||
|
|
||||||
/* 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
|
||||||
@@ -401,33 +429,49 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||||||
for(current = 0, i = upgrade; i; i = i->next, current++) {
|
for(current = 0, i = upgrade; i; i = i->next, current++) {
|
||||||
alpm_pkg_t *p1 = i->data;
|
alpm_pkg_t *p1 = i->data;
|
||||||
alpm_list_t *j;
|
alpm_list_t *j;
|
||||||
alpm_filelist_t tmpfiles;
|
alpm_list_t *tmpfiles = NULL;
|
||||||
alpm_pkg_t *dbpkg;
|
alpm_pkg_t *dbpkg;
|
||||||
size_t filenum;
|
|
||||||
|
|
||||||
int percent = (current * 100) / numtargs;
|
int percent = (current * 100) / numtargs;
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_CONFLICTS_START, "", percent,
|
PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", percent,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
/* CHECK 1: check every target against every target */
|
/* CHECK 1: check every target against every target */
|
||||||
_alpm_log(handle, ALPM_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) {
|
||||||
alpm_list_t *common_files;
|
alpm_list_t *common_files;
|
||||||
alpm_pkg_t *p2 = j->data;
|
alpm_pkg_t *p2 = j->data;
|
||||||
common_files = filelist_operation(alpm_pkg_get_files(p1),
|
|
||||||
alpm_pkg_get_files(p2), INTERSECT);
|
alpm_filelist_t *p1_files = alpm_pkg_get_files(p1);
|
||||||
|
alpm_filelist_t *p2_files = alpm_pkg_get_files(p2);
|
||||||
|
|
||||||
|
common_files = _alpm_filelist_intersection(p1_files, p2_files);
|
||||||
|
|
||||||
if(common_files) {
|
if(common_files) {
|
||||||
alpm_list_t *k;
|
alpm_list_t *k;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
for(k = common_files; k; k = k->next) {
|
for(k = common_files; k; k = k->next) {
|
||||||
snprintf(path, PATH_MAX, "%s%s", handle->root, (char *)k->data);
|
char *filename = k->data;
|
||||||
conflicts = add_fileconflict(handle, conflicts,
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
||||||
ALPM_FILECONFLICT_TARGET, path,
|
|
||||||
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
/* can skip file-file conflicts when forced *
|
||||||
|
* checking presence in p2_files detects dir-file or file-dir
|
||||||
|
* conflicts as the path from p1 is returned */
|
||||||
|
if((handle->trans->flags & ALPM_TRANS_FLAG_FORCE) &&
|
||||||
|
alpm_filelist_contains(p2_files, filename)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"%s exists in both '%s' and '%s'\n", filename,
|
||||||
|
p1->name, p2->name);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"file-file conflict being forced\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
conflicts = add_fileconflict(handle, conflicts, path, p1, p2);
|
||||||
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
||||||
FREELIST(conflicts);
|
FREELIST(conflicts);
|
||||||
FREELIST(common_files);
|
alpm_list_free(common_files);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -446,64 +490,66 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||||||
* that the former list needs to be freed while the latter list should NOT
|
* that the former list needs to be freed while the latter list should NOT
|
||||||
* be freed. */
|
* be freed. */
|
||||||
if(dbpkg) {
|
if(dbpkg) {
|
||||||
alpm_list_t *difference;
|
|
||||||
/* older ver of package currently installed */
|
/* older ver of package currently installed */
|
||||||
difference = filelist_operation(alpm_pkg_get_files(p1),
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(dbpkg));
|
||||||
alpm_pkg_get_files(dbpkg), DIFFERENCE);
|
tmpfiles = _alpm_filelist_difference(alpm_pkg_get_files(p1),
|
||||||
tmpfiles.count = alpm_list_count(difference);
|
alpm_pkg_get_files(dbpkg));
|
||||||
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_pkg_get_files(p1);
|
alpm_filelist_t *fl = alpm_pkg_get_files(p1);
|
||||||
|
size_t filenum;
|
||||||
|
for(filenum = 0; filenum < fl->count; filenum++) {
|
||||||
|
tmpfiles = alpm_list_add(tmpfiles, fl->resolved_path[filenum]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(filenum = 0; filenum < tmpfiles.count; filenum++) {
|
for(j = tmpfiles; j; j = j->next) {
|
||||||
alpm_file_t *file = tmpfiles.files + filenum;
|
const char *filestr = j->data;
|
||||||
const char *filestr = file->name;
|
|
||||||
const char *relative_path;
|
const char *relative_path;
|
||||||
alpm_list_t *k;
|
alpm_list_t *k;
|
||||||
/* have we acted on this conflict? */
|
/* have we acted on this conflict? */
|
||||||
int resolved_conflict = 0;
|
int resolved_conflict = 0;
|
||||||
struct stat lsbuf;
|
struct stat lsbuf;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
size_t pathlen;
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
|
pathlen = snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
|
||||||
|
|
||||||
/* stat the file - if it exists, do some checks */
|
/* stat the file - if it exists, do some checks */
|
||||||
if(_alpm_lstat(path, &lsbuf) != 0) {
|
if(_alpm_lstat(path, &lsbuf) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(S_ISDIR(file->mode)) {
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
||||||
|
|
||||||
|
if(filestr[strlen(filestr) - 1] == '/') {
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
if(S_ISDIR(lsbuf.st_mode)) {
|
if(S_ISDIR(lsbuf.st_mode)) {
|
||||||
_alpm_log(handle, ALPM_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;
|
continue;
|
||||||
}
|
}
|
||||||
stat(path, &sbuf);
|
stat(path, &sbuf);
|
||||||
if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
"%s is a symlink to a dir, hopefully not a conflict\n", path);
|
"file is a symlink to a dir, hopefully not a conflict\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* if we made it to here, we want all subsequent path comparisons to
|
/* if we made it to here, we want all subsequent path comparisons to
|
||||||
* not include the trailing slash. This allows things like file ->
|
* not include the trailing slash. This allows things like file ->
|
||||||
* directory replacements. */
|
* directory replacements. */
|
||||||
path[strlen(path) - 1] = '\0';
|
path[pathlen - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
relative_path = path + rootlen;
|
||||||
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 = rem; k && !resolved_conflict; k = k->next) {
|
||||||
alpm_pkg_t *rempkg = k->data;
|
alpm_pkg_t *rempkg = k->data;
|
||||||
if(rempkg && _alpm_filelist_contains(alpm_pkg_get_files(rempkg),
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(rempkg));
|
||||||
|
if(rempkg && alpm_filelist_contains(alpm_pkg_get_files(rempkg),
|
||||||
relative_path)) {
|
relative_path)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
"local file will be removed, not a conflict: %s\n", path);
|
"local file will be removed, not a conflict\n");
|
||||||
resolved_conflict = 1;
|
resolved_conflict = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,14 +563,15 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||||||
alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, 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_filelist_contains(alpm_pkg_get_files(localp2), filestr)) {
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(localp2));
|
||||||
|
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 */
|
||||||
handle->trans->skip_remove =
|
handle->trans->skip_remove =
|
||||||
alpm_list_add(handle->trans->skip_remove, strdup(filestr));
|
alpm_list_add(handle->trans->skip_remove, strdup(filestr));
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
"file changed packages, adding to remove skiplist: %s\n", path);
|
"file changed packages, adding to remove skiplist\n");
|
||||||
resolved_conflict = 1;
|
resolved_conflict = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -533,27 +580,29 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||||||
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_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) {
|
if(alpm_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
"check if all files in %s belongs to %s\n",
|
"checking if all files in %s belong to %s\n",
|
||||||
dir, dbpkg->name);
|
dir, dbpkg->name);
|
||||||
resolved_conflict = dir_belongsto_pkg(handle->root, filestr, dbpkg);
|
resolved_conflict = dir_belongsto_pkg(handle, dir, 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, sizeof(char));
|
* and look for it in the old package. note that the actual file under
|
||||||
const char *relative_rpath;
|
* consideration cannot itself be a link, as it might be unowned- path
|
||||||
if(!realpath(path, rpath)) {
|
* components can be safely checked as all directories are "unowned". */
|
||||||
free(rpath);
|
if(!resolved_conflict && dbpkg && !S_ISLNK(lsbuf.st_mode)) {
|
||||||
continue;
|
char rpath[PATH_MAX];
|
||||||
|
if(realpath(path, rpath)) {
|
||||||
|
const char *relative_rpath = rpath + rootlen;
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
relative_rpath = rpath + strlen(handle->root);
|
|
||||||
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
|
|
||||||
resolved_conflict = 1;
|
|
||||||
}
|
|
||||||
free(rpath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is the file unowned and in the backup list of the new package? */
|
/* is the file unowned and in the backup list of the new package? */
|
||||||
@@ -561,36 +610,38 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||||||
alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local);
|
alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local);
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for(k = local_pkgs; k && !found; k = k->next) {
|
for(k = local_pkgs; k && !found; k = k->next) {
|
||||||
if(_alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) {
|
_alpm_filelist_resolve(handle, alpm_pkg_get_files(k->data));
|
||||||
|
if(alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) {
|
if(!found) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
"file was unowned but in new backup list: %s\n", path);
|
"file was unowned but in new backup list\n");
|
||||||
resolved_conflict = 1;
|
resolved_conflict = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* skip file-file conflicts when being forced */
|
||||||
|
if((handle->trans->flags & ALPM_TRANS_FLAG_FORCE) &&
|
||||||
|
!S_ISDIR(lsbuf.st_mode)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"conflict with file on filesystem being forced\n");
|
||||||
|
resolved_conflict = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(!resolved_conflict) {
|
if(!resolved_conflict) {
|
||||||
conflicts = add_fileconflict(handle, conflicts,
|
conflicts = add_fileconflict(handle, conflicts, path, p1, NULL);
|
||||||
ALPM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL);
|
|
||||||
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
||||||
FREELIST(conflicts);
|
FREELIST(conflicts);
|
||||||
if(dbpkg) {
|
alpm_list_free(tmpfiles);
|
||||||
/* only freed if it was generated from filelist_operation() */
|
|
||||||
free(tmpfiles.files);
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dbpkg) {
|
alpm_list_free(tmpfiles);
|
||||||
/* only freed if it was generated from filelist_operation() */
|
|
||||||
free(tmpfiles.files);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_CONFLICTS_START, "", 100,
|
PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", 100,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
return conflicts;
|
return conflicts;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* conflict.h
|
* conflict.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -33,9 +33,6 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||||||
|
|
||||||
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict);
|
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict);
|
||||||
|
|
||||||
const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
|
|
||||||
const char *name);
|
|
||||||
|
|
||||||
#endif /* _ALPM_CONFLICT_H */
|
#endif /* _ALPM_CONFLICT_H */
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
107
lib/libalpm/db.c
107
lib/libalpm/db.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* db.c
|
* db.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -22,8 +22,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -45,7 +43,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** Register a sync database of packages. */
|
/** Register a sync database of packages. */
|
||||||
alpm_db_t SYMEXPORT *alpm_db_register_sync(alpm_handle_t *handle,
|
alpm_db_t SYMEXPORT *alpm_register_syncdb(alpm_handle_t *handle,
|
||||||
const char *treename, alpm_siglevel_t level)
|
const char *treename, alpm_siglevel_t level)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
@@ -70,7 +68,7 @@ void _alpm_db_unregister(alpm_db_t *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Unregister all package databases. */
|
/** Unregister all package databases. */
|
||||||
int SYMEXPORT alpm_db_unregister_all(alpm_handle_t *handle)
|
int SYMEXPORT alpm_unregister_all_syncdbs(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
alpm_db_t *db;
|
alpm_db_t *db;
|
||||||
@@ -109,7 +107,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
|
|||||||
} else {
|
} else {
|
||||||
/* Warning : this function shouldn't be used to unregister all sync
|
/* Warning : this function shouldn't be used to unregister all sync
|
||||||
* databases by walking through the list returned by
|
* databases by walking through the list returned by
|
||||||
* alpm_option_get_syncdbs, because the db is removed from that list here.
|
* alpm_get_syncdbs, because the db is removed from that list here.
|
||||||
*/
|
*/
|
||||||
void *data;
|
void *data;
|
||||||
handle->dbs_sync = alpm_list_remove(handle->dbs_sync,
|
handle->dbs_sync = alpm_list_remove(handle->dbs_sync,
|
||||||
@@ -138,7 +136,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_servers(const alpm_db_t *db)
|
|||||||
int SYMEXPORT alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers)
|
int SYMEXPORT alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
if(db->servers) FREELIST(db->servers);
|
FREELIST(db->servers);
|
||||||
db->servers = servers;
|
db->servers = servers;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -190,6 +188,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
|||||||
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
{
|
{
|
||||||
char *newurl, *vdata = NULL;
|
char *newurl, *vdata = NULL;
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
@@ -200,16 +199,18 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
|||||||
if(!newurl) {
|
if(!newurl) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
||||||
free(newurl);
|
|
||||||
if(vdata) {
|
if(vdata) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n",
|
||||||
db->treename, newurl);
|
db->treename, newurl);
|
||||||
free(vdata);
|
free(vdata);
|
||||||
return 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
free(newurl);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the name of a package database. */
|
/** Get the name of a package database. */
|
||||||
@@ -224,7 +225,7 @@ alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
|
|||||||
{
|
{
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
if(db->siglevel & ALPM_SIG_USE_DEFAULT) {
|
if(db->siglevel & ALPM_SIG_USE_DEFAULT) {
|
||||||
return alpm_option_get_default_siglevel(db->handle);
|
return db->handle->siglevel;
|
||||||
} else {
|
} else {
|
||||||
return db->siglevel;
|
return db->siglevel;
|
||||||
}
|
}
|
||||||
@@ -263,7 +264,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get a group entry from a package database. */
|
/** Get a group entry from a package database. */
|
||||||
alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name)
|
alpm_group_t SYMEXPORT *alpm_db_get_group(alpm_db_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
@@ -283,7 +284,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Searches a database. */
|
/** Searches a database. */
|
||||||
alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles)
|
alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
@@ -291,32 +292,6 @@ alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles)
|
|||||||
return _alpm_db_search(db, needles);
|
return _alpm_db_search(db, needles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set install reason for a package in db. */
|
|
||||||
int SYMEXPORT alpm_db_set_pkgreason(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 */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* set reason (in pkgcache) */
|
|
||||||
pkg->reason = reason;
|
|
||||||
/* write DESC */
|
|
||||||
if(_alpm_local_db_write(handle->db_local, pkg, INFRQ_DESC)) {
|
|
||||||
RET_ERR(handle, ALPM_ERR_DB_WRITE, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -326,7 +301,11 @@ alpm_db_t *_alpm_db_new(const char *treename, int is_local)
|
|||||||
|
|
||||||
CALLOC(db, 1, sizeof(alpm_db_t), return NULL);
|
CALLOC(db, 1, sizeof(alpm_db_t), return NULL);
|
||||||
STRDUP(db->treename, treename, return NULL);
|
STRDUP(db->treename, treename, return NULL);
|
||||||
db->is_local = is_local;
|
if(is_local) {
|
||||||
|
db->status |= DB_STATUS_LOCAL;
|
||||||
|
} else {
|
||||||
|
db->status &= ~DB_STATUS_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
@@ -353,13 +332,13 @@ const char *_alpm_db_path(alpm_db_t *db)
|
|||||||
const char *dbpath;
|
const char *dbpath;
|
||||||
size_t pathsize;
|
size_t pathsize;
|
||||||
|
|
||||||
dbpath = alpm_option_get_dbpath(db->handle);
|
dbpath = db->handle->dbpath;
|
||||||
if(!dbpath) {
|
if(!dbpath) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n"));
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n"));
|
||||||
RET_ERR(db->handle, ALPM_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(db->handle, ALPM_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);
|
||||||
@@ -375,24 +354,10 @@ const char *_alpm_db_path(alpm_db_t *db)
|
|||||||
return db->_path;
|
return db->_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_alpm_db_sig_path(alpm_db_t *db)
|
|
||||||
{
|
|
||||||
char *sigpath;
|
|
||||||
size_t len;
|
|
||||||
const char *dbfile = _alpm_db_path(db);
|
|
||||||
if(!db || !dbfile) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
len = strlen(dbfile) + strlen(".sig") + 1;
|
|
||||||
CALLOC(sigpath, len, sizeof(char), RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
|
|
||||||
sprintf(sigpath, "%s.sig", dbfile);
|
|
||||||
return sigpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_db_cmp(const void *d1, const void *d2)
|
int _alpm_db_cmp(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
alpm_db_t *db1 = (alpm_db_t *)d1;
|
const alpm_db_t *db1 = d1;
|
||||||
alpm_db_t *db2 = (alpm_db_t *)d2;
|
const alpm_db_t *db2 = d2;
|
||||||
return strcmp(db1->treename, db2->treename);
|
return strcmp(db1->treename, db2->treename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +386,7 @@ alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
|
|||||||
for(j = list; j; j = j->next) {
|
for(j = list; j; j = j->next) {
|
||||||
alpm_pkg_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 */
|
||||||
@@ -437,8 +402,9 @@ alpm_list_t *_alpm_db_search(alpm_db_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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -454,8 +420,8 @@ alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(matched != NULL) {
|
if(matched != NULL) {
|
||||||
_alpm_log(db->handle, ALPM_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,9 +483,11 @@ void _alpm_db_free_pkgcache(alpm_db_t *db)
|
|||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
"freeing package cache for repository '%s'\n", db->treename);
|
"freeing package cache for repository '%s'\n", db->treename);
|
||||||
|
|
||||||
alpm_list_free_inner(_alpm_db_get_pkgcache(db),
|
if(db->pkgcache) {
|
||||||
|
alpm_list_free_inner(db->pkgcache->list,
|
||||||
(alpm_list_fn_free)_alpm_pkg_free);
|
(alpm_list_fn_free)_alpm_pkg_free);
|
||||||
_alpm_pkghash_free(db->pkgcache);
|
_alpm_pkghash_free(db->pkgcache);
|
||||||
|
}
|
||||||
db->status &= ~DB_STATUS_PKGCACHE;
|
db->status &= ~DB_STATUS_PKGCACHE;
|
||||||
|
|
||||||
free_groupcache(db);
|
free_groupcache(db);
|
||||||
@@ -562,13 +530,12 @@ int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
newpkg = _alpm_pkg_dup(pkg);
|
if(_alpm_pkg_dup(pkg, &newpkg)) {
|
||||||
if(newpkg == NULL) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
|
||||||
alpm_pkg_get_name(newpkg), db->treename);
|
newpkg->name, db->treename);
|
||||||
db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
|
db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
|
||||||
|
|
||||||
free_groupcache(db);
|
free_groupcache(db);
|
||||||
@@ -585,13 +552,13 @@ int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
|
||||||
alpm_pkg_get_name(pkg), db->treename);
|
pkg->name, db->treename);
|
||||||
|
|
||||||
db->pkgcache = _alpm_pkghash_remove(db->pkgcache, pkg, &data);
|
db->pkgcache = _alpm_pkghash_remove(db->pkgcache, pkg, &data);
|
||||||
if(data == NULL) {
|
if(data == NULL) {
|
||||||
/* package not found */
|
/* package not found */
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
|
||||||
alpm_pkg_get_name(pkg), db->treename);
|
pkg->name, db->treename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* db.h
|
* db.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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,8 +22,6 @@
|
|||||||
#ifndef _ALPM_DB_H
|
#ifndef _ALPM_DB_H
|
||||||
#define _ALPM_DB_H
|
#define _ALPM_DB_H
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
/* libarchive */
|
/* libarchive */
|
||||||
#include <archive.h>
|
#include <archive.h>
|
||||||
#include <archive_entry.h>
|
#include <archive_entry.h>
|
||||||
@@ -47,8 +45,13 @@ typedef enum _alpm_dbinfrq_t {
|
|||||||
/** Database status. Bitflags. */
|
/** Database status. Bitflags. */
|
||||||
enum _alpm_dbstatus_t {
|
enum _alpm_dbstatus_t {
|
||||||
DB_STATUS_VALID = (1 << 0),
|
DB_STATUS_VALID = (1 << 0),
|
||||||
DB_STATUS_PKGCACHE = (1 << 1),
|
DB_STATUS_INVALID = (1 << 1),
|
||||||
DB_STATUS_GRPCACHE = (1 << 2)
|
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 {
|
struct db_operations {
|
||||||
@@ -63,16 +66,13 @@ struct __alpm_db_t {
|
|||||||
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;
|
||||||
/* also indicates whether we are RO or RW */
|
|
||||||
int is_local;
|
|
||||||
/* flags determining validity, loaded caches, etc. */
|
|
||||||
enum _alpm_dbstatus_t status;
|
|
||||||
alpm_pkghash_t *pkgcache;
|
alpm_pkghash_t *pkgcache;
|
||||||
alpm_list_t *grpcache;
|
alpm_list_t *grpcache;
|
||||||
alpm_list_t *servers;
|
alpm_list_t *servers;
|
||||||
alpm_siglevel_t siglevel;
|
|
||||||
|
|
||||||
struct db_operations *ops;
|
struct db_operations *ops;
|
||||||
|
/* flags determining validity, local, loaded caches, etc. */
|
||||||
|
enum _alpm_dbstatus_t status;
|
||||||
|
alpm_siglevel_t siglevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +80,6 @@ struct __alpm_db_t {
|
|||||||
alpm_db_t *_alpm_db_new(const char *treename, int is_local);
|
alpm_db_t *_alpm_db_new(const char *treename, int is_local);
|
||||||
void _alpm_db_free(alpm_db_t *db);
|
void _alpm_db_free(alpm_db_t *db);
|
||||||
const char *_alpm_db_path(alpm_db_t *db);
|
const char *_alpm_db_path(alpm_db_t *db);
|
||||||
char *_alpm_db_sig_path(alpm_db_t *db);
|
|
||||||
int _alpm_db_cmp(const void *d1, const void *d2);
|
int _alpm_db_cmp(const void *d1, const void *d2);
|
||||||
alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
|
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_local(alpm_handle_t *handle);
|
||||||
@@ -92,6 +91,7 @@ void _alpm_db_unregister(alpm_db_t *db);
|
|||||||
int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info);
|
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_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);
|
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 */
|
/* cache bullshit */
|
||||||
/* packages */
|
/* packages */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* delta.c
|
* delta.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h> /* intmax_t */
|
#include <stdint.h> /* intmax_t */
|
||||||
@@ -89,12 +87,28 @@ static void graph_init_size(alpm_handle_t *handle, alpm_list_t *vertices)
|
|||||||
|
|
||||||
/* determine whether the delta file already exists */
|
/* determine whether the delta file already exists */
|
||||||
fpath = _alpm_filecache_find(handle, 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(handle, vdelta->from);
|
fpath = _alpm_filecache_find(handle, vdelta->from);
|
||||||
@@ -249,69 +263,72 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(alpm_pkg_t *pkg)
|
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,
|
||||||
alpm_pkg_get_deltas(pkg),
|
pkg->size * pkg->handle->deltaratio);
|
||||||
alpm_pkg_get_filename(pkg),
|
|
||||||
pkgsize * MAX_DELTA_RATIO);
|
|
||||||
return unused;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
#define NUM_MATCHES 6
|
||||||
|
|
||||||
/** Parses the string representation of a alpm_delta_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 handle the context handle
|
||||||
* @param line the string to parse
|
* @param line the string to parse
|
||||||
* @return A pointer to the new alpm_delta_t object
|
* @return A pointer to the new alpm_delta_t object
|
||||||
*/
|
*/
|
||||||
/* TODO this does not really belong here, but in a parsing lib */
|
alpm_delta_t *_alpm_delta_parse(alpm_handle_t *handle, const char *line)
|
||||||
alpm_delta_t *_alpm_delta_parse(char *line)
|
|
||||||
{
|
{
|
||||||
alpm_delta_t *delta;
|
alpm_delta_t *delta;
|
||||||
char *tmp = line, *tmp2;
|
size_t len;
|
||||||
regex_t reg;
|
regmatch_t pmatch[NUM_MATCHES];
|
||||||
|
char filesize[32];
|
||||||
|
|
||||||
regcomp(®,
|
/* this is so we only have to compile the pattern once */
|
||||||
"^[^[:space:]]* [[:xdigit:]]{32} [[:digit:]]*"
|
if(!handle->delta_regex_compiled) {
|
||||||
" [^[:space:]]* [^[:space:]]*$",
|
/* $deltafile $deltamd5 $deltasize $oldfile $newfile*/
|
||||||
REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
|
regcomp(&handle->delta_regex,
|
||||||
if(regexec(®, line, 0, 0, 0) != 0) {
|
"^([^[:space:]]+) ([[:xdigit:]]{32}) ([[:digit:]]+)"
|
||||||
|
" ([^[:space:]]+) ([^[:space:]]+)$",
|
||||||
|
REG_EXTENDED | REG_NEWLINE);
|
||||||
|
handle->delta_regex_compiled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(regexec(&handle->delta_regex, line, NUM_MATCHES, pmatch, 0) != 0) {
|
||||||
/* delta line is invalid, return NULL */
|
/* delta line is invalid, return NULL */
|
||||||
regfree(®);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
regfree(®);
|
|
||||||
|
|
||||||
CALLOC(delta, 1, sizeof(alpm_delta_t), return NULL);
|
CALLOC(delta, 1, sizeof(alpm_delta_t), return NULL);
|
||||||
|
|
||||||
tmp2 = tmp;
|
/* start at index 1 -- match 0 is the entire match */
|
||||||
tmp = strchr(tmp, ' ');
|
len = pmatch[1].rm_eo - pmatch[1].rm_so;
|
||||||
*(tmp++) = '\0';
|
STRNDUP(delta->delta, &line[pmatch[1].rm_so], len, return NULL);
|
||||||
STRDUP(delta->delta, tmp2, return NULL);
|
|
||||||
|
|
||||||
tmp2 = tmp;
|
len = pmatch[2].rm_eo - pmatch[2].rm_so;
|
||||||
tmp = strchr(tmp, ' ');
|
STRNDUP(delta->delta_md5, &line[pmatch[2].rm_so], len, return NULL);
|
||||||
*(tmp++) = '\0';
|
|
||||||
STRDUP(delta->delta_md5, tmp2, return NULL);
|
|
||||||
|
|
||||||
tmp2 = tmp;
|
len = pmatch[3].rm_eo - pmatch[3].rm_so;
|
||||||
tmp = strchr(tmp, ' ');
|
if(len < sizeof(filesize)) {
|
||||||
*(tmp++) = '\0';
|
strncpy(filesize, &line[pmatch[3].rm_so], len);
|
||||||
delta->delta_size = atol(tmp2);
|
filesize[len] = '\0';
|
||||||
|
delta->delta_size = _alpm_strtoofft(filesize);
|
||||||
|
}
|
||||||
|
|
||||||
tmp2 = tmp;
|
len = pmatch[4].rm_eo - pmatch[4].rm_so;
|
||||||
tmp = strchr(tmp, ' ');
|
STRNDUP(delta->from, &line[pmatch[4].rm_so], len, return NULL);
|
||||||
*(tmp++) = '\0';
|
|
||||||
STRDUP(delta->from, tmp2, return NULL);
|
|
||||||
|
|
||||||
tmp2 = tmp;
|
len = pmatch[5].rm_eo - pmatch[5].rm_so;
|
||||||
STRDUP(delta->to, tmp2, return NULL);
|
STRNDUP(delta->to, &line[pmatch[5].rm_so], len, return NULL);
|
||||||
|
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef NUM_MATCHES
|
||||||
|
|
||||||
void _alpm_delta_free(alpm_delta_t *delta)
|
void _alpm_delta_free(alpm_delta_t *delta)
|
||||||
{
|
{
|
||||||
FREE(delta->delta);
|
FREE(delta->delta);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* delta.h
|
* delta.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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,21 +20,16 @@
|
|||||||
#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"
|
||||||
|
|
||||||
alpm_delta_t *_alpm_delta_parse(char *line);
|
alpm_delta_t *_alpm_delta_parse(alpm_handle_t *handle, const char *line);
|
||||||
void _alpm_delta_free(alpm_delta_t *delta);
|
void _alpm_delta_free(alpm_delta_t *delta);
|
||||||
alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta);
|
alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta);
|
||||||
off_t _alpm_shortest_delta_path(alpm_handle_t *handle, 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);
|
||||||
|
|
||||||
/* 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: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* deps.c
|
* deps.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -20,8 +20,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -41,6 +39,7 @@ void _alpm_dep_free(alpm_depend_t *dep)
|
|||||||
{
|
{
|
||||||
FREE(dep->name);
|
FREE(dep->name);
|
||||||
FREE(dep->version);
|
FREE(dep->version);
|
||||||
|
FREE(dep->desc);
|
||||||
FREE(dep);
|
FREE(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,15 +158,17 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
|
|||||||
else if(nextchild->state == -1) {
|
else if(nextchild->state == -1) {
|
||||||
alpm_pkg_t *vertexpkg = vertex->data;
|
alpm_pkg_t *vertexpkg = vertex->data;
|
||||||
alpm_pkg_t *childpkg = nextchild->data;
|
alpm_pkg_t *childpkg = nextchild->data;
|
||||||
const char *message;
|
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle detected:\n"));
|
_alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle detected:\n"));
|
||||||
if(reverse) {
|
if(reverse) {
|
||||||
message =_("%s will be removed after its %s dependency\n");
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("%s will be removed after its %s dependency\n"),
|
||||||
|
vertexpkg->name, childpkg->name);
|
||||||
} else {
|
} else {
|
||||||
message =_("%s will be installed before its %s dependency\n");
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("%s will be installed before its %s dependency\n"),
|
||||||
|
vertexpkg->name, childpkg->name);
|
||||||
}
|
}
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) {
|
if(!found) {
|
||||||
@@ -204,8 +205,10 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
|
|||||||
|
|
||||||
static int no_dep_version(alpm_handle_t *handle)
|
static int no_dep_version(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
int flags = alpm_trans_get_flags(handle);
|
if(!handle->trans) {
|
||||||
return flags != -1 && (flags & ALPM_TRANS_FLAG_NODEPVERSION);
|
return 0;
|
||||||
|
}
|
||||||
|
return (handle->trans->flags & ALPM_TRANS_FLAG_NODEPVERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static alpm_depend_t *filtered_depend(alpm_depend_t *dep, int nodepversion)
|
static alpm_depend_t *filtered_depend(alpm_depend_t *dep, int nodepversion)
|
||||||
@@ -230,7 +233,7 @@ static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
|
|||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
for(i = pkgs; i; i = alpm_list_next(i)) {
|
for(i = pkgs; i; i = i->next) {
|
||||||
alpm_pkg_t *pkg = i->data;
|
alpm_pkg_t *pkg = i->data;
|
||||||
if(_alpm_depcmp(pkg, dep)) {
|
if(_alpm_depcmp(pkg, dep)) {
|
||||||
return pkg;
|
return pkg;
|
||||||
@@ -266,7 +269,7 @@ alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstri
|
|||||||
* @return an alpm_list_t* of alpm_depmissing_t pointers.
|
* @return an alpm_list_t* of alpm_depmissing_t pointers.
|
||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
|
alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
|
||||||
alpm_list_t *pkglist, alpm_list_t *remove, alpm_list_t *upgrade,
|
alpm_list_t *pkglist, alpm_list_t *rem, alpm_list_t *upgrade,
|
||||||
int reversedeps)
|
int reversedeps)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
@@ -278,7 +281,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
|
|||||||
|
|
||||||
for(i = pkglist; i; i = i->next) {
|
for(i = pkglist; i; i = i->next) {
|
||||||
alpm_pkg_t *pkg = i->data;
|
alpm_pkg_t *pkg = i->data;
|
||||||
if(_alpm_pkg_find(remove, pkg->name) || _alpm_pkg_find(upgrade, pkg->name)) {
|
if(alpm_pkg_find(rem, pkg->name) || alpm_pkg_find(upgrade, pkg->name)) {
|
||||||
modified = alpm_list_add(modified, pkg);
|
modified = alpm_list_add(modified, pkg);
|
||||||
} else {
|
} else {
|
||||||
dblist = alpm_list_add(dblist, pkg);
|
dblist = alpm_list_add(dblist, pkg);
|
||||||
@@ -368,41 +371,38 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod,
|
|||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep)
|
||||||
|
{
|
||||||
|
if(pkg->name_hash != dep->name_hash
|
||||||
|
|| strcmp(pkg->name, dep->name) != 0) {
|
||||||
|
/* skip more expensive checks */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return dep_vercmp(pkg->version, dep->mod, dep->version);
|
||||||
|
}
|
||||||
|
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
int satisfy = 0;
|
int satisfy = _alpm_depcmp_literal(pkg, dep);
|
||||||
|
|
||||||
/* check (pkg->name, pkg->version) */
|
if(satisfy) {
|
||||||
if(pkg->name_hash != dep->name_hash) {
|
return satisfy;
|
||||||
/* skip more expensive checks */
|
|
||||||
} else {
|
|
||||||
satisfy = (strcmp(pkg->name, dep->name) == 0
|
|
||||||
&& dep_vercmp(pkg->version, dep->mod, dep->version));
|
|
||||||
if(satisfy) {
|
|
||||||
return satisfy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check provisions, format : "name=version" */
|
/* check provisions, name and version if available */
|
||||||
for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) {
|
for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) {
|
||||||
const char *provision = i->data;
|
alpm_depend_t *provision = i->data;
|
||||||
const char *provver = strchr(provision, '=');
|
|
||||||
|
|
||||||
if(provver == NULL) { /* no provision version */
|
if(dep->mod == ALPM_DEP_MOD_ANY) {
|
||||||
satisfy = (dep->mod == ALPM_DEP_MOD_ANY
|
/* any version will satisfy the requirement */
|
||||||
&& strcmp(provision, dep->name) == 0);
|
satisfy = (provision->name_hash == dep->name_hash
|
||||||
} else {
|
&& strcmp(provision->name, dep->name) == 0);
|
||||||
/* This is a bit tricker than the old code for performance reasons. To
|
} else if(provision->mod == ALPM_DEP_MOD_EQ) {
|
||||||
* prevent the need to copy and duplicate strings, strncmp only the name
|
/* provision specifies a version, so try it out */
|
||||||
* portion if they are the same length, since there is a version and
|
satisfy = (provision->name_hash == dep->name_hash
|
||||||
* operator in play here. Cast is to silence sign conversion warning;
|
&& strcmp(provision->name, dep->name) == 0
|
||||||
* we know provver >= provision if we are here. */
|
&& dep_vercmp(provision->version, dep->mod, dep->version));
|
||||||
size_t namelen = (size_t)(provver - provision);
|
|
||||||
provver += 1;
|
|
||||||
satisfy = (strlen(dep->name) == namelen
|
|
||||||
&& strncmp(provision, dep->name, namelen) == 0
|
|
||||||
&& dep_vercmp(provver, dep->mod, dep->version));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,42 +412,61 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
|
|||||||
alpm_depend_t *_alpm_splitdep(const char *depstring)
|
alpm_depend_t *_alpm_splitdep(const char *depstring)
|
||||||
{
|
{
|
||||||
alpm_depend_t *depend;
|
alpm_depend_t *depend;
|
||||||
const char *ptr, *version = NULL;
|
const char *ptr, *version, *desc;
|
||||||
|
size_t deplen;
|
||||||
|
|
||||||
if(depstring == NULL) {
|
if(depstring == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALLOC(depend, 1, sizeof(alpm_depend_t), return NULL);
|
MALLOC(depend, sizeof(alpm_depend_t), return NULL);
|
||||||
|
|
||||||
|
/* Note the extra space in ": " to avoid matching the epoch */
|
||||||
|
if((desc = strstr(depstring, ": ")) != NULL) {
|
||||||
|
STRDUP(depend->desc, desc + 2, return NULL);
|
||||||
|
deplen = desc - depstring;
|
||||||
|
} else {
|
||||||
|
/* no description- point desc at NULL at end of string for later use */
|
||||||
|
depend->desc = NULL;
|
||||||
|
deplen = strlen(depstring);
|
||||||
|
desc = depstring + deplen;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find a version comparator if one exists. If it does, set the type and
|
/* Find a version comparator if one exists. If it does, set the type and
|
||||||
* increment the ptr accordingly so we can copy the right strings. */
|
* increment the ptr accordingly so we can copy the right strings. */
|
||||||
if((ptr = strstr(depstring, ">="))) {
|
if((ptr = memchr(depstring, '<', deplen))) {
|
||||||
depend->mod = ALPM_DEP_MOD_GE;
|
if(ptr[1] == '=') {
|
||||||
version = ptr + 2;
|
depend->mod = ALPM_DEP_MOD_LE;
|
||||||
} else if((ptr = strstr(depstring, "<="))) {
|
version = ptr + 2;
|
||||||
depend->mod = ALPM_DEP_MOD_LE;
|
} else {
|
||||||
version = ptr + 2;
|
depend->mod = ALPM_DEP_MOD_LT;
|
||||||
} else if((ptr = strstr(depstring, "="))) {
|
version = ptr + 1;
|
||||||
|
}
|
||||||
|
} else if((ptr = memchr(depstring, '>', deplen))) {
|
||||||
|
if(ptr[1] == '=') {
|
||||||
|
depend->mod = ALPM_DEP_MOD_GE;
|
||||||
|
version = ptr + 2;
|
||||||
|
} else {
|
||||||
|
depend->mod = ALPM_DEP_MOD_GT;
|
||||||
|
version = ptr + 1;
|
||||||
|
}
|
||||||
|
} else if((ptr = memchr(depstring, '=', deplen))) {
|
||||||
/* Note: we must do =,<,> checks after <=, >= checks */
|
/* Note: we must do =,<,> checks after <=, >= checks */
|
||||||
depend->mod = ALPM_DEP_MOD_EQ;
|
depend->mod = ALPM_DEP_MOD_EQ;
|
||||||
version = ptr + 1;
|
version = ptr + 1;
|
||||||
} else if((ptr = strstr(depstring, "<"))) {
|
|
||||||
depend->mod = ALPM_DEP_MOD_LT;
|
|
||||||
version = ptr + 1;
|
|
||||||
} else if((ptr = strstr(depstring, ">"))) {
|
|
||||||
depend->mod = ALPM_DEP_MOD_GT;
|
|
||||||
version = ptr + 1;
|
|
||||||
} else {
|
} else {
|
||||||
/* no version specified, leave version and ptr NULL */
|
/* no version specified, set ptr to end of string and version to NULL */
|
||||||
|
ptr = depstring + deplen;
|
||||||
depend->mod = ALPM_DEP_MOD_ANY;
|
depend->mod = ALPM_DEP_MOD_ANY;
|
||||||
|
depend->version = NULL;
|
||||||
|
version = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the right parts to the right places */
|
/* copy the right parts to the right places */
|
||||||
STRNDUP(depend->name, depstring, ptr - depstring, return NULL);
|
STRNDUP(depend->name, depstring, ptr - depstring, return NULL);
|
||||||
depend->name_hash = _alpm_hash_sdbm(depend->name);
|
depend->name_hash = _alpm_hash_sdbm(depend->name);
|
||||||
if(version) {
|
if(version) {
|
||||||
STRDUP(depend->version, version, return NULL);
|
STRNDUP(depend->version, version, desc - version, return NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return depend;
|
return depend;
|
||||||
@@ -459,8 +478,9 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
|
|||||||
CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
|
CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
|
||||||
|
|
||||||
STRDUP(newdep->name, dep->name, return NULL);
|
STRDUP(newdep->name, dep->name, return NULL);
|
||||||
newdep->name_hash = dep->name_hash;
|
|
||||||
STRDUP(newdep->version, dep->version, return NULL);
|
STRDUP(newdep->version, dep->version, return NULL);
|
||||||
|
STRDUP(newdep->desc, dep->desc, return NULL);
|
||||||
|
newdep->name_hash = dep->name_hash;
|
||||||
newdep->mod = dep->mod;
|
newdep->mod = dep->mod;
|
||||||
|
|
||||||
return newdep;
|
return newdep;
|
||||||
@@ -468,14 +488,14 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
|
|||||||
|
|
||||||
/* These parameters are messy. We check if this package, given a list of
|
/* These parameters are messy. We check if this package, given a list of
|
||||||
* targets and a db is safe to remove. We do NOT remove it if it is in the
|
* targets and a db is safe to remove. We do NOT remove it if it is in the
|
||||||
* target list, or if if the package was explictly installed and
|
* target list, or if the package was explicitly installed and
|
||||||
* include_explicit == 0 */
|
* include_explicit == 0 */
|
||||||
static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
|
static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
|
||||||
alpm_list_t *targets, int include_explicit)
|
alpm_list_t *targets, int include_explicit)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
if(_alpm_pkg_find(targets, pkg->name)) {
|
if(alpm_pkg_find(targets, pkg->name)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +517,7 @@ static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
|
|||||||
/* see if other packages need it */
|
/* see if other packages need it */
|
||||||
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
||||||
alpm_pkg_t *lpkg = i->data;
|
alpm_pkg_t *lpkg = i->data;
|
||||||
if(_alpm_dep_edge(lpkg, pkg) && !_alpm_pkg_find(targets, lpkg->name)) {
|
if(_alpm_dep_edge(lpkg, pkg) && !alpm_pkg_find(targets, lpkg->name)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,13 +535,14 @@ static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
|
|||||||
* @param db package database to do dependency tracing in
|
* @param db package database to do dependency tracing in
|
||||||
* @param *targs pointer to a list of packages
|
* @param *targs pointer to a list of packages
|
||||||
* @param include_explicit if 0, explicitly installed packages are not included
|
* @param include_explicit if 0, explicitly installed packages are not included
|
||||||
|
* @return 0 on success, -1 on errors
|
||||||
*/
|
*/
|
||||||
void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
|
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
|
|
||||||
if(db == NULL || targs == NULL) {
|
if(db == NULL || targs == NULL) {
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = targs; i; i = i->next) {
|
for(i = targs; i; i = i->next) {
|
||||||
@@ -530,13 +551,18 @@ void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
|
|||||||
alpm_pkg_t *deppkg = j->data;
|
alpm_pkg_t *deppkg = j->data;
|
||||||
if(_alpm_dep_edge(pkg, deppkg)
|
if(_alpm_dep_edge(pkg, deppkg)
|
||||||
&& can_remove_package(db, deppkg, targs, include_explicit)) {
|
&& can_remove_package(db, deppkg, targs, include_explicit)) {
|
||||||
|
alpm_pkg_t *copy;
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding '%s' to the targets\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding '%s' to the targets\n",
|
||||||
deppkg->name);
|
deppkg->name);
|
||||||
/* add it to the target list */
|
/* add it to the target list */
|
||||||
targs = alpm_list_add(targs, _alpm_pkg_dup(deppkg));
|
if(_alpm_pkg_dup(deppkg, ©)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
targs = alpm_list_add(targs, copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -564,14 +590,16 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||||||
/* 1. literals */
|
/* 1. literals */
|
||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
||||||
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
if(pkg && _alpm_depcmp_literal(pkg, dep)
|
||||||
|
&& !alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if(prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG, pkg,
|
||||||
NULL, NULL, &install);
|
NULL, NULL, &install);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
|
||||||
|
pkg->name, pkg->version);
|
||||||
}
|
}
|
||||||
if(!install) {
|
if(!install) {
|
||||||
ignored = 1;
|
ignored = 1;
|
||||||
@@ -585,15 +613,18 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
|
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
|
||||||
alpm_pkg_t *pkg = j->data;
|
alpm_pkg_t *pkg = j->data;
|
||||||
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
/* with hash != hash, we can even skip the strcmp() as we know they can't
|
||||||
!_alpm_pkg_find(excluding, pkg->name)) {
|
* possibly be the same string */
|
||||||
|
if(pkg->name_hash != dep->name_hash && _alpm_depcmp(pkg, dep)
|
||||||
|
&& !alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if(prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG,
|
QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG,
|
||||||
pkg, NULL, NULL, &install);
|
pkg, NULL, NULL, &install);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
|
||||||
|
pkg->name, pkg->version);
|
||||||
}
|
}
|
||||||
if(!install) {
|
if(!install) {
|
||||||
ignored = 1;
|
ignored = 1;
|
||||||
@@ -611,7 +642,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||||||
/* first check if one provider is already installed locally */
|
/* first check if one provider is already installed locally */
|
||||||
for(i = providers; i; i = i->next) {
|
for(i = providers; i; i = i->next) {
|
||||||
alpm_pkg_t *pkg = i->data;
|
alpm_pkg_t *pkg = i->data;
|
||||||
if(_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) {
|
if(_alpm_db_get_pkgfromcache(handle->db_local, pkg->name)) {
|
||||||
alpm_list_free(providers);
|
alpm_list_free(providers);
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
@@ -619,14 +650,15 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||||||
count = alpm_list_count(providers);
|
count = alpm_list_count(providers);
|
||||||
if(count >= 1) {
|
if(count >= 1) {
|
||||||
/* default to first provider if there is no QUESTION callback */
|
/* default to first provider if there is no QUESTION callback */
|
||||||
int index = 0;
|
int idx = 0;
|
||||||
if(count > 1) {
|
if(count > 1) {
|
||||||
/* if there is more than one provider, we ask the user */
|
/* if there is more than one provider, we ask the user */
|
||||||
QUESTION(handle->trans, ALPM_TRANS_CONV_SELECT_PROVIDER,
|
QUESTION(handle, ALPM_QUESTION_SELECT_PROVIDER,
|
||||||
providers, dep, NULL, &index);
|
providers, dep, NULL, &idx);
|
||||||
}
|
}
|
||||||
if(index >= 0 && index < count) {
|
if(idx >= 0 && idx < count) {
|
||||||
alpm_pkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index));
|
alpm_list_t *nth = alpm_list_nth(providers, idx);
|
||||||
|
alpm_pkg_t *pkg = nth->data;
|
||||||
alpm_list_free(providers);
|
alpm_list_free(providers);
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
@@ -674,6 +706,7 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
|
|||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
* @param localpkgs is the list of local packages
|
* @param localpkgs is the list of local packages
|
||||||
* @param pkg is the package to resolve
|
* @param pkg is the package to resolve
|
||||||
|
* @param preferred packages to prefer when resolving
|
||||||
* @param packages is a pointer to a list of packages which will be
|
* @param packages is a pointer to a list of packages which will be
|
||||||
* searched first for any dependency packages needed to complete the
|
* searched first for any dependency packages needed to complete the
|
||||||
* resolve, and to which will be added any [pkg] and all of its
|
* resolve, and to which will be added any [pkg] and all of its
|
||||||
@@ -689,24 +722,18 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
|
|||||||
*/
|
*/
|
||||||
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
|
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
|
||||||
alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages,
|
alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages,
|
||||||
alpm_list_t *remove, alpm_list_t **data)
|
alpm_list_t *rem, alpm_list_t **data)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *j;
|
||||||
alpm_list_t *targ;
|
alpm_list_t *targ;
|
||||||
alpm_list_t *deps = NULL;
|
alpm_list_t *deps = NULL;
|
||||||
alpm_list_t *packages_copy;
|
alpm_list_t *packages_copy;
|
||||||
|
|
||||||
if(_alpm_pkg_find(*packages, pkg->name) != NULL) {
|
if(alpm_pkg_find(*packages, pkg->name) != NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(handle->trans->flags & ALPM_TRANS_FLAG_RECURSE) {
|
|
||||||
/* removing local packages from the equation causes the entire dep chain to
|
|
||||||
* get pulled for each target- e.g., pactree -u output */
|
|
||||||
localpkgs = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a copy of the packages list, so that it can be restored
|
/* Create a copy of the packages list, so that it can be restored
|
||||||
on error */
|
on error */
|
||||||
packages_copy = alpm_list_copy(*packages);
|
packages_copy = alpm_list_copy(*packages);
|
||||||
@@ -715,72 +742,49 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
|
|||||||
*packages = alpm_list_add(*packages, pkg);
|
*packages = alpm_list_add(*packages, pkg);
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "started resolving dependencies\n");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "started resolving dependencies\n");
|
||||||
for(i = alpm_list_last(*packages); i; i = i->next) {
|
targ = alpm_list_add(NULL, pkg);
|
||||||
alpm_pkg_t *tpkg = i->data;
|
deps = alpm_checkdeps(handle, localpkgs, rem, targ, 0);
|
||||||
targ = alpm_list_add(NULL, tpkg);
|
alpm_list_free(targ);
|
||||||
deps = alpm_checkdeps(handle, localpkgs, remove, targ, 0);
|
targ = NULL;
|
||||||
alpm_list_free(targ);
|
|
||||||
|
|
||||||
for(j = deps; j; j = j->next) {
|
for(j = deps; j; j = j->next) {
|
||||||
alpm_depmissing_t *miss = j->data;
|
alpm_depmissing_t *miss = j->data;
|
||||||
alpm_depend_t *missdep = miss->depend;
|
alpm_depend_t *missdep = miss->depend;
|
||||||
/* check if one of the packages in the [*packages] list already satisfies
|
/* check if one of the packages in the [*packages] list already satisfies
|
||||||
* this dependency */
|
* this dependency */
|
||||||
if(find_dep_satisfier(*packages, missdep)) {
|
if(find_dep_satisfier(*packages, missdep)) {
|
||||||
_alpm_depmiss_free(miss);
|
_alpm_depmiss_free(miss);
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
/* check if one of the packages in the [preferred] list already satisfies
|
|
||||||
* this dependency */
|
|
||||||
alpm_pkg_t *spkg = find_dep_satisfier(preferred, missdep);
|
|
||||||
if(!spkg) {
|
|
||||||
/* find a satisfier package in the given repositories */
|
|
||||||
spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0);
|
|
||||||
}
|
|
||||||
if(!spkg) {
|
|
||||||
handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS;
|
|
||||||
char *missdepstring = alpm_dep_compute_string(missdep);
|
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
|
||||||
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
|
||||||
missdepstring, tpkg->name);
|
|
||||||
free(missdepstring);
|
|
||||||
if(data) {
|
|
||||||
*data = alpm_list_add(*data, miss);
|
|
||||||
}
|
|
||||||
ret = -1;
|
|
||||||
} else {
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
|
||||||
"pulling dependency %s (needed by %s)\n",
|
|
||||||
spkg->name, tpkg->name);
|
|
||||||
*packages = alpm_list_add(*packages, spkg);
|
|
||||||
_alpm_depmiss_free(miss);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
alpm_list_free(deps);
|
/* check if one of the packages in the [preferred] list already satisfies
|
||||||
}
|
* this dependency */
|
||||||
|
alpm_pkg_t *spkg = find_dep_satisfier(preferred, missdep);
|
||||||
if(handle->trans->flags & ALPM_TRANS_FLAG_NEEDED) {
|
if(!spkg) {
|
||||||
/* remove any deps that were pulled that match installed version */
|
/* find a satisfier package in the given repositories */
|
||||||
/* odd loop syntax so we can modify the list as we iterate */
|
spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0);
|
||||||
i = *packages;
|
}
|
||||||
while(i) {
|
if(spkg && _alpm_resolvedeps(handle, localpkgs, spkg, preferred, packages, rem, data) == 0) {
|
||||||
alpm_pkg_t *tpkg = i->data;
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(
|
"pulling dependency %s (needed by %s)\n",
|
||||||
handle->db_local, tpkg->name);
|
spkg->name, pkg->name);
|
||||||
if(local && _alpm_pkg_compare_versions(tpkg, local) == 0) {
|
_alpm_depmiss_free(miss);
|
||||||
/* with the NEEDED flag, packages up to date are not reinstalled */
|
} else if(resolvedep(handle, missdep, (targ = alpm_list_add(NULL, handle->db_local)), rem, 0)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_depmiss_free(miss);
|
||||||
"not adding dep %s-%s as it is not needed, same version\n",
|
} else {
|
||||||
local->name, local->version);
|
handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS;
|
||||||
j = i;
|
char *missdepstring = alpm_dep_compute_string(missdep);
|
||||||
i = i->next;
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
*packages = alpm_list_remove_item(*packages, j);
|
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
||||||
free(j);
|
missdepstring, pkg->name);
|
||||||
} else {
|
free(missdepstring);
|
||||||
i = i->next;
|
if(data) {
|
||||||
|
*data = alpm_list_add(*data, miss);
|
||||||
}
|
}
|
||||||
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
alpm_list_free(targ);
|
||||||
|
alpm_list_free(deps);
|
||||||
|
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
alpm_list_free(*packages);
|
alpm_list_free(*packages);
|
||||||
@@ -799,7 +803,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
|
|||||||
*/
|
*/
|
||||||
char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
|
char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
const char *name, *opr, *ver;
|
const char *name, *opr, *ver, *desc_delim, *desc;
|
||||||
char *str;
|
char *str;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
@@ -841,12 +845,21 @@ char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
|
|||||||
ver = "";
|
ver = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(dep->desc) {
|
||||||
|
desc_delim = ": ";
|
||||||
|
desc = dep->desc;
|
||||||
|
} else {
|
||||||
|
desc_delim = "";
|
||||||
|
desc = "";
|
||||||
|
}
|
||||||
|
|
||||||
/* we can always compute len and print the string like this because opr
|
/* we can always compute len and print the string like this because opr
|
||||||
* and ver will be empty when ALPM_DEP_MOD_ANY is the depend type. the
|
* and ver will be empty when ALPM_DEP_MOD_ANY is the depend type. the
|
||||||
* reassignments above also ensure we do not do a strlen(NULL). */
|
* reassignments above also ensure we do not do a strlen(NULL). */
|
||||||
len = strlen(name) + strlen(opr) + strlen(ver) + 1;
|
len = strlen(name) + strlen(opr) + strlen(ver)
|
||||||
|
+ strlen(desc_delim) + strlen(desc) + 1;
|
||||||
MALLOC(str, len, return NULL);
|
MALLOC(str, len, return NULL);
|
||||||
snprintf(str, len, "%s%s%s", name, opr, ver);
|
snprintf(str, len, "%s%s%s%s%s", name, opr, ver, desc_delim, desc);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* deps.h
|
* deps.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -31,11 +31,12 @@ void _alpm_dep_free(alpm_depend_t *dep);
|
|||||||
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
|
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
|
||||||
void _alpm_depmiss_free(alpm_depmissing_t *miss);
|
void _alpm_depmiss_free(alpm_depmissing_t *miss);
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
||||||
void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit);
|
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,
|
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_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);
|
||||||
alpm_depend_t *_alpm_splitdep(const char *depstring);
|
alpm_depend_t *_alpm_splitdep(const char *depstring);
|
||||||
|
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
|
|
||||||
#endif /* _ALPM_DEPS_H */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* diskspace.c
|
* diskspace.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2010-2013 Pacman Development Team <pacman-dev@archlinux.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,12 +17,15 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(HAVE_MNTENT_H)
|
#if defined(HAVE_MNTENT_H)
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_SYS_MNTTAB_H)
|
||||||
|
#include <sys/mnttab.h>
|
||||||
|
#endif
|
||||||
#if defined(HAVE_SYS_STATVFS_H)
|
#if defined(HAVE_SYS_STATVFS_H)
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -55,56 +58,107 @@ static int mount_point_cmp(const void *p1, const void *p2)
|
|||||||
return -strcmp(mp1->mount_dir, mp2->mount_dir);
|
return -strcmp(mp1->mount_dir, mp2->mount_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mount_point_list_free(alpm_list_t *mount_points)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
for(i = mount_points; i; i = i->next) {
|
||||||
|
alpm_mountpoint_t *data = i->data;
|
||||||
|
FREE(data->mount_dir);
|
||||||
|
}
|
||||||
|
FREELIST(mount_points);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mount_point_load_fsinfo(alpm_handle_t *handle, alpm_mountpoint_t *mountpoint)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_GETMNTENT)
|
||||||
|
/* grab the filesystem usage */
|
||||||
|
if(statvfs(mountpoint->mount_dir, &(mountpoint->fsp)) != 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("could not get filesystem information for %s: %s\n"),
|
||||||
|
mountpoint->mount_dir, strerror(errno));
|
||||||
|
mountpoint->fsinfo_loaded = MOUNT_FSINFO_FAIL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "loading fsinfo for %s\n", mountpoint->mount_dir);
|
||||||
|
mountpoint->read_only = mountpoint->fsp.f_flag & ST_RDONLY;
|
||||||
|
mountpoint->fsinfo_loaded = MOUNT_FSINFO_LOADED;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
alpm_list_t *mount_points = NULL, *ptr;
|
alpm_list_t *mount_points = NULL, *ptr;
|
||||||
alpm_mountpoint_t *mp;
|
alpm_mountpoint_t *mp;
|
||||||
|
|
||||||
#if defined HAVE_GETMNTENT
|
#if defined(HAVE_GETMNTENT) && defined(HAVE_MNTENT_H)
|
||||||
|
/* Linux */
|
||||||
struct mntent *mnt;
|
struct mntent *mnt;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct statvfs fsp;
|
|
||||||
|
|
||||||
fp = setmntent(MOUNTED, "r");
|
fp = setmntent(MOUNTED, "r");
|
||||||
|
|
||||||
if(fp == NULL) {
|
if(fp == NULL) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not open file: %s: %s\n"),
|
||||||
|
MOUNTED, strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while((mnt = getmntent(fp))) {
|
while((mnt = getmntent(fp))) {
|
||||||
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));
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir = strdup(mnt->mnt_dir);
|
mp->mount_dir = strdup(mnt->mnt_dir);
|
||||||
mp->mount_dir_len = strlen(mp->mount_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);
|
mount_points = alpm_list_add(mount_points, mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
endmntent(fp);
|
endmntent(fp);
|
||||||
#elif defined HAVE_GETMNTINFO
|
#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) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
|
||||||
|
"/etc/mnttab", strerror(errno));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while((ret = getmntent(fp, &mnt)) == 0) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
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;
|
int entries;
|
||||||
FSSTATSTYPE *fsp;
|
FSSTATSTYPE *fsp;
|
||||||
|
|
||||||
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
||||||
|
|
||||||
if(entries < 0) {
|
if(entries < 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("could not get filesystem information\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; entries-- > 0; fsp++) {
|
for(; entries-- > 0; fsp++) {
|
||||||
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(ALPM_ERR_MEMORY, NULL));
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir = strdup(fsp->f_mntonname);
|
mp->mount_dir = strdup(fsp->f_mntonname);
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
||||||
@@ -114,6 +168,9 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
|||||||
mp->read_only = fsp->f_flags & MNT_RDONLY;
|
mp->read_only = fsp->f_flags & MNT_RDONLY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* we don't support lazy loading on this platform */
|
||||||
|
mp->fsinfo_loaded = MOUNT_FSINFO_LOADED;
|
||||||
|
|
||||||
mount_points = alpm_list_add(mount_points, mp);
|
mount_points = alpm_list_add(mount_points, mp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -122,7 +179,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
|||||||
mount_point_cmp);
|
mount_point_cmp);
|
||||||
for(ptr = mount_points; ptr != NULL; ptr = ptr->next) {
|
for(ptr = mount_points; ptr != NULL; ptr = ptr->next) {
|
||||||
mp = ptr->data;
|
mp = ptr->data;
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "mountpoint: %s\n", mp->mount_dir);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "discovered mountpoint: %s\n", mp->mount_dir);
|
||||||
}
|
}
|
||||||
return mount_points;
|
return mount_points;
|
||||||
}
|
}
|
||||||
@@ -135,8 +192,20 @@ static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points,
|
|||||||
for(mp = mount_points; mp != NULL; mp = mp->next) {
|
for(mp = mount_points; mp != NULL; mp = mp->next) {
|
||||||
alpm_mountpoint_t *data = mp->data;
|
alpm_mountpoint_t *data = mp->data;
|
||||||
|
|
||||||
|
/* first, check if the prefix matches */
|
||||||
if(strncmp(data->mount_dir, real_path, data->mount_dir_len) == 0) {
|
if(strncmp(data->mount_dir, real_path, data->mount_dir_len) == 0) {
|
||||||
return data;
|
/* now, the hard work- a file like '/etc/myconfig' shouldn't map to a
|
||||||
|
* mountpoint '/e', but only '/etc'. If the mountpoint ends in a trailing
|
||||||
|
* slash, we know we didn't have a mismatch, otherwise we have to do some
|
||||||
|
* more sanity checks. */
|
||||||
|
if(data->mount_dir[data->mount_dir_len - 1] == '/') {
|
||||||
|
return data;
|
||||||
|
} else if(strlen(real_path) >= data->mount_dir_len) {
|
||||||
|
const char next = real_path[data->mount_dir_len];
|
||||||
|
if(next == '/' || next == '\0') {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +228,7 @@ static int calculate_removed_size(alpm_handle_t *handle,
|
|||||||
alpm_mountpoint_t *mp;
|
alpm_mountpoint_t *mp;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
blkcnt_t remove_size;
|
||||||
const char *filename = file->name;
|
const char *filename = file->name;
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
||||||
@@ -177,9 +247,21 @@ static int calculate_removed_size(alpm_handle_t *handle,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* don't check a mount that we know we can't stat */
|
||||||
|
if(mp && mp->fsinfo_loaded == MOUNT_FSINFO_FAIL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* lazy load filesystem info */
|
||||||
|
if(mp->fsinfo_loaded == MOUNT_FSINFO_UNLOADED) {
|
||||||
|
if(mount_point_load_fsinfo(handle, mp) < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* the addition of (divisor - 1) performs ceil() with integer division */
|
/* the addition of (divisor - 1) performs ceil() with integer division */
|
||||||
mp->blocks_needed -=
|
remove_size = (st.st_size + mp->fsp.f_bsize - 1) / mp->fsp.f_bsize;
|
||||||
(st.st_size + mp->fsp.f_bsize - 1l) / mp->fsp.f_bsize;
|
mp->blocks_needed -= remove_size;
|
||||||
mp->used |= USED_REMOVE;
|
mp->used |= USED_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +282,7 @@ static int calculate_installed_size(alpm_handle_t *handle,
|
|||||||
const alpm_file_t *file = filelist->files + i;
|
const alpm_file_t *file = filelist->files + i;
|
||||||
alpm_mountpoint_t *mp;
|
alpm_mountpoint_t *mp;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
blkcnt_t install_size;
|
||||||
const char *filename = file->name;
|
const char *filename = file->name;
|
||||||
|
|
||||||
/* libarchive reports these as zero size anyways */
|
/* libarchive reports these as zero size anyways */
|
||||||
@@ -211,7 +294,7 @@ static int calculate_installed_size(alpm_handle_t *handle,
|
|||||||
|
|
||||||
/* approximate space requirements for db entries */
|
/* approximate space requirements for db entries */
|
||||||
if(filename[0] == '.') {
|
if(filename[0] == '.') {
|
||||||
filename = alpm_option_get_dbpath(handle);
|
filename = handle->dbpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
|
||||||
@@ -223,15 +306,108 @@ static int calculate_installed_size(alpm_handle_t *handle,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* don't check a mount that we know we can't stat */
|
||||||
|
if(mp && mp->fsinfo_loaded == MOUNT_FSINFO_FAIL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* lazy load filesystem info */
|
||||||
|
if(mp->fsinfo_loaded == MOUNT_FSINFO_UNLOADED) {
|
||||||
|
if(mount_point_load_fsinfo(handle, mp) < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* the addition of (divisor - 1) performs ceil() with integer division */
|
/* the addition of (divisor - 1) performs ceil() with integer division */
|
||||||
mp->blocks_needed +=
|
install_size = (file->size + mp->fsp.f_bsize - 1) / mp->fsp.f_bsize;
|
||||||
(file->size + mp->fsp.f_bsize - 1l) / mp->fsp.f_bsize;
|
mp->blocks_needed += install_size;
|
||||||
mp->used |= USED_INSTALL;
|
mp->used |= USED_INSTALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int check_mountpoint(alpm_handle_t *handle, alpm_mountpoint_t *mp)
|
||||||
|
{
|
||||||
|
/* cushion is roughly min(5% capacity, 20MiB) */
|
||||||
|
fsblkcnt_t fivepc = (mp->fsp.f_blocks / 20) + 1;
|
||||||
|
fsblkcnt_t twentymb = (20 * 1024 * 1024 / mp->fsp.f_bsize) + 1;
|
||||||
|
fsblkcnt_t cushion = fivepc < twentymb ? fivepc : twentymb;
|
||||||
|
blkcnt_t needed = mp->max_blocks_needed + cushion;
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"partition %s, needed %jd, cushion %ju, free %ju\n",
|
||||||
|
mp->mount_dir, (intmax_t)mp->max_blocks_needed,
|
||||||
|
(uintmax_t)cushion, (uintmax_t)mp->fsp.f_bfree);
|
||||||
|
if(needed >= 0 && (fsblkcnt_t)needed > mp->fsp.f_bfree) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("Partition %s too full: %jd blocks needed, %jd blocks free\n"),
|
||||||
|
mp->mount_dir, (intmax_t)needed, (uintmax_t)mp->fsp.f_bfree);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
|
||||||
|
size_t num_files, off_t *file_sizes)
|
||||||
|
{
|
||||||
|
alpm_list_t *mount_points;
|
||||||
|
alpm_mountpoint_t *cachedir_mp;
|
||||||
|
char resolved_cachedir[PATH_MAX];
|
||||||
|
size_t j;
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
/* resolve the cachedir path to ensure we check the right mountpoint. We
|
||||||
|
* handle failures silently, and continue to use the possibly unresolved
|
||||||
|
* path. */
|
||||||
|
if(realpath(cachedir, resolved_cachedir) != NULL) {
|
||||||
|
cachedir = resolved_cachedir;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedir_mp = match_mount_point(mount_points, cachedir);
|
||||||
|
if(cachedir_mp == NULL) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not determine cachedir mount point %s\n"),
|
||||||
|
cachedir);
|
||||||
|
error = 1;
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cachedir_mp->fsinfo_loaded == MOUNT_FSINFO_UNLOADED) {
|
||||||
|
if(mount_point_load_fsinfo(handle, cachedir_mp)) {
|
||||||
|
error = 1;
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* there's no need to check for a R/O mounted filesystem here, as
|
||||||
|
* _alpm_filecache_setup will never give us a non-writable directory */
|
||||||
|
|
||||||
|
/* round up the size of each file to the nearest block and accumulate */
|
||||||
|
for(j = 0; j < num_files; j++) {
|
||||||
|
cachedir_mp->max_blocks_needed += (file_sizes[j] + cachedir_mp->fsp.f_bsize + 1) /
|
||||||
|
cachedir_mp->fsp.f_bsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(check_mountpoint(handle, cachedir_mp)) {
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
|
mount_point_list_free(mount_points);
|
||||||
|
|
||||||
|
if(error) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_DISK_SPACE, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int _alpm_check_diskspace(alpm_handle_t *handle)
|
int _alpm_check_diskspace(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
alpm_list_t *mount_points, *i;
|
alpm_list_t *mount_points, *i;
|
||||||
@@ -251,7 +427,8 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
if(root_mp == NULL) {
|
if(root_mp == NULL) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not determine root mount point %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not determine root mount point %s\n"),
|
||||||
handle->root);
|
handle->root);
|
||||||
return -1;
|
error = 1;
|
||||||
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
replaces = alpm_list_count(trans->remove);
|
replaces = alpm_list_count(trans->remove);
|
||||||
@@ -260,7 +437,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
||||||
alpm_pkg_t *local_pkg;
|
alpm_pkg_t *local_pkg;
|
||||||
int percent = (current * 100) / numtargs;
|
int percent = (current * 100) / numtargs;
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
local_pkg = targ->data;
|
local_pkg = targ->data;
|
||||||
@@ -271,7 +448,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
for(targ = trans->add; targ; targ = targ->next, current++) {
|
for(targ = trans->add; targ; targ = targ->next, current++) {
|
||||||
alpm_pkg_t *pkg, *local_pkg;
|
alpm_pkg_t *pkg, *local_pkg;
|
||||||
int percent = (current * 100) / numtargs;
|
int percent = (current * 100) / numtargs;
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", percent,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
pkg = targ->data;
|
pkg = targ->data;
|
||||||
@@ -282,7 +459,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
}
|
}
|
||||||
calculate_installed_size(handle, mount_points, pkg);
|
calculate_installed_size(handle, mount_points, pkg);
|
||||||
|
|
||||||
for(i = mount_points; i; i = alpm_list_next(i)) {
|
for(i = mount_points; i; i = i->next) {
|
||||||
alpm_mountpoint_t *data = i->data;
|
alpm_mountpoint_t *data = i->data;
|
||||||
if(data->blocks_needed > data->max_blocks_needed) {
|
if(data->blocks_needed > data->max_blocks_needed) {
|
||||||
data->max_blocks_needed = data->blocks_needed;
|
data->max_blocks_needed = data->blocks_needed;
|
||||||
@@ -290,39 +467,22 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGRESS(trans, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", 100,
|
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", 100,
|
||||||
numtargs, current);
|
numtargs, current);
|
||||||
|
|
||||||
for(i = mount_points; i; i = alpm_list_next(i)) {
|
for(i = mount_points; i; i = i->next) {
|
||||||
alpm_mountpoint_t *data = i->data;
|
alpm_mountpoint_t *data = i->data;
|
||||||
if(data->used && data->read_only) {
|
if(data->used && data->read_only) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("Partition %s is mounted read only\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("Partition %s is mounted read only\n"),
|
||||||
data->mount_dir);
|
data->mount_dir);
|
||||||
error = 1;
|
error = 1;
|
||||||
} else if(data->used & USED_INSTALL) {
|
} else if(data->used & USED_INSTALL && check_mountpoint(handle, data)) {
|
||||||
/* cushion is roughly min(5% capacity, 20MiB) */
|
error = 1;
|
||||||
long fivepc = ((long)data->fsp.f_blocks / 20) + 1;
|
|
||||||
long twentymb = (20 * 1024 * 1024 / (long)data->fsp.f_bsize) + 1;
|
|
||||||
long cushion = fivepc < twentymb ? fivepc : twentymb;
|
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n",
|
|
||||||
data->mount_dir, data->max_blocks_needed, cushion,
|
|
||||||
(unsigned long)data->fsp.f_bfree);
|
|
||||||
if(data->max_blocks_needed + cushion >= 0 &&
|
|
||||||
(unsigned long)(data->max_blocks_needed + cushion) > data->fsp.f_bfree) {
|
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("Partition %s too full: %ld blocks needed, %ld blocks free\n"),
|
|
||||||
data->mount_dir, data->max_blocks_needed + cushion,
|
|
||||||
(unsigned long)data->fsp.f_bfree);
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = mount_points; i; i = alpm_list_next(i)) {
|
finish:
|
||||||
alpm_mountpoint_t *data = i->data;
|
mount_point_list_free(mount_points);
|
||||||
FREE(data->mount_dir);
|
|
||||||
}
|
|
||||||
FREELIST(mount_points);
|
|
||||||
|
|
||||||
if(error) {
|
if(error) {
|
||||||
RET_ERR(handle, ALPM_ERR_DISK_SPACE, -1);
|
RET_ERR(handle, ALPM_ERR_DISK_SPACE, -1);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* diskspace.h
|
* diskspace.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2010-2013 Pacman Development Team <pacman-dev@archlinux.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
|
||||||
@@ -26,6 +26,9 @@
|
|||||||
#if defined(HAVE_SYS_STATVFS_H)
|
#if defined(HAVE_SYS_STATVFS_H)
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TYPES_H)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
@@ -34,19 +37,28 @@ enum mount_used_level {
|
|||||||
USED_INSTALL = (1 << 1),
|
USED_INSTALL = (1 << 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum mount_fsinfo {
|
||||||
|
MOUNT_FSINFO_UNLOADED = 0,
|
||||||
|
MOUNT_FSINFO_LOADED,
|
||||||
|
MOUNT_FSINFO_FAIL,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct __alpm_mountpoint_t {
|
typedef struct __alpm_mountpoint_t {
|
||||||
/* mount point information */
|
/* mount point information */
|
||||||
char *mount_dir;
|
char *mount_dir;
|
||||||
size_t mount_dir_len;
|
size_t mount_dir_len;
|
||||||
/* storage for additional disk usage calculations */
|
/* storage for additional disk usage calculations */
|
||||||
long blocks_needed;
|
blkcnt_t blocks_needed;
|
||||||
long max_blocks_needed;
|
blkcnt_t max_blocks_needed;
|
||||||
enum mount_used_level used;
|
enum mount_used_level used;
|
||||||
int read_only;
|
int read_only;
|
||||||
|
enum mount_fsinfo fsinfo_loaded;
|
||||||
FSSTATSTYPE fsp;
|
FSSTATSTYPE fsp;
|
||||||
} alpm_mountpoint_t;
|
} alpm_mountpoint_t;
|
||||||
|
|
||||||
int _alpm_check_diskspace(alpm_handle_t *handle);
|
int _alpm_check_diskspace(alpm_handle_t *handle);
|
||||||
|
int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
|
||||||
|
size_t num_files, off_t *file_sizes);
|
||||||
|
|
||||||
#endif /* _ALPM_DISKSPACE_H */
|
#endif /* _ALPM_DISKSPACE_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* download.c
|
* download.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,18 +18,24 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/socket.h> /* setsockopt, SO_KEEPALIVE */
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
|
#include <netinet/in.h> /* IPPROTO_TCP */
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_NETINET_TCP_H
|
||||||
|
#include <netinet/tcp.h> /* TCP_KEEPINTVL, TCP_KEEPIDLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -43,8 +49,6 @@
|
|||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
static double prevprogress; /* last download amount */
|
|
||||||
|
|
||||||
static const char *get_filename(const char *url)
|
static const char *get_filename(const char *url)
|
||||||
{
|
{
|
||||||
char *filename = strrchr(url, '/');
|
char *filename = strrchr(url, '/');
|
||||||
@@ -60,64 +64,88 @@ static char *get_fullpath(const char *path, const char *filename,
|
|||||||
char *filepath;
|
char *filepath;
|
||||||
/* len = localpath len + filename len + suffix len + null */
|
/* len = localpath len + filename len + suffix len + null */
|
||||||
size_t len = strlen(path) + strlen(filename) + strlen(suffix) + 1;
|
size_t len = strlen(path) + strlen(filename) + strlen(suffix) + 1;
|
||||||
CALLOC(filepath, len, sizeof(char), return NULL);
|
MALLOC(filepath, len, return NULL);
|
||||||
snprintf(filepath, len, "%s%s%s", path, filename, suffix);
|
snprintf(filepath, len, "%s%s%s", path, filename, suffix);
|
||||||
|
|
||||||
return filepath;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define check_stop() if(dload_interrupted) { ret = -1; goto cleanup; }
|
static CURL *get_libcurl_handle(alpm_handle_t *handle)
|
||||||
enum sighandlers { OLD = 0, NEW = 1 };
|
{
|
||||||
|
if(!handle->curl) {
|
||||||
|
curl_global_init(CURL_GLOBAL_SSL);
|
||||||
|
handle->curl = curl_easy_init();
|
||||||
|
}
|
||||||
|
return handle->curl;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ABORT_SIGINT = 1,
|
||||||
|
ABORT_OVER_MAXFILESIZE
|
||||||
|
};
|
||||||
|
|
||||||
static int dload_interrupted;
|
static int dload_interrupted;
|
||||||
static void inthandler(int UNUSED signum)
|
static void inthandler(int UNUSED signum)
|
||||||
{
|
{
|
||||||
dload_interrupted = 1;
|
dload_interrupted = ABORT_SIGINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int curl_progress(void *file, double dltotal, double dlnow,
|
static int dload_progress_cb(void *file, double dltotal, double dlnow,
|
||||||
double UNUSED ultotal, double UNUSED ulnow)
|
double UNUSED ultotal, double UNUSED ulnow)
|
||||||
{
|
{
|
||||||
struct dload_payload *payload = (struct dload_payload *)file;
|
struct dload_payload *payload = (struct dload_payload *)file;
|
||||||
double current_size, total_size;
|
off_t current_size, total_size;
|
||||||
|
|
||||||
|
/* avoid displaying progress bar for redirects with a body */
|
||||||
|
if(payload->respcode >= 300) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* SIGINT sent, abort by alerting curl */
|
/* SIGINT sent, abort by alerting curl */
|
||||||
if(dload_interrupted) {
|
if(dload_interrupted) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current_size = payload->initial_size + (off_t)dlnow;
|
||||||
|
|
||||||
|
/* is our filesize still under any set limit? */
|
||||||
|
if(payload->max_size && current_size > payload->max_size) {
|
||||||
|
dload_interrupted = ABORT_OVER_MAXFILESIZE;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* none of what follows matters if the front end has no callback */
|
/* none of what follows matters if the front end has no callback */
|
||||||
if(payload->handle->dlcb == NULL) {
|
if(payload->handle->dlcb == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_size = payload->initial_size + dlnow;
|
total_size = payload->initial_size + (off_t)dltotal;
|
||||||
total_size = payload->initial_size + dltotal;
|
|
||||||
|
|
||||||
if(DOUBLE_EQ(dltotal, 0) || DOUBLE_EQ(prevprogress, total_size)) {
|
if(DOUBLE_EQ(dltotal, 0.0) || payload->prevprogress == total_size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the progress bar here to avoid displaying it when
|
/* initialize the progress bar here to avoid displaying it when
|
||||||
* a repo is up to date and nothing gets downloaded */
|
* a repo is up to date and nothing gets downloaded */
|
||||||
if(DOUBLE_EQ(prevprogress, 0)) {
|
if(payload->prevprogress == 0) {
|
||||||
payload->handle->dlcb(payload->filename, 0, (long)dltotal);
|
payload->handle->dlcb(payload->remote_name, 0, (off_t)dltotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
payload->handle->dlcb(payload->filename, (long)current_size, (long)total_size);
|
payload->handle->dlcb(payload->remote_name, current_size, total_size);
|
||||||
|
|
||||||
prevprogress = current_size;
|
payload->prevprogress = current_size;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int curl_gethost(const char *url, char *buffer)
|
static int curl_gethost(const char *url, char *buffer, size_t buf_len)
|
||||||
{
|
{
|
||||||
size_t hostlen;
|
size_t hostlen;
|
||||||
char *p;
|
char *p, *q;
|
||||||
|
|
||||||
if(strncmp(url, "file://", 7) == 0) {
|
if(strncmp(url, "file://", 7) == 0) {
|
||||||
strcpy(buffer, _("disk"));
|
p = _("disk");
|
||||||
|
hostlen = strlen(p);
|
||||||
} else {
|
} else {
|
||||||
p = strstr(url, "//");
|
p = strstr(url, "//");
|
||||||
if(!p) {
|
if(!p) {
|
||||||
@@ -125,13 +153,28 @@ static int curl_gethost(const char *url, char *buffer)
|
|||||||
}
|
}
|
||||||
p += 2; /* jump over the found // */
|
p += 2; /* jump over the found // */
|
||||||
hostlen = strcspn(p, "/");
|
hostlen = strcspn(p, "/");
|
||||||
if(hostlen > 255) {
|
|
||||||
/* buffer overflow imminent */
|
/* there might be a user:pass@ on the URL. hide it. avoid using memrchr()
|
||||||
return 1;
|
* for portability concerns. */
|
||||||
|
q = p + hostlen;
|
||||||
|
while(--q > p) {
|
||||||
|
if(*q == '@') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(*q == '@' && p != q) {
|
||||||
|
hostlen -= q - p + 1;
|
||||||
|
p = q + 1;
|
||||||
}
|
}
|
||||||
snprintf(buffer, hostlen + 1, "%s", p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hostlen > buf_len - 1) {
|
||||||
|
/* buffer overflow imminent */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
memcpy(buffer, p, hostlen);
|
||||||
|
buffer[hostlen] = '\0';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,13 +189,22 @@ static int utimes_long(const char *path, long seconds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t parse_headers(void *ptr, size_t size, size_t nmemb, void *user)
|
/* prefix to avoid possible future clash with getumask(3) */
|
||||||
|
static mode_t _getumask(void)
|
||||||
|
{
|
||||||
|
mode_t mask = umask(0);
|
||||||
|
umask(mask);
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *user)
|
||||||
{
|
{
|
||||||
size_t realsize = size * nmemb;
|
size_t realsize = size * nmemb;
|
||||||
const char *fptr, *endptr = NULL;
|
const char *fptr, *endptr = NULL;
|
||||||
const char * const cd_header = "Content-Disposition:";
|
const char * const cd_header = "Content-Disposition:";
|
||||||
const char * const fn_key = "filename=";
|
const char * const fn_key = "filename=";
|
||||||
struct dload_payload *payload = (struct dload_payload *)user;
|
struct dload_payload *payload = (struct dload_payload *)user;
|
||||||
|
long respcode;
|
||||||
|
|
||||||
if(_alpm_raw_ncmp(cd_header, ptr, strlen(cd_header)) == 0) {
|
if(_alpm_raw_ncmp(cd_header, ptr, strlen(cd_header)) == 0) {
|
||||||
if((fptr = strstr(ptr, fn_key))) {
|
if((fptr = strstr(ptr, fn_key))) {
|
||||||
@@ -169,170 +221,318 @@ static size_t parse_headers(void *ptr, size_t size, size_t nmemb, void *user)
|
|||||||
endptr--;
|
endptr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNDUP(payload->cd_filename, fptr, endptr - fptr + 1,
|
STRNDUP(payload->content_disp_name, fptr, endptr - fptr + 1,
|
||||||
RET_ERR(payload->handle, ALPM_ERR_MEMORY, realsize));
|
RET_ERR(payload->handle, ALPM_ERR_MEMORY, realsize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curl_easy_getinfo(payload->handle->curl, CURLINFO_RESPONSE_CODE, &respcode);
|
||||||
|
if(payload->respcode != respcode) {
|
||||||
|
payload->respcode = respcode;
|
||||||
|
}
|
||||||
|
|
||||||
return realsize;
|
return realsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int curl_download_internal(struct dload_payload *payload,
|
static int dload_sockopt_cb(void *userdata, curl_socket_t curlfd,
|
||||||
const char *localpath, char **final_file)
|
curlsocktype purpose)
|
||||||
{
|
{
|
||||||
int ret = -1, should_unlink = 0;
|
alpm_handle_t *handle = userdata;
|
||||||
|
int optval = 1;
|
||||||
|
|
||||||
|
/* this whole method is to prevent FTP control connections from going sour
|
||||||
|
* during a long data transfer; crappy firewalls love to drop otherwise idle
|
||||||
|
* connections if there is no traffic. */
|
||||||
|
if(purpose != CURLSOCKTYPE_IPCXN) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* don't abort operation if any setsockopt fails, just log to debug */
|
||||||
|
if(setsockopt(curlfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&optval,
|
||||||
|
sizeof(optval)) < 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"Failed to set SO_KEEPALIVE on fd %d\n", curlfd);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#ifdef TCP_KEEPIDLE
|
||||||
|
optval = 60;
|
||||||
|
if(setsockopt(curlfd, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&optval,
|
||||||
|
sizeof(optval)) < 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"Failed to set TCP_KEEPIDLE on fd %d\n", curlfd);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_KEEPINTVL
|
||||||
|
optval = 60;
|
||||||
|
if(setsockopt(curlfd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&optval,
|
||||||
|
sizeof(optval)) < 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"Failed to set TCP_KEEPINTVL on fd %d\n", curlfd);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void curl_set_handle_opts(struct dload_payload *payload,
|
||||||
|
CURL *curl, char *error_buffer)
|
||||||
|
{
|
||||||
|
alpm_handle_t *handle = payload->handle;
|
||||||
|
const char *useragent = getenv("HTTP_USER_AGENT");
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
/* the curl_easy handle is initialized with the alpm handle, so we only need
|
||||||
|
* to reset the handle's parameters for each time it's used. */
|
||||||
|
curl_easy_reset(curl);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, dload_progress_cb);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *)payload);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, dload_parseheader_cb);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, dload_sockopt_cb);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SOCKOPTDATA, (void *)handle);
|
||||||
|
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "url: %s\n", payload->fileurl);
|
||||||
|
|
||||||
|
if(payload->max_size) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "maxsize: %jd\n",
|
||||||
|
(intmax_t)payload->max_size);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE,
|
||||||
|
(curl_off_t)payload->max_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(useragent != NULL) {
|
||||||
|
curl_easy_setopt(curl, CURLOPT_USERAGENT, useragent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!payload->allow_resume && !payload->force && payload->destfile_name &&
|
||||||
|
stat(payload->destfile_name, &st) == 0) {
|
||||||
|
/* start from scratch, but only download if our local is out of date. */
|
||||||
|
curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"using time condition: %lu\n", (long)st.st_mtime);
|
||||||
|
} else if(stat(payload->tempfile_name, &st) == 0 && payload->allow_resume) {
|
||||||
|
/* a previous partial download exists, resume from end of file. */
|
||||||
|
payload->tempfile_openmode = "ab";
|
||||||
|
curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)st.st_size);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"tempfile found, attempting continuation from %jd bytes\n",
|
||||||
|
(intmax_t)st.st_size);
|
||||||
|
payload->initial_size = st.st_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mask_signal(int signum, void (*handler)(int),
|
||||||
|
struct sigaction *origaction)
|
||||||
|
{
|
||||||
|
struct sigaction newaction;
|
||||||
|
|
||||||
|
newaction.sa_handler = handler;
|
||||||
|
sigemptyset(&newaction.sa_mask);
|
||||||
|
newaction.sa_flags = 0;
|
||||||
|
|
||||||
|
sigaction(signum, NULL, origaction);
|
||||||
|
sigaction(signum, &newaction, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unmask_signal(int signum, struct sigaction *sa)
|
||||||
|
{
|
||||||
|
sigaction(signum, sa, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FILE *create_tempfile(struct dload_payload *payload, const char *localpath)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
FILE *fp;
|
||||||
|
char *randpath;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
/* create a random filename, which is opened with O_EXCL */
|
||||||
|
len = strlen(localpath) + 14 + 1;
|
||||||
|
MALLOC(randpath, len, RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
|
||||||
|
snprintf(randpath, len, "%salpmtmp.XXXXXX", localpath);
|
||||||
|
if((fd = mkstemp(randpath)) == -1 ||
|
||||||
|
fchmod(fd, ~(_getumask()) & 0666) ||
|
||||||
|
!(fp = fdopen(fd, payload->tempfile_openmode))) {
|
||||||
|
unlink(randpath);
|
||||||
|
CLOSE(fd);
|
||||||
|
_alpm_log(payload->handle, ALPM_LOG_ERROR,
|
||||||
|
_("failed to create temporary file for download\n"));
|
||||||
|
free(randpath);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* fp now points to our alpmtmp.XXXXXX */
|
||||||
|
free(payload->tempfile_name);
|
||||||
|
payload->tempfile_name = randpath;
|
||||||
|
free(payload->remote_name);
|
||||||
|
STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
|
||||||
|
RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
return fp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RFC1123 states applications should support this length */
|
||||||
|
#define HOSTNAME_SIZE 256
|
||||||
|
|
||||||
|
static int curl_download_internal(struct dload_payload *payload,
|
||||||
|
const char *localpath, char **final_file, char **final_url)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
FILE *localf = NULL;
|
FILE *localf = NULL;
|
||||||
const char *useragent;
|
char *effective_url;
|
||||||
const char *open_mode = "wb";
|
char hostname[HOSTNAME_SIZE];
|
||||||
char *destfile = NULL, *tempfile = NULL, *effective_url;
|
char error_buffer[CURL_ERROR_SIZE] = {0};
|
||||||
/* RFC1123 states applications should support this length */
|
|
||||||
char hostname[256];
|
|
||||||
char error_buffer[CURL_ERROR_SIZE];
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
long timecond, remote_time = -1;
|
long timecond, remote_time = -1;
|
||||||
double remote_size, bytes_dl;
|
double remote_size, bytes_dl;
|
||||||
struct sigaction sig_pipe[2], sig_int[2];
|
struct sigaction orig_sig_pipe, orig_sig_int;
|
||||||
/* shortcut to our handle within the payload */
|
/* shortcut to our handle within the payload */
|
||||||
alpm_handle_t *handle = payload->handle;
|
alpm_handle_t *handle = payload->handle;
|
||||||
|
CURL *curl = get_libcurl_handle(handle);
|
||||||
|
handle->pm_errno = 0;
|
||||||
|
|
||||||
if(!payload->filename) {
|
/* make sure these are NULL */
|
||||||
payload->filename = get_filename(payload->fileurl);
|
FREE(payload->tempfile_name);
|
||||||
|
FREE(payload->destfile_name);
|
||||||
|
FREE(payload->content_disp_name);
|
||||||
|
|
||||||
|
payload->tempfile_openmode = "wb";
|
||||||
|
if(!payload->remote_name) {
|
||||||
|
STRDUP(payload->remote_name, get_filename(payload->fileurl),
|
||||||
|
RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
}
|
}
|
||||||
if(!payload->filename || curl_gethost(payload->fileurl, hostname) != 0) {
|
if(curl_gethost(payload->fileurl, hostname, sizeof(hostname)) != 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
|
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
|
||||||
RET_ERR(handle, ALPM_ERR_SERVER_BAD_URL, -1);
|
RET_ERR(handle, ALPM_ERR_SERVER_BAD_URL, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(payload->filename) > 0 && strcmp(payload->filename, ".sig") != 0) {
|
if(payload->remote_name && strlen(payload->remote_name) > 0 &&
|
||||||
destfile = get_fullpath(localpath, payload->filename, "");
|
strcmp(payload->remote_name, ".sig") != 0) {
|
||||||
tempfile = get_fullpath(localpath, payload->filename, ".part");
|
payload->destfile_name = get_fullpath(localpath, payload->remote_name, "");
|
||||||
if(!destfile || !tempfile) {
|
payload->tempfile_name = get_fullpath(localpath, payload->remote_name, ".part");
|
||||||
|
if(!payload->destfile_name || !payload->tempfile_name) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* URL isn't to a file and ended with a slash */
|
/* URL doesn't contain a filename, so make a tempfile. We can't support
|
||||||
int fd;
|
* resuming this kind of download; partial transfers will be destroyed */
|
||||||
char randpath[PATH_MAX];
|
payload->unlink_on_fail = 1;
|
||||||
|
|
||||||
/* we can't support resuming this kind of download, so a partial transfer
|
localf = create_tempfile(payload, localpath);
|
||||||
* will be destroyed */
|
|
||||||
should_unlink = 1;
|
|
||||||
|
|
||||||
/* create a random filename, which is opened with O_EXCL */
|
|
||||||
snprintf(randpath, PATH_MAX, "%salpmtmp.XXXXXX", localpath);
|
|
||||||
if((fd = mkstemp(randpath)) == -1 || !(localf = fdopen(fd, open_mode))) {
|
|
||||||
unlink(randpath);
|
|
||||||
close(fd);
|
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
|
||||||
_("failed to create temporary file for download\n"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
/* localf now points to our alpmtmp.XXXXXX */
|
|
||||||
STRDUP(tempfile, randpath, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
|
||||||
payload->filename = strrchr(randpath, '/') + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_buffer[0] = '\0';
|
|
||||||
|
|
||||||
/* the curl_easy handle is initialized with the alpm handle, so we only need
|
|
||||||
* to reset the curl handle set parameters for each time it's used. */
|
|
||||||
curl_easy_reset(handle->curl);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_URL, payload->fileurl);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_FAILONERROR, 1L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_ERRORBUFFER, error_buffer);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_CONNECTTIMEOUT, 10L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_FILETIME, 1L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_NOPROGRESS, 0L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)payload);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 1024L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_HEADERFUNCTION, parse_headers);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_WRITEHEADER, (void *)payload);
|
|
||||||
|
|
||||||
if(payload->max_size) {
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_MAXFILESIZE, payload->max_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
useragent = getenv("HTTP_USER_AGENT");
|
|
||||||
if(useragent != NULL) {
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!payload->allow_resume && !payload->force && stat(destfile, &st) == 0) {
|
|
||||||
/* start from scratch, but only download if our local is out of date. */
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
|
|
||||||
} else if(stat(tempfile, &st) == 0 && payload->allow_resume) {
|
|
||||||
/* a previous partial download exists, resume from end of file. */
|
|
||||||
open_mode = "ab";
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_RESUME_FROM, (long)st.st_size);
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "tempfile found, attempting continuation\n");
|
|
||||||
payload->initial_size = (double)st.st_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(localf == NULL) {
|
|
||||||
localf = fopen(tempfile, open_mode);
|
|
||||||
if(localf == NULL) {
|
if(localf == NULL) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_WRITEDATA, localf);
|
curl_set_handle_opts(payload, curl, error_buffer);
|
||||||
|
|
||||||
/* ignore any SIGPIPE signals- these may occur if our FTP socket dies or
|
if(localf == NULL) {
|
||||||
* something along those lines. Store the old signal handler first. */
|
localf = fopen(payload->tempfile_name, payload->tempfile_openmode);
|
||||||
sig_pipe[NEW].sa_handler = SIG_IGN;
|
if(localf == NULL) {
|
||||||
sigemptyset(&sig_pipe[NEW].sa_mask);
|
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
||||||
sig_pipe[NEW].sa_flags = 0;
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
sigaction(SIGPIPE, NULL, &sig_pipe[OLD]);
|
_("could not open file %s: %s\n"),
|
||||||
sigaction(SIGPIPE, &sig_pipe[NEW], NULL);
|
payload->tempfile_name, strerror(errno));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dload_interrupted = 0;
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
sig_int[NEW].sa_handler = &inthandler;
|
"opened tempfile for download: %s (%s)\n", payload->tempfile_name,
|
||||||
sigemptyset(&sig_int[NEW].sa_mask);
|
payload->tempfile_openmode);
|
||||||
sig_int[NEW].sa_flags = 0;
|
|
||||||
sigaction(SIGINT, NULL, &sig_int[OLD]);
|
|
||||||
sigaction(SIGINT, &sig_int[NEW], NULL);
|
|
||||||
|
|
||||||
/* Progress 0 - initialize */
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, localf);
|
||||||
prevprogress = 0;
|
|
||||||
|
/* Ignore any SIGPIPE signals. With libcurl, these shouldn't be happening,
|
||||||
|
* but better safe than sorry. Store the old signal handler first. */
|
||||||
|
mask_signal(SIGPIPE, SIG_IGN, &orig_sig_pipe);
|
||||||
|
mask_signal(SIGINT, &inthandler, &orig_sig_int);
|
||||||
|
|
||||||
/* perform transfer */
|
/* perform transfer */
|
||||||
handle->curlerr = curl_easy_perform(handle->curl);
|
payload->curlerr = curl_easy_perform(curl);
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "curl returned error %d from transfer\n",
|
||||||
|
payload->curlerr);
|
||||||
|
|
||||||
/* immediately unhook the progress callback */
|
/* disconnect relationships from the curl handle for things that might go out
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_NOPROGRESS, 1L);
|
* of scope, but could still be touched on connection teardown. This really
|
||||||
|
* only applies to FTP transfers. See FS#26327 for an example. */
|
||||||
|
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL);
|
||||||
|
|
||||||
/* was it a success? */
|
/* was it a success? */
|
||||||
if(handle->curlerr == CURLE_ABORTED_BY_CALLBACK) {
|
switch(payload->curlerr) {
|
||||||
goto cleanup;
|
case CURLE_OK:
|
||||||
} else if(handle->curlerr != CURLE_OK) {
|
/* get http/ftp response code */
|
||||||
if(!payload->errors_ok) {
|
_alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", payload->respcode);
|
||||||
handle->pm_errno = ALPM_ERR_LIBCURL;
|
if(payload->respcode >= 400) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
payload->unlink_on_fail = 1;
|
||||||
payload->filename, hostname, error_buffer);
|
/* non-translated message is same as libcurl */
|
||||||
} else {
|
snprintf(error_buffer, sizeof(error_buffer),
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "failed retrieving file '%s' from %s : %s\n",
|
"The requested URL returned error: %ld", payload->respcode);
|
||||||
payload->filename, hostname, error_buffer);
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
}
|
_("failed retrieving file '%s' from %s : %s\n"),
|
||||||
unlink(tempfile);
|
payload->remote_name, hostname, error_buffer);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
|
/* handle the interrupt accordingly */
|
||||||
|
if(dload_interrupted == ABORT_OVER_MAXFILESIZE) {
|
||||||
|
payload->curlerr = CURLE_FILESIZE_EXCEEDED;
|
||||||
|
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||||
|
/* use the 'size exceeded' message from libcurl */
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("failed retrieving file '%s' from %s : %s\n"),
|
||||||
|
payload->remote_name, hostname,
|
||||||
|
curl_easy_strerror(CURLE_FILESIZE_EXCEEDED));
|
||||||
|
}
|
||||||
|
goto cleanup;
|
||||||
|
default:
|
||||||
|
/* delete zero length downloads */
|
||||||
|
if(fstat(fileno(localf), &st) == 0 && st.st_size == 0) {
|
||||||
|
payload->unlink_on_fail = 1;
|
||||||
|
}
|
||||||
|
if(!payload->errors_ok) {
|
||||||
|
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("failed retrieving file '%s' from %s : %s\n"),
|
||||||
|
payload->remote_name, hostname, error_buffer);
|
||||||
|
} else {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"failed retrieving file '%s' from %s : %s\n",
|
||||||
|
payload->remote_name, hostname, error_buffer);
|
||||||
|
}
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve info about the state of the transfer */
|
/* retrieve info about the state of the transfer */
|
||||||
curl_easy_getinfo(handle->curl, CURLINFO_FILETIME, &remote_time);
|
curl_easy_getinfo(curl, CURLINFO_FILETIME, &remote_time);
|
||||||
curl_easy_getinfo(handle->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &remote_size);
|
curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &remote_size);
|
||||||
curl_easy_getinfo(handle->curl, CURLINFO_SIZE_DOWNLOAD, &bytes_dl);
|
curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &bytes_dl);
|
||||||
curl_easy_getinfo(handle->curl, CURLINFO_CONDITION_UNMET, &timecond);
|
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &timecond);
|
||||||
curl_easy_getinfo(handle->curl, CURLINFO_EFFECTIVE_URL, &effective_url);
|
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);
|
||||||
|
|
||||||
|
if(final_url != NULL) {
|
||||||
|
*final_url = effective_url;
|
||||||
|
}
|
||||||
|
|
||||||
/* time condition was met and we didn't download anything. we need to
|
/* time condition was met and we didn't download anything. we need to
|
||||||
* clean up the 0 byte .part file that's left behind. */
|
* clean up the 0 byte .part file that's left behind. */
|
||||||
if(timecond == 1 && DOUBLE_EQ(bytes_dl, 0)) {
|
if(timecond == 1 && DOUBLE_EQ(bytes_dl, 0)) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "file met time condition\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
unlink(tempfile);
|
unlink(payload->tempfile_name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,26 +543,27 @@ static int curl_download_internal(struct dload_payload *payload,
|
|||||||
!DOUBLE_EQ(bytes_dl, remote_size)) {
|
!DOUBLE_EQ(bytes_dl, remote_size)) {
|
||||||
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
|
||||||
payload->filename, (intmax_t)bytes_dl, (intmax_t)remote_size);
|
payload->remote_name, (intmax_t)bytes_dl, (intmax_t)remote_size);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(payload->cd_filename) {
|
if(payload->content_disp_name) {
|
||||||
/* content-disposition header has a better name for our file */
|
/* content-disposition header has a better name for our file */
|
||||||
free(destfile);
|
free(payload->destfile_name);
|
||||||
destfile = get_fullpath(localpath, payload->cd_filename, "");
|
payload->destfile_name = get_fullpath(localpath, payload->content_disp_name, "");
|
||||||
} else {
|
} else {
|
||||||
const char *effective_filename = strrchr(effective_url, '/');
|
const char *effective_filename = strrchr(effective_url, '/');
|
||||||
if(effective_filename) {
|
if(effective_filename && strlen(effective_filename) > 2) {
|
||||||
effective_filename++;
|
effective_filename++;
|
||||||
|
|
||||||
/* if destfile was never set, we wrote to a tempfile. even if destfile is
|
/* if destfile was never set, we wrote to a tempfile. even if destfile is
|
||||||
* set, we may have followed some redirects and the effective url may
|
* set, we may have followed some redirects and the effective url may
|
||||||
* have a better suggestion as to what to name our file. in either case,
|
* have a better suggestion as to what to name our file. in either case,
|
||||||
* refactor destfile to this newly derived name. */
|
* refactor destfile to this newly derived name. */
|
||||||
if(!destfile || strcmp(effective_filename, strrchr(destfile, '/') + 1) != 0) {
|
if(!payload->destfile_name || strcmp(effective_filename,
|
||||||
free(destfile);
|
strrchr(payload->destfile_name, '/') + 1) != 0) {
|
||||||
destfile = get_fullpath(localpath, effective_filename, "");
|
free(payload->destfile_name);
|
||||||
|
payload->destfile_name = get_fullpath(localpath, effective_filename, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,29 +573,33 @@ static int curl_download_internal(struct dload_payload *payload,
|
|||||||
cleanup:
|
cleanup:
|
||||||
if(localf != NULL) {
|
if(localf != NULL) {
|
||||||
fclose(localf);
|
fclose(localf);
|
||||||
utimes_long(tempfile, remote_time);
|
utimes_long(payload->tempfile_name, remote_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
if(rename(tempfile, destfile)) {
|
const char *realname = payload->tempfile_name;
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
if(payload->destfile_name) {
|
||||||
tempfile, destfile, strerror(errno));
|
realname = payload->destfile_name;
|
||||||
ret = -1;
|
if(rename(payload->tempfile_name, payload->destfile_name)) {
|
||||||
} else if(final_file) {
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
*final_file = strdup(strrchr(destfile, '/') + 1);
|
payload->tempfile_name, payload->destfile_name, strerror(errno));
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ret != -1 && final_file) {
|
||||||
|
STRDUP(*final_file, strrchr(realname, '/') + 1,
|
||||||
|
RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dload_interrupted && should_unlink) {
|
if((ret == -1 || dload_interrupted) && payload->unlink_on_fail &&
|
||||||
unlink(tempfile);
|
payload->tempfile_name) {
|
||||||
|
unlink(payload->tempfile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(tempfile);
|
|
||||||
FREE(destfile);
|
|
||||||
|
|
||||||
/* restore the old signal handlers */
|
/* restore the old signal handlers */
|
||||||
sigaction(SIGINT, &sig_int[OLD], NULL);
|
unmask_signal(SIGINT, &orig_sig_int);
|
||||||
sigaction(SIGPIPE, &sig_pipe[OLD], NULL);
|
unmask_signal(SIGPIPE, &orig_sig_pipe);
|
||||||
/* if we were interrupted, trip the old handler */
|
/* if we were interrupted, trip the old handler */
|
||||||
if(dload_interrupted) {
|
if(dload_interrupted) {
|
||||||
raise(SIGINT);
|
raise(SIGINT);
|
||||||
@@ -412,13 +617,13 @@ cleanup:
|
|||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly if errors_ok == 0)
|
* @return 0 on success, -1 on error (pm_errno is set accordingly if errors_ok == 0)
|
||||||
*/
|
*/
|
||||||
int _alpm_download(struct dload_payload *payload, const char *localpath,
|
int _alpm_download(struct dload_payload *payload, const char *localpath,
|
||||||
char **final_file)
|
char **final_file, char **final_url)
|
||||||
{
|
{
|
||||||
alpm_handle_t *handle = payload->handle;
|
alpm_handle_t *handle = payload->handle;
|
||||||
|
|
||||||
if(handle->fetchcb == NULL) {
|
if(handle->fetchcb == NULL) {
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
return curl_download_internal(payload, localpath, final_file);
|
return curl_download_internal(payload, localpath, final_file, final_url);
|
||||||
#else
|
#else
|
||||||
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||||
#endif
|
#endif
|
||||||
@@ -431,73 +636,110 @@ int _alpm_download(struct dload_payload *payload, const char *localpath,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *filecache_find_url(alpm_handle_t *handle, const char *url)
|
||||||
|
{
|
||||||
|
const char *filebase = strrchr(url, '/');
|
||||||
|
|
||||||
|
if(filebase == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
filebase++;
|
||||||
|
if(filebase == '\0') {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _alpm_filecache_find(handle, filebase);
|
||||||
|
}
|
||||||
|
|
||||||
/** Fetch a remote pkg. */
|
/** Fetch a remote pkg. */
|
||||||
char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
|
char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
|
||||||
{
|
{
|
||||||
char *filepath;
|
char *filepath;
|
||||||
const char *cachedir;
|
const char *cachedir;
|
||||||
char *final_file = NULL;
|
char *final_file = NULL, *final_pkg_url = NULL;
|
||||||
struct dload_payload *payload;
|
struct dload_payload payload;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
ASSERT(url, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
|
||||||
|
|
||||||
/* find a valid cache dir to download to */
|
/* find a valid cache dir to download to */
|
||||||
cachedir = _alpm_filecache_setup(handle);
|
cachedir = _alpm_filecache_setup(handle);
|
||||||
|
|
||||||
CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
memset(&payload, 0, sizeof(struct dload_payload));
|
||||||
payload->handle = handle;
|
|
||||||
payload->fileurl = strdup(url);
|
|
||||||
payload->allow_resume = 1;
|
|
||||||
|
|
||||||
/* download the file */
|
/* attempt to find the file in our pkgcache */
|
||||||
ret = _alpm_download(payload, cachedir, &final_file);
|
filepath = filecache_find_url(handle, url);
|
||||||
if(ret == -1) {
|
if(filepath == NULL) {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to download %s\n"), url);
|
STRDUP(payload.fileurl, url, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
return NULL;
|
payload.allow_resume = 1;
|
||||||
|
payload.handle = handle;
|
||||||
|
|
||||||
|
/* download the file */
|
||||||
|
ret = _alpm_download(&payload, cachedir, &final_file, &final_pkg_url);
|
||||||
|
_alpm_dload_payload_reset(&payload);
|
||||||
|
if(ret == -1) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to download %s\n"), url);
|
||||||
|
free(final_file);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG, "successfully downloaded %s\n", url);
|
||||||
}
|
}
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "successfully downloaded %s\n", url);
|
|
||||||
|
|
||||||
/* attempt to download the signature */
|
/* attempt to download the signature */
|
||||||
if(ret == 0 && (handle->siglevel & ALPM_SIG_PACKAGE)) {
|
if(ret == 0 && final_pkg_url && (handle->siglevel & ALPM_SIG_PACKAGE)) {
|
||||||
char *sig_final_file = NULL;
|
char *sig_filepath, *sig_final_file = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct dload_payload *sig_payload;
|
|
||||||
|
|
||||||
CALLOC(sig_payload, 1, sizeof(*sig_payload), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
len = strlen(final_pkg_url) + 5;
|
||||||
len = strlen(url) + 5;
|
MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
CALLOC(sig_payload->fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
snprintf(payload.fileurl, len, "%s.sig", final_pkg_url);
|
||||||
snprintf(sig_payload->fileurl, len, "%s.sig", url);
|
|
||||||
sig_payload->handle = handle;
|
|
||||||
sig_payload->force = 1;
|
|
||||||
sig_payload->errors_ok = (handle->siglevel & ALPM_SIG_PACKAGE_OPTIONAL);
|
|
||||||
|
|
||||||
ret = _alpm_download(sig_payload, cachedir, &sig_final_file);
|
sig_filepath = filecache_find_url(handle, payload.fileurl);
|
||||||
if(ret == -1 && !sig_payload->errors_ok) {
|
if(sig_filepath == NULL) {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to download %s\n"), sig_payload->fileurl);
|
payload.handle = handle;
|
||||||
/* Warn now, but don't return NULL. We will fail later during package
|
payload.force = 1;
|
||||||
* load time. */
|
payload.errors_ok = (handle->siglevel & ALPM_SIG_PACKAGE_OPTIONAL);
|
||||||
} else if(ret == 0) {
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "successfully downloaded %s\n", sig_payload->fileurl);
|
/* set hard upper limit of 16KiB */
|
||||||
|
payload.max_size = 16 * 1024;
|
||||||
|
|
||||||
|
ret = _alpm_download(&payload, cachedir, &sig_final_file, NULL);
|
||||||
|
if(ret == -1 && !payload.errors_ok) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
_("failed to download %s\n"), payload.fileurl);
|
||||||
|
/* Warn now, but don't return NULL. We will fail later during package
|
||||||
|
* load time. */
|
||||||
|
} else if(ret == 0) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
"successfully downloaded %s\n", payload.fileurl);
|
||||||
|
}
|
||||||
|
FREE(sig_final_file);
|
||||||
}
|
}
|
||||||
FREE(sig_final_file);
|
free(sig_filepath);
|
||||||
_alpm_dload_payload_free(sig_payload);
|
_alpm_dload_payload_reset(&payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we should be able to find the file the second time around */
|
/* we should be able to find the file the second time around */
|
||||||
filepath = _alpm_filecache_find(handle, final_file);
|
if(filepath == NULL) {
|
||||||
FREE(final_file);
|
filepath = _alpm_filecache_find(handle, final_file);
|
||||||
_alpm_dload_payload_free(payload);
|
}
|
||||||
|
free(final_file);
|
||||||
|
|
||||||
return filepath;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_dload_payload_free(struct dload_payload *payload) {
|
void _alpm_dload_payload_reset(struct dload_payload *payload)
|
||||||
|
{
|
||||||
ASSERT(payload, return);
|
ASSERT(payload, return);
|
||||||
|
|
||||||
|
FREE(payload->remote_name);
|
||||||
|
FREE(payload->tempfile_name);
|
||||||
|
FREE(payload->destfile_name);
|
||||||
|
FREE(payload->content_disp_name);
|
||||||
FREE(payload->fileurl);
|
FREE(payload->fileurl);
|
||||||
FREE(payload->cd_filename);
|
memset(payload, '\0', sizeof(*payload));
|
||||||
FREE(payload);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dload.h
|
* dload.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -23,24 +23,32 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
struct dload_payload {
|
struct dload_payload {
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
const char *filename;
|
const char *tempfile_openmode;
|
||||||
char *cd_filename;
|
char *remote_name;
|
||||||
|
char *tempfile_name;
|
||||||
|
char *destfile_name;
|
||||||
|
char *content_disp_name;
|
||||||
char *fileurl;
|
char *fileurl;
|
||||||
double initial_size;
|
off_t initial_size;
|
||||||
long max_size;
|
off_t max_size;
|
||||||
|
off_t prevprogress;
|
||||||
int force;
|
int force;
|
||||||
int allow_resume;
|
int allow_resume;
|
||||||
int errors_ok;
|
int errors_ok;
|
||||||
|
int unlink_on_fail;
|
||||||
|
alpm_list_t *servers;
|
||||||
|
#ifdef HAVE_LIBCURL
|
||||||
|
CURLcode curlerr; /* last error produced by curl */
|
||||||
|
#endif
|
||||||
|
long respcode;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _alpm_dload_payload_free(struct dload_payload *payload);
|
void _alpm_dload_payload_reset(struct dload_payload *payload);
|
||||||
|
|
||||||
int _alpm_download(struct dload_payload *payload, const char *localpath,
|
int _alpm_download(struct dload_payload *payload, const char *localpath,
|
||||||
char **final_file);
|
char **final_file, char **final_url);
|
||||||
|
|
||||||
#endif /* _ALPM_DLOAD_H */
|
#endif /* _ALPM_DLOAD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* error.c
|
* error.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -29,12 +27,12 @@
|
|||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
|
||||||
enum _alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle)
|
alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
return handle->pm_errno;
|
return handle->pm_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_strerror(enum _alpm_errno_t err)
|
const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
|
||||||
{
|
{
|
||||||
switch(err) {
|
switch(err) {
|
||||||
/* System */
|
/* System */
|
||||||
@@ -43,7 +41,7 @@ const char SYMEXPORT *alpm_strerror(enum _alpm_errno_t err)
|
|||||||
case ALPM_ERR_SYSTEM:
|
case ALPM_ERR_SYSTEM:
|
||||||
return _("unexpected system error");
|
return _("unexpected system error");
|
||||||
case ALPM_ERR_BADPERMS:
|
case ALPM_ERR_BADPERMS:
|
||||||
return _("insufficient privileges");
|
return _("permission denied");
|
||||||
case ALPM_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 ALPM_ERR_NOT_A_DIR:
|
case ALPM_ERR_NOT_A_DIR:
|
||||||
|
|||||||
351
lib/libalpm/filelist.c
Normal file
351
lib/libalpm/filelist.c
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
/*
|
||||||
|
* filelist.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2013 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 <limits.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "filelist.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
/** Helper function for comparing strings when sorting */
|
||||||
|
static int _alpm_filelist_strcmp(const void *s1, const void *s2)
|
||||||
|
{
|
||||||
|
return strcmp(*(char **)s1, *(char **)s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO make sure callers check the return value so we can bail on errors.
|
||||||
|
* For now we soldier on as best we can, skipping paths that are too long to
|
||||||
|
* resolve and using the original filenames on memory errors. */
|
||||||
|
/**
|
||||||
|
* @brief Resolves a symlink and its children.
|
||||||
|
*
|
||||||
|
* @attention Pre-condition: files must be sorted!
|
||||||
|
*
|
||||||
|
* @param files filelist to resolve
|
||||||
|
* @param i pointer to the index in files to start processing, will point to
|
||||||
|
* the last file processed on return
|
||||||
|
* @param path absolute path for the symlink being resolved
|
||||||
|
* @param root_len length of the root portion of path
|
||||||
|
* @param resolving is file \i in \files a symlink that needs to be resolved
|
||||||
|
*
|
||||||
|
* @return 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
int _alpm_filelist_resolve_link(alpm_filelist_t *files, size_t *i,
|
||||||
|
char *path, size_t root_len, int resolving)
|
||||||
|
{
|
||||||
|
char *causal_dir = NULL; /* symlink being resolved */
|
||||||
|
char *filename_r = NULL; /* resolved filename */
|
||||||
|
size_t causal_dir_len = 0, causal_dir_r_len = 0;
|
||||||
|
|
||||||
|
if(resolving) {
|
||||||
|
/* deal with the symlink being resolved */
|
||||||
|
MALLOC(filename_r, PATH_MAX, goto error);
|
||||||
|
causal_dir = files->files[*i].name;
|
||||||
|
causal_dir_len = strlen(causal_dir);
|
||||||
|
if(realpath(path, filename_r) == NULL) {
|
||||||
|
files->resolved_path[*i] = causal_dir;
|
||||||
|
FREE(filename_r);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
causal_dir_r_len = strlen(filename_r + root_len) + 1;
|
||||||
|
if(causal_dir_r_len >= PATH_MAX) {
|
||||||
|
files->resolved_path[*i] = causal_dir;
|
||||||
|
FREE(filename_r);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* remove root_r from filename_r */
|
||||||
|
memmove(filename_r, filename_r + root_len, causal_dir_r_len);
|
||||||
|
filename_r[causal_dir_r_len - 1] = '/';
|
||||||
|
filename_r[causal_dir_r_len] = '\0';
|
||||||
|
STRDUP(files->resolved_path[*i], filename_r, goto error);
|
||||||
|
(*i)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(; *i < files->count; (*i)++) {
|
||||||
|
char *filename = files->files[*i].name;
|
||||||
|
size_t filename_len = strlen(filename);
|
||||||
|
size_t filename_r_len = filename_len;
|
||||||
|
struct stat sbuf;
|
||||||
|
int exists;
|
||||||
|
|
||||||
|
if(resolving) {
|
||||||
|
if(filename_len < causal_dir_len || strncmp(filename, causal_dir, causal_dir_len) != 0) {
|
||||||
|
/* not inside causal_dir anymore */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
filename_r_len = filename_len + causal_dir_r_len - causal_dir_len;
|
||||||
|
if(filename_r_len >= PATH_MAX) {
|
||||||
|
/* resolved path is too long */
|
||||||
|
files->resolved_path[*i] = filename;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(filename_r + causal_dir_r_len, filename + causal_dir_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* deal with files and paths too long to resolve*/
|
||||||
|
if(filename[filename_len - 1] != '/' || root_len + filename_r_len >= PATH_MAX) {
|
||||||
|
if(resolving) {
|
||||||
|
STRDUP(files->resolved_path[*i], filename_r, goto error);
|
||||||
|
} else {
|
||||||
|
files->resolved_path[*i] = filename;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct absolute path and stat() */
|
||||||
|
strcpy(path + root_len, resolving ? filename_r : filename);
|
||||||
|
exists = !_alpm_lstat(path, &sbuf);
|
||||||
|
|
||||||
|
/* deal with symlinks */
|
||||||
|
if(exists && S_ISLNK(sbuf.st_mode)) {
|
||||||
|
_alpm_filelist_resolve_link(files, i, path, root_len, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* deal with normal directories */
|
||||||
|
if(resolving) {
|
||||||
|
STRDUP(files->resolved_path[*i], filename_r, goto error);
|
||||||
|
} else {
|
||||||
|
files->resolved_path[*i] = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* deal with children of non-existent directories to reduce lstat() calls */
|
||||||
|
if(!exists) {
|
||||||
|
for((*i)++; *i < files->count; (*i)++) {
|
||||||
|
char *f = files->files[*i].name;
|
||||||
|
size_t f_len = strlen(f);
|
||||||
|
size_t f_r_len;
|
||||||
|
|
||||||
|
if(f_len < filename_len || strncmp(f, filename, filename_len) != 0) {
|
||||||
|
/* not inside the non-existent dir anymore */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
f_r_len = f_len + causal_dir_r_len - causal_dir_len;
|
||||||
|
if(resolving && f_r_len <= PATH_MAX) {
|
||||||
|
strcpy(filename_r + causal_dir_r_len, f + causal_dir_len);
|
||||||
|
STRDUP(files->resolved_path[*i], filename_r, goto error);
|
||||||
|
} else {
|
||||||
|
files->resolved_path[*i] = f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*i)--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*i)--;
|
||||||
|
|
||||||
|
FREE(filename_r);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
FREE(filename_r);
|
||||||
|
/* out of memory, set remaining files to their original names */
|
||||||
|
for(; *i < files->count; (*i)++) {
|
||||||
|
files->resolved_path[*i] = files->files[*i].name;
|
||||||
|
}
|
||||||
|
(*i)--;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Takes a file list and resolves all directory paths according to the
|
||||||
|
* filesystem
|
||||||
|
*
|
||||||
|
* @attention Pre-condition: files must be sorted!
|
||||||
|
*
|
||||||
|
* @note A symlink and directory at the same path in two difference packages
|
||||||
|
* causes a conflict so the filepath can not change as packages get installed
|
||||||
|
*
|
||||||
|
* @param handle the context handle
|
||||||
|
* @param files list of files to resolve
|
||||||
|
*
|
||||||
|
* @return 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
int _alpm_filelist_resolve(alpm_handle_t *handle, alpm_filelist_t *files)
|
||||||
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
size_t root_len, i = 0;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if(!files || files->resolved_path) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALLOC(files->resolved_path, files->count, sizeof(char *), return -1);
|
||||||
|
|
||||||
|
/* not much point in going on if we can't even resolve root */
|
||||||
|
if(realpath(handle->root, path) == NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
root_len = strlen(path);
|
||||||
|
if(root_len + 1 >= PATH_MAX) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* append '/' if root is not "/" */
|
||||||
|
if(path[root_len - 1] != '/') {
|
||||||
|
path[root_len] = '/';
|
||||||
|
root_len++;
|
||||||
|
path[root_len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = _alpm_filelist_resolve_link(files, &i, path, root_len, 0);
|
||||||
|
|
||||||
|
qsort(files->resolved_path, files->count, sizeof(char *),
|
||||||
|
_alpm_filelist_strcmp);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Returns the difference of the provided two lists of files.
|
||||||
|
* Pre-condition: both lists are sorted!
|
||||||
|
* When done, free the list but NOT the contained data.
|
||||||
|
*/
|
||||||
|
alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
|
||||||
|
alpm_filelist_t *filesB)
|
||||||
|
{
|
||||||
|
alpm_list_t *ret = NULL;
|
||||||
|
size_t ctrA = 0, ctrB = 0;
|
||||||
|
|
||||||
|
while(ctrA < filesA->count && ctrB < filesB->count) {
|
||||||
|
char *strA = filesA->resolved_path[ctrA];
|
||||||
|
char *strB = filesB->resolved_path[ctrB];
|
||||||
|
|
||||||
|
int cmp = strcmp(strA, strB);
|
||||||
|
if(cmp < 0) {
|
||||||
|
/* item only in filesA, qualifies as a difference */
|
||||||
|
ret = alpm_list_add(ret, strA);
|
||||||
|
ctrA++;
|
||||||
|
} else if(cmp > 0) {
|
||||||
|
ctrB++;
|
||||||
|
} else {
|
||||||
|
ctrA++;
|
||||||
|
ctrB++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ensure we have completely emptied pA */
|
||||||
|
while(ctrA < filesA->count) {
|
||||||
|
ret = alpm_list_add(ret, filesA->resolved_path[ctrA]);
|
||||||
|
ctrA++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns the intersection of the provided two lists of files.
|
||||||
|
* Pre-condition: both lists are sorted!
|
||||||
|
* When done, free the list but NOT the contained data.
|
||||||
|
*/
|
||||||
|
alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
|
||||||
|
alpm_filelist_t *filesB)
|
||||||
|
{
|
||||||
|
alpm_list_t *ret = NULL;
|
||||||
|
size_t ctrA = 0, ctrB = 0;
|
||||||
|
|
||||||
|
while(ctrA < filesA->count && ctrB < filesB->count) {
|
||||||
|
int cmp, isdirA, isdirB;
|
||||||
|
char *strA, *strB;
|
||||||
|
|
||||||
|
isdirA = 0;
|
||||||
|
strA = filesA->resolved_path[ctrA];
|
||||||
|
if(strA[strlen(strA)-1] == '/') {
|
||||||
|
isdirA = 1;
|
||||||
|
strA = strndup(filesA->resolved_path[ctrA], strlen(strA)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
isdirB = 0;
|
||||||
|
strB = filesB->resolved_path[ctrB];
|
||||||
|
if(strB[strlen(strB)-1] == '/') {
|
||||||
|
isdirB = 1;
|
||||||
|
strB = strndup(filesB->resolved_path[ctrB], strlen(strB)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp = strcmp(strA, strB);
|
||||||
|
if(cmp < 0) {
|
||||||
|
ctrA++;
|
||||||
|
} else if(cmp > 0) {
|
||||||
|
ctrB++;
|
||||||
|
} else {
|
||||||
|
/* TODO: this creates conflicts between a symlink to a directory in
|
||||||
|
* one package and a real directory in the other. For example,
|
||||||
|
* lib -> /usr/lib in pkg1 and /lib in pkg2. This would be allowed
|
||||||
|
* when installing one package at a time _provided_ pkg1 is installed
|
||||||
|
* first. This will need adjusted if the order of package install can
|
||||||
|
* be guaranteed to install the symlink first */
|
||||||
|
|
||||||
|
/* when not directories, item in both qualifies as an intersect */
|
||||||
|
if(! (isdirA && isdirB)) {
|
||||||
|
ret = alpm_list_add(ret, filesA->resolved_path[ctrA]);
|
||||||
|
}
|
||||||
|
ctrA++;
|
||||||
|
ctrB++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isdirA) {
|
||||||
|
free(strA);
|
||||||
|
}
|
||||||
|
if(isdirB) {
|
||||||
|
free(strB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Helper function for comparing files list entries
|
||||||
|
*/
|
||||||
|
int _alpm_files_cmp(const void *f1, const void *f2)
|
||||||
|
{
|
||||||
|
const alpm_file_t *file1 = f1;
|
||||||
|
const alpm_file_t *file2 = f2;
|
||||||
|
return strcmp(file1->name, file2->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
|
||||||
|
const char *path)
|
||||||
|
{
|
||||||
|
alpm_file_t key, *match;
|
||||||
|
|
||||||
|
if(!filelist) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
key.name = (char *)path;
|
||||||
|
|
||||||
|
match = bsearch(&key, filelist->files, filelist->count,
|
||||||
|
sizeof(alpm_file_t), _alpm_files_cmp);
|
||||||
|
|
||||||
|
if(match) {
|
||||||
|
return match->name;
|
||||||
|
} else if(filelist->resolved_path) {
|
||||||
|
return bsearch(&path, filelist->resolved_path, filelist->count,
|
||||||
|
sizeof(char *), _alpm_filelist_strcmp);
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
38
lib/libalpm/filelist.h
Normal file
38
lib/libalpm/filelist.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* filelist.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2013 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_FILELIST_H
|
||||||
|
#define _ALPM_FILELIST_H
|
||||||
|
|
||||||
|
#include "alpm.h"
|
||||||
|
|
||||||
|
int _alpm_filelist_resolve_link(alpm_filelist_t *files, size_t *i,
|
||||||
|
char *path, size_t root_len, int resolving);
|
||||||
|
int _alpm_filelist_resolve(alpm_handle_t *handle, alpm_filelist_t *files);
|
||||||
|
|
||||||
|
alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
|
||||||
|
alpm_filelist_t *filesB);
|
||||||
|
|
||||||
|
alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
|
||||||
|
alpm_filelist_t *filesB);
|
||||||
|
|
||||||
|
int _alpm_files_cmp(const void *f1, const void *f2);
|
||||||
|
|
||||||
|
#endif /* _ALPM_FILELIST_H */
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* graph.c - helpful graph structure and setup/teardown methods
|
* graph.c - helpful graph structure and setup/teardown methods
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2007-2013 Pacman Development Team <pacman-dev@archlinux.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,8 +17,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* graph.h - helpful graph structure and setup/teardown methods
|
* graph.h - helpful graph structure and setup/teardown methods
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2007-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,8 +19,6 @@
|
|||||||
#ifndef _ALPM_GRAPH_H
|
#ifndef _ALPM_GRAPH_H
|
||||||
#define _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"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* group.c
|
* group.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@
|
|||||||
|
|
||||||
alpm_group_t *_alpm_group_new(const char *name)
|
alpm_group_t *_alpm_group_new(const char *name)
|
||||||
{
|
{
|
||||||
alpm_group_t* grp;
|
alpm_group_t *grp;
|
||||||
|
|
||||||
CALLOC(grp, 1, sizeof(alpm_group_t), return NULL);
|
CALLOC(grp, 1, sizeof(alpm_group_t), return NULL);
|
||||||
STRDUP(grp->name, name, free(grp); return NULL);
|
STRDUP(grp->name, name, free(grp); return NULL);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* group.h
|
* group.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* handle.c
|
* handle.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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>
|
||||||
@@ -20,8 +20,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -36,19 +34,16 @@
|
|||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "delta.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
alpm_handle_t *_alpm_handle_new()
|
alpm_handle_t *_alpm_handle_new(void)
|
||||||
{
|
{
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
|
|
||||||
CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
|
CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
|
||||||
|
handle->deltaratio = 0.0;
|
||||||
#ifdef HAVE_LIBGPGME
|
|
||||||
handle->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
|
|
||||||
ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@@ -62,7 +57,7 @@ void _alpm_handle_free(alpm_handle_t *handle)
|
|||||||
/* close logfile */
|
/* close logfile */
|
||||||
if(handle->logstream) {
|
if(handle->logstream) {
|
||||||
fclose(handle->logstream);
|
fclose(handle->logstream);
|
||||||
handle->logstream= NULL;
|
handle->logstream = NULL;
|
||||||
}
|
}
|
||||||
if(handle->usesyslog) {
|
if(handle->usesyslog) {
|
||||||
handle->usesyslog = 0;
|
handle->usesyslog = 0;
|
||||||
@@ -74,6 +69,8 @@ void _alpm_handle_free(alpm_handle_t *handle)
|
|||||||
curl_easy_cleanup(handle->curl);
|
curl_easy_cleanup(handle->curl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
regfree(&handle->delta_regex);
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
_alpm_trans_free(handle->trans);
|
_alpm_trans_free(handle->trans);
|
||||||
FREE(handle->root);
|
FREE(handle->root);
|
||||||
@@ -115,7 +112,7 @@ int _alpm_handle_lock(alpm_handle_t *handle)
|
|||||||
do {
|
do {
|
||||||
fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000);
|
fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000);
|
||||||
} while(fd == -1 && errno == EINTR);
|
} while(fd == -1 && errno == EINTR);
|
||||||
if(fd > 0) {
|
if(fd >= 0) {
|
||||||
FILE *f = fdopen(fd, "w");
|
FILE *f = fdopen(fd, "w");
|
||||||
fprintf(f, "%ld\n", (long)getpid());
|
fprintf(f, "%ld\n", (long)getpid());
|
||||||
fflush(f);
|
fflush(f);
|
||||||
@@ -132,10 +129,9 @@ int _alpm_handle_unlock(alpm_handle_t *handle)
|
|||||||
ASSERT(handle->lockfile != NULL, return -1);
|
ASSERT(handle->lockfile != NULL, return -1);
|
||||||
ASSERT(handle->lckstream != NULL, return 0);
|
ASSERT(handle->lckstream != NULL, return 0);
|
||||||
|
|
||||||
if(handle->lckstream != NULL) {
|
fclose(handle->lckstream);
|
||||||
fclose(handle->lckstream);
|
handle->lckstream = NULL;
|
||||||
handle->lckstream = NULL;
|
|
||||||
}
|
|
||||||
if(unlink(handle->lockfile) && errno != ENOENT) {
|
if(unlink(handle->lockfile) && errno != ENOENT) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -167,6 +163,24 @@ alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(alpm_handle_t *handle)
|
|||||||
return handle->totaldlcb;
|
return handle->totaldlcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alpm_cb_event SYMEXPORT alpm_option_get_eventcb(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
return handle->eventcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
const char SYMEXPORT *alpm_option_get_root(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
@@ -239,10 +253,10 @@ const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle)
|
|||||||
return handle->arch;
|
return handle->arch;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usedelta(alpm_handle_t *handle)
|
double SYMEXPORT alpm_option_get_deltaratio(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
return handle->usedelta;
|
return handle->deltaratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
|
int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
|
||||||
@@ -251,18 +265,6 @@ int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
|
|||||||
return handle->checkspace;
|
return handle->checkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_db_t SYMEXPORT *alpm_option_get_localdb(alpm_handle_t *handle)
|
|
||||||
{
|
|
||||||
CHECK_HANDLE(handle, return NULL);
|
|
||||||
return handle->db_local;
|
|
||||||
}
|
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs(alpm_handle_t *handle)
|
|
||||||
{
|
|
||||||
CHECK_HANDLE(handle, return NULL);
|
|
||||||
return handle->dbs_sync;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb)
|
int SYMEXPORT alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
@@ -291,7 +293,29 @@ int SYMEXPORT alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *canonicalize_path(const char *path) {
|
int SYMEXPORT alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
handle->eventcb = cb;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
handle->questioncb = cb;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
char *new_path;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
@@ -306,11 +330,11 @@ static char *canonicalize_path(const char *path) {
|
|||||||
return new_path;
|
return new_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
alpm_errno_t _alpm_set_directory_option(const char *value,
|
||||||
char **storage, int must_exist)
|
char **storage, int must_exist)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *real = NULL;
|
char real[PATH_MAX];
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
path = value;
|
path = value;
|
||||||
@@ -321,9 +345,7 @@ enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
|||||||
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||||
return ALPM_ERR_NOT_A_DIR;
|
return ALPM_ERR_NOT_A_DIR;
|
||||||
}
|
}
|
||||||
CALLOC(real, PATH_MAX, sizeof(char), return ALPM_ERR_MEMORY);
|
|
||||||
if(!realpath(path, real)) {
|
if(!realpath(path, real)) {
|
||||||
free(real);
|
|
||||||
return ALPM_ERR_NOT_A_DIR;
|
return ALPM_ERR_NOT_A_DIR;
|
||||||
}
|
}
|
||||||
path = real;
|
path = real;
|
||||||
@@ -336,7 +358,6 @@ enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
|||||||
if(!*storage) {
|
if(!*storage) {
|
||||||
return ALPM_ERR_MEMORY;
|
return ALPM_ERR_MEMORY;
|
||||||
}
|
}
|
||||||
free(real);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,13 +584,28 @@ int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta)
|
int SYMEXPORT alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->usedelta = usedelta;
|
if(ratio < 0.0 || ratio > 2.0) {
|
||||||
|
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||||
|
}
|
||||||
|
handle->deltaratio = ratio;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alpm_db_t SYMEXPORT *alpm_get_localdb(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
return handle->db_local;
|
||||||
|
}
|
||||||
|
|
||||||
|
alpm_list_t SYMEXPORT *alpm_get_syncdbs(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
return handle->dbs_sync;
|
||||||
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace)
|
int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
@@ -597,4 +633,44 @@ alpm_siglevel_t SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle
|
|||||||
return handle->siglevel;
|
return handle->siglevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle,
|
||||||
|
alpm_siglevel_t level)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
#ifdef HAVE_LIBGPGME
|
||||||
|
handle->localfilesiglevel = 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_local_file_siglevel(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
return handle->localfilesiglevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle,
|
||||||
|
alpm_siglevel_t level)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
#ifdef HAVE_LIBGPGME
|
||||||
|
handle->remotefilesiglevel = 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_remote_file_siglevel(alpm_handle_t *handle)
|
||||||
|
{
|
||||||
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
return handle->remotefilesiglevel;
|
||||||
|
}
|
||||||
|
|
||||||
/* 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-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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,6 +22,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
@@ -30,6 +31,25 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#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 {
|
struct __alpm_handle_t {
|
||||||
/* internal usage */
|
/* internal usage */
|
||||||
alpm_db_t *db_local; /* local db pointer */
|
alpm_db_t *db_local; /* local db pointer */
|
||||||
@@ -41,14 +61,16 @@ struct __alpm_handle_t {
|
|||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
/* libcurl handle */
|
/* libcurl handle */
|
||||||
CURL *curl; /* reusable curl_easy handle */
|
CURL *curl; /* reusable curl_easy handle */
|
||||||
CURLcode curlerr; /* last error produced by curl */
|
|
||||||
#endif
|
#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 '/' */
|
||||||
@@ -65,14 +87,22 @@ struct __alpm_handle_t {
|
|||||||
alpm_list_t *ignoregroup; /* 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 */
|
|
||||||
char *arch; /* Architecture of packages we should allow */
|
char *arch; /* Architecture of packages we should allow */
|
||||||
int usedelta; /* Download deltas if possible */
|
double deltaratio; /* Download deltas if possible; a ratio value */
|
||||||
|
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
||||||
int checkspace; /* Check disk space before installing */
|
int checkspace; /* Check disk space before installing */
|
||||||
alpm_siglevel_t siglevel; /* Default signature verification level */
|
alpm_siglevel_t siglevel; /* Default signature verification level */
|
||||||
|
alpm_siglevel_t localfilesiglevel; /* Signature verification level for local file
|
||||||
|
upgrade operations */
|
||||||
|
alpm_siglevel_t remotefilesiglevel; /* Signature verification level for remote file
|
||||||
|
upgrade operations */
|
||||||
|
|
||||||
/* error code */
|
/* error code */
|
||||||
enum _alpm_errno_t pm_errno;
|
alpm_errno_t pm_errno;
|
||||||
|
|
||||||
|
/* for delta parsing efficiency */
|
||||||
|
int delta_regex_compiled;
|
||||||
|
regex_t delta_regex;
|
||||||
};
|
};
|
||||||
|
|
||||||
alpm_handle_t *_alpm_handle_new(void);
|
alpm_handle_t *_alpm_handle_new(void);
|
||||||
@@ -81,7 +111,7 @@ void _alpm_handle_free(alpm_handle_t *handle);
|
|||||||
int _alpm_handle_lock(alpm_handle_t *handle);
|
int _alpm_handle_lock(alpm_handle_t *handle);
|
||||||
int _alpm_handle_unlock(alpm_handle_t *handle);
|
int _alpm_handle_unlock(alpm_handle_t *handle);
|
||||||
|
|
||||||
enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
alpm_errno_t _alpm_set_directory_option(const char *value,
|
||||||
char **storage, int must_exist);
|
char **storage, int must_exist);
|
||||||
|
|
||||||
#endif /* _ALPM_HANDLE_H */
|
#endif /* _ALPM_HANDLE_H */
|
||||||
|
|||||||
12
lib/libalpm/libalpm.pc.in
Normal file
12
lib/libalpm/libalpm.pc.in
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: libalpm
|
||||||
|
Description: Arch Linux package management library
|
||||||
|
URL: http://www.archlinux.org/pacman/
|
||||||
|
Version: @LIB_VERSION@
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -lalpm
|
||||||
|
Libs.private: @LIBS@ @LIBARCHIVE_LIBS@ @LIBSSL_LIBS@ @LIBCURL_LIBS@ @GPGME_LIBS@
|
||||||
73
lib/libalpm/libarchive-compat.h
Normal file
73
lib/libalpm/libarchive-compat.h
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#ifndef _LIBARCHIVE_COMPAT_H
|
||||||
|
#define _LIBARCHIVE_COMPAT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* libarchive-compat.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 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 <stdint.h>
|
||||||
|
|
||||||
|
static inline int _alpm_archive_read_free(struct archive *archive)
|
||||||
|
{
|
||||||
|
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
||||||
|
return archive_read_free(archive);
|
||||||
|
#else
|
||||||
|
return archive_read_finish(archive);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64_t _alpm_archive_compressed_ftell(struct archive *archive)
|
||||||
|
{
|
||||||
|
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
||||||
|
return archive_filter_bytes(archive, -1);
|
||||||
|
#else
|
||||||
|
return archive_position_compressed(archive);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int _alpm_archive_read_open_file(struct archive *archive,
|
||||||
|
const char *filename, size_t block_size)
|
||||||
|
{
|
||||||
|
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
||||||
|
return archive_read_open_filename(archive, filename, block_size);
|
||||||
|
#else
|
||||||
|
return archive_read_open_file(archive, filename, block_size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int _alpm_archive_filter_code(struct archive *archive)
|
||||||
|
{
|
||||||
|
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
||||||
|
return archive_filter_code(archive, 0);
|
||||||
|
#else
|
||||||
|
return archive_compression(archive);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int _alpm_archive_read_support_filter_all(struct archive *archive)
|
||||||
|
{
|
||||||
|
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
||||||
|
return archive_read_support_filter_all(archive);
|
||||||
|
#else
|
||||||
|
return archive_read_support_compression_all(archive);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _LIBARCHIVE_COMPAT_H */
|
||||||
|
|
||||||
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* log.c
|
* log.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -37,10 +35,12 @@
|
|||||||
|
|
||||||
/** A printf-like function for logging.
|
/** A printf-like function for logging.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
|
* @param prefix caller-specific prefix for the log
|
||||||
* @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(alpm_handle_t *handle, const char *fmt, ...)
|
int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *prefix,
|
||||||
|
const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -64,20 +64,9 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ret = _alpm_logaction(handle, fmt, args);
|
ret = _alpm_logaction(handle, prefix, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
/* TODO We should add a prefix to log strings depending on who called us.
|
|
||||||
* If logaction was called by the frontend:
|
|
||||||
* USER: <the frontend log>
|
|
||||||
* and if called internally:
|
|
||||||
* ALPM: <the library log>
|
|
||||||
* Moreover, the frontend should be able to choose its prefix
|
|
||||||
* (USER by default?):
|
|
||||||
* pacman: "PACMAN"
|
|
||||||
* kpacman: "KPACMAN"
|
|
||||||
* This would allow us to share the log file between several frontends
|
|
||||||
* and know who does what */
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* log.h
|
* log.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
* Copyright (c) 2006-2013 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,6 +22,8 @@
|
|||||||
|
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
|
#define ALPM_CALLER_PREFIX "ALPM"
|
||||||
|
|
||||||
void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag,
|
void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag,
|
||||||
const char *fmt, ...) __attribute__((format(printf,3,4)));
|
const char *fmt, ...) __attribute__((format(printf,3,4)));
|
||||||
|
|
||||||
|
|||||||
@@ -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,47 +29,38 @@
|
|||||||
/*
|
/*
|
||||||
* 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/md5.h" to "md5.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 md5.h
|
||||||
* * change of md5_file prototype from
|
* * increase the size of buffer for performance reasons
|
||||||
* int md5_file( char *path, unsigned char *output )
|
* * change 'unsigned long' to uint32_t
|
||||||
* to
|
|
||||||
* int md5_file( const char *path, unsigned char *output )
|
|
||||||
* * use a dynamically-allocated buffer in md5_file, and increase the size
|
|
||||||
* for performance reasons
|
|
||||||
* * various static/inline changes
|
|
||||||
*
|
|
||||||
* NOTE: XySSL has been renamed to PolarSSL, which is available at
|
|
||||||
* www.polarssl.org. If we update, we should get it from there.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
*/
|
*/
|
||||||
#ifndef GET_ULONG_LE
|
#ifndef GET_U32_LE
|
||||||
#define GET_ULONG_LE(n,b,i) \
|
#define GET_U32_LE(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(n) = ( (unsigned long) (b)[(i) ] ) \
|
(n) = ( (uint32_t) (b)[(i) ] ) \
|
||||||
| ( (unsigned long) (b)[(i) + 1] << 8 ) \
|
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
|
||||||
| ( (unsigned long) (b)[(i) + 2] << 16 ) \
|
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
|
||||||
| ( (unsigned long) (b)[(i) + 3] << 24 ); \
|
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PUT_ULONG_LE
|
#ifndef PUT_U32_LE
|
||||||
#define PUT_ULONG_LE(n,b,i) \
|
#define PUT_U32_LE(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(b)[(i) ] = (unsigned char) ( (n) ); \
|
(b)[(i) ] = (unsigned char) ( (n) ); \
|
||||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
||||||
@@ -76,7 +72,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;
|
||||||
@@ -87,26 +83,26 @@ 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;
|
uint32_t X[16], A, B, C, D;
|
||||||
|
|
||||||
GET_ULONG_LE( X[ 0], data, 0 );
|
GET_U32_LE( X[ 0], data, 0 );
|
||||||
GET_ULONG_LE( X[ 1], data, 4 );
|
GET_U32_LE( X[ 1], data, 4 );
|
||||||
GET_ULONG_LE( X[ 2], data, 8 );
|
GET_U32_LE( X[ 2], data, 8 );
|
||||||
GET_ULONG_LE( X[ 3], data, 12 );
|
GET_U32_LE( X[ 3], data, 12 );
|
||||||
GET_ULONG_LE( X[ 4], data, 16 );
|
GET_U32_LE( X[ 4], data, 16 );
|
||||||
GET_ULONG_LE( X[ 5], data, 20 );
|
GET_U32_LE( X[ 5], data, 20 );
|
||||||
GET_ULONG_LE( X[ 6], data, 24 );
|
GET_U32_LE( X[ 6], data, 24 );
|
||||||
GET_ULONG_LE( X[ 7], data, 28 );
|
GET_U32_LE( X[ 7], data, 28 );
|
||||||
GET_ULONG_LE( X[ 8], data, 32 );
|
GET_U32_LE( X[ 8], data, 32 );
|
||||||
GET_ULONG_LE( X[ 9], data, 36 );
|
GET_U32_LE( X[ 9], data, 36 );
|
||||||
GET_ULONG_LE( X[10], data, 40 );
|
GET_U32_LE( X[10], data, 40 );
|
||||||
GET_ULONG_LE( X[11], data, 44 );
|
GET_U32_LE( X[11], data, 44 );
|
||||||
GET_ULONG_LE( X[12], data, 48 );
|
GET_U32_LE( X[12], data, 48 );
|
||||||
GET_ULONG_LE( X[13], data, 52 );
|
GET_U32_LE( X[13], data, 52 );
|
||||||
GET_ULONG_LE( X[14], data, 56 );
|
GET_U32_LE( X[14], data, 56 );
|
||||||
GET_ULONG_LE( X[15], data, 60 );
|
GET_U32_LE( X[15], data, 60 );
|
||||||
|
|
||||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||||
|
|
||||||
@@ -161,7 +157,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 );
|
||||||
@@ -213,10 +209,10 @@ 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;
|
uint32_t left;
|
||||||
|
|
||||||
if( ilen <= 0 )
|
if( ilen <= 0 )
|
||||||
return;
|
return;
|
||||||
@@ -224,10 +220,10 @@ 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] += (uint32_t) ilen;
|
||||||
ctx->total[0] &= 0xFFFFFFFF;
|
ctx->total[0] &= 0xFFFFFFFF;
|
||||||
|
|
||||||
if( ctx->total[0] < (unsigned long) ilen )
|
if( ctx->total[0] < (uint32_t) ilen )
|
||||||
ctx->total[1]++;
|
ctx->total[1]++;
|
||||||
|
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
@@ -254,7 +250,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,
|
||||||
@@ -265,18 +261,18 @@ 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;
|
uint32_t last, padn;
|
||||||
unsigned long high, low;
|
uint32_t high, low;
|
||||||
unsigned char msglen[8];
|
unsigned char msglen[8];
|
||||||
|
|
||||||
high = ( ctx->total[0] >> 29 )
|
high = ( ctx->total[0] >> 29 )
|
||||||
| ( ctx->total[1] << 3 );
|
| ( ctx->total[1] << 3 );
|
||||||
low = ( ctx->total[0] << 3 );
|
low = ( ctx->total[0] << 3 );
|
||||||
|
|
||||||
PUT_ULONG_LE( low, msglen, 0 );
|
PUT_U32_LE( low, msglen, 0 );
|
||||||
PUT_ULONG_LE( high, msglen, 4 );
|
PUT_U32_LE( high, msglen, 4 );
|
||||||
|
|
||||||
last = ctx->total[0] & 0x3F;
|
last = ctx->total[0] & 0x3F;
|
||||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
@@ -284,16 +280,16 @@ static inline void md5_finish( md5_context *ctx, unsigned char output[16] )
|
|||||||
md5_update( ctx, (unsigned char *) md5_padding, padn );
|
md5_update( ctx, (unsigned char *) md5_padding, padn );
|
||||||
md5_update( ctx, msglen, 8 );
|
md5_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
PUT_ULONG_LE( ctx->state[0], output, 0 );
|
PUT_U32_LE( ctx->state[0], output, 0 );
|
||||||
PUT_ULONG_LE( ctx->state[1], output, 4 );
|
PUT_U32_LE( ctx->state[1], output, 4 );
|
||||||
PUT_ULONG_LE( ctx->state[2], output, 8 );
|
PUT_U32_LE( ctx->state[2], output, 8 );
|
||||||
PUT_ULONG_LE( ctx->state[3], output, 12 );
|
PUT_U32_LE( ctx->state[3], output, 12 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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;
|
||||||
|
|
||||||
@@ -312,25 +308,19 @@ 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;
|
unsigned char buf[4096];
|
||||||
|
|
||||||
if( ( buf = calloc(8192, sizeof(unsigned char)) ) == NULL )
|
if( ( f = fopen( path, "rb" ) ) == NULL )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
||||||
if( ( f = fopen( path, "rb" ) ) == NULL ) {
|
|
||||||
free( buf );
|
|
||||||
return( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
md5_starts( &ctx );
|
md5_starts( &ctx );
|
||||||
|
|
||||||
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
||||||
md5_update( &ctx, buf, (int) n );
|
md5_update( &ctx, buf, n );
|
||||||
|
|
||||||
md5_finish( &ctx, output );
|
md5_finish( &ctx, output );
|
||||||
|
|
||||||
memset( &ctx, 0, sizeof( md5_context ) );
|
memset( &ctx, 0, sizeof( md5_context ) );
|
||||||
free( buf );
|
|
||||||
|
|
||||||
if( ferror( f ) != 0 )
|
if( ferror( f ) != 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -16,10 +21,11 @@
|
|||||||
* 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 _MD5_H
|
#ifndef _MD5_H
|
||||||
#define _MD5_H
|
#define _MD5_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief MD5 context structure
|
* \brief MD5 context structure
|
||||||
*/
|
*/
|
||||||
@@ -38,7 +44,7 @@ md5_context;
|
|||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
* \param output MD5 checksum result
|
* \param output MD5 checksum result
|
||||||
*/
|
*/
|
||||||
void md5( unsigned char *input, int ilen, unsigned char output[16] );
|
void md5( const unsigned char *input, size_t ilen, unsigned char output[16] );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = MD5( file contents )
|
* \brief Output = MD5( file contents )
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user