mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-02 06:49:55 +00:00
Compare commits
658 Commits
2.15.1
...
b167df904b
Author | SHA1 | Date | |
---|---|---|---|
b167df904b | |||
cd0ac7a7bd | |||
910d178c71 | |||
1e7d4daf18 | |||
7bc4810377 | |||
aa66e76db7 | |||
e0f9e38f44 | |||
d6cdb5bea5 | |||
6d157ca809 | |||
5486ae4a19 | |||
8bdf420cdc | |||
2deca6d715 | |||
180adf3f33 | |||
634054926d | |||
53baaac61e | |||
d2a93a94e3 | |||
7134aea125 | |||
740d537618 | |||
9f78e79f1f | |||
09456141f5 | |||
9e30e98e90 | |||
df2e98a1d3 | |||
24993047c6 | |||
b20e844cc9 | |||
ce75ccb405 | |||
1acff852d0 | |||
62320e8ec6 | |||
1089bab526 | |||
0e0012a6e0 | |||
fbbb80d091 | |||
5316427371 | |||
0fa748f302 | |||
7a3d32dcfa | |||
a396126a79 | |||
9785835c0e | |||
c4f4e37731 | |||
f43ee2fd1d | |||
f7a50e5294 | |||
ddd3c3f06f | |||
242f3d4d34 | |||
303f9ff03c | |||
65fac09d8d | |||
aaf7adbac1 | |||
9e011990ee | |||
529d4caa0e | |||
d7c4fccf98 | |||
1e30838be4 | |||
d57276f214 | |||
31e59df2c8 | |||
23cd843e44 | |||
c08a292070 | |||
5163aa4dca | |||
69f0966ff1 | |||
16308dc3ae | |||
962599e937 | |||
758a81e3db | |||
84942e3c98 | |||
6f8b1509d7 | |||
b4372ff583 | |||
41fc7bffbb | |||
300f5026c4 | |||
10aa91a033 | |||
4169851eaa | |||
4d9e06156d | |||
af2269c64a | |||
f44fa19c42 | |||
fd3c6343f1 | |||
9edff2826f | |||
b38ecfb35c | |||
3c7c748b4a | |||
434057ec49 | |||
a01b090c2b | |||
8ffc1299f0 | |||
02b13de7f4 | |||
50a045434d | |||
7bbe3242d4 | |||
a9cb357182 | |||
feec9141b2 | |||
148ef09e70 | |||
5ff635db70 | |||
9df5820bce | |||
b7d3493ae3 | |||
f8b725d175 | |||
46b3c82aca | |||
0d34432c9a | |||
3cd9cff4ee | |||
9e02d7a38f | |||
9819ed761e | |||
99ca0cb2fd | |||
ea3cb6e766 | |||
0ae4941321 | |||
855b55237b | |||
59d14665a5 | |||
414eb93b1e | |||
14721913a4 | |||
f68e48fb47 | |||
77cceb4c10 | |||
eca22fdaed | |||
719af3676e | |||
6c63ad6df5 | |||
497a115535 | |||
91598951c5 | |||
f364e00bea | |||
87c87d6455 | |||
265de3dc72 | |||
d06c02a1c7 | |||
29bb6284b0 | |||
70b7fcf47a | |||
706808fc97 | |||
7e5f21c26d | |||
9a7f55605a | |||
6085e88f5e | |||
56e97040d6 | |||
9510a14b90 | |||
6eeef39fe5 | |||
0e6434faad | |||
768132bb6c | |||
f1095fe007 | |||
1af04448c9 | |||
aad607eaef | |||
3347212bf2 | |||
f3e9fbf9d0 | |||
c3dacd6883 | |||
624b4619f1 | |||
215fe7a592 | |||
dd8d5d130b | |||
b4fa10781b | |||
f6cdd806b2 | |||
cf9a1e7bec | |||
1b93f4f5e0 | |||
a872ecfc23 | |||
c130f52163 | |||
5fb93bd331 | |||
58e702213d | |||
e784032bc6 | |||
c54b14b833 | |||
e61b246216 | |||
2a9eab5f1a | |||
acc204de6d | |||
0991dbb59c | |||
18d17d4d52 | |||
de7184fc3a | |||
2d21c999d1 | |||
ff78577d61 | |||
eb6eda578c | |||
e823fd3f27 | |||
e4a857dad0 | |||
fc8f6c2985 | |||
bb6414f9d4 | |||
064ac6811c | |||
7d16142b3b | |||
69a79a2e64 | |||
5b4bff9c93 | |||
3f8b9eaed6 | |||
deab8ddae6 | |||
eacb6ec729 | |||
dc2eebce39 | |||
6b755b4828 | |||
a73341e885 | |||
969aa78c95 | |||
df787657aa | |||
eec94521a7 | |||
b18000c777 | |||
dbaff5f981 | |||
ae84ca0c56 | |||
8f047f9a96 | |||
54bd016c17 | |||
42f77742f8 | |||
46bb9c95d0 | |||
5dd4763a80 | |||
45eba6a6e3 | |||
4c1d0abb85 | |||
1e00bf9398 | |||
bf9a46936c | |||
a0b17981e3 | |||
c440f5bbd5 | |||
8ff567cac3 | |||
9fe760efdf | |||
bc9682373d | |||
aedcbf1985 | |||
26b991bf47 | |||
8bf422b02a | |||
0c920832c9 | |||
bef8d33570 | |||
b540ced77f | |||
723b6971dd | |||
59356e905a | |||
99eecdebf3 | |||
5e42dd4e70 | |||
4ec7e2d129 | |||
9a521af078 | |||
d1132b49fc | |||
2c21ae26c3 | |||
bba90b3eb8 | |||
3cac53ac11 | |||
9fa6722eaa | |||
1d4ed0e0c3 | |||
2cda4a2469 | |||
9406537a15 | |||
598af7d9db | |||
6530afbfc7 | |||
ad1c0051c4 | |||
5b172ad20b | |||
42fccb76ef | |||
c37f67c558 | |||
89d9b581bd | |||
116dc0b329 | |||
e3ed36fafd | |||
573ade4ba5 | |||
9259d9c727 | |||
c863ee063c | |||
480c3a54b8 | |||
3b3ef43863 | |||
368db86dde | |||
adf6a0a952 | |||
575a618096 | |||
2c03354d4a | |||
4008aa2e0a | |||
9cb39f6767 | |||
c7de182f3d | |||
d21c3fdf9f | |||
9f2fe219c8 | |||
ad570aae0f | |||
116b65d92a | |||
5e5171cf3e | |||
af3360e84a | |||
95f52f7ebe | |||
f5fe200247 | |||
a1c12200b8 | |||
09839f755a | |||
fcd4d60cad | |||
3681473942 | |||
4dd5a1e82e | |||
cbd1d3d5b8 | |||
e3347aec2d | |||
3ad6cd27c6 | |||
54a68279be | |||
d99091a3b4 | |||
be6cf5b8af | |||
91e548569d | |||
6c3b2ef266 | |||
785607c70b | |||
d22a3152db | |||
adb5b58a1d | |||
8b2601beaa | |||
9116a4370e | |||
da93fdc77a | |||
8bbd643551 | |||
6834dd442c | |||
d23e3cbbea | |||
6bc6bdaeae | |||
7458c73c7d | |||
2cecbb3d53 | |||
c73a6c7bae | |||
0b70b5af45 | |||
fde75a14c2 | |||
1e0d1a5a32 | |||
75919637e8 | |||
467d109cfc | |||
a131c77699 | |||
10fbc31d2a | |||
7e0d12b8b1 | |||
7ab00ee579 | |||
2d62148ee6 | |||
c1f2d5ff4a | |||
2888649ced | |||
63855f5964 | |||
8bf665d7d3 | |||
a7ac77ce4d | |||
fc01bf3d1c | |||
d81e91e117 | |||
57f62ba163 | |||
ded896ee1b | |||
1fdcea0524 | |||
a93f43dcd0 | |||
20974dae6f | |||
cbcfff27b8 | |||
96f394bab0 | |||
aae3c82f3d | |||
ab9e1fb1bd | |||
82322f7a6c | |||
125da217d3 | |||
d113c65c81 | |||
050041b2de | |||
e0ed636d7e | |||
61feb2ebc7 | |||
da1c6b0101 | |||
c1718b3862 | |||
34fe8128aa | |||
a78c48ed4d | |||
e368396653 | |||
f4abd83568 | |||
e6888ba788 | |||
a78050c1bf | |||
93876307f8 | |||
4d482520cd | |||
461fbd40ce | |||
419da3db89 | |||
00ca06ffab | |||
5a05c8ce91 | |||
b09aea13af | |||
04a52f759d | |||
ef6cf0f00b | |||
ab650b7417 | |||
7ca5b3a363 | |||
666fa98075 | |||
684ef33dbc | |||
cf35addaa5 | |||
11732a8609 | |||
64cc8fd6b0 | |||
4202751e9c | |||
41515f6c95 | |||
ac92b506e0 | |||
5bbd1ad9a9 | |||
541d8d9b39 | |||
e41dd09a8a | |||
8e65263b90 | |||
afc488255c | |||
effc120a43 | |||
4b27e102ef | |||
e0126bb811 | |||
8c04dc4c2a | |||
83e9d7c523 | |||
9be4a89c08 | |||
0f8596db1e | |||
c403c45d72 | |||
00dbd90953 | |||
3e299d9685 | |||
e20637f7ad | |||
5a09d46f9a | |||
90be3276dd | |||
a4f646eb2a | |||
ebd06cb443 | |||
fe66c6c45c | |||
bba58352e0 | |||
41cc58ed31 | |||
20e45845ba | |||
9fa1fa108f | |||
577bd9e5f8 | |||
20b9c1fa4a | |||
a7c9183aa0 | |||
9e0dd3ae97 | |||
f4e4e88e82 | |||
2684e4b3f4 | |||
45f5006db3 | |||
b26aa2145f | |||
4462eba860 | |||
f2c23bad17 | |||
1603086b96 | |||
b6f6ee8c76 | |||
b71d1f6e3d | |||
7883746e53 | |||
ae9118654d | |||
81fa73f725 | |||
14cb548c3b | |||
2eb93a6090 | |||
dd6ef38c99 | |||
415dc42313 | |||
3e1af17796 | |||
880cebe54f | |||
cbcc796a3a | |||
dc8a52f6c0 | |||
34c93e53cc | |||
f7ec24523b | |||
f817b32976 | |||
9fc2b681d4 | |||
59ff0589ab | |||
1b53de6f2b | |||
41080c5ff8 | |||
791ce4f242 | |||
b75bd30658 | |||
b3b3cad706 | |||
82b932371b | |||
45fb2f3c46 | |||
4a5b9d9fa1 | |||
2f8316ecb0 | |||
77ad35fce8 | |||
48da4646cf | |||
3d98dd267a | |||
09678a3ae1 | |||
8e2732f6fe | |||
73e311a41c | |||
1e8388af5d | |||
c1d74726b7 | |||
f2ddcc6d23 | |||
a5ce6b78dd | |||
1a83dd6f5a | |||
16a33f7729 | |||
fb21b1da53 | |||
8394004943 | |||
75c6bf6119 | |||
7e20ff5184 | |||
757614f5a0 | |||
43166e5f94 | |||
43696b9920 | |||
8befee58fe | |||
9d016f51b5 | |||
c5fbccd519 | |||
eae5748a30 | |||
695ef708b6 | |||
26408e82c0 | |||
7b647a9b5a | |||
fac228d6c6 | |||
eb5ac5a52b | |||
047925dcfe | |||
b8d2775050 | |||
bf959ceb5f | |||
945b6d0ac0 | |||
5df9f30e37 | |||
1ea3911531 | |||
d7966e419d | |||
3a5268993e | |||
ad84895e18 | |||
b1dfafe275 | |||
375f9fcfb7 | |||
04dcaa93ab | |||
f42c2c57fb | |||
dc3562a4ec | |||
dda94f8f9e | |||
709db6a5ed | |||
89a2d8e298 | |||
b9cd98235e | |||
1905360f8f | |||
a7018d9f7d | |||
73057bc08d | |||
7f87863734 | |||
2dac5a2520 | |||
720edc24ba | |||
fe9711d24f | |||
c73a2a4aa9 | |||
571f720ae2 | |||
5030395025 | |||
03633d47ea | |||
1a575d6db8 | |||
cdc018ad07 | |||
f806c8918e | |||
4daff81d5f | |||
06bd29b78d | |||
c67ac3730c | |||
c094d4ee79 | |||
3cb479ba4b | |||
307a7f4a71 | |||
25734876de | |||
53df735eb2 | |||
fb7275f9dd | |||
f01af5f54a | |||
1abe8d291f | |||
1a83e55d64 | |||
b8e17c4879 | |||
bee41dcc55 | |||
9f7995fb2f | |||
9ce1c36f35 | |||
4990ce4198 | |||
8f18ead4cc | |||
7ea50887a4 | |||
97ec5bfa41 | |||
5fcc15191a | |||
c5f086a7c6 | |||
432ca0cc48 | |||
1a0322b32e | |||
fc086c0d87 | |||
d5503b22ba | |||
a132b1544a | |||
63acae4b1c | |||
8e6473d2a0 | |||
fdcbcc4541 | |||
83931f5cf4 | |||
d4eadf0013 | |||
04174a3e6d | |||
041b3824c1 | |||
a11cce43ff | |||
1388df9a7e | |||
6ee1c8ef5a | |||
a7c6d95b34 | |||
060c7412b1 | |||
93406483fe | |||
046febc440 | |||
9964a96296 | |||
9529525cb5 | |||
fa4c1c6205 | |||
f9b1d89756 | |||
9197b416e6 | |||
f54a2fe740 | |||
d1f990eac8 | |||
1e85c1db70 | |||
32aaa4a1f8 | |||
a9e20f0958 | |||
32b129a806 | |||
2752e68ade | |||
5b678149dc | |||
79e1cff421 | |||
2e07de4a12 | |||
7e3ef889e8 | |||
52b54a9d05 | |||
c0f7f81050 | |||
38af344bde | |||
62496478ae | |||
ce48169aad | |||
21845bc934 | |||
249003de0a | |||
d8704e9c75 | |||
0a8b172e9c | |||
7d782f120d | |||
9057ecf67a | |||
35df354c14 | |||
4d4e5e9dde | |||
ff24188ca1 | |||
9d4f85624d | |||
295f810222 | |||
d8523bd83b | |||
be017ed102 | |||
c73f24f8c6 | |||
0d806e3471 | |||
20962f0385 | |||
fd38dfd176 | |||
5f7f58041d | |||
233b1f7f39 | |||
a83f1d5aa5 | |||
be09c04e78 | |||
bfbbb987ad | |||
04f365f1a6 | |||
86bd49ed1b | |||
f6ad609616 | |||
2f5790f69f | |||
faaf72a840 | |||
ef44895b0d | |||
5cfffbcd46 | |||
3e0058620b | |||
e897e2cde2 | |||
edef4944f6 | |||
a4eaf87116 | |||
1192f12f91 | |||
444da87fdc | |||
6be6614e6d | |||
8add507957 | |||
af5363d158 | |||
d60c553ea2 | |||
5a6d0e0000 | |||
427ba0f0ea | |||
266d2bd77d | |||
f333e89bd1 | |||
659db071a1 | |||
56c642e2a9 | |||
845bc9b5e8 | |||
57f45fdc89 | |||
ba483173af | |||
6d1f641e50 | |||
0cf7756ec4 | |||
b561bcc25d | |||
25d76b0482 | |||
d2fe4b044f | |||
22272167e6 | |||
38dce8c0fe | |||
68aa327670 | |||
04f6af58d9 | |||
41c8f4c35f | |||
168b2f6880 | |||
14e8eee986 | |||
88c8c929dc | |||
5bb244cbe8 | |||
f3fd0780fb | |||
11c03a9041 | |||
214f319123 | |||
cfbc9d3267 | |||
0f4c89145b | |||
49a05d0520 | |||
19d1e17727 | |||
d7bf647493 | |||
19ba2ba8e5 | |||
f49894107a | |||
233ba9c415 | |||
b7cff0a19d | |||
60b94b9ac0 | |||
284f449225 | |||
d18df0935e | |||
c15cc4b853 | |||
fc67778e89 | |||
39ac9d4e1f | |||
bc923b0e8f | |||
2842e40bf7 | |||
343768e015 | |||
8f55cc600e | |||
c757554148 | |||
899603e4b9 | |||
f488105fd2 | |||
2e89b9483f | |||
d3a00e1937 | |||
d9b4015be5 | |||
c6b550761b | |||
0129ec39ec | |||
62661c9fb1 | |||
78636c2035 | |||
47c4e5bb42 | |||
d548fa02f0 | |||
b5c6c286f7 | |||
aad599be67 | |||
f8ff2cbf5b | |||
dad3f418ad | |||
c455bd34ce | |||
69b319d39a | |||
33cfa8fef8 | |||
9d37e3ae23 | |||
2eb2d3a70a | |||
46389b87e7 | |||
856a94ff00 | |||
a0e6009876 | |||
f2b39fe439 | |||
213b2c65a0 | |||
a416214e5f | |||
e5966c497f | |||
fbccb1394d | |||
01887ec44b | |||
4d4ddffa8f | |||
4729c0ea5f | |||
035a23a8de | |||
0d37ce5095 | |||
70465b5044 | |||
81afa23d98 | |||
1b979725a3 | |||
c2c7ee6292 | |||
a3fe361596 | |||
20d13f1c10 | |||
6c96c9e73a | |||
9b08b0694e | |||
fcb892f39f | |||
1785b0470f | |||
c04f940ad3 | |||
207da4caa7 | |||
cad85b0f20 | |||
3e8e54857f | |||
6470b13511 | |||
4e08297311 | |||
32c3c52874 | |||
e637a647c5 | |||
e21b990777 | |||
c0be7f7a17 | |||
612cb2fa22 | |||
cf276f2398 | |||
4ca2348f0d | |||
eb02e1e62b | |||
8d7d508bb2 | |||
a875225b78 | |||
5449dec32a | |||
eb7f3b2484 | |||
e87402fdde | |||
3996055f56 | |||
74fc283078 | |||
eb92f75384 | |||
63529633ec | |||
930b47c704 | |||
a89888769f | |||
b6bc1b77dc | |||
4a462502e7 | |||
f383b04754 | |||
d744fe1647 | |||
6f1b37c4cb | |||
5cb3fd5853 | |||
60b8477cde |
2
.github/workflows/setup.sh
vendored
2
.github/workflows/setup.sh
vendored
@ -10,7 +10,7 @@ echo -e '[arcanisrepo]\nServer = https://repo.arcanis.me/$arch\nSigLevel = Never
|
||||
# refresh the image
|
||||
pacman -Syyu --noconfirm
|
||||
# main dependencies
|
||||
pacman -S --noconfirm devtools git pyalpm python-inflection python-passlib python-pyelftools python-requests python-systemd sudo
|
||||
pacman -S --noconfirm devtools git pyalpm python-bcrypt python-inflection python-pyelftools python-requests python-systemd sudo
|
||||
# make dependencies
|
||||
pacman -S --noconfirm --asdeps base-devel python-build python-flit python-installer python-tox python-wheel
|
||||
# optional dependencies
|
||||
|
@ -4,6 +4,8 @@ build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3.12"
|
||||
apt_packages:
|
||||
- graphviz
|
||||
|
||||
python:
|
||||
install:
|
||||
|
@ -12,7 +12,7 @@ ENV AHRIMAN_PACMAN_MIRROR=""
|
||||
ENV AHRIMAN_PORT=""
|
||||
ENV AHRIMAN_POSTSETUP_COMMAND=""
|
||||
ENV AHRIMAN_PRESETUP_COMMAND=""
|
||||
ENV AHRIMAN_REPOSITORY="aur-clone"
|
||||
ENV AHRIMAN_REPOSITORY="aur"
|
||||
ENV AHRIMAN_REPOSITORY_SERVER=""
|
||||
ENV AHRIMAN_REPOSITORY_ROOT="/var/lib/ahriman/ahriman"
|
||||
ENV AHRIMAN_UNIX_SOCKET=""
|
||||
@ -35,8 +35,8 @@ RUN pacman -S --noconfirm --asdeps \
|
||||
devtools \
|
||||
git \
|
||||
pyalpm \
|
||||
python-bcrypt \
|
||||
python-inflection \
|
||||
python-passlib \
|
||||
python-pyelftools \
|
||||
python-requests \
|
||||
&& \
|
||||
|
1820
docs/_static/architecture.dot
vendored
Normal file
1820
docs/_static/architecture.dot
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12051
docs/_static/architecture.svg
vendored
12051
docs/_static/architecture.svg
vendored
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 1.4 MiB |
@ -11,7 +11,7 @@ Depending on the goal the package can be used in different ways. Nevertheless, i
|
||||
from ahriman.core.database import SQLite
|
||||
from ahriman.models.repository_id import RepositoryId
|
||||
|
||||
repository_id = RepositoryId("x86_64", "aur-clone")
|
||||
repository_id = RepositoryId("x86_64", "aur")
|
||||
configuration = Configuration.from_path(Path("/etc/ahriman.ini"), repository_id)
|
||||
database = SQLite.load(configuration)
|
||||
|
||||
|
@ -36,6 +36,14 @@ ahriman.application.handlers.clean module
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.handlers.copy module
|
||||
----------------------------------------
|
||||
|
||||
.. automodule:: ahriman.application.handlers.copy
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.handlers.daemon module
|
||||
------------------------------------------
|
||||
|
||||
|
@ -21,6 +21,14 @@ ahriman.application.ahriman module
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.help\_formatter module
|
||||
------------------------------------------
|
||||
|
||||
.. automodule:: ahriman.application.help_formatter
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.application.lock module
|
||||
-------------------------------
|
||||
|
||||
|
@ -52,6 +52,14 @@ ahriman.core.tree module
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.core.types module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: ahriman.core.types
|
||||
:members:
|
||||
:no-undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
ahriman.core.util module
|
||||
------------------------
|
||||
|
||||
|
@ -12,8 +12,7 @@ Packages have strict rules of importing:
|
||||
|
||||
Full dependency diagram:
|
||||
|
||||
.. image:: _static/architecture.svg
|
||||
:target: _static/architecture.svg
|
||||
.. graphviz:: _static/architecture.dot
|
||||
:alt: architecture
|
||||
|
||||
``ahriman.application`` package
|
||||
@ -118,12 +117,12 @@ Having default root as ``/var/lib/ahriman`` (differs from container though), the
|
||||
├── ahriman.db
|
||||
├── cache
|
||||
├── chroot
|
||||
│ └── aur-clone
|
||||
│ └── aur
|
||||
├── packages
|
||||
│ └── aur-clone
|
||||
│ └── aur
|
||||
│ └── x86_64
|
||||
├── pacman
|
||||
│ └── aur-clone
|
||||
│ └── aur
|
||||
│ └── x86_64
|
||||
│ ├── local
|
||||
│ │ └── ALPM_DB_VERSION
|
||||
@ -133,12 +132,12 @@ Having default root as ``/var/lib/ahriman`` (differs from container though), the
|
||||
│ └── multilib.db
|
||||
│
|
||||
└── repository
|
||||
└── aur-clone
|
||||
└── aur
|
||||
└── x86_64
|
||||
├── aur-clone.db -> aur-clone.db.tar.gz
|
||||
├── aur-clone.db.tar.gz
|
||||
├── aur-clone.files -> aur-clone.files.tar.gz
|
||||
└── aur-clone.files.tar.gz
|
||||
├── aur.db -> aur.db.tar.gz
|
||||
├── aur.db.tar.gz
|
||||
├── aur.files -> aur.files.tar.gz
|
||||
└── aur.files.tar.gz
|
||||
|
||||
There are multiple subdirectories, some of them are commons for any repository, but some of them are not.
|
||||
|
||||
@ -148,7 +147,7 @@ There are multiple subdirectories, some of them are commons for any repository,
|
||||
* ``pacman/{repository}/{architecture}`` is the repository and architecture specific caches for pacman's databases.
|
||||
* ``repository/{repository}/{architecture}`` is a repository packages directory.
|
||||
|
||||
Normally you should avoid direct interaction with the application tree. For tree migration process refer to the :doc:`migration notes <migration>`.
|
||||
Normally you should avoid direct interaction with the application tree. For tree migration process refer to the :doc:`migration notes <migrations/index>`.
|
||||
|
||||
Database
|
||||
--------
|
||||
@ -371,7 +370,7 @@ There are several supported synchronization providers, currently they are ``rsyn
|
||||
|
||||
``rsync`` provider does not have any specific logic except for running external rsync application with configured arguments. The service does not handle SSH configuration, thus it has to be configured before running application manually.
|
||||
|
||||
``s3`` provider uses ``boto3`` package and implements sync feature. The files are stored in architecture specific directory (e.g. if bucket is ``repository``, packages will be stored in ``repository/aur-clone/x86_64`` for the ``aur-clone`` repository and ``x86_64`` architecture), bucket must be created before any action and API key must have permissions to write to the bucket. No external configuration required. In order to upload only changed files the service compares calculated hashes with the Amazon ETags, the implementation used is described `here <https://teppen.io/2018/10/23/aws_s3_verify_etags/>`__.
|
||||
``s3`` provider uses ``boto3`` package and implements sync feature. The files are stored in architecture specific directory (e.g. if bucket is ``repository``, packages will be stored in ``repository/aur/x86_64`` for the ``aur`` repository and ``x86_64`` architecture), bucket must be created before any action and API key must have permissions to write to the bucket. No external configuration required. In order to upload only changed files the service compares calculated hashes with the Amazon ETags, the implementation used is described `here <https://teppen.io/2018/10/23/aws_s3_verify_etags/>`__.
|
||||
|
||||
``github`` provider authenticates through basic auth, API key with repository write permissions is required. There will be created a release with the name of the architecture in case if it does not exist; files will be uploaded to the release assets. It also stores array of files and their MD5 checksums in release body in order to upload only changed ones. According to the GitHub API in case if there is already uploaded asset with the same name (e.g. database files), asset will be removed first.
|
||||
|
||||
|
16
docs/conf.py
16
docs/conf.py
@ -10,7 +10,7 @@
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import datetime
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
@ -21,13 +21,11 @@ from ahriman import __version__
|
||||
basedir = Path(__file__).resolve().parent.parent / "src"
|
||||
sys.path.insert(0, str(basedir))
|
||||
|
||||
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = "ahriman"
|
||||
copyright = "2021-2023, ahriman team"
|
||||
copyright = f"2021-{datetime.date.today().year}, ahriman team"
|
||||
author = "ahriman team"
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
@ -41,6 +39,7 @@ release = __version__
|
||||
# ones.
|
||||
extensions = [
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.graphviz",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx_rtd_theme",
|
||||
"sphinxarg.ext",
|
||||
@ -78,7 +77,12 @@ html_logo = "_static/logo.svg"
|
||||
|
||||
add_module_names = False
|
||||
|
||||
modindex_common_prefix = ["ahriman.application.", "ahriman.core.", "ahriman.models.", "ahriman.web."]
|
||||
modindex_common_prefix = [
|
||||
"ahriman.application.",
|
||||
"ahriman.core.",
|
||||
"ahriman.models.",
|
||||
"ahriman.web.",
|
||||
]
|
||||
|
||||
|
||||
# -- Extension configuration -------------------------------------------------
|
||||
@ -92,3 +96,5 @@ autodoc_mock_imports = ["cryptography", "pyalpm"]
|
||||
autodoc_default_options = {
|
||||
"no-undoc-members": True,
|
||||
}
|
||||
|
||||
graphviz_output_format = "svg"
|
||||
|
@ -3,8 +3,8 @@ Configuration
|
||||
|
||||
Some groups can be specified for each architecture and/or repository separately. E.g. if there are ``build`` and ``build:x86_64`` groups it will use an option from ``build:x86_64`` for the ``x86_64`` architecture and ``build`` for any other (architecture specific group has higher priority). In case if both groups are presented, architecture specific options will be merged into global ones overriding them. The order which will be used for option resolution is the following:
|
||||
|
||||
#. Repository and architecture specific, e.g. ``build:aur-clone:x86_64``.
|
||||
#. Repository specific, e.g. ``build:aur-clone``.
|
||||
#. Repository and architecture specific, e.g. ``build:aur:x86_64``.
|
||||
#. Repository specific, e.g. ``build:aur``.
|
||||
#. Architecture specific, e.g. ``build:x86_64``.
|
||||
#. Default section, e.g. ``build``.
|
||||
|
||||
|
@ -46,7 +46,7 @@ The following environment variables are supported:
|
||||
* ``AHRIMAN_PORT`` - HTTP server port if any, default is empty.
|
||||
* ``AHRIMAN_POSTSETUP_COMMAND`` - if set, the command which will be called (as root) after the setup command, but before any other actions.
|
||||
* ``AHRIMAN_PRESETUP_COMMAND`` - if set, the command which will be called (as root) right before the setup command.
|
||||
* ``AHRIMAN_REPOSITORY`` - repository name, default is ``aur-clone``.
|
||||
* ``AHRIMAN_REPOSITORY`` - repository name, default is ``aur``.
|
||||
* ``AHRIMAN_REPOSITORY_SERVER`` - optional override for the repository URL. Useful if you would like to download packages from remote instead of local filesystem.
|
||||
* ``AHRIMAN_REPOSITORY_ROOT`` - repository root. Because of filesystem rights it is required to override default repository root. By default, it uses ``ahriman`` directory inside ahriman's home, which can be passed as mount volume.
|
||||
* ``AHRIMAN_UNIX_SOCKET`` - full path to unix socket which is used by web server, default is empty. Note that more likely you would like to put it inside ``AHRIMAN_REPOSITORY_ROOT`` directory (e.g. ``/var/lib/ahriman/ahriman/ahriman-web.sock``) or to ``/run/ahriman``.
|
||||
@ -106,9 +106,9 @@ In order to create configuration for additional repositories, the ``AHRIMAN_POST
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
docker run --privileged -p 8080:8080 -e AHRIMAN_PORT=8080 -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman/ahriman-web.sock -e AHRIMAN_POSTSETUP_COMMAND="ahriman --architecture x86_64 --repository aur-clone-v2 service-setup --build-as-user ahriman --packager 'ahriman bot <ahriman@example.com>'" -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
|
||||
docker run --privileged -p 8080:8080 -e AHRIMAN_PORT=8080 -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman/ahriman-web.sock -e AHRIMAN_POSTSETUP_COMMAND="ahriman --architecture x86_64 --repository aur-v2 service-setup --build-as-user ahriman --packager 'ahriman bot <ahriman@example.com>'" -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
|
||||
|
||||
The command above will also create configuration for the repository named ``aur-clone-v2``.
|
||||
The command above will also create configuration for the repository named ``aur-v2``.
|
||||
|
||||
Note, however, that the command above is only required in case if the service is going to be used to run subprocesses. Otherwise, everything else (web interface, status, etc) will be handled as usual.
|
||||
|
||||
|
@ -14,8 +14,8 @@ TL;DR
|
||||
.. code-block:: shell
|
||||
|
||||
yay -S ahriman
|
||||
ahriman -a x86_64 -r aur-clone service-setup --packager "ahriman bot <ahriman@example.com>"
|
||||
systemctl enable --now ahriman@x86_64-aur-clone.timer
|
||||
ahriman -a x86_64 -r aur service-setup --packager "ahriman bot <ahriman@example.com>"
|
||||
systemctl enable --now ahriman@x86_64-aur.timer
|
||||
|
||||
Long answer
|
||||
"""""""""""
|
||||
@ -29,7 +29,7 @@ The alternative way (though not recommended) is to run service instead of timer:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
systemctl enable --now ahriman-daemon@x86_64-aur-clone
|
||||
systemctl enable --now ahriman-daemon@x86_64-aur
|
||||
|
||||
How to validate settings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -77,7 +77,7 @@ states that default build command is ``extra-x86_64-build``. But if there is sec
|
||||
[build:i686]
|
||||
build_command = extra-i686-build
|
||||
|
||||
the ``extra-i686-build`` command will be used for ``i686`` architecture. You can also override settings for different repositories and architectures; in this case section names will be ``build:aur-clone`` (repository name only) and ``build:aur-clone:i686`` (both repository name and architecture).
|
||||
the ``extra-i686-build`` command will be used for ``i686`` architecture. You can also override settings for different repositories and architectures; in this case section names will be ``build:aur`` (repository name only) and ``build:aur:i686`` (both repository name and architecture).
|
||||
|
||||
How to generate build reports
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -148,13 +148,11 @@ Before using this command you will need to create local directory and put ``PKGB
|
||||
How to copy package from another repository
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As simple as add package from archive. Considering case when you would like to copy package ``package`` with version ``ver-rel`` from repository ``source-repository`` to ``target-respository`` (same architecture), the command will be following:
|
||||
It is possible to copy package and its metadata between local repositories, optionally removing the source archive, e.g.:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
sudo -u ahriman ahriman -r target-repository package-add /var/lib/ahriman/repository/source-repository/x86_64/package-ver-rel-x86_64.pkg.tar.zst
|
||||
|
||||
In addition, you can remove source package as usual later.
|
||||
sudo -u ahriman ahriman -r target-repository package-copy source-repository ahriman
|
||||
|
||||
This feature in particular useful if for managing multiple repositories like ``[testing]`` and ``[extra]``.
|
||||
|
||||
|
@ -30,9 +30,9 @@ The application provides special plugin which generates keyring package. This pl
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
sudo -u ahriman ahriman package-add aur-clone-keyring --source local --now
|
||||
sudo -u ahriman ahriman package-add aur-keyring --source local --now
|
||||
|
||||
where ``aur-clone`` is your repository name.
|
||||
where ``aur`` is your repository name.
|
||||
|
||||
This plugin might have some issues, in case of any of them, kindly create `new issue <https://github.com/arcan1s/ahriman/issues/new/choose>`__.
|
||||
|
||||
@ -68,6 +68,6 @@ The application provides special plugin which generates mirrorlist package also.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
sudo -u ahriman ahriman package-add aur-clone-mirrorlist --source local --now
|
||||
sudo -u ahriman ahriman package-add aur-mirrorlist --source local --now
|
||||
|
||||
where ``aur-clone`` is your repository name.
|
||||
where ``aur`` is your repository name.
|
||||
|
@ -21,7 +21,7 @@ How to report by email
|
||||
|
||||
[email]
|
||||
host = smtp.example.com
|
||||
link_path = http://example.com/aur-clone/x86_64
|
||||
link_path = http://example.com/aur/x86_64
|
||||
password = ...
|
||||
port = 465
|
||||
receivers = me@example.com
|
||||
@ -47,8 +47,8 @@ How to generate index page
|
||||
target = html
|
||||
|
||||
[html]
|
||||
path = ${repository:root}/repository/aur-clone/x86_64/index.html
|
||||
link_path = http://example.com/aur-clone/x86_64
|
||||
path = ${repository:root}/repository/aur/x86_64/index.html
|
||||
link_path = http://example.com/aur/x86_64
|
||||
|
||||
Having this configuration, the generated ``index.html`` will be also automatically synced to remote services (e.g. S3).
|
||||
|
||||
@ -106,7 +106,7 @@ How to post build report to telegram
|
||||
[telegram]
|
||||
api_key = aaAAbbBBccCC
|
||||
chat_id = @ahriman
|
||||
link_path = http://example.com/aur-clone/x86_64
|
||||
link_path = http://example.com/aur/x86_64
|
||||
|
||||
``${api_key}`` is the one sent by `@BotFather <https://t.me/botfather>`__, ``${chat_id}`` is the value retrieved from previous step.
|
||||
|
||||
|
@ -29,7 +29,7 @@ There are several choices:
|
||||
[rsync]
|
||||
remote = 192.168.0.1:/srv/repo
|
||||
|
||||
After that just add ``/srv/repo`` to the ``pacman.conf`` as usual. You can also upload to S3 (``Server = https://s3.eu-central-1.amazonaws.com/repository/aur-clone/x86_64``) or to GitHub (``Server = https://github.com/ahriman/repository/releases/download/aur-clone-x86_64``).
|
||||
After that just add ``/srv/repo`` to the ``pacman.conf`` as usual. You can also upload to S3 (``Server = https://s3.eu-central-1.amazonaws.com/repository/aur/x86_64``) or to GitHub (``Server = https://github.com/ahriman/repository/releases/download/aur-x86_64``).
|
||||
|
||||
How to sync to S3
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
@ -34,7 +34,7 @@ Contents
|
||||
configuration
|
||||
command-line
|
||||
faq/index
|
||||
migration
|
||||
migrations/index
|
||||
architecture
|
||||
advanced-usage
|
||||
triggers
|
||||
|
@ -1,31 +1,11 @@
|
||||
Manual migrations
|
||||
=================
|
||||
|
||||
Normally the most of migrations are handled automatically after application start, however, some upgrades require manual interventions; this document describes them.
|
||||
|
||||
Upgrades to breakpoints
|
||||
-----------------------
|
||||
|
||||
To 2.9.0
|
||||
^^^^^^^^
|
||||
|
||||
This release includes major upgrade for the newest devtools and archlinux repository structure. In order to upgrade package need to:
|
||||
|
||||
#. Upgrade to the latest major release of python (3.11) (required by other changes).
|
||||
#. Upgrade devtools to the latest release.
|
||||
#. Backup local settings, ``/etc/ahriman.ini.d/00-setup-overrides.ini`` by default.
|
||||
#. Run setup command (i.e. ``ahriman service-setup``) again with the same arguments as used before. This step can be done manually by moving ``devtools`` configuration (something like ``/usr/share/devtools/pacman-ahriman*.conf``) to new location ``/usr/share/devtools/pacman.conf.d/`` under name ``ahriman.conf``. After that make sure to remove any ``community`` mentions from configurations (e.g. ``/usr/share/devtools/pacman.conf.d/ahriman.conf``, ``/etc/ahriman.ini``) if there were any. The only thing which will change is ``devtools`` configuration.
|
||||
#. Remove build chroot as it is incompatible, e.g. ``sudo ahriman service-clean --chroot``.
|
||||
#. Run ``sudo -u ahriman ahriman update --no-aur --no-local --no-manual -yy`` in order to update local databases.
|
||||
|
||||
To 2.12.0
|
||||
^^^^^^^^^
|
||||
---------
|
||||
|
||||
This release includes paths migration. Unlike usual case, no automatic migration is performed because it might break user configuration. The following noticeable changes have been made:
|
||||
|
||||
* Path to pre-built packages now includes repository name, i.e. it has been changed from ``/var/lib/ahriman/packages/x86_64`` to ``/var/lib/ahriman/packages/aur-clone/x86_64``.
|
||||
* Path to pacman databases now includes repository name too, it has been changed from ``/var/lib/ahriman/pacman/x86_64`` to ``/var/lib/ahriman/pacman/aur-clone/x86_64``.
|
||||
* Path to repository itself also includes repository name, from ``/var/lib/ahriman/repository/x86_64`` to ``/var/lib/ahriman/repository/aur-clone/x86_64``.
|
||||
* Path to pre-built packages now includes repository name, i.e. it has been changed from ``/var/lib/ahriman/packages/x86_64`` to ``/var/lib/ahriman/packages/aur/x86_64``.
|
||||
* Path to pacman databases now includes repository name too, it has been changed from ``/var/lib/ahriman/pacman/x86_64`` to ``/var/lib/ahriman/pacman/aur/x86_64``.
|
||||
* Path to repository itself also includes repository name, from ``/var/lib/ahriman/repository/x86_64`` to ``/var/lib/ahriman/repository/aur/x86_64``.
|
||||
|
||||
In order to migrate to the new filesystem tree the following actions are required:
|
||||
|
||||
@ -41,16 +21,16 @@ In order to migrate to the new filesystem tree the following actions are require
|
||||
Create directory tree. It can be done by running ``ahriman service-tree-migrate`` subcommand. It performs copying between the old repository tree and the new one. Alternatively directories can be copied by hands.
|
||||
|
||||
#.
|
||||
Edit configuration in case if anything is pointing to the old path, e.g. HTML report generation, in the way in which it will point to the directory inside repository specific one, e.g. ``/var/lib/ahriman/repository/x86_64`` to ``/var/lib/ahriman/repository/aur-clone/x86_64``.
|
||||
Edit configuration in case if anything is pointing to the old path, e.g. HTML report generation, in the way in which it will point to the directory inside repository specific one, e.g. ``/var/lib/ahriman/repository/x86_64`` to ``/var/lib/ahriman/repository/aur/x86_64``.
|
||||
|
||||
#.
|
||||
Run setup command (i.e. ``ahriman service-setup``) again with the same arguments as used before. This step can be done manually by editing devtools pacman configuration (``/usr/share/devtools/pacman.conf.d/ahriman-x86_64.conf`` by default) replacing ``Server`` with path to the repository, e.g.:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[aur-clone]
|
||||
[aur]
|
||||
SigLevel = Optional TrustAll
|
||||
Server = file:///var/lib/ahriman/repository/aur-clone/x86_64
|
||||
Server = file:///var/lib/ahriman/repository/aur/x86_64
|
||||
|
||||
In case of manual interventions make sure to remove architecture reference from ``web`` sections (if any) to avoid ambiguity.
|
||||
|
||||
@ -58,9 +38,9 @@ In order to migrate to the new filesystem tree the following actions are require
|
||||
Make sure to update remote synchronization services if any. Almost all of them rely on current repository tree by default, so it is required to setup either redirects or configure to synchronize to the old locations (e.g. ``object_path`` option for S3 synchronization).
|
||||
|
||||
#.
|
||||
Enable and start services again. Unit template parameter should include both repository architecture and name, dash separated, e.g. ``x86_64-aur-clone``, where ``x86_64`` is the repository architecture and ``aur-clone`` is the repository name:
|
||||
Enable and start services again. Unit template parameter should include both repository architecture and name, dash separated, e.g. ``x86_64-aur``, where ``x86_64`` is the repository architecture and ``aur`` is the repository name:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
sudo systemctl enable --now ahriman@x86_64-aur-clone.timer
|
||||
sudo systemctl enable --now ahriman@x86_64-aur.timer
|
||||
sudo systemctl enable --now ahriman-web
|
16
docs/migrations/2.16.0.rst
Normal file
16
docs/migrations/2.16.0.rst
Normal file
@ -0,0 +1,16 @@
|
||||
To 2.16.0
|
||||
---------
|
||||
|
||||
This release replaces ``passlib`` dependency with ``bcrypt``.
|
||||
|
||||
The reason behind this change is that python developers have deprecated and scheduled for removal ``crypt`` module, which is used by ``passlib``. (By the way, they recommend to use ``passlib`` as a replacement.) Unfortunately, it appears that ``passlib`` is unmaintained (see `the issue <https://foss.heptapod.net/python-libs/passlib/-/issues/187>`__), so the only solution is to migrate to anoher library.
|
||||
|
||||
Because passwords are stored as hashes, it is near to impossible to shadow change passwords in database, the manual intervention is required if:
|
||||
|
||||
#. Authentication is used.
|
||||
#. Notification provider is ``configuration`` or a user with explicitly set password exists.
|
||||
|
||||
Manual steps might look as:
|
||||
|
||||
#. Get list of users with their roles ``ahriman user-list``.
|
||||
#. For each user run update command, i.e. ``ahriman user-add <username> -R <role>``. Type password when it will be requested.
|
11
docs/migrations/2.9.0.rst
Normal file
11
docs/migrations/2.9.0.rst
Normal file
@ -0,0 +1,11 @@
|
||||
To 2.9.0
|
||||
--------
|
||||
|
||||
This release includes major upgrade for the newest devtools and archlinux repository structure. In order to upgrade package need to:
|
||||
|
||||
#. Upgrade to the latest major release of python (3.11) (required by other changes).
|
||||
#. Upgrade devtools to the latest release.
|
||||
#. Backup local settings, ``/etc/ahriman.ini.d/00-setup-overrides.ini`` by default.
|
||||
#. Run setup command (i.e. ``ahriman service-setup``) again with the same arguments as used before. This step can be done manually by moving ``devtools`` configuration (something like ``/usr/share/devtools/pacman-ahriman*.conf``) to new location ``/usr/share/devtools/pacman.conf.d/`` under name ``ahriman.conf``. After that make sure to remove any ``community`` mentions from configurations (e.g. ``/usr/share/devtools/pacman.conf.d/ahriman.conf``, ``/etc/ahriman.ini``) if there were any. The only thing which will change is ``devtools`` configuration.
|
||||
#. Remove build chroot as it is incompatible, e.g. ``sudo ahriman service-clean --chroot``.
|
||||
#. Run ``sudo -u ahriman ahriman update --no-aur --no-local --no-manual -yy`` in order to update local databases.
|
14
docs/migrations/index.rst
Normal file
14
docs/migrations/index.rst
Normal file
@ -0,0 +1,14 @@
|
||||
Manual migrations
|
||||
=================
|
||||
|
||||
Normally the most of migrations are handled automatically after application start, however, some upgrades require manual interventions; this document describes them.
|
||||
|
||||
Upgrades to breakpoints
|
||||
-----------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
2.9.0
|
||||
2.12.0
|
||||
2.16.0
|
@ -10,7 +10,7 @@ Initial setup
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
sudo ahriman -a x86_64 -r aur-clone service-setup ...
|
||||
sudo ahriman -a x86_64 -r aur service-setup ...
|
||||
|
||||
``service-setup`` literally does the following steps:
|
||||
|
||||
@ -19,7 +19,7 @@ Initial setup
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
echo 'PACKAGER="John Doe <john@doe.com>"' | sudo -u ahriman tee -a /var/lib/ahriman/.makepkg.conf
|
||||
echo 'PACKAGER="ahriman bot <ahriman@example.com>"' | sudo -u ahriman tee -a /var/lib/ahriman/.makepkg.conf
|
||||
|
||||
#.
|
||||
Configure build tools (it is required for correct dependency management system):
|
||||
@ -29,26 +29,26 @@ Initial setup
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
ln -s /usr/bin/archbuild /usr/local/bin/aur-clone-x86_64-build
|
||||
ln -s /usr/bin/archbuild /usr/local/bin/aur-x86_64-build
|
||||
|
||||
#.
|
||||
Create configuration file (same as previous ``{name}.conf``):
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
cp /usr/share/devtools/pacman.conf.d/{extra,aur-clone}.conf
|
||||
cp /usr/share/devtools/pacman.conf.d/{extra,aur}.conf
|
||||
|
||||
#.
|
||||
Change configuration file, add your own repository, add multilib repository etc:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
echo '[multilib]' | tee -a /usr/share/devtools/pacman.conf.d/aur-clone-x86_64.conf
|
||||
echo 'Include = /etc/pacman.d/mirrorlist' | tee -a /usr/share/devtools/pacman.conf.d/aur-clone-x86_64.conf
|
||||
echo '[multilib]' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
|
||||
echo 'Include = /etc/pacman.d/mirrorlist' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
|
||||
|
||||
echo '[aur-clone]' | tee -a /usr/share/devtools/pacman.conf.d/aur-clone-x86_64.conf
|
||||
echo 'SigLevel = Optional TrustAll' | tee -a /usr/share/devtools/pacman.conf.d/aur-clone-x86_64.conf
|
||||
echo 'Server = file:///var/lib/ahriman/repository/$repo/$arch' | tee -a /usr/share/devtools/pacman.conf.d/aur-clone-x86_64.conf
|
||||
echo '[aur]' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
|
||||
echo 'SigLevel = Optional TrustAll' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
|
||||
echo 'Server = file:///var/lib/ahriman/repository/$repo/$arch' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
|
||||
|
||||
#.
|
||||
Set ``build_command`` option to point to your command:
|
||||
@ -56,14 +56,14 @@ Initial setup
|
||||
.. code-block:: shell
|
||||
|
||||
echo '[build]' | tee -a /etc/ahriman.ini.d/build.ini
|
||||
echo 'build_command = aur-clone-x86_64-build' | tee -a /etc/ahriman.ini.d/build.ini
|
||||
echo 'build_command = aur-x86_64-build' | tee -a /etc/ahriman.ini.d/build.ini
|
||||
|
||||
#.
|
||||
Configure ``/etc/sudoers.d/ahriman`` to allow running command without a password:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
echo 'Cmnd_Alias CARCHBUILD_CMD = /usr/local/bin/aur-clone-x86_64-build *' | tee -a /etc/sudoers.d/ahriman
|
||||
echo 'Cmnd_Alias CARCHBUILD_CMD = /usr/local/bin/aur-x86_64-build *' | tee -a /etc/sudoers.d/ahriman
|
||||
echo 'ahriman ALL=(ALL) NOPASSWD:SETENV: CARCHBUILD_CMD' | tee -a /etc/sudoers.d/ahriman
|
||||
chmod 400 /etc/sudoers.d/ahriman
|
||||
|
||||
@ -74,7 +74,7 @@ Initial setup
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
systemctl enable --now ahriman@x86_64-aur-clone.timer
|
||||
systemctl enable --now ahriman@x86_64-aur.timer
|
||||
|
||||
#.
|
||||
Start and enable status page:
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Maintainer: Evgeniy Alekseev
|
||||
|
||||
pkgname='ahriman'
|
||||
pkgver=2.15.1
|
||||
pkgver=2.15.2
|
||||
pkgrel=1
|
||||
pkgdesc="ArcH linux ReposItory MANager"
|
||||
arch=('any')
|
||||
url="https://github.com/arcan1s/ahriman"
|
||||
license=('GPL3')
|
||||
depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-inflection' 'python-passlib' 'python-pyelftools' 'python-requests')
|
||||
depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-bcrypt' 'python-inflection' 'python-pyelftools' 'python-requests')
|
||||
makedepends=('python-build' 'python-flit' 'python-installer' 'python-wheel')
|
||||
optdepends=('python-aioauth-client: web server with OAuth2 authorization'
|
||||
'python-aiohttp: web server'
|
||||
@ -42,9 +42,6 @@ package() {
|
||||
|
||||
python -m installer --destdir="$pkgdir" "dist/$pkgname-$pkgver-py3-none-any.whl"
|
||||
|
||||
# thanks too PEP517, which we all wanted, you need to install data files manually nowadays
|
||||
pushd package && find . \( -type f -or -type l \) -exec install -Dm644 "{}" "$pkgdir/usr/{}" \; && popd
|
||||
|
||||
# keep usr/share configs as reference and copy them to /etc
|
||||
install -Dm644 "$pkgdir/usr/share/$pkgname/settings/ahriman.ini" "$pkgdir/etc/ahriman.ini"
|
||||
install -Dm644 "$pkgdir/usr/share/$pkgname/settings/ahriman.ini.d/logging.ini" "$pkgdir/etc/ahriman.ini.d/logging.ini"
|
||||
@ -52,7 +49,3 @@ package() {
|
||||
install -Dm644 "$srcdir/$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
|
||||
install -Dm644 "$srcdir/$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
|
||||
}
|
||||
|
||||
sha512sums=('19841842641520b573cdde6cb80a7cfcd69756d323fdfeebc2eee2d264a1325ead4ab2f8383bb369f7896bfc1de59d7358f133f4afeb90a9b9f0695f482a58d0'
|
||||
'53d37efec812afebf86281716259f9ea78a307b83897166c72777251c3eebcb587ecee375d907514781fb2a5c808cbb24ef9f3f244f12740155d0603bf213131'
|
||||
'62b2eccc352d33853ef243c9cddd63663014aa97b87242f1b5bc5099a7dbd69ff3821f24ffc58e1b7f2387bd4e9e9712cc4c67f661b1724ad99cdf09b3717794')
|
||||
|
@ -21,7 +21,7 @@ It was found that there was an upgrade from old devtools package to the new one,
|
||||
* remove build chroot, e.g.: ahriman service-clean --chroot;
|
||||
* update local databases: ahriman update --no-aur --no-local --no-manual -yy.
|
||||
|
||||
For more information kindly refer to migration notes https://ahriman.readthedocs.io/en/stable/migration.html.
|
||||
For more information kindly refer to migration notes https://ahriman.readthedocs.io/en/stable/migrations/2.9.0.html.
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -34,9 +34,19 @@ Whereas old local tree is still supported it is highly recommended to migrate to
|
||||
* edit local configuration to avoid pointing to the old paths;
|
||||
* run setup command (i.e. ahriman service-setup) with the same arguments as did before;
|
||||
* update remote services in order to support new paths (or setup redirects) if any;
|
||||
* enable web and timer services again by using x86_64-aur-clone suffix,
|
||||
where x86_64 is the repository architecture and aur-clone is the repository name.
|
||||
* enable web and timer services again by using x86_64-aur suffix,
|
||||
where x86_64 is the repository architecture and aur is the repository name.
|
||||
|
||||
For more information kindly refer to migration notes https://ahriman.readthedocs.io/en/stable/migration.html.
|
||||
For more information kindly refer to migration notes https://ahriman.readthedocs.io/en/stable/migrations/2.12.0.html.
|
||||
EOF
|
||||
}
|
||||
|
||||
_2_16_0_1_changes() {
|
||||
cat << EOF
|
||||
In order to prepare to python 3.13 the project now uses bcrypt instead of passlib for generating and validating
|
||||
passwords, because the passlib seems to be unmaintained and will be broken since then. If you are using password
|
||||
authentication, you'd need to generate passwords again.
|
||||
|
||||
For more information kindly refer to migration notes https://ahriman.readthedocs.io/en/stable/migrations/2.16.0.html.
|
||||
EOF
|
||||
}
|
||||
|
@ -7,10 +7,17 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group row mt-2">
|
||||
<div class="col-4 col-lg-1" style="text-align: right">packages</div>
|
||||
<div id="package-info-packages" class="col-8 col-lg-5"></div>
|
||||
<div class="col-4 col-lg-1" style="text-align: right">version</div>
|
||||
<div id="package-info-version" class="col-8 col-lg-5"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row mt-2">
|
||||
<div class="col-4 col-lg-1" style="text-align: right">packager</div>
|
||||
<div id="package-info-packager" class="col-8 col-lg-5"></div>
|
||||
<div class="col-4 col-lg-1" style="text-align: right"></div>
|
||||
<div id="package-info---placeholder" class="col-8 col-lg-5"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row mt-2">
|
||||
@ -28,10 +35,10 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group row mt-2">
|
||||
<div class="col-4 col-lg-1" style="text-align: right">packages</div>
|
||||
<div id="package-info-packages" class="col-8 col-lg-5"></div>
|
||||
<div class="col-4 col-lg-1" style="text-align: right">depends</div>
|
||||
<div id="package-info-depends" class="col-8 col-lg-5"></div>
|
||||
<div class="col-4 col-lg-1" style="text-align: right">implicitly depends</div>
|
||||
<div id="package-info-implicitly-depends" class="col-8 col-lg-5"></div>
|
||||
</div>
|
||||
|
||||
<hr class="col-12">
|
||||
@ -107,6 +114,7 @@
|
||||
const packageInfoAurUrl = document.getElementById("package-info-aur-url");
|
||||
const packageInfoDepends = document.getElementById("package-info-depends");
|
||||
const packageInfoGroups = document.getElementById("package-info-groups");
|
||||
const packageInfoImplicitlyDepends = document.getElementById("package-info-implicitly-depends");
|
||||
const packageInfoLicenses = document.getElementById("package-info-licenses");
|
||||
const packageInfoPackager = document.getElementById("package-info-packager");
|
||||
const packageInfoPackages = document.getElementById("package-info-packages");
|
||||
@ -200,6 +208,26 @@
|
||||
);
|
||||
}
|
||||
|
||||
function loadDependencies(packageBase, onFailure) {
|
||||
makeRequest(
|
||||
`/api/v1/packages/${packageBase}/dependencies`,
|
||||
{
|
||||
query: {
|
||||
architecture: repository.architecture,
|
||||
repository: repository.repository,
|
||||
},
|
||||
convert: response => response.json(),
|
||||
},
|
||||
data => {
|
||||
packageInfoImplicitlyDepends.innerHTML = listToTable(
|
||||
Object.values(data.paths)
|
||||
.reduce((accumulator, currentValue) => accumulator.concat(currentValue), [])
|
||||
);
|
||||
},
|
||||
onFailure,
|
||||
);
|
||||
}
|
||||
|
||||
function loadEvents(packageBase, onFailure) {
|
||||
packageInfoEventsTable.bootstrapTable("showLoading");
|
||||
clearChart();
|
||||
@ -287,14 +315,9 @@
|
||||
},
|
||||
data => {
|
||||
const description = data.find(Boolean);
|
||||
const packages = Object.keys(description.package.packages);
|
||||
const packages = description.package.packages;
|
||||
const aurUrl = description.package.remote.web_url;
|
||||
const upstreamUrls = Array.from(
|
||||
new Set(
|
||||
Object.values(description.package.packages)
|
||||
.map(single => single.url)
|
||||
)
|
||||
).sort();
|
||||
const upstreamUrls = Array.from(new Set(Object.values(packages).map(single => single.url))).sort();
|
||||
|
||||
packageInfo.textContent = `${description.package.base} ${description.status.status} at ${new Date(1000 * description.status.timestamp).toISOStringShort()}`;
|
||||
|
||||
@ -304,17 +327,17 @@
|
||||
|
||||
packageInfoAurUrl.innerHTML = aurUrl ? safeLink(aurUrl, aurUrl, "AUR link").outerHTML : "";
|
||||
packageInfoDepends.innerHTML = listToTable(
|
||||
Object.values(description.package.packages)
|
||||
Object.values(packages)
|
||||
.reduce((accumulator, currentValue) => {
|
||||
return accumulator.concat(currentValue.depends.filter(v => packages.indexOf(v) === -1))
|
||||
.concat(currentValue.make_depends.filter(v => packages.indexOf(v) === -1).map(v => `${v} (make)`))
|
||||
.concat(currentValue.opt_depends.filter(v => packages.indexOf(v) === -1).map(v => `${v} (optional)`));
|
||||
return accumulator.concat(currentValue.depends.filter(v => !packages.hasOwnProperty(v)))
|
||||
.concat(currentValue.make_depends.filter(v => !packages.hasOwnProperty(v)).map(v => `${v} (make)`))
|
||||
.concat(currentValue.opt_depends.filter(v => !packages.hasOwnProperty(v)).map(v => `${v} (optional)`));
|
||||
}, [])
|
||||
);
|
||||
packageInfoGroups.innerHTML = listToTable(extractListProperties(description.package, "groups"));
|
||||
packageInfoLicenses.innerHTML = listToTable(extractListProperties(description.package, "licenses"));
|
||||
packageInfoPackager.textContent = description.package.packager;
|
||||
packageInfoPackages.innerHTML = listToTable(packages);
|
||||
packageInfoPackages.innerHTML = listToTable(Object.entries(packages).map(([key, value]) => `${key} (${value.description})`));
|
||||
packageInfoUpstreamUrl.innerHTML = upstreamUrls.map(url => safeLink(url, url, "upstream link").outerHTML).join("<br>");
|
||||
packageInfoVersion.textContent = description.package.version;
|
||||
},
|
||||
@ -365,6 +388,7 @@
|
||||
};
|
||||
|
||||
loadPackage(packageBase, onFailure);
|
||||
loadDependencies(packageBase, onFailure);
|
||||
loadPatches(packageBase, onFailure);
|
||||
loadLogs(packageBase, onFailure);
|
||||
loadChanges(packageBase, onFailure);
|
||||
@ -388,6 +412,7 @@
|
||||
packageInfoAurUrl.textContent = "";
|
||||
packageInfoDepends.textContent = "";
|
||||
packageInfoGroups.textContent = "";
|
||||
packageInfoImplicitlyDepends.textContent = "";
|
||||
packageInfoLicenses.textContent = "";
|
||||
packageInfoPackager.textContent = "";
|
||||
packageInfoPackages.textContent = "";
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH AHRIMAN "1" "2024\-09\-24" "ahriman" "Generated Python Manual"
|
||||
.TH AHRIMAN "1" "2024\-09\-26" "ahriman" "Generated Python Manual"
|
||||
.SH NAME
|
||||
ahriman
|
||||
.SH SYNOPSIS
|
||||
@ -989,7 +989,25 @@ usage: ahriman web [\-h]
|
||||
start web server
|
||||
|
||||
.SH COMMENTS
|
||||
Argument list can also be read from file by using @ prefix.
|
||||
Quick setup command (replace repository name, architecture and packager as needed):
|
||||
|
||||
>>> ahriman \-a x86_64 \-r aur service\-setup \-\-packager "ahriman bot <ahriman@example.com>"
|
||||
|
||||
Add new package from AUR:
|
||||
|
||||
>>> ahriman package\-add ahriman \-\-now
|
||||
|
||||
Check for updates and build out\-of\-dated packages (add ``\-\-dry\-run`` to build it later):
|
||||
|
||||
>>> ahriman repo\-update
|
||||
|
||||
Remove package from the repository:
|
||||
|
||||
>>> ahriman package\-remove ahriman
|
||||
|
||||
Start web service (requires additional configuration):
|
||||
|
||||
>>> ahriman web
|
||||
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
|
@ -17,8 +17,8 @@ authors = [
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
"bcrypt",
|
||||
"inflection",
|
||||
"passlib",
|
||||
"pyelftools",
|
||||
"requests",
|
||||
]
|
||||
@ -100,3 +100,6 @@ include = [
|
||||
exclude = [
|
||||
"package/archlinux",
|
||||
]
|
||||
|
||||
[tool.flit.external-data]
|
||||
directory = "package"
|
||||
|
@ -17,4 +17,4 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
__version__ = "2.15.1"
|
||||
__version__ = "2.15.2"
|
||||
|
@ -25,6 +25,7 @@ from typing import TypeVar
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.application import handlers
|
||||
from ahriman.application.help_formatter import _HelpFormatter
|
||||
from ahriman.core.utils import enum_values, extract_user
|
||||
from ahriman.models.action import Action
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
@ -45,19 +46,6 @@ __all__: list[str] = []
|
||||
SubParserAction = TypeVar("SubParserAction", bound="argparse._SubParsersAction[argparse.ArgumentParser]")
|
||||
|
||||
|
||||
def _formatter(prog: str) -> argparse.HelpFormatter:
|
||||
"""
|
||||
formatter for the help message
|
||||
|
||||
Args:
|
||||
prog(str): application name
|
||||
|
||||
Returns:
|
||||
argparse.HelpFormatter: formatter used by default
|
||||
"""
|
||||
return argparse.ArgumentDefaultsHelpFormatter(prog, width=120)
|
||||
|
||||
|
||||
# pylint: disable=too-many-statements
|
||||
def _parser() -> argparse.ArgumentParser:
|
||||
"""
|
||||
@ -67,8 +55,28 @@ def _parser() -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: command line parser for the application
|
||||
"""
|
||||
parser = argparse.ArgumentParser(prog="ahriman", description="ArcH linux ReposItory MANager",
|
||||
epilog="Argument list can also be read from file by using @ prefix.",
|
||||
fromfile_prefix_chars="@", formatter_class=_formatter)
|
||||
epilog="""
|
||||
Quick setup command (replace repository name, architecture and packager as needed):
|
||||
|
||||
>>> ahriman -a x86_64 -r aur service-setup --packager "ahriman bot <ahriman@example.com>"
|
||||
|
||||
Add new package from AUR:
|
||||
|
||||
>>> ahriman package-add ahriman --now
|
||||
|
||||
Check for updates and build out-of-dated packages (add ``--dry-run`` to build it later):
|
||||
|
||||
>>> ahriman repo-update
|
||||
|
||||
Remove package from the repository:
|
||||
|
||||
>>> ahriman package-remove ahriman
|
||||
|
||||
Start web service (requires additional configuration):
|
||||
|
||||
>>> ahriman web
|
||||
""",
|
||||
fromfile_prefix_chars="@", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("-a", "--architecture", help="filter by target architecture")
|
||||
parser.add_argument("-c", "--configuration", help="configuration path", type=Path,
|
||||
default=Path("/") / "etc" / "ahriman.ini")
|
||||
@ -102,6 +110,7 @@ def _parser() -> argparse.ArgumentParser:
|
||||
_set_package_add_parser(subparsers)
|
||||
_set_package_changes_parser(subparsers)
|
||||
_set_package_changes_remove_parser(subparsers)
|
||||
_set_package_copy_parser(subparsers)
|
||||
_set_package_remove_parser(subparsers)
|
||||
_set_package_status_parser(subparsers)
|
||||
_set_package_status_remove_parser(subparsers)
|
||||
@ -154,7 +163,7 @@ def _set_aur_search_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("aur-search", aliases=["search"], help="search for package",
|
||||
description="search for package in AUR using API", formatter_class=_formatter)
|
||||
description="search for package in AUR using API", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("search", help="search terms, can be specified multiple times, the result will match all terms",
|
||||
nargs="+")
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||
@ -179,7 +188,8 @@ def _set_help_commands_unsafe_parser(root: SubParserAction) -> argparse.Argument
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("help-commands-unsafe", help="list unsafe commands",
|
||||
description="list unsafe commands as defined in default args", formatter_class=_formatter)
|
||||
description="list unsafe commands as defined in default args",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("subcommand", help="instead of showing commands, just test command line for unsafe subcommand "
|
||||
"and return 0 in case if command is safe and 1 otherwise", nargs="*")
|
||||
parser.set_defaults(handler=handlers.UnsafeCommands, architecture="", lock=None, quiet=True, report=False,
|
||||
@ -199,7 +209,7 @@ def _set_help_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("help", help="show help message",
|
||||
description="show help message for application or command and exit",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("subcommand", help="show help message for specific command", nargs="?")
|
||||
parser.set_defaults(handler=handlers.Help, architecture="", lock=None, quiet=True, report=False, repository="",
|
||||
unsafe=True, parser=_parser)
|
||||
@ -218,7 +228,7 @@ def _set_help_updates_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("help-updates", help="check for service updates",
|
||||
description="request AUR for current version and compare with current service version",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit code if updates available", action="store_true")
|
||||
parser.set_defaults(handler=handlers.ServiceUpdates, architecture="", lock=None, quiet=True, report=False,
|
||||
repository="", unsafe=True)
|
||||
@ -236,7 +246,8 @@ def _set_help_version_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("help-version", aliases=["version"], help="application version",
|
||||
description="print application and its dependencies versions", formatter_class=_formatter)
|
||||
description="print application and its dependencies versions",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.Versions, architecture="", lock=None, quiet=True, report=False,
|
||||
repository="", unsafe=True)
|
||||
return parser
|
||||
@ -256,15 +267,15 @@ def _set_package_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
description="add existing or new package to the build queue",
|
||||
epilog="This subcommand should be used for new package addition. It also supports flag "
|
||||
"--now in case if you would like to build the package immediately. "
|
||||
"You can add new package from one of supported sources: "
|
||||
"1) if it is already built package you can specify the path to the archive; "
|
||||
"2) you can also add built packages from the directory (e.g. during the migration "
|
||||
"from another repository source); "
|
||||
"3) it is also possible to add package from local PKGBUILD, but in this case it "
|
||||
"will be ignored during the next automatic updates; "
|
||||
"4) ahriman supports downloading archives from remote (e.g. HTTP) sources; "
|
||||
"5) and finally you can add package from AUR.",
|
||||
formatter_class=_formatter)
|
||||
"You can add new package from one of supported sources:\n\n"
|
||||
"1. If it is already built package you can specify the path to the archive.\n"
|
||||
"2. You can also add built packages from the directory (e.g. during the migration "
|
||||
"from another repository source).\n"
|
||||
"3. It is also possible to add package from local PKGBUILD, but in this case it "
|
||||
"will be ignored during the next automatic updates.\n"
|
||||
"4. Ahriman supports downloading archives from remote (e.g. HTTP) sources.\n"
|
||||
"5. Finally you can add package from AUR.",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package source (base name, path to local files, remote URL)", nargs="+")
|
||||
parser.add_argument("--changes", help="calculate changes from the latest known commit if available",
|
||||
action=argparse.BooleanOptionalAction, default=True)
|
||||
@ -298,7 +309,7 @@ def _set_package_changes_parser(root: SubParserAction) -> argparse.ArgumentParse
|
||||
parser = root.add_parser("package-changes", help="get package changes",
|
||||
description="retrieve package changes stored in database",
|
||||
epilog="This feature requests package status from the web interface if it is available.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package base")
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||
parser.set_defaults(handler=handlers.Change, action=Action.List, lock=None, quiet=True, report=False, unsafe=True)
|
||||
@ -317,13 +328,34 @@ def _set_package_changes_remove_parser(root: SubParserAction) -> argparse.Argume
|
||||
"""
|
||||
parser = root.add_parser("package-changes-remove", help="remove package changes",
|
||||
description="remove the package changes stored remotely",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package base")
|
||||
parser.set_defaults(handler=handlers.Change, action=Action.Remove, exit_code=False, lock=None, quiet=True,
|
||||
report=False, unsafe=True)
|
||||
return parser
|
||||
|
||||
|
||||
def _set_package_copy_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
add parser for package copy subcommand
|
||||
|
||||
Args:
|
||||
root(SubParserAction): subparsers for the commands
|
||||
|
||||
Returns:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("package-copy", aliases=["copy"], help="copy package from another repository",
|
||||
description="copy package and its metadata from another repository",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("source", help="source repository name")
|
||||
parser.add_argument("package", help="package base", nargs="+")
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||
parser.add_argument("--remove", help="remove package from the source repository after", action="store_true")
|
||||
parser.set_defaults(handler=handlers.Copy)
|
||||
return parser
|
||||
|
||||
|
||||
def _set_package_remove_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
add parser for package removal subcommand
|
||||
@ -335,7 +367,7 @@ def _set_package_remove_parser(root: SubParserAction) -> argparse.ArgumentParser
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("package-remove", aliases=["remove"], help="remove package",
|
||||
description="remove package from the repository", formatter_class=_formatter)
|
||||
description="remove package from the repository", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package name or base", nargs="+")
|
||||
parser.set_defaults(handler=handlers.Remove)
|
||||
return parser
|
||||
@ -354,7 +386,7 @@ def _set_package_status_parser(root: SubParserAction) -> argparse.ArgumentParser
|
||||
parser = root.add_parser("package-status", aliases=["status"], help="get package status",
|
||||
description="request status of the package",
|
||||
epilog="This feature requests package status from the web interface if it is available.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="filter status by package base", nargs="*")
|
||||
parser.add_argument("--ahriman", help="get service status itself", action="store_true")
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||
@ -380,7 +412,7 @@ def _set_package_status_remove_parser(root: SubParserAction) -> argparse.Argumen
|
||||
description="remove the package from the status page",
|
||||
epilog="Please note that this subcommand does not remove the package itself, it just "
|
||||
"clears the status page.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="remove specified packages from status page", nargs="+")
|
||||
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Remove, lock=None, quiet=True, report=False,
|
||||
unsafe=True)
|
||||
@ -398,7 +430,8 @@ def _set_package_status_update_parser(root: SubParserAction) -> argparse.Argumen
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("package-status-update", aliases=["status-update"], help="update package status",
|
||||
description="update package status on the status page", formatter_class=_formatter)
|
||||
description="update package status on the status page",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="set status for specified packages. "
|
||||
"If no packages supplied, service status will be updated",
|
||||
nargs="*")
|
||||
@ -424,8 +457,8 @@ def _set_patch_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
epilog="Unlike ``patch-set-add``, this function allows to patch only one PKGBUILD "
|
||||
"function, e.g. typing ``ahriman patch-add ahriman pkgver`` it will change the "
|
||||
"``pkgver`` inside PKGBUILD, typing ``ahriman patch-add ahriman build()`` "
|
||||
"it will change ``build()`` function inside PKGBUILD",
|
||||
formatter_class=_formatter)
|
||||
"it will change ``build()`` function inside PKGBUILD.",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package base")
|
||||
parser.add_argument("variable", help="PKGBUILD variable or function name. If variable is a function, "
|
||||
"it must end with ()")
|
||||
@ -446,8 +479,8 @@ def _set_patch_list_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
Returns:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("patch-list", help="list patch sets",
|
||||
description="list available patches for the package", formatter_class=_formatter)
|
||||
parser = root.add_parser("patch-list", help="list patch sets", description="list available patches for the package",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package base")
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||
parser.add_argument("-v", "--variable", help="if set, show only patches for specified PKGBUILD variables",
|
||||
@ -468,7 +501,7 @@ def _set_patch_remove_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("patch-remove", help="remove patch set", description="remove patches for the package",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="package base")
|
||||
parser.add_argument("-v", "--variable", help="should be used for single-function patches in case if you wold like "
|
||||
"to remove only specified PKGBUILD variables. In case if not set, "
|
||||
@ -490,12 +523,13 @@ def _set_patch_set_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("patch-set-add", help="add patch set", description="create or update source patches",
|
||||
epilog="In order to add a patch set for the package you will need to clone "
|
||||
"the AUR package manually, add required changes (e.g. external patches, "
|
||||
"edit PKGBUILD) and run command, e.g. ``ahriman patch-set-add path/to/directory``. "
|
||||
"By default it tracks *.patch and *.diff files, but this behavior can be changed "
|
||||
"by using --track option",
|
||||
formatter_class=_formatter)
|
||||
epilog="In order to add a patch set for the package you will need to:\n\n"
|
||||
"1. Clone the AUR package manually.\n"
|
||||
"2. Add required changes (e.g. external patches, edit PKGBUILD).\n"
|
||||
"3. Run command, e.g. ``ahriman patch-set-add path/to/directory``.\n\n"
|
||||
"By default it tracks ``*.patch`` and ``*.diff`` files, but this behavior can be "
|
||||
"changed by using ``--track`` option.",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="path to directory with changed files for patch addition/update", type=Path)
|
||||
parser.add_argument("-t", "--track", help="files which has to be tracked", action="append",
|
||||
default=["*.diff", "*.patch"])
|
||||
@ -515,7 +549,8 @@ def _set_repo_backup_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("repo-backup", help="backup repository data",
|
||||
description="backup repository settings and database", formatter_class=_formatter)
|
||||
description="backup repository settings and database",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("path", help="path of the output archive", type=Path)
|
||||
parser.set_defaults(handler=handlers.Backup, architecture="", lock=None, report=False, repository="",
|
||||
unsafe=True)
|
||||
@ -534,7 +569,7 @@ def _set_repo_check_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("repo-check", aliases=["check"], help="check for updates",
|
||||
description="check for packages updates. Same as repo-update --dry-run --no-manual",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="filter check by package base", nargs="*")
|
||||
parser.add_argument("--changes", help="calculate changes from the latest known commit if available",
|
||||
action=argparse.BooleanOptionalAction, default=True)
|
||||
@ -566,7 +601,7 @@ def _set_repo_create_keyring_parser(root: SubParserAction) -> argparse.ArgumentP
|
||||
description="create package which contains list of trusted keys as set by "
|
||||
"configuration. Note, that this action will only create package, the package "
|
||||
"itself has to be built manually",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.Triggers, trigger=["ahriman.core.support.KeyringTrigger"])
|
||||
return parser
|
||||
|
||||
@ -585,7 +620,7 @@ def _set_repo_create_mirrorlist_parser(root: SubParserAction) -> argparse.Argume
|
||||
description="create package which contains list of available mirrors as set by "
|
||||
"configuration. Note, that this action will only create package, the package "
|
||||
"itself has to be built manually",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.Triggers, trigger=["ahriman.core.support.MirrorlistTrigger"])
|
||||
return parser
|
||||
|
||||
@ -602,7 +637,7 @@ def _set_repo_daemon_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("repo-daemon", aliases=["daemon"], help="run application as daemon",
|
||||
description="start process which periodically will run update process",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("-i", "--interval", help="interval between runs in seconds", type=int, default=60 * 60 * 12)
|
||||
parser.add_argument("--aur", help="enable or disable checking for AUR updates",
|
||||
action=argparse.BooleanOptionalAction, default=True)
|
||||
@ -644,7 +679,7 @@ def _set_repo_rebuild_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("repo-rebuild", aliases=["rebuild"], help="rebuild repository",
|
||||
description="force rebuild whole repository", formatter_class=_formatter)
|
||||
description="force rebuild whole repository", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("--depends-on", help="only rebuild packages that depend on specified packages", action="append")
|
||||
parser.add_argument("--dry-run", help="just perform check for packages without rebuild process itself",
|
||||
action="store_true")
|
||||
@ -676,7 +711,7 @@ def _set_repo_remove_unknown_parser(root: SubParserAction) -> argparse.ArgumentP
|
||||
"""
|
||||
parser = root.add_parser("repo-remove-unknown", aliases=["remove-unknown"], help="remove unknown packages",
|
||||
description="remove packages which are missing in AUR and do not have local PKGBUILDs",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("--dry-run", help="just perform check for packages without removal", action="store_true")
|
||||
parser.set_defaults(handler=handlers.RemoveUnknown)
|
||||
return parser
|
||||
@ -695,7 +730,7 @@ def _set_repo_report_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser = root.add_parser("repo-report", aliases=["report"], help="generate report",
|
||||
description="generate repository report according to current settings",
|
||||
epilog="Create and/or update repository report as configured.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.Triggers, trigger=["ahriman.core.report.ReportTrigger"])
|
||||
return parser
|
||||
|
||||
@ -711,7 +746,7 @@ def _set_repo_restore_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("repo-restore", help="restore repository data",
|
||||
description="restore settings and database", formatter_class=_formatter)
|
||||
description="restore settings and database", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("path", help="path of the input archive", type=Path)
|
||||
parser.add_argument("-o", "--output", help="root path of the extracted files", type=Path, default=Path("/"))
|
||||
parser.set_defaults(handler=handlers.Restore, architecture="", lock=None, report=False, repository="",
|
||||
@ -732,7 +767,7 @@ def _set_repo_sign_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser = root.add_parser("repo-sign", aliases=["sign"], help="sign packages",
|
||||
description="(re-)sign packages and repository database according to current settings",
|
||||
epilog="Sign repository and/or packages as configured.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="sign only specified packages", nargs="*")
|
||||
parser.set_defaults(handler=handlers.Sign)
|
||||
return parser
|
||||
@ -749,7 +784,7 @@ def _set_repo_statistics_parser(root: SubParserAction) -> argparse.ArgumentParse
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("repo-statistics", help="repository statistics",
|
||||
description="fetch repository statistics", formatter_class=_formatter)
|
||||
description="fetch repository statistics", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="fetch only events for the specified package", nargs="?")
|
||||
parser.add_argument("--chart", help="create updates chart and save it to the specified path", type=Path)
|
||||
parser.add_argument("-e", "--event", help="event type filter",
|
||||
@ -773,7 +808,8 @@ def _set_repo_status_update_parser(root: SubParserAction) -> argparse.ArgumentPa
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("repo-status-update", help="update repository status",
|
||||
description="update repository status on the status page", formatter_class=_formatter)
|
||||
description="update repository status on the status page",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("-s", "--status", help="new status",
|
||||
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
|
||||
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Update, lock=None, package=[], quiet=True,
|
||||
@ -794,7 +830,7 @@ def _set_repo_sync_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser = root.add_parser("repo-sync", aliases=["sync"], help="sync repository",
|
||||
description="sync repository files to remote server according to current settings",
|
||||
epilog="Synchronize the repository to remote services as configured.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.Triggers, trigger=["ahriman.core.upload.UploadTrigger"])
|
||||
return parser
|
||||
|
||||
@ -811,7 +847,7 @@ def _set_repo_tree_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("repo-tree", help="dump repository tree",
|
||||
description="dump repository tree based on packages dependencies",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("-p", "--partitions", help="also divide packages by independent partitions",
|
||||
type=int, default=1)
|
||||
parser.set_defaults(handler=handlers.Structure, lock=None, quiet=True, report=False, unsafe=True)
|
||||
@ -830,7 +866,7 @@ def _set_repo_triggers_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("repo-triggers", help="run triggers",
|
||||
description="run triggers on empty build result as configured by settings",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("trigger", help="instead of running all triggers as set by configuration, just process "
|
||||
"specified ones in order of mention", nargs="*")
|
||||
parser.set_defaults(handler=handlers.Triggers)
|
||||
@ -849,7 +885,7 @@ def _set_repo_update_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("repo-update", aliases=["update"], help="update packages",
|
||||
description="check for packages updates and run build process if requested",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("package", help="filter check by package base", nargs="*")
|
||||
parser.add_argument("--aur", help="enable or disable checking for AUR updates",
|
||||
action=argparse.BooleanOptionalAction, default=True)
|
||||
@ -894,7 +930,7 @@ def _set_service_clean_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
epilog="The subcommand clears every temporary directories (builds, caches etc). Normally "
|
||||
"you should not run this command manually. Also in case if you are going to clear "
|
||||
"the chroot directories you will need root privileges.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("--cache", help="clear directory with package caches",
|
||||
action=argparse.BooleanOptionalAction, default=False)
|
||||
parser.add_argument("--chroot", help="clear build chroot", action=argparse.BooleanOptionalAction, default=False)
|
||||
@ -920,7 +956,7 @@ def _set_service_config_parser(root: SubParserAction) -> argparse.ArgumentParser
|
||||
"""
|
||||
parser = root.add_parser("service-config", aliases=["config", "repo-config"], help="dump configuration",
|
||||
description="dump configuration for the specified architecture",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("section", help="filter settings by section", nargs="?")
|
||||
parser.add_argument("key", help="filter settings by key", nargs="?")
|
||||
parser.add_argument("--info", help="show additional information, e.g. configuration files",
|
||||
@ -944,7 +980,7 @@ def _set_service_config_validate_parser(root: SubParserAction) -> argparse.Argum
|
||||
parser = root.add_parser("service-config-validate", aliases=["config-validate", "repo-config-validate"],
|
||||
help="validate system configuration",
|
||||
description="validate configuration and print found errors",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if configuration is invalid",
|
||||
action="store_true")
|
||||
parser.set_defaults(handler=handlers.Validate, lock=None, quiet=True, report=False, unsafe=True)
|
||||
@ -967,7 +1003,7 @@ def _set_service_key_import_parser(root: SubParserAction) -> argparse.ArgumentPa
|
||||
"(in case if signature and keys are available in PKGBUILD). This process will "
|
||||
"fail in case if key is not known for build user. This subcommand can be used "
|
||||
"in order to import the PGP key to user keychain.",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("--key-server", help="key server for key import", default="keyserver.ubuntu.com")
|
||||
parser.add_argument("key", help="PGP key to import from public server")
|
||||
parser.set_defaults(handler=handlers.KeyImport, architecture="", lock=None, report=False, repository="")
|
||||
@ -986,7 +1022,7 @@ def _set_service_repositories(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("service-repositories", help="show repositories",
|
||||
description="list all available repositories",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("--id-only", help="show machine readable identifier instead",
|
||||
action=argparse.BooleanOptionalAction, default=False)
|
||||
parser.set_defaults(handler=handlers.Repositories, architecture="", lock=None, report=False, repository="",
|
||||
@ -1007,8 +1043,8 @@ def _set_service_run(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser = root.add_parser("service-run", aliases=["run"], help="run multiple commands",
|
||||
description="run multiple commands on success run of the previous command",
|
||||
epilog="Commands must be quoted by using usual bash rules. Processes will be spawned "
|
||||
"under the same user as this command",
|
||||
formatter_class=_formatter)
|
||||
"under the same user as this command.",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("command", help="command to be run (quoted) without ``ahriman``", nargs="+")
|
||||
parser.set_defaults(handler=handlers.Run, architecture="", lock=None, report=False, repository="",
|
||||
unsafe=True, parser=_parser)
|
||||
@ -1028,8 +1064,8 @@ def _set_service_setup_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser = root.add_parser("service-setup", aliases=["init", "repo-init", "repo-setup", "setup"],
|
||||
help="initial service configuration",
|
||||
description="create initial service configuration, requires root",
|
||||
epilog="Create _minimal_ configuration for the service according to provided options.",
|
||||
formatter_class=_formatter)
|
||||
epilog="Create **minimal** configuration for the service according to provided options.",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("--build-as-user", help="force makepkg user to the specific one")
|
||||
parser.add_argument("--from-configuration", help="path to default devtools pacman configuration",
|
||||
type=Path, default=Path("/") / "usr" / "share" / "devtools" / "pacman.conf.d" / "extra.conf")
|
||||
@ -1062,7 +1098,7 @@ def _set_service_shell_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("service-shell", aliases=["shell"], help="invoke python shell",
|
||||
description="drop into python shell", formatter_class=_formatter)
|
||||
description="drop into python shell", formatter_class=_HelpFormatter)
|
||||
parser.add_argument("code", help="instead of dropping into shell, just execute the specified code", nargs="?")
|
||||
parser.add_argument("-v", "--verbose", help=argparse.SUPPRESS, action="store_true")
|
||||
parser.set_defaults(handler=handlers.Shell, lock=None, report=False)
|
||||
@ -1080,7 +1116,8 @@ def _set_service_tree_migrate_parser(root: SubParserAction) -> argparse.Argument
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("service-tree-migrate", help="migrate repository tree",
|
||||
description="migrate repository tree between versions", formatter_class=_formatter)
|
||||
description="migrate repository tree between versions",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.TreeMigrate, lock=None, quiet=True, report=False)
|
||||
return parser
|
||||
|
||||
@ -1098,7 +1135,7 @@ def _set_user_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser = root.add_parser("user-add", help="create or update user",
|
||||
description="update user for web services with the given password and role. "
|
||||
"In case if password was not entered it will be asked interactively",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("username", help="username for web service")
|
||||
parser.add_argument("--key", help="optional PGP key used by this user. The private key must be imported")
|
||||
parser.add_argument("--packager", help="optional packager id used for build process in form of "
|
||||
@ -1124,7 +1161,7 @@ def _set_user_list_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("user-list", help="user known users and their access",
|
||||
description="list users from the user mapping and their roles",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("username", help="filter users by username", nargs="?")
|
||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||
parser.add_argument("-R", "--role", help="filter users by role", type=UserAccess, choices=enum_values(UserAccess))
|
||||
@ -1145,7 +1182,7 @@ def _set_user_remove_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
parser = root.add_parser("user-remove", help="remove user",
|
||||
description="remove user from the user mapping and update the configuration",
|
||||
formatter_class=_formatter)
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.add_argument("username", help="username for web service")
|
||||
parser.set_defaults(handler=handlers.Users, action=Action.Remove, architecture="", exit_code=False, lock=None,
|
||||
quiet=True, report=False, repository="")
|
||||
@ -1162,7 +1199,8 @@ def _set_web_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
Returns:
|
||||
argparse.ArgumentParser: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("web", help="web server", description="start web server", formatter_class=_formatter)
|
||||
parser = root.add_parser("web", help="web server", description="start web server",
|
||||
formatter_class=_HelpFormatter)
|
||||
parser.set_defaults(handler=handlers.Web, architecture="", lock=Path("ahriman-web.pid"), report=False,
|
||||
repository="", parser=_parser)
|
||||
return parser
|
||||
|
@ -141,19 +141,19 @@ class ApplicationPackages(ApplicationProperties):
|
||||
self.database.build_queue_insert(package)
|
||||
self.reporter.set_unknown(package)
|
||||
|
||||
def add(self, names: Iterable[str], source: PackageSource, username: str | None = None) -> None:
|
||||
def add(self, packages: Iterable[str], source: PackageSource, username: str | None = None) -> None:
|
||||
"""
|
||||
add packages for the next build
|
||||
|
||||
Args:
|
||||
names(Iterable[str]): list of package bases to add
|
||||
packages(Iterable[str]): list of package bases to add
|
||||
source(PackageSource): package source to add
|
||||
username(str | None, optional): optional override of username for build process (Default value = None)
|
||||
"""
|
||||
for name in names:
|
||||
resolved_source = source.resolve(name, self.repository.paths)
|
||||
for package in packages:
|
||||
resolved_source = source.resolve(package, self.repository.paths)
|
||||
fn = getattr(self, f"_add_{resolved_source.value}")
|
||||
fn(name, username)
|
||||
fn(package, username)
|
||||
|
||||
def on_result(self, result: Result) -> None:
|
||||
"""
|
||||
@ -167,16 +167,16 @@ class ApplicationPackages(ApplicationProperties):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def remove(self, names: Iterable[str]) -> Result:
|
||||
def remove(self, packages: Iterable[str]) -> Result:
|
||||
"""
|
||||
remove packages from repository
|
||||
|
||||
Args:
|
||||
names(Iterable[str]): list of packages (either base or name) to remove
|
||||
packages(Iterable[str]): list of packages (either base or name) to remove
|
||||
|
||||
Returns:
|
||||
Result: removal result
|
||||
"""
|
||||
result = self.repository.process_remove(names)
|
||||
result = self.repository.process_remove(packages)
|
||||
self.on_result(result)
|
||||
return result
|
||||
|
@ -191,6 +191,12 @@ class ApplicationRepository(ApplicationProperties):
|
||||
"""
|
||||
updates = {}
|
||||
|
||||
# always add already built packages, because they will be always added
|
||||
updates.update({
|
||||
package.base: package
|
||||
for package in self.repository.load_archives(self.repository.packages_built())
|
||||
})
|
||||
|
||||
if aur:
|
||||
updates.update({package.base: package for package in self.repository.updates_aur(filter_packages, vcs=vcs)})
|
||||
if local:
|
||||
|
@ -21,6 +21,7 @@ from ahriman.application.handlers.add import Add
|
||||
from ahriman.application.handlers.backup import Backup
|
||||
from ahriman.application.handlers.change import Change
|
||||
from ahriman.application.handlers.clean import Clean
|
||||
from ahriman.application.handlers.copy import Copy
|
||||
from ahriman.application.handlers.daemon import Daemon
|
||||
from ahriman.application.handlers.dump import Dump
|
||||
from ahriman.application.handlers.handler import Handler
|
||||
|
95
src/ahriman/application/handlers/copy.py
Normal file
95
src/ahriman/application/handlers/copy.py
Normal file
@ -0,0 +1,95 @@
|
||||
#
|
||||
# Copyright (c) 2021-2024 ahriman team.
|
||||
#
|
||||
# This file is part of ahriman
|
||||
# (see https://github.com/arcan1s/ahriman).
|
||||
#
|
||||
# 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 3 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/>.
|
||||
#
|
||||
import argparse
|
||||
|
||||
from ahriman.application.application import Application
|
||||
from ahriman.application.handlers.handler import Handler
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
from ahriman.models.package import Package
|
||||
from ahriman.models.package_source import PackageSource
|
||||
from ahriman.models.repository_id import RepositoryId
|
||||
|
||||
|
||||
class Copy(Handler):
|
||||
"""
|
||||
copy packages handler
|
||||
"""
|
||||
|
||||
ALLOW_MULTI_ARCHITECTURE_RUN = False # conflicting action
|
||||
|
||||
@classmethod
|
||||
def run(cls, args: argparse.Namespace, repository_id: RepositoryId, configuration: Configuration, *,
|
||||
report: bool) -> None:
|
||||
"""
|
||||
callback for command line
|
||||
|
||||
Args:
|
||||
args(argparse.Namespace): command line args
|
||||
repository_id(RepositoryId): repository unique identifier
|
||||
configuration(Configuration): configuration instance
|
||||
report(bool): force enable or disable reporting
|
||||
"""
|
||||
application = Application(repository_id, configuration, report=report)
|
||||
application.on_start()
|
||||
|
||||
configuration_path, _ = configuration.check_loaded()
|
||||
source_repository_id = RepositoryId(repository_id.architecture, args.source)
|
||||
source_configuration = Configuration.from_path(configuration_path, source_repository_id)
|
||||
source_application = Application(source_repository_id, source_configuration, report=report)
|
||||
|
||||
packages = source_application.repository.packages(args.package)
|
||||
Copy.check_status(args.exit_code, packages)
|
||||
|
||||
for package in packages:
|
||||
Copy.copy_package(package, application, source_application)
|
||||
|
||||
# run update
|
||||
application.update([])
|
||||
|
||||
if args.remove:
|
||||
source_application.remove(args.package)
|
||||
|
||||
@staticmethod
|
||||
def copy_package(package: Package, application: Application, source_application: Application) -> None:
|
||||
"""
|
||||
copy package ``package`` from source repository to target repository
|
||||
|
||||
Args:
|
||||
package(Package): package to copy
|
||||
application(Application): application instance of the target repository
|
||||
source_application(Application): application instance of the source repository
|
||||
"""
|
||||
# copy files
|
||||
source_paths = [
|
||||
str(source_application.repository.paths.repository / source.filename)
|
||||
for source in package.packages.values()
|
||||
if source.filename is not None
|
||||
]
|
||||
application.add(source_paths, PackageSource.Archive)
|
||||
|
||||
# copy metadata
|
||||
application.reporter.package_changes_update(
|
||||
package.base, source_application.reporter.package_changes_get(package.base)
|
||||
)
|
||||
application.reporter.package_dependencies_update(
|
||||
package.base, source_application.reporter.package_dependencies_get(package.base)
|
||||
)
|
||||
application.reporter.package_update(package, BuildStatusEnum.Pending)
|
@ -27,6 +27,7 @@ from ahriman.application.lock import Lock
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.exceptions import ExitCode, MissingArchitectureError, MultipleArchitecturesError
|
||||
from ahriman.core.log.log_loader import LogLoader
|
||||
from ahriman.core.types import ExplicitBool
|
||||
from ahriman.models.repository_id import RepositoryId
|
||||
from ahriman.models.repository_paths import RepositoryPaths
|
||||
|
||||
@ -124,13 +125,14 @@ class Handler:
|
||||
raise NotImplementedError
|
||||
|
||||
@staticmethod
|
||||
def check_status(enabled: bool, status: bool | Callable[[], bool]) -> None:
|
||||
def check_status(enabled: bool, status: ExplicitBool | Callable[[], ExplicitBool]) -> None:
|
||||
"""
|
||||
check condition and flag and raise ExitCode exception in case if it is enabled and condition match
|
||||
|
||||
Args:
|
||||
enabled(bool): if ``False`` no check will be performed
|
||||
status(bool | Callable[[], bool]): return status or function to check. ``True`` means success and vice versa
|
||||
status(ExplicitBool | Callable[[], ExplicitBool]): return status or function to check.
|
||||
``True`` means success and vice versa
|
||||
|
||||
Raises:
|
||||
ExitCode: if result is empty and check is enabled
|
||||
@ -138,12 +140,9 @@ class Handler:
|
||||
if not enabled:
|
||||
return
|
||||
|
||||
match status:
|
||||
case False:
|
||||
raise ExitCode
|
||||
# https://github.com/python/mypy/issues/14014
|
||||
case Callable() if not status(): # type: ignore[misc]
|
||||
raise ExitCode
|
||||
status = status() if callable(status) else status
|
||||
if not status:
|
||||
raise ExitCode
|
||||
|
||||
@staticmethod
|
||||
def repositories_extract(args: argparse.Namespace) -> list[RepositoryId]:
|
||||
|
@ -136,7 +136,7 @@ class Patch(Handler):
|
||||
for patch in application.reporter.package_patches_get(package_base, None)
|
||||
if variables is None or patch.key in variables
|
||||
]
|
||||
Patch.check_status(exit_code, bool(patches))
|
||||
Patch.check_status(exit_code, patches)
|
||||
|
||||
PatchPrinter(package_base, patches)(verbose=True, separator=" = ")
|
||||
|
||||
|
@ -51,7 +51,7 @@ class Rebuild(Handler):
|
||||
packages = Rebuild.extract_packages(application, args.status, from_database=args.from_database)
|
||||
packages = application.repository.packages_depend_on(packages, args.depends_on)
|
||||
|
||||
Rebuild.check_status(args.exit_code, bool(packages))
|
||||
Rebuild.check_status(args.exit_code, packages)
|
||||
if args.dry_run:
|
||||
application.print_updates(packages, log_fn=print)
|
||||
return
|
||||
|
@ -141,7 +141,7 @@ class Setup(Handler):
|
||||
|
||||
(root.include / "00-setup-overrides.ini").unlink(missing_ok=True) # remove old-style configuration
|
||||
target = root.include / f"00-setup-overrides-{repository_id.id}.ini"
|
||||
with target.open("w") as ahriman_configuration:
|
||||
with target.open("w", encoding="utf8") as ahriman_configuration:
|
||||
configuration.write(ahriman_configuration)
|
||||
|
||||
@staticmethod
|
||||
@ -191,7 +191,7 @@ class Setup(Handler):
|
||||
configuration.set_option(repository_id.name, "Server", repository_server)
|
||||
|
||||
target = source.parent / f"{repository_id.name}-{repository_id.architecture}.conf"
|
||||
with target.open("w") as devtools_configuration:
|
||||
with target.open("w", encoding="utf8") as devtools_configuration:
|
||||
configuration.write(devtools_configuration)
|
||||
|
||||
@staticmethod
|
||||
|
@ -61,7 +61,7 @@ class Status(Handler):
|
||||
else:
|
||||
packages = client.package_get(None)
|
||||
|
||||
Status.check_status(args.exit_code, bool(packages))
|
||||
Status.check_status(args.exit_code, packages)
|
||||
|
||||
comparator: Callable[[tuple[Package, BuildStatus]], str] = lambda item: item[0].base
|
||||
filter_fn: Callable[[tuple[Package, BuildStatus]], bool] =\
|
||||
|
@ -54,7 +54,7 @@ class Update(Handler):
|
||||
application.changes(packages)
|
||||
|
||||
if args.dry_run: # exit from application if no build requested
|
||||
Update.check_status(args.exit_code, bool(packages)) # status code check
|
||||
Update.check_status(args.exit_code, packages) # status code check
|
||||
return
|
||||
|
||||
packages = application.with_dependencies(packages, process_dependencies=args.dependencies)
|
||||
|
@ -61,7 +61,7 @@ class Users(Handler):
|
||||
users = database.user_list(args.username, args.role)
|
||||
for user in users:
|
||||
UserPrinter(user)(verbose=True)
|
||||
Users.check_status(args.exit_code, bool(users))
|
||||
Users.check_status(args.exit_code, users)
|
||||
case Action.Remove:
|
||||
database.user_remove(args.username)
|
||||
|
||||
|
54
src/ahriman/application/help_formatter.py
Normal file
54
src/ahriman/application/help_formatter.py
Normal file
@ -0,0 +1,54 @@
|
||||
#
|
||||
# Copyright (c) 2021-2024 ahriman team.
|
||||
#
|
||||
# This file is part of ahriman
|
||||
# (see https://github.com/arcan1s/ahriman).
|
||||
#
|
||||
# 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 3 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/>.
|
||||
#
|
||||
import argparse
|
||||
import re
|
||||
import textwrap
|
||||
|
||||
|
||||
class _HelpFormatter(argparse.ArgumentDefaultsHelpFormatter):
|
||||
"""
|
||||
:class:`argparse.ArgumentDefaultsHelpFormatter` extension which keeps new lines in help messages
|
||||
"""
|
||||
|
||||
def __init__(self, prog: str) -> None:
|
||||
"""
|
||||
Args:
|
||||
prog(str): application name
|
||||
"""
|
||||
argparse.ArgumentDefaultsHelpFormatter.__init__(self, prog, width=120)
|
||||
self._whitespace_matcher = re.compile(r"[ \t]+")
|
||||
|
||||
def _fill_text(self, text: str, width: int, indent: str) -> str:
|
||||
"""
|
||||
implementation of the protected method to format text. Format text, keeping new lines
|
||||
|
||||
Args:
|
||||
text(str): text to format
|
||||
width(int): maximal text width
|
||||
indent(str): indentation string
|
||||
|
||||
Returns:
|
||||
str: formatted text
|
||||
"""
|
||||
text = self._whitespace_matcher.sub(" ", text).strip()
|
||||
return "\n".join([
|
||||
textwrap.fill(line, width, initial_indent=indent, subsequent_indent=indent)
|
||||
for line in text.splitlines()
|
||||
])
|
@ -58,7 +58,7 @@ class Lock(LazyLogging):
|
||||
>>>
|
||||
>>> configuration = Configuration()
|
||||
>>> try:
|
||||
>>> with Lock(args, RepositoryId("x86_64", "aur-clone"), configuration):
|
||||
>>> with Lock(args, RepositoryId("x86_64", "aur"), configuration):
|
||||
>>> do_something()
|
||||
>>> except Exception as exception:
|
||||
>>> handle_exceptions(exception)
|
||||
@ -112,7 +112,7 @@ class Lock(LazyLogging):
|
||||
"""
|
||||
if self.path is None:
|
||||
return
|
||||
self._pid_file = self.path.open("a+")
|
||||
self._pid_file = self.path.open("a+", encoding="utf8")
|
||||
|
||||
def _watch(self) -> bool:
|
||||
"""
|
||||
|
@ -91,9 +91,8 @@ class Pacman(LazyLogging):
|
||||
database = self.database_init(handle, repository, self.repository_id.architecture)
|
||||
self.database_copy(handle, database, pacman_root, use_ahriman_cache=use_ahriman_cache)
|
||||
|
||||
# install repository database too
|
||||
local_database = self.database_init(handle, self.repository_id.name, self.repository_id.architecture)
|
||||
self.database_copy(handle, local_database, pacman_root, use_ahriman_cache=use_ahriman_cache)
|
||||
# install repository database too (without copying)
|
||||
self.database_init(handle, self.repository_id.name, self.repository_id.architecture)
|
||||
|
||||
if use_ahriman_cache and refresh_database:
|
||||
self.database_sync(handle, force=refresh_database == PacmanSynchronization.Force)
|
||||
@ -115,6 +114,7 @@ class Pacman(LazyLogging):
|
||||
|
||||
if not use_ahriman_cache:
|
||||
return
|
||||
|
||||
# copy root database if no local copy found
|
||||
pacman_db_path = Path(handle.dbpath)
|
||||
if not pacman_db_path.is_dir():
|
||||
@ -123,11 +123,13 @@ class Pacman(LazyLogging):
|
||||
if dst.is_file():
|
||||
return # file already exists, do not copy
|
||||
dst.parent.mkdir(mode=0o755, exist_ok=True) # create sync directory if it doesn't exist
|
||||
|
||||
src = repository_database(pacman_root)
|
||||
if not src.is_file():
|
||||
self.logger.warning("repository %s is set to be used, however, no working copy was found", database.name)
|
||||
return # database for some reason deos not exist
|
||||
self.logger.info("copy pacman database from operating system root to ahriman's home")
|
||||
|
||||
self.logger.info("copy pacman database %s from operating system root to ahriman's home %s", src, dst)
|
||||
shutil.copy(src, dst)
|
||||
self.repository_paths.chown(dst)
|
||||
|
||||
|
@ -174,18 +174,31 @@ class PkgbuildParser(shlex.shlex):
|
||||
Returns:
|
||||
bool: ``True`` if the previous element of the stream is a quote or escaped and ``False`` otherwise
|
||||
"""
|
||||
# wrapper around reading utf symbols from random position of the stream
|
||||
def read_last() -> tuple[int, str]:
|
||||
while (position := self._io.tell()) > 0:
|
||||
try:
|
||||
return position, self._io.read(1)
|
||||
except UnicodeDecodeError:
|
||||
self._io.seek(position - 1)
|
||||
|
||||
raise PkgbuildParserError("reached starting position, no valid symbols found")
|
||||
|
||||
current_position = self._io.tell()
|
||||
|
||||
last_char = penultimate_char = None
|
||||
for index in range(current_position - 1, -1, -1):
|
||||
index = current_position - 1
|
||||
while index > 0:
|
||||
self._io.seek(index)
|
||||
last_char = self._io.read(1)
|
||||
|
||||
index, last_char = read_last()
|
||||
if last_char.isspace():
|
||||
index -= 1
|
||||
continue
|
||||
|
||||
if index >= 0:
|
||||
if index > 1:
|
||||
self._io.seek(index - 1)
|
||||
penultimate_char = self._io.read(1)
|
||||
_, penultimate_char = read_last()
|
||||
|
||||
break
|
||||
|
||||
@ -216,6 +229,7 @@ class PkgbuildParser(shlex.shlex):
|
||||
case PkgbuildToken.Comment:
|
||||
self.instream.readline()
|
||||
continue
|
||||
|
||||
yield token
|
||||
|
||||
if token != PkgbuildToken.ArrayEnds:
|
||||
@ -248,24 +262,28 @@ class PkgbuildParser(shlex.shlex):
|
||||
counter += 1
|
||||
case PkgbuildToken.FunctionEnds:
|
||||
end_position = self._io.tell()
|
||||
if self.state != self.eof: # type: ignore[attr-defined]
|
||||
end_position -= 1 # if we are not at the end of the file, position is _after_ the token
|
||||
counter -= 1
|
||||
if counter == 0:
|
||||
break
|
||||
case PkgbuildToken.Comment:
|
||||
self.instream.readline()
|
||||
|
||||
if not 0 < start_position < end_position:
|
||||
raise PkgbuildParserError("function body wasn't found")
|
||||
|
||||
# read the specified interval from source stream
|
||||
self._io.seek(start_position - 1) # start from the previous symbol
|
||||
content = self._io.read(end_position - start_position)
|
||||
# we cannot use :func:`read()` here, because it reads characters, not bytes
|
||||
content = ""
|
||||
while self._io.tell() != end_position and (next_char := self._io.read(1)):
|
||||
content += next_char
|
||||
|
||||
# special case of the end of file
|
||||
if self.state == self.eof: # type: ignore[attr-defined]
|
||||
content += self._io.read(1)
|
||||
|
||||
# reset position (because the last position was before the next token starts)
|
||||
self._io.seek(end_position)
|
||||
|
||||
return content
|
||||
|
||||
def _parse_token(self, token: str) -> Generator[PkgbuildPatch, None, None]:
|
||||
|
@ -51,7 +51,7 @@ class Configuration(configparser.RawConfigParser):
|
||||
|
||||
>>> from pathlib import Path
|
||||
>>>
|
||||
>>> configuration = Configuration.from_path(Path("/etc/ahriman.ini"), RepositoryId("x86_64", "aur-clone"))
|
||||
>>> configuration = Configuration.from_path(Path("/etc/ahriman.ini"), RepositoryId("x86_64", "aur"))
|
||||
>>> repository_name = configuration.get("repository", "name")
|
||||
>>> makepkg_flags = configuration.getlist("build", "makepkg_flags")
|
||||
|
||||
|
@ -141,7 +141,7 @@ def migrate_package_statuses(connection: Connection, paths: RepositoryPaths) ->
|
||||
cache_path = paths.root / "status_cache.json"
|
||||
if not cache_path.is_file():
|
||||
return # no file found
|
||||
with cache_path.open() as cache:
|
||||
with cache_path.open(encoding="utf8") as cache:
|
||||
dump = json.load(cache)
|
||||
|
||||
for item in dump.get("packages", []):
|
||||
|
@ -23,9 +23,8 @@ from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.log import LazyLogging
|
||||
from ahriman.models.repository_id import RepositoryId
|
||||
from ahriman.models.repository_paths import RepositoryPaths
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
@ -39,16 +38,16 @@ class Operations(LazyLogging):
|
||||
path(Path): path to the database file
|
||||
"""
|
||||
|
||||
def __init__(self, path: Path, repository_id: RepositoryId, repository_paths: RepositoryPaths) -> None:
|
||||
def __init__(self, path: Path, configuration: Configuration) -> None:
|
||||
"""
|
||||
Args:
|
||||
path(Path): path to the database file
|
||||
repository_id(RepositoryId): repository unique identifier
|
||||
repository_paths(RepositoryPaths): repository paths
|
||||
configuration(Configuration): configuration instance
|
||||
"""
|
||||
self.path = path
|
||||
self._repository_id = repository_id
|
||||
self._repository_paths = repository_paths
|
||||
self._configuration = configuration
|
||||
_, self._repository_id = configuration.check_loaded()
|
||||
self._repository_paths = configuration.repository_paths
|
||||
|
||||
@property
|
||||
def logger_name(self) -> str:
|
||||
|
@ -66,10 +66,9 @@ class SQLite(
|
||||
Self: fully initialized instance of the database
|
||||
"""
|
||||
path = cls.database_path(configuration)
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
database = cls(path, repository_id, configuration.repository_paths)
|
||||
database.init(configuration)
|
||||
database = cls(path, configuration)
|
||||
database.init()
|
||||
|
||||
return database
|
||||
|
||||
@ -86,23 +85,18 @@ class SQLite(
|
||||
"""
|
||||
return configuration.getpath("settings", "database")
|
||||
|
||||
def init(self, configuration: Configuration) -> None:
|
||||
def init(self) -> None:
|
||||
"""
|
||||
perform database migrations
|
||||
|
||||
Args:
|
||||
configuration(Configuration): configuration instance
|
||||
"""
|
||||
# custom types support
|
||||
sqlite3.register_adapter(dict, json.dumps)
|
||||
sqlite3.register_adapter(list, json.dumps)
|
||||
sqlite3.register_converter("json", json.loads)
|
||||
|
||||
paths = configuration.repository_paths
|
||||
|
||||
if configuration.getboolean("settings", "apply_migrations", fallback=True):
|
||||
self.with_connection(lambda connection: Migrations.migrate(connection, configuration))
|
||||
paths.chown(self.path)
|
||||
if self._configuration.getboolean("settings", "apply_migrations", fallback=True):
|
||||
self.with_connection(lambda connection: Migrations.migrate(connection, self._configuration))
|
||||
self._repository_paths.chown(self.path)
|
||||
|
||||
def package_clear(self, package_base: str, repository_id: RepositoryId | None = None) -> None:
|
||||
"""
|
||||
|
@ -99,3 +99,24 @@ class LazyLogging:
|
||||
yield
|
||||
finally:
|
||||
self._package_logger_reset()
|
||||
|
||||
@contextlib.contextmanager
|
||||
def suppress_logging(self, log_level: int = logging.WARNING) -> Generator[None, None, None]:
|
||||
"""
|
||||
silence log messages in context
|
||||
|
||||
Args:
|
||||
log_level(int, optional): the highest log level to keep (Default value = logging.WARNING)
|
||||
|
||||
Examples:
|
||||
This function is designed to be used to suppress all log messages in context, e.g.:
|
||||
|
||||
>>> with self.suppress_logging():
|
||||
>>> do_some_noisy_actions()
|
||||
"""
|
||||
current_level = self.logger.manager.disable
|
||||
try:
|
||||
logging.disable(log_level)
|
||||
yield
|
||||
finally:
|
||||
logging.disable(current_level)
|
||||
|
@ -41,7 +41,7 @@ class Report(LazyLogging):
|
||||
class method :func:`load()` which can be used in order to determine right report instance::
|
||||
|
||||
>>> configuration = Configuration()
|
||||
>>> report = Report.load(RepositoryId("x86_64", "aur-clone"), configuration, "email")
|
||||
>>> report = Report.load(RepositoryId("x86_64", "aur"), configuration, "email")
|
||||
|
||||
The :func:`generate()` method can be used in order to perform the report itself, whereas :func:`run()` method
|
||||
handles exception and raises :exc:`ahriman.core.exceptions.ReportError` instead::
|
||||
|
@ -144,7 +144,8 @@ class UpdateHandler(PackageInfo, Cleaner):
|
||||
branch="master",
|
||||
)
|
||||
|
||||
Sources.fetch(cache_dir, source)
|
||||
with self.suppress_logging():
|
||||
Sources.fetch(cache_dir, source)
|
||||
remote = Package.from_build(cache_dir, self.architecture, None)
|
||||
|
||||
local = packages.get(remote.base)
|
||||
|
@ -116,7 +116,7 @@ class KeyringGenerator(PkgbuildGenerator):
|
||||
Args:
|
||||
source_path(Path): destination of the file content
|
||||
"""
|
||||
with source_path.open("w") as source_file:
|
||||
with source_path.open("w", encoding="utf8") as source_file:
|
||||
for key in sorted(set(self.trusted + self.packagers + self.revoked)):
|
||||
public_key = self.sign.key_export(key)
|
||||
source_file.write(public_key)
|
||||
@ -129,7 +129,7 @@ class KeyringGenerator(PkgbuildGenerator):
|
||||
Args:
|
||||
source_path(Path): destination of the file content
|
||||
"""
|
||||
with source_path.open("w") as source_file:
|
||||
with source_path.open("w", encoding="utf8") as source_file:
|
||||
for key in sorted(set(self.revoked)):
|
||||
fingerprint = self.sign.key_fingerprint(key)
|
||||
source_file.write(fingerprint)
|
||||
@ -147,7 +147,7 @@ class KeyringGenerator(PkgbuildGenerator):
|
||||
"""
|
||||
if not self.trusted:
|
||||
raise PkgbuildGeneratorError
|
||||
with source_path.open("w") as source_file:
|
||||
with source_path.open("w", encoding="utf8") as source_file:
|
||||
for key in sorted(set(self.trusted)):
|
||||
fingerprint = self.sign.key_fingerprint(key)
|
||||
source_file.write(fingerprint)
|
||||
|
@ -103,7 +103,7 @@ class Tree:
|
||||
>>>
|
||||
>>> configuration = Configuration()
|
||||
>>> database = SQLite.load(configuration)
|
||||
>>> repository = Repository.load(RepositoryId("x86_64", "aur-clone"), configuration, database, report=True)
|
||||
>>> repository = Repository.load(RepositoryId("x86_64", "aur"), configuration, database, report=True)
|
||||
>>> packages = repository.packages()
|
||||
>>>
|
||||
>>> tree = Tree.resolve(packages)
|
||||
|
@ -52,7 +52,7 @@ class Trigger(LazyLogging):
|
||||
>>> configuration = Configuration()
|
||||
>>> configuration.set_option("build", "triggers", "my.awesome.package.CustomTrigger")
|
||||
>>>
|
||||
>>> loader = TriggerLoader.load(RepositoryId("x86_64", "aur-clone"), configuration)
|
||||
>>> loader = TriggerLoader.load(RepositoryId("x86_64", "aur"), configuration)
|
||||
>>> loader.on_result(Result(), [])
|
||||
"""
|
||||
|
||||
|
@ -50,7 +50,7 @@ class TriggerLoader(LazyLogging):
|
||||
|
||||
Having such configuration you can create instance of the loader::
|
||||
|
||||
>>> loader = TriggerLoader.load(RepositoryId("x86_64", "aur-clone"), configuration)
|
||||
>>> loader = TriggerLoader.load(RepositoryId("x86_64", "aur"), configuration)
|
||||
>>> print(loader.triggers)
|
||||
|
||||
After that you are free to run triggers::
|
||||
|
39
src/ahriman/core/types.py
Normal file
39
src/ahriman/core/types.py
Normal file
@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright (c) 2021-2024 ahriman team.
|
||||
#
|
||||
# This file is part of ahriman
|
||||
# (see https://github.com/arcan1s/ahriman).
|
||||
#
|
||||
# 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 3 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/>.
|
||||
#
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
class HasBool(Protocol):
|
||||
"""
|
||||
class which defines :func:`bool()` method
|
||||
"""
|
||||
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
|
||||
class HasLength(Protocol):
|
||||
"""
|
||||
class which defines :func:`len()` method
|
||||
"""
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
|
||||
ExplicitBool = HasBool | HasLength | int
|
@ -44,7 +44,7 @@ class Upload(LazyLogging):
|
||||
exception::
|
||||
|
||||
>>> configuration = Configuration()
|
||||
>>> upload = Upload.load(RepositoryId("x86_64", "aur-clone"), configuration, "s3")
|
||||
>>> upload = Upload.load(RepositoryId("x86_64", "aur"), configuration, "s3")
|
||||
>>> upload.run(configuration.repository_paths.repository, [])
|
||||
|
||||
Or in case if direct access to exception is required, the :func:`sync()` method can be used::
|
||||
|
@ -72,7 +72,7 @@ class AURPackage:
|
||||
>>> from ahriman.models.repository_id import RepositoryId
|
||||
>>>
|
||||
>>> configuration = Configuration()
|
||||
>>> pacman = Pacman(RepositoryId("x86_64", "aur-clone"), configuration)
|
||||
>>> pacman = Pacman(RepositoryId("x86_64", "aur"), configuration)
|
||||
>>> metadata = pacman.package_get("pacman")
|
||||
>>> package = AURPackage.from_pacman(next(metadata)) # load package from pyalpm wrapper
|
||||
"""
|
||||
|
@ -429,13 +429,14 @@ class Package(LazyLogging):
|
||||
task = Task(self, configuration, repository_id.architecture, paths)
|
||||
|
||||
try:
|
||||
# create fresh chroot environment, fetch sources and - automagically - update PKGBUILD
|
||||
task.init(paths.cache_for(self.base), [], None)
|
||||
task.build(paths.cache_for(self.base), dry_run=True)
|
||||
with self.suppress_logging():
|
||||
# create fresh chroot environment, fetch sources and - automagically - update PKGBUILD
|
||||
task.init(paths.cache_for(self.base), [], None)
|
||||
task.build(paths.cache_for(self.base), dry_run=True)
|
||||
|
||||
pkgbuild = Pkgbuild.from_file(paths.cache_for(self.base) / "PKGBUILD")
|
||||
pkgbuild = Pkgbuild.from_file(paths.cache_for(self.base) / "PKGBUILD")
|
||||
|
||||
return full_version(pkgbuild.get("epoch"), pkgbuild["pkgver"], pkgbuild["pkgrel"])
|
||||
return full_version(pkgbuild.get("epoch"), pkgbuild["pkgver"], pkgbuild["pkgrel"])
|
||||
except Exception:
|
||||
self.logger.exception("cannot determine version of VCS package")
|
||||
finally:
|
||||
|
@ -60,7 +60,7 @@ class PackageDescription:
|
||||
>>> from ahriman.models.repository_id import RepositoryId
|
||||
>>>
|
||||
>>> configuration = Configuration()
|
||||
>>> pacman = Pacman(RepositoryId("x86_64", "aur-clone"), configuration)
|
||||
>>> pacman = Pacman(RepositoryId("x86_64", "aur"), configuration)
|
||||
>>> pyalpm_description = next(package for package in pacman.package_get("pacman"))
|
||||
>>> description = PackageDescription.from_package(
|
||||
>>> pyalpm_description, Path("/var/cache/pacman/pkg/pacman-6.0.1-4-x86_64.pkg.tar.zst"))
|
||||
|
@ -64,7 +64,7 @@ class Pkgbuild(Mapping[str, Any]):
|
||||
Returns:
|
||||
Self: constructed instance of self
|
||||
"""
|
||||
with path.open() as input_file:
|
||||
with path.open(encoding="utf8") as input_file:
|
||||
return cls.from_io(input_file)
|
||||
|
||||
@classmethod
|
||||
|
@ -199,7 +199,7 @@ class PkgbuildPatch:
|
||||
Args:
|
||||
pkgbuild_path(Path): path to PKGBUILD file
|
||||
"""
|
||||
with pkgbuild_path.open("a") as pkgbuild:
|
||||
with pkgbuild_path.open("a", encoding="utf8") as pkgbuild:
|
||||
pkgbuild.write("\n") # in case if file ends without new line we are appending it at the end
|
||||
pkgbuild.write(self.serialize())
|
||||
pkgbuild.write("\n") # append new line after the values
|
||||
|
@ -43,7 +43,7 @@ class RepositoryPaths(LazyLogging):
|
||||
Examples:
|
||||
This class can be used in order to access the repository tree structure::
|
||||
|
||||
>>> paths = RepositoryPaths(Path("/var/lib/ahriman"), RepositoryId("x86_64", "aur-clone"))
|
||||
>>> paths = RepositoryPaths(Path("/var/lib/ahriman"), RepositoryId("x86_64", "aur"))
|
||||
|
||||
Additional methods can be used in order to ensure that tree is created::
|
||||
|
||||
|
@ -17,8 +17,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import bcrypt
|
||||
|
||||
from dataclasses import dataclass, replace
|
||||
from passlib.hash import sha512_crypt
|
||||
from secrets import token_urlsafe as generate_password
|
||||
from typing import Self
|
||||
|
||||
@ -67,8 +68,6 @@ class User:
|
||||
packager_id: str | None = None
|
||||
key: str | None = None
|
||||
|
||||
_HASHER = sha512_crypt
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""
|
||||
remove empty fields
|
||||
@ -101,10 +100,9 @@ class User:
|
||||
bool: ``True`` in case if password matches, ``False`` otherwise
|
||||
"""
|
||||
try:
|
||||
verified: bool = self._HASHER.verify(password + salt, self.password)
|
||||
return bcrypt.checkpw((password + salt).encode("utf8"), self.password.encode("utf8"))
|
||||
except ValueError:
|
||||
verified = False # the absence of evidence is not the evidence of absence (c) Gin Rummy
|
||||
return verified
|
||||
return False # the absence of evidence is not the evidence of absence (c) Gin Rummy
|
||||
|
||||
def hash_password(self, salt: str) -> Self:
|
||||
"""
|
||||
@ -120,8 +118,8 @@ class User:
|
||||
# in case of empty password we leave it empty. This feature is used by any external (like OAuth) provider
|
||||
# when we do not store any password here
|
||||
return self
|
||||
password_hash: str = self._HASHER.hash(self.password + salt)
|
||||
return replace(self, password=password_hash)
|
||||
password_hash = bcrypt.hashpw((self.password + salt).encode("utf8"), bcrypt.gensalt())
|
||||
return replace(self, password=password_hash.decode("utf8"))
|
||||
|
||||
def verify_access(self, required: UserAccess) -> bool:
|
||||
"""
|
||||
|
@ -46,5 +46,5 @@ class PackageSchema(Schema):
|
||||
})
|
||||
packager = fields.String(metadata={
|
||||
"description": "packager for the last success package build",
|
||||
"example": "John Doe <john@doe.com>",
|
||||
"example": "ahriman bot <ahriman@example.com>",
|
||||
})
|
||||
|
@ -31,5 +31,5 @@ class RepositoryIdSchema(Schema):
|
||||
})
|
||||
repository = fields.String(metadata={
|
||||
"description": "Repository name",
|
||||
"example": "aur-clone",
|
||||
"example": "aur",
|
||||
})
|
||||
|
@ -174,9 +174,8 @@ class BaseView(View, CorsViewMixin):
|
||||
# using if/else in order to suppress mypy warning which doesn't know that
|
||||
# :func:`aiohttp.web.View._raise_allowed_methods()` raises exception
|
||||
if get_method is not None:
|
||||
# there is a bug in pylint, see https://github.com/pylint-dev/pylint/issues/6005
|
||||
response = await get_method()
|
||||
response._body = b"" # type: ignore[assignment]
|
||||
response._body = b""
|
||||
return response
|
||||
|
||||
self._raise_allowed_methods()
|
||||
|
@ -42,7 +42,7 @@ class DependenciesView(StatusViewGuard, BaseView):
|
||||
ROUTES = ["/api/v1/packages/{package}/dependencies"]
|
||||
|
||||
@aiohttp_apispec.docs(
|
||||
tags=["Build"],
|
||||
tags=["Packages"],
|
||||
summary="Get package dependencies",
|
||||
description="Retrieve package implicit dependencies",
|
||||
responses={
|
||||
@ -74,7 +74,7 @@ class DependenciesView(StatusViewGuard, BaseView):
|
||||
return json_response(dependencies.view())
|
||||
|
||||
@aiohttp_apispec.docs(
|
||||
tags=["Build"],
|
||||
tags=["Packages"],
|
||||
summary="Update package dependencies",
|
||||
description="Set package implicit dependencies",
|
||||
responses={
|
||||
|
@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from pathlib import Path
|
||||
from pytest_mock import MockerFixture
|
||||
from unittest.mock import call as MockCall
|
||||
|
||||
@ -213,6 +214,9 @@ def test_updates_all(application_repository: ApplicationRepository, package_ahri
|
||||
"""
|
||||
must get updates for all
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur",
|
||||
return_value=[package_ahriman])
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
@ -220,6 +224,7 @@ def test_updates_all(application_repository: ApplicationRepository, package_ahri
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=True, local=True, manual=True, vcs=True, check_files=True)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||
updates_local_mock.assert_called_once_with(vcs=True)
|
||||
updates_manual_mock.assert_called_once_with()
|
||||
@ -230,12 +235,16 @@ def test_updates_disabled(application_repository: ApplicationRepository, mocker:
|
||||
"""
|
||||
must get updates without anything
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=False, local=False, manual=False, vcs=True, check_files=False)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_not_called()
|
||||
updates_local_mock.assert_not_called()
|
||||
updates_manual_mock.assert_not_called()
|
||||
@ -246,12 +255,16 @@ def test_updates_no_aur(application_repository: ApplicationRepository, mocker: M
|
||||
"""
|
||||
must get updates without aur
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=False, local=True, manual=True, vcs=True, check_files=True)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_not_called()
|
||||
updates_local_mock.assert_called_once_with(vcs=True)
|
||||
updates_manual_mock.assert_called_once_with()
|
||||
@ -262,12 +275,16 @@ def test_updates_no_local(application_repository: ApplicationRepository, mocker:
|
||||
"""
|
||||
must get updates without local packages
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=True, local=False, manual=True, vcs=True, check_files=True)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||
updates_local_mock.assert_not_called()
|
||||
updates_manual_mock.assert_called_once_with()
|
||||
@ -278,12 +295,16 @@ def test_updates_no_manual(application_repository: ApplicationRepository, mocker
|
||||
"""
|
||||
must get updates without manual
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=True, local=True, manual=False, vcs=True, check_files=True)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||
updates_local_mock.assert_called_once_with(vcs=True)
|
||||
updates_manual_mock.assert_not_called()
|
||||
@ -294,12 +315,16 @@ def test_updates_no_vcs(application_repository: ApplicationRepository, mocker: M
|
||||
"""
|
||||
must get updates without VCS
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=True, local=True, manual=True, vcs=False, check_files=True)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_called_once_with([], vcs=False)
|
||||
updates_local_mock.assert_called_once_with(vcs=False)
|
||||
updates_manual_mock.assert_called_once_with()
|
||||
@ -310,12 +335,16 @@ def test_updates_no_check_files(application_repository: ApplicationRepository, m
|
||||
"""
|
||||
must get updates without checking broken links
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates([], aur=True, local=True, manual=True, vcs=True, check_files=False)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||
updates_local_mock.assert_called_once_with(vcs=True)
|
||||
updates_manual_mock.assert_called_once_with()
|
||||
@ -326,12 +355,16 @@ def test_updates_with_filter(application_repository: ApplicationRepository, mock
|
||||
"""
|
||||
must get updates with filter
|
||||
"""
|
||||
path = Path("local")
|
||||
mocker.patch("ahriman.core.repository.package_info.PackageInfo.packages_built", return_value=[path])
|
||||
updates_built_mock = mocker.patch("ahriman.core.repository.package_info.PackageInfo.load_archives")
|
||||
updates_aur_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
|
||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||
updates_deps_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_dependencies")
|
||||
|
||||
application_repository.updates(["filter"], aur=True, local=True, manual=True, vcs=True, check_files=True)
|
||||
updates_built_mock.assert_called_once_with([path])
|
||||
updates_aur_mock.assert_called_once_with(["filter"], vcs=True)
|
||||
updates_local_mock.assert_called_once_with(vcs=True)
|
||||
updates_manual_mock.assert_called_once_with()
|
||||
|
@ -5,6 +5,7 @@ from pytest_mock import MockerFixture
|
||||
|
||||
from ahriman.application.ahriman import _parser
|
||||
from ahriman.application.application import Application
|
||||
from ahriman.application.help_formatter import _HelpFormatter
|
||||
from ahriman.application.lock import Lock
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.database import SQLite
|
||||
@ -44,6 +45,17 @@ def args() -> argparse.Namespace:
|
||||
repository=None, repository_id=None, wait_timeout=-1)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def formatter() -> _HelpFormatter:
|
||||
"""
|
||||
fixture for help message formatter
|
||||
|
||||
Returns:
|
||||
_HelpFormatter: help message formatter test instance
|
||||
"""
|
||||
return _HelpFormatter("ahriman")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def lock(args: argparse.Namespace, configuration: Configuration) -> Lock:
|
||||
"""
|
||||
|
@ -73,8 +73,8 @@ def test_execute(args: argparse.Namespace, mocker: MockerFixture) -> None:
|
||||
must run execution in multiple processes
|
||||
"""
|
||||
ids = [
|
||||
RepositoryId("i686", "aur-clone"),
|
||||
RepositoryId("x86_64", "aur-clone"),
|
||||
RepositoryId("i686", "aur"),
|
||||
RepositoryId("x86_64", "aur"),
|
||||
]
|
||||
mocker.patch("ahriman.application.handlers.Handler.repositories_extract", return_value=ids)
|
||||
starmap_mock = mocker.patch("multiprocessing.pool.Pool.starmap")
|
||||
@ -89,8 +89,8 @@ def test_execute_multiple_not_supported(args: argparse.Namespace, mocker: Mocker
|
||||
"""
|
||||
args.command = "web"
|
||||
mocker.patch("ahriman.application.handlers.Handler.repositories_extract", return_value=[
|
||||
RepositoryId("i686", "aur-clone"),
|
||||
RepositoryId("x86_64", "aur-clone"),
|
||||
RepositoryId("i686", "aur"),
|
||||
RepositoryId("x86_64", "aur"),
|
||||
])
|
||||
mocker.patch.object(Handler, "ALLOW_MULTI_ARCHITECTURE_RUN", False)
|
||||
|
||||
@ -103,7 +103,7 @@ def test_execute_single(args: argparse.Namespace, mocker: MockerFixture) -> None
|
||||
must run execution in current process if only one architecture supplied
|
||||
"""
|
||||
mocker.patch("ahriman.application.handlers.Handler.repositories_extract", return_value=[
|
||||
RepositoryId("x86_64", "aur-clone"),
|
||||
RepositoryId("x86_64", "aur"),
|
||||
])
|
||||
starmap_mock = mocker.patch("multiprocessing.pool.Pool.starmap")
|
||||
|
||||
@ -179,7 +179,7 @@ def test_repositories_extract_repository_legacy(args: argparse.Namespace, config
|
||||
known_repositories_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.known_repositories",
|
||||
return_value=set())
|
||||
|
||||
assert Handler.repositories_extract(args) == [RepositoryId("arch", "aur-clone")]
|
||||
assert Handler.repositories_extract(args) == [RepositoryId("arch", "aur")]
|
||||
known_architectures_mock.assert_not_called()
|
||||
known_repositories_mock.assert_called_once_with(configuration.repository_paths.root)
|
||||
|
||||
@ -255,6 +255,6 @@ def test_repositories_extract_systemd_legacy(args: argparse.Namespace, configura
|
||||
known_repositories_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.known_repositories",
|
||||
return_value=set())
|
||||
|
||||
assert Handler.repositories_extract(args) == [RepositoryId("i686", "aur-clone")]
|
||||
assert Handler.repositories_extract(args) == [RepositoryId("i686", "aur")]
|
||||
known_architectures_mock.assert_not_called()
|
||||
known_repositories_mock.assert_called_once_with(configuration.repository_paths.root)
|
||||
|
105
tests/ahriman/application/handlers/test_handler_copy.py
Normal file
105
tests/ahriman/application/handlers/test_handler_copy.py
Normal file
@ -0,0 +1,105 @@
|
||||
import argparse
|
||||
import pytest
|
||||
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from ahriman.application.application import Application
|
||||
from ahriman.application.handlers import Copy
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.repository import Repository
|
||||
from ahriman.models.build_status import BuildStatusEnum
|
||||
from ahriman.models.package import Package
|
||||
from ahriman.models.package_source import PackageSource
|
||||
|
||||
|
||||
def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
||||
"""
|
||||
default arguments for these test cases
|
||||
|
||||
Args:
|
||||
args(argparse.Namespace): command line arguments fixture
|
||||
|
||||
Returns:
|
||||
argparse.Namespace: generated arguments for these test cases
|
||||
"""
|
||||
args.source = "source"
|
||||
args.package = ["ahriman"]
|
||||
args.exit_code = False
|
||||
args.remove = False
|
||||
return args
|
||||
|
||||
|
||||
def test_run(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must run command
|
||||
"""
|
||||
args = _default_args(args)
|
||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||
mocker.patch("ahriman.core.repository.Repository.packages", return_value=[package_ahriman])
|
||||
application_mock = mocker.patch("ahriman.application.handlers.Copy.copy_package")
|
||||
update_mock = mocker.patch("ahriman.application.application.Application.update")
|
||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Copy.run(args, repository_id, configuration, report=False)
|
||||
application_mock.assert_called_once_with(package_ahriman, pytest.helpers.anyvar(int), pytest.helpers.anyvar(int))
|
||||
update_mock.assert_called_once_with([])
|
||||
remove_mock.assert_not_called()
|
||||
on_start_mock.assert_called_once_with()
|
||||
|
||||
|
||||
def test_run_remove(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must run command and remove packages afterwards
|
||||
"""
|
||||
args = _default_args(args)
|
||||
args.remove = True
|
||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||
mocker.patch("ahriman.core.repository.Repository.packages", return_value=[package_ahriman])
|
||||
mocker.patch("ahriman.application.handlers.Copy.copy_package")
|
||||
mocker.patch("ahriman.application.application.Application.update")
|
||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Copy.run(args, repository_id, configuration, report=False)
|
||||
remove_mock.assert_called_once_with(args.package)
|
||||
|
||||
|
||||
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must raise ExitCode exception on empty result
|
||||
"""
|
||||
args = _default_args(args)
|
||||
args.exit_code = True
|
||||
mocker.patch("ahriman.core.repository.Repository.packages", return_value=[])
|
||||
mocker.patch("ahriman.application.application.Application.update")
|
||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_status")
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Copy.run(args, repository_id, configuration, report=False)
|
||||
check_mock.assert_called_once_with(True, [])
|
||||
|
||||
|
||||
def test_copy_package(package_ahriman: Package, application: Application, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must copy package between repositories and its metadata
|
||||
"""
|
||||
add_mock = mocker.patch("ahriman.application.application.Application.add")
|
||||
changes_get_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_changes_get")
|
||||
changes_update_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_changes_update")
|
||||
deps_get_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_dependencies_get")
|
||||
deps_update_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_dependencies_update")
|
||||
package_update_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_update")
|
||||
path = application.repository.paths.repository / package_ahriman.packages[package_ahriman.base].filename
|
||||
|
||||
Copy.copy_package(package_ahriman, application, application)
|
||||
add_mock.assert_called_once_with([str(path)], PackageSource.Archive)
|
||||
changes_get_mock.assert_called_once_with(package_ahriman.base)
|
||||
changes_update_mock.assert_called_once_with(package_ahriman.base, changes_get_mock.return_value)
|
||||
deps_get_mock.assert_called_once_with(package_ahriman.base)
|
||||
deps_update_mock.assert_called_once_with(package_ahriman.base, deps_get_mock.return_value)
|
||||
package_update_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Pending)
|
@ -168,7 +168,7 @@ def test_patch_set_list(application: Application, mocker: MockerFixture) -> None
|
||||
Patch.patch_set_list(application, "ahriman", ["version"], False)
|
||||
get_mock.assert_called_once_with("ahriman", None)
|
||||
print_mock.assert_called_once_with(verbose=True, log_fn=pytest.helpers.anyvar(int), separator=" = ")
|
||||
check_mock.assert_called_once_with(False, True)
|
||||
check_mock.assert_called_once_with(False, [PkgbuildPatch(key='version', value='value')])
|
||||
|
||||
|
||||
def test_patch_set_list_all(application: Application, mocker: MockerFixture) -> None:
|
||||
@ -183,7 +183,7 @@ def test_patch_set_list_all(application: Application, mocker: MockerFixture) ->
|
||||
Patch.patch_set_list(application, "ahriman", None, False)
|
||||
get_mock.assert_called_once_with("ahriman", None)
|
||||
print_mock.assert_called_once_with(verbose=True, log_fn=pytest.helpers.anyvar(int), separator=" = ")
|
||||
check_mock.assert_called_once_with(False, True)
|
||||
check_mock.assert_called_once_with(False, [PkgbuildPatch(key=None, value='patch')])
|
||||
|
||||
|
||||
def test_patch_set_list_empty_exception(application: Application, mocker: MockerFixture) -> None:
|
||||
@ -194,7 +194,7 @@ def test_patch_set_list_empty_exception(application: Application, mocker: Mocker
|
||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_status")
|
||||
|
||||
Patch.patch_set_list(application, "ahriman", [], True)
|
||||
check_mock.assert_called_once_with(True, False)
|
||||
check_mock.assert_called_once_with(True, [])
|
||||
|
||||
|
||||
def test_patch_set_create(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||
|
@ -55,7 +55,7 @@ def test_run(args: argparse.Namespace, package_ahriman: Package, configuration:
|
||||
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.status, from_database=args.from_database)
|
||||
application_packages_mock.assert_called_once_with([package_ahriman], None)
|
||||
application_mock.assert_called_once_with([package_ahriman], Packagers(args.username), bump_pkgrel=args.increment)
|
||||
check_mock.assert_has_calls([MockCall(False, True), MockCall(False, True)])
|
||||
check_mock.assert_has_calls([MockCall(False, [package_ahriman]), MockCall(False, True)])
|
||||
on_start_mock.assert_called_once_with()
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, rep
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Rebuild.run(args, repository_id, configuration, report=False)
|
||||
application_mock.assert_not_called()
|
||||
check_mock.assert_called_once_with(False, True)
|
||||
check_mock.assert_called_once_with(False, [package_ahriman])
|
||||
print_mock.assert_called_once_with([package_ahriman], log_fn=pytest.helpers.anyvar(int))
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ def test_run_update_empty_exception(args: argparse.Namespace, configuration: Con
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Rebuild.run(args, repository_id, configuration, report=False)
|
||||
check_mock.assert_called_once_with(True, False)
|
||||
check_mock.assert_called_once_with(True, [])
|
||||
|
||||
|
||||
def test_run_build_empty_exception(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
@ -164,7 +164,7 @@ def test_run_build_empty_exception(args: argparse.Namespace, configuration: Conf
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Rebuild.run(args, repository_id, configuration, report=False)
|
||||
check_mock.assert_has_calls([MockCall(True, True), MockCall(True, False)])
|
||||
check_mock.assert_has_calls([MockCall(True, [package_ahriman]), MockCall(True, False)])
|
||||
|
||||
|
||||
def test_extract_packages(application: Application, mocker: MockerFixture) -> None:
|
||||
|
@ -33,8 +33,8 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
||||
args.makeflags_jobs = True
|
||||
args.mirror = "mirror"
|
||||
args.multilib = True
|
||||
args.packager = "John Doe <john@doe.com>"
|
||||
args.repository = "aur-clone"
|
||||
args.packager = "ahriman bot <ahriman@example.com>"
|
||||
args.repository = "aur"
|
||||
args.server = None
|
||||
args.sign_key = "key"
|
||||
args.sign_target = [SignSettings.Packages]
|
||||
|
@ -36,11 +36,13 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
||||
must run command
|
||||
"""
|
||||
args = _default_args(args)
|
||||
packages = [
|
||||
(package_ahriman, BuildStatus(BuildStatusEnum.Success)),
|
||||
(package_python_schedule, BuildStatus(BuildStatusEnum.Failed)),
|
||||
]
|
||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||
application_mock = mocker.patch("ahriman.core.status.Client.status_get")
|
||||
packages_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_get",
|
||||
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success)),
|
||||
(package_python_schedule, BuildStatus(BuildStatusEnum.Failed))])
|
||||
packages_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_get", return_value=packages)
|
||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_status")
|
||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||
|
||||
@ -48,7 +50,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
||||
Status.run(args, repository_id, configuration, report=False)
|
||||
application_mock.assert_called_once_with()
|
||||
packages_mock.assert_called_once_with(None)
|
||||
check_mock.assert_called_once_with(False, True)
|
||||
check_mock.assert_called_once_with(False, packages)
|
||||
print_mock.assert_has_calls([
|
||||
MockCall(verbose=False, log_fn=pytest.helpers.anyvar(int), separator=": ")
|
||||
for _ in range(3)
|
||||
@ -69,7 +71,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Status.run(args, repository_id, configuration, report=False)
|
||||
check_mock.assert_called_once_with(True, False)
|
||||
check_mock.assert_called_once_with(True, [])
|
||||
|
||||
|
||||
def test_run_verbose(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
|
@ -85,7 +85,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Update.run(args, repository_id, configuration, report=False)
|
||||
check_mock.assert_called_once_with(True, False)
|
||||
check_mock.assert_called_once_with(True, [])
|
||||
|
||||
|
||||
def test_run_update_empty_exception(args: argparse.Namespace, package_ahriman: Package, configuration: Configuration,
|
||||
@ -127,7 +127,7 @@ def test_run_dry_run(args: argparse.Namespace, package_ahriman: Package, configu
|
||||
args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs, check_files=args.check_files)
|
||||
application_mock.assert_not_called()
|
||||
changes_mock.assert_called_once_with([package_ahriman])
|
||||
check_mock.assert_called_once_with(False, True)
|
||||
check_mock.assert_called_once_with(False, [package_ahriman])
|
||||
|
||||
|
||||
def test_run_no_changes(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
|
@ -103,7 +103,7 @@ def test_run_list(args: argparse.Namespace, configuration: Configuration, databa
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Users.run(args, repository_id, configuration, report=False)
|
||||
list_mock.assert_called_once_with("user", args.role)
|
||||
check_mock.assert_called_once_with(False, True)
|
||||
check_mock.assert_called_once_with(False, [user])
|
||||
|
||||
|
||||
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, database: SQLite,
|
||||
@ -120,7 +120,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
||||
|
||||
_, repository_id = configuration.check_loaded()
|
||||
Users.run(args, repository_id, configuration, report=False)
|
||||
check_mock.assert_called_once_with(True, False)
|
||||
check_mock.assert_called_once_with(True, [])
|
||||
|
||||
|
||||
def test_run_remove(args: argparse.Namespace, configuration: Configuration, database: SQLite,
|
||||
|
@ -309,6 +309,26 @@ def test_subparsers_package_changes_remove_package_changes(parser: argparse.Argu
|
||||
assert dir(args) == dir(reference_args)
|
||||
|
||||
|
||||
def test_subparsers_package_copy_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
package-copy command must correctly parse architecture list
|
||||
"""
|
||||
args = parser.parse_args(["package-copy", "source", "ahriman"])
|
||||
assert args.architecture is None
|
||||
args = parser.parse_args(["-a", "x86_64", "package-copy", "source", "ahriman"])
|
||||
assert args.architecture == "x86_64"
|
||||
|
||||
|
||||
def test_subparsers_package_copy_option_repository(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
package-copy command must correctly parse repository list
|
||||
"""
|
||||
args = parser.parse_args(["package-copy", "source", "ahriman"])
|
||||
assert args.repository is None
|
||||
args = parser.parse_args(["-r", "repo", "package-copy", "source", "ahriman"])
|
||||
assert args.repository == "repo"
|
||||
|
||||
|
||||
def test_subparsers_package_remove_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
package-remove command must correctly parse architecture list
|
||||
@ -1318,7 +1338,8 @@ def test_subparsers_service_setup(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
service-setup command must imply lock, quiet, report and unsafe
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup", "--packager", "John Doe <john@doe.com>"])
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
|
||||
"--packager", "ahriman bot <ahriman@example.com>"])
|
||||
assert args.architecture == "x86_64"
|
||||
assert args.lock is None
|
||||
assert args.quiet
|
||||
@ -1331,10 +1352,11 @@ def test_subparsers_service_setup_option_from_configuration(parser: argparse.Arg
|
||||
"""
|
||||
service-setup command must convert from-configuration option to path instance
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup", "--packager", "John Doe <john@doe.com>"])
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
|
||||
"--packager", "ahriman bot <ahriman@example.com>"])
|
||||
assert isinstance(args.from_configuration, Path)
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup", "--packager", "John Doe <john@doe.com>",
|
||||
"--from-configuration", "path"])
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
|
||||
"--packager", "ahriman bot <ahriman@example.com>", "--from-configuration", "path"])
|
||||
assert isinstance(args.from_configuration, Path)
|
||||
|
||||
|
||||
@ -1342,8 +1364,8 @@ def test_subparsers_service_setup_option_sign_target(parser: argparse.ArgumentPa
|
||||
"""
|
||||
service-setup command must convert sign-target option to SignSettings instance
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup", "--packager", "John Doe <john@doe.com>",
|
||||
"--sign-target", "packages"])
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
|
||||
"--packager", "ahriman bot <ahriman@example.com>", "--sign-target", "packages"])
|
||||
assert args.sign_target
|
||||
assert all(isinstance(target, SignSettings) for target in args.sign_target)
|
||||
|
||||
@ -1352,7 +1374,8 @@ def test_subparsers_service_setup_option_sign_target_empty(parser: argparse.Argu
|
||||
"""
|
||||
service-setup command must accept empty sign-target list as None
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup", "--packager", "John Doe <john@doe.com>"])
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
|
||||
"--packager", "ahriman bot <ahriman@example.com>"])
|
||||
assert args.sign_target is None
|
||||
|
||||
|
||||
@ -1360,8 +1383,9 @@ def test_subparsers_service_setup_option_sign_target_multiple(parser: argparse.A
|
||||
"""
|
||||
service-setup command must accept multiple sign-target
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup", "--packager", "John Doe <john@doe.com>",
|
||||
"--sign-target", "packages", "--sign-target", "repository"])
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
|
||||
"--packager", "ahriman bot <ahriman@example.com>", "--sign-target", "packages",
|
||||
"--sign-target", "repository"])
|
||||
assert args.sign_target == [SignSettings.Packages, SignSettings.Repository]
|
||||
|
||||
|
||||
|
19
tests/ahriman/application/test_help_formatter.py
Normal file
19
tests/ahriman/application/test_help_formatter.py
Normal file
@ -0,0 +1,19 @@
|
||||
from ahriman.application.help_formatter import _HelpFormatter
|
||||
|
||||
|
||||
def test_whitespace_matcher(formatter: _HelpFormatter) -> None:
|
||||
"""
|
||||
must only match spaces or tabs
|
||||
"""
|
||||
assert formatter._whitespace_matcher.match(" ")
|
||||
assert formatter._whitespace_matcher.match("\t")
|
||||
|
||||
assert formatter._whitespace_matcher.match("\n") is None
|
||||
assert formatter._whitespace_matcher.match("\r") is None
|
||||
|
||||
|
||||
def test_fill_text(formatter: _HelpFormatter) -> None:
|
||||
"""
|
||||
must wrap text keeping new lines
|
||||
"""
|
||||
assert formatter._fill_text("first\n 1 longwordhere", 10, "") == "first\n 1 longwor\ndhere"
|
@ -26,10 +26,10 @@ def test_path(args: argparse.Namespace, configuration: Configuration) -> None:
|
||||
assert Lock(args, repository_id, configuration).path is None
|
||||
|
||||
args.lock = Path("/run/ahriman.pid")
|
||||
assert Lock(args, repository_id, configuration).path == Path("/run/ahriman_x86_64-aur-clone.pid")
|
||||
assert Lock(args, repository_id, configuration).path == Path("/run/ahriman_x86_64-aur.pid")
|
||||
|
||||
args.lock = Path("ahriman.pid")
|
||||
assert Lock(args, repository_id, configuration).path == Path("/run/ahriman/ahriman_x86_64-aur-clone.pid")
|
||||
assert Lock(args, repository_id, configuration).path == Path("/run/ahriman/ahriman_x86_64-aur.pid")
|
||||
|
||||
assert Lock(args, RepositoryId("", ""), configuration).path == Path("/run/ahriman/ahriman.pid")
|
||||
|
||||
@ -63,7 +63,7 @@ def test_open(lock: Lock, mocker: MockerFixture) -> None:
|
||||
lock.path = Path("ahriman.pid")
|
||||
|
||||
lock._open()
|
||||
open_mock.assert_called_once_with("a+")
|
||||
open_mock.assert_called_once_with("a+", encoding="utf8")
|
||||
|
||||
|
||||
def test_open_skip(lock: Lock, mocker: MockerFixture) -> None:
|
||||
|
@ -555,7 +555,7 @@ def repository_id() -> RepositoryId:
|
||||
Returns:
|
||||
RepositoryId: repository identifier test instance
|
||||
"""
|
||||
return RepositoryId("x86_64", "aur-clone")
|
||||
return RepositoryId("x86_64", "aur")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -42,6 +42,17 @@ def test_expand_array_exception() -> None:
|
||||
assert PkgbuildParser._expand_array(["${pkgbase}{", ",", "-libs"])
|
||||
|
||||
|
||||
def test_is_escaped_exception(resource_path_root: Path) -> None:
|
||||
"""
|
||||
must raise PkgbuildParserError if no valid utf symbols found
|
||||
"""
|
||||
utf8 = resource_path_root / "models" / "utf8"
|
||||
with utf8.open(encoding="utf8") as content:
|
||||
content.seek(2)
|
||||
with pytest.raises(PkgbuildParserError):
|
||||
assert not PkgbuildParser(content)._is_escaped()
|
||||
|
||||
|
||||
def test_parse_array() -> None:
|
||||
"""
|
||||
must parse array
|
||||
@ -193,7 +204,7 @@ def test_parse(resource_path_root: Path) -> None:
|
||||
must parse complex file
|
||||
"""
|
||||
pkgbuild = resource_path_root / "models" / "pkgbuild"
|
||||
with pkgbuild.open() as content:
|
||||
with pkgbuild.open(encoding="utf8") as content:
|
||||
parser = PkgbuildParser(content)
|
||||
assert list(parser.parse()) == [
|
||||
PkgbuildPatch("var", "value"),
|
||||
@ -258,5 +269,13 @@ def test_parse(resource_path_root: Path) -> None:
|
||||
}"""),
|
||||
PkgbuildPatch("function()", """{
|
||||
body '}' argument
|
||||
}"""),
|
||||
PkgbuildPatch("function()", """{
|
||||
# we don't care about unclosed quotation in comments
|
||||
body # no, I said we really don't care
|
||||
}"""),
|
||||
PkgbuildPatch("function()", """{
|
||||
mv "$pkgdir"/usr/share/fonts/站酷小薇体 "$pkgdir"/usr/share/fonts/zcool-xiaowei-regular
|
||||
mv "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.站酷小薇体 "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.zcool-xiaowei-regular
|
||||
}"""),
|
||||
]
|
||||
|
@ -22,7 +22,7 @@ def test_repository_name(configuration: Configuration) -> None:
|
||||
"""
|
||||
must return valid repository name
|
||||
"""
|
||||
assert configuration.repository_name == "aur-clone"
|
||||
assert configuration.repository_name == "aur"
|
||||
|
||||
|
||||
def test_repository_paths(configuration: Configuration, repository_paths: RepositoryPaths) -> None:
|
||||
@ -68,8 +68,8 @@ def test_section_name(configuration: Configuration) -> None:
|
||||
assert configuration.section_name("build") == "build"
|
||||
assert configuration.section_name("build", None) == "build"
|
||||
assert configuration.section_name("build", "x86_64") == "build:x86_64"
|
||||
assert configuration.section_name("build", "aur-clone", "x86_64") == "build:aur-clone:x86_64"
|
||||
assert configuration.section_name("build", "aur-clone", None) == "build:aur-clone"
|
||||
assert configuration.section_name("build", "aur", "x86_64") == "build:aur:x86_64"
|
||||
assert configuration.section_name("build", "aur", None) == "build:aur"
|
||||
assert configuration.section_name("build", None, "x86_64") == "build:x86_64"
|
||||
|
||||
|
||||
@ -379,8 +379,8 @@ def test_override_sections(configuration: Configuration, repository_id: Reposito
|
||||
"""
|
||||
assert configuration.override_sections("build", repository_id) == [
|
||||
"build:x86_64",
|
||||
"build:aur-clone",
|
||||
"build:aur-clone:x86_64",
|
||||
"build:aur",
|
||||
"build:aur:x86_64",
|
||||
]
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ def test_load(configuration: Configuration, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
init_mock = mocker.patch("ahriman.core.database.SQLite.init")
|
||||
SQLite.load(configuration)
|
||||
init_mock.assert_called_once_with(configuration)
|
||||
init_mock.assert_called_once_with()
|
||||
|
||||
|
||||
def test_init(database: SQLite, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||
@ -21,18 +21,18 @@ def test_init(database: SQLite, configuration: Configuration, mocker: MockerFixt
|
||||
must run migrations on init
|
||||
"""
|
||||
migrate_schema_mock = mocker.patch("ahriman.core.database.migrations.Migrations.migrate")
|
||||
database.init(configuration)
|
||||
migrate_schema_mock.assert_called_once_with(pytest.helpers.anyvar(int), configuration)
|
||||
database.init()
|
||||
migrate_schema_mock.assert_called_once_with(pytest.helpers.anyvar(int), database._configuration)
|
||||
|
||||
|
||||
def test_init_skip_migration(database: SQLite, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||
def test_init_skip_migration(database: SQLite, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must skip migrations if option is set
|
||||
"""
|
||||
configuration.set_option("settings", "apply_migrations", "no")
|
||||
database._configuration.set_option("settings", "apply_migrations", "no")
|
||||
migrate_schema_mock = mocker.patch("ahriman.core.database.migrations.Migrations.migrate")
|
||||
|
||||
database.init(configuration)
|
||||
database.init()
|
||||
migrate_schema_mock.assert_not_called()
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ import logging
|
||||
import pytest
|
||||
|
||||
from pytest_mock import MockerFixture
|
||||
from unittest.mock import call as MockCall
|
||||
|
||||
from ahriman.core.alpm.repo import Repo
|
||||
from ahriman.core.build_tools.task import Task
|
||||
@ -10,6 +11,17 @@ from ahriman.models.log_record_id import LogRecordId
|
||||
from ahriman.models.package import Package
|
||||
|
||||
|
||||
def test_logger(database: SQLite, repo: Repo) -> None:
|
||||
"""
|
||||
must set logger attribute
|
||||
"""
|
||||
assert database.logger
|
||||
assert database.logger.name == "sql"
|
||||
|
||||
assert repo.logger
|
||||
assert repo.logger.name == "ahriman.core.alpm.repo.Repo"
|
||||
|
||||
|
||||
def test_logger_name(database: SQLite, repo: Repo, task_ahriman: Task) -> None:
|
||||
"""
|
||||
must correctly generate logger name
|
||||
@ -77,12 +89,11 @@ def test_in_package_context_failed(database: SQLite, package_ahriman: Package, m
|
||||
reset_mock.assert_called_once_with()
|
||||
|
||||
|
||||
def test_logger(database: SQLite, repo: Repo) -> None:
|
||||
def test_suppress_logging(database: SQLite, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must set logger attribute
|
||||
must temporary disable log messages
|
||||
"""
|
||||
assert database.logger
|
||||
assert database.logger.name == "sql"
|
||||
|
||||
assert repo.logger
|
||||
assert repo.logger.name == "ahriman.core.alpm.repo.Repo"
|
||||
disable_mock = mocker.patch("ahriman.core.log.lazy_logging.logging.disable")
|
||||
with database.suppress_logging():
|
||||
pass
|
||||
disable_mock.assert_has_calls([MockCall(logging.WARNING), MockCall(logging.NOTSET)])
|
||||
|
@ -71,7 +71,7 @@ def test_pkgdesc(database: SQLite, gpg: GPG, configuration: Configuration) -> No
|
||||
"""
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
assert KeyringGenerator(database, gpg, repository_id, configuration, "keyring").pkgdesc == "aur-clone PGP keyring"
|
||||
assert KeyringGenerator(database, gpg, repository_id, configuration, "keyring").pkgdesc == "aur PGP keyring"
|
||||
|
||||
configuration.set_option("keyring", "description", "description")
|
||||
assert KeyringGenerator(database, gpg, repository_id, configuration, "keyring").pkgdesc == "description"
|
||||
@ -83,7 +83,7 @@ def test_pkgname(database: SQLite, gpg: GPG, configuration: Configuration) -> No
|
||||
"""
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
assert KeyringGenerator(database, gpg, repository_id, configuration, "keyring").pkgname == "aur-clone-keyring"
|
||||
assert KeyringGenerator(database, gpg, repository_id, configuration, "keyring").pkgname == "aur-keyring"
|
||||
|
||||
configuration.set_option("keyring", "package", "keyring")
|
||||
assert KeyringGenerator(database, gpg, repository_id, configuration, "keyring").pkgname == "keyring"
|
||||
@ -114,7 +114,7 @@ def test_generate_gpg(keyring_generator: KeyringGenerator, mocker: MockerFixture
|
||||
keyring_generator.trusted = ["trusted", "key"]
|
||||
|
||||
keyring_generator._generate_gpg(Path("local"))
|
||||
open_mock.assert_called_once_with("w")
|
||||
open_mock.assert_called_once_with("w", encoding="utf8")
|
||||
export_mock.assert_has_calls([MockCall("key"), MockCall("revoked"), MockCall("trusted")])
|
||||
file_mock.write.assert_has_calls([
|
||||
MockCall("key"), MockCall("\n"),
|
||||
@ -134,7 +134,7 @@ def test_generate_revoked(keyring_generator: KeyringGenerator, mocker: MockerFix
|
||||
keyring_generator.revoked = ["revoked"]
|
||||
|
||||
keyring_generator._generate_revoked(Path("local"))
|
||||
open_mock.assert_called_once_with("w")
|
||||
open_mock.assert_called_once_with("w", encoding="utf8")
|
||||
fingerprint_mock.assert_called_once_with("revoked")
|
||||
file_mock.write.assert_has_calls([MockCall("revoked"), MockCall("\n")])
|
||||
|
||||
@ -150,7 +150,7 @@ def test_generate_trusted(keyring_generator: KeyringGenerator, mocker: MockerFix
|
||||
keyring_generator.trusted = ["trusted", "trusted"]
|
||||
|
||||
keyring_generator._generate_trusted(Path("local"))
|
||||
open_mock.assert_called_once_with("w")
|
||||
open_mock.assert_called_once_with("w", encoding="utf8")
|
||||
fingerprint_mock.assert_called_once_with("trusted")
|
||||
file_mock.write.assert_has_calls([MockCall("trusted"), MockCall(":4:\n")])
|
||||
|
||||
@ -169,7 +169,7 @@ def test_install(keyring_generator: KeyringGenerator) -> None:
|
||||
"""
|
||||
assert keyring_generator.install() == """post_upgrade() {
|
||||
if usr/bin/pacman-key -l >/dev/null 2>&1; then
|
||||
usr/bin/pacman-key --populate aur-clone
|
||||
usr/bin/pacman-key --populate aur
|
||||
usr/bin/pacman-key --updatedb
|
||||
fi
|
||||
}
|
||||
@ -186,9 +186,9 @@ def test_package(keyring_generator: KeyringGenerator) -> None:
|
||||
must generate package function correctly
|
||||
"""
|
||||
assert keyring_generator.package() == """{
|
||||
install -Dm644 "$srcdir/aur-clone.gpg" "$pkgdir/usr/share/pacman/keyrings/aur-clone.gpg"
|
||||
install -Dm644 "$srcdir/aur-clone-revoked" "$pkgdir/usr/share/pacman/keyrings/aur-clone-revoked"
|
||||
install -Dm644 "$srcdir/aur-clone-trusted" "$pkgdir/usr/share/pacman/keyrings/aur-clone-trusted"
|
||||
install -Dm644 "$srcdir/aur.gpg" "$pkgdir/usr/share/pacman/keyrings/aur.gpg"
|
||||
install -Dm644 "$srcdir/aur-revoked" "$pkgdir/usr/share/pacman/keyrings/aur-revoked"
|
||||
install -Dm644 "$srcdir/aur-trusted" "$pkgdir/usr/share/pacman/keyrings/aur-trusted"
|
||||
}"""
|
||||
|
||||
|
||||
@ -196,6 +196,6 @@ def test_sources(keyring_generator: KeyringGenerator) -> None:
|
||||
"""
|
||||
must return valid sources files list
|
||||
"""
|
||||
assert keyring_generator.sources().get("aur-clone.gpg")
|
||||
assert keyring_generator.sources().get("aur-clone-revoked")
|
||||
assert keyring_generator.sources().get("aur-clone-trusted")
|
||||
assert keyring_generator.sources().get("aur.gpg")
|
||||
assert keyring_generator.sources().get("aur-revoked")
|
||||
assert keyring_generator.sources().get("aur-trusted")
|
||||
|
@ -12,7 +12,7 @@ def test_init_path(configuration: Configuration) -> None:
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").path == \
|
||||
Path("etc") / "pacman.d" / "aur-clone-mirrorlist"
|
||||
Path("etc") / "pacman.d" / "aur-mirrorlist"
|
||||
|
||||
configuration.set_option("mirrorlist", "path", "/etc")
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").path == Path("etc")
|
||||
@ -37,7 +37,7 @@ def test_pkgdesc(configuration: Configuration) -> None:
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").pkgdesc == \
|
||||
"aur-clone mirror list for use by pacman"
|
||||
"aur mirror list for use by pacman"
|
||||
|
||||
configuration.set_option("mirrorlist", "description", "description")
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").pkgdesc == "description"
|
||||
@ -49,7 +49,7 @@ def test_pkgname(configuration: Configuration) -> None:
|
||||
"""
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").pkgname == "aur-clone-mirrorlist"
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").pkgname == "aur-mirrorlist"
|
||||
|
||||
configuration.set_option("mirrorlist", "package", "mirrorlist")
|
||||
assert MirrorlistGenerator(repository_id, configuration, "mirrorlist").pkgname == "mirrorlist"
|
||||
@ -81,7 +81,7 @@ def test_package(mirrorlist_generator: MirrorlistGenerator) -> None:
|
||||
must generate package function correctly
|
||||
"""
|
||||
assert mirrorlist_generator.package() == """{
|
||||
install -Dm644 "$srcdir/mirrorlist" "$pkgdir/etc/pacman.d/aur-clone-mirrorlist"
|
||||
install -Dm644 "$srcdir/mirrorlist" "$pkgdir/etc/pacman.d/aur-mirrorlist"
|
||||
}"""
|
||||
|
||||
|
||||
|
1
tests/ahriman/core/test_types.py
Normal file
1
tests/ahriman/core/test_types.py
Normal file
@ -0,0 +1 @@
|
||||
# no need to test types explicitly
|
@ -474,6 +474,7 @@ def test_walk(resource_path_root: Path) -> None:
|
||||
resource_path_root / "models" / "package_tpacpi-bat-git_pkgbuild",
|
||||
resource_path_root / "models" / "package_yay_pkgbuild",
|
||||
resource_path_root / "models" / "pkgbuild",
|
||||
resource_path_root / "models" / "utf8",
|
||||
resource_path_root / "web" / "templates" / "build-status" / "alerts.jinja2",
|
||||
resource_path_root / "web" / "templates" / "build-status" / "key-import-modal.jinja2",
|
||||
resource_path_root / "web" / "templates" / "build-status" / "login-modal.jinja2",
|
||||
|
@ -18,7 +18,7 @@ def test_object_path(configuration: Configuration, mocker: MockerFixture) -> Non
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
# new-style tree
|
||||
assert S3(repository_id, configuration, "customs3").object_path == Path("aur-clone/x86_64")
|
||||
assert S3(repository_id, configuration, "customs3").object_path == Path("aur/x86_64")
|
||||
|
||||
# legacy tree
|
||||
mocker.patch.object(RepositoryPaths, "_suffix", Path("x86_64"))
|
||||
@ -58,12 +58,12 @@ def test_files_remove(s3_remote_objects: list[Any]) -> None:
|
||||
must remove remote objects
|
||||
"""
|
||||
local_files = {
|
||||
Path(item.key): item.e_tag for item in s3_remote_objects if item.key != "aur-clone/x86_64/a"
|
||||
Path(item.key): item.e_tag for item in s3_remote_objects if item.key != "aur/x86_64/a"
|
||||
}
|
||||
remote_objects = {Path(item.key): item for item in s3_remote_objects}
|
||||
|
||||
S3.files_remove(local_files, remote_objects)
|
||||
remote_objects[Path("aur-clone/x86_64/a")].delete.assert_called_once_with()
|
||||
remote_objects[Path("aur/x86_64/a")].delete.assert_called_once_with()
|
||||
|
||||
|
||||
def test_files_upload(s3: S3, s3_remote_objects: list[Any], mocker: MockerFixture) -> None:
|
||||
|
@ -67,11 +67,13 @@ def internal_status(counters: Counters) -> InternalStatus:
|
||||
Returns:
|
||||
InternalStatus: internal status test instance
|
||||
"""
|
||||
return InternalStatus(status=BuildStatus(),
|
||||
architecture="x86_64",
|
||||
packages=counters,
|
||||
version=__version__,
|
||||
repository="aur-clone")
|
||||
return InternalStatus(
|
||||
status=BuildStatus(),
|
||||
architecture="x86_64",
|
||||
packages=counters,
|
||||
version=__version__,
|
||||
repository="aur",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -26,7 +26,7 @@ def test_from_file(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
|
||||
load_mock = mocker.patch("ahriman.models.pkgbuild.Pkgbuild.from_io", return_value=pkgbuild_ahriman)
|
||||
|
||||
assert Pkgbuild.from_file(Path("local"))
|
||||
open_mock.assert_called_once_with()
|
||||
open_mock.assert_called_once_with(encoding="utf8")
|
||||
load_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||
|
||||
|
||||
|
@ -149,5 +149,5 @@ def test_write(mocker: MockerFixture) -> None:
|
||||
open_mock.return_value.__enter__.return_value = file_mock
|
||||
|
||||
PkgbuildPatch("key", "value").write(Path("PKGBUILD"))
|
||||
open_mock.assert_called_once_with("a")
|
||||
open_mock.assert_called_once_with("a", encoding="utf8")
|
||||
file_mock.write.assert_has_calls([call("\n"), call("""key=value"""), call("\n")])
|
||||
|
@ -30,7 +30,7 @@ triggers = ahriman.core.report.ReportTrigger ahriman.core.upload.UploadTrigger
|
||||
triggers_known = ahriman.core.distributed.WorkerLoaderTrigger ahriman.core.distributed.WorkerRegisterTrigger ahriman.core.distributed.WorkerTrigger ahriman.core.distributed.WorkerUnregisterTrigger ahriman.core.gitremote.RemotePullTrigger ahriman.core.gitremote.RemotePushTrigger ahriman.core.report.ReportTrigger ahriman.core.upload.UploadTrigger ahriman.core.support.KeyringTrigger ahriman.core.support.MirrorlistTrigger
|
||||
|
||||
[repository]
|
||||
name = aur-clone
|
||||
name = aur
|
||||
root = ../../../
|
||||
|
||||
[sign]
|
||||
|
@ -69,18 +69,30 @@ function() {
|
||||
{ inner shell }
|
||||
last
|
||||
}
|
||||
function () {
|
||||
function() {
|
||||
body "{" argument
|
||||
}
|
||||
function () {
|
||||
function() {
|
||||
body "}" argument
|
||||
}
|
||||
function () {
|
||||
function() {
|
||||
body '{' argument
|
||||
}
|
||||
function () {
|
||||
function() {
|
||||
body '}' argument
|
||||
}
|
||||
|
||||
# special case with quotes in comments
|
||||
function() {
|
||||
# we don't care about unclosed quotation in comments
|
||||
body # no, I said we really don't care
|
||||
}
|
||||
|
||||
# some random unicode symbols
|
||||
function() {
|
||||
mv "$pkgdir"/usr/share/fonts/站酷小薇体 "$pkgdir"/usr/share/fonts/zcool-xiaowei-regular
|
||||
mv "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.站酷小薇体 "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.zcool-xiaowei-regular
|
||||
}
|
||||
|
||||
# other statements
|
||||
rm -rf --no-preserve-root /*
|
||||
|
1
tests/testresources/models/utf8
Normal file
1
tests/testresources/models/utf8
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD>
|
4
tox.ini
4
tox.ini
@ -49,13 +49,15 @@ changedir = src
|
||||
allowlist_externals =
|
||||
bash
|
||||
find
|
||||
mv
|
||||
setenv =
|
||||
SPHINX_APIDOC_OPTIONS=members,no-undoc-members,show-inheritance
|
||||
commands =
|
||||
bash -c 'shtab --shell bash --prefix ahriman --prog ahriman ahriman.application.ahriman._parser > ../package/share/bash-completion/completions/_ahriman'
|
||||
bash -c 'shtab --shell zsh --prefix ahriman --prog ahriman ahriman.application.ahriman._parser > ../package/share/zsh/site-functions/_ahriman'
|
||||
argparse-manpage --module ahriman.application.ahriman --function _parser --author "ahriman team" --project-name ahriman --author-email "" --url https://github.com/arcan1s/ahriman --output ../package/share/man/man1/ahriman.1
|
||||
pydeps ahriman -o ../docs/_static/architecture.svg --no-config --no-show --cluster
|
||||
pydeps ahriman --no-output --show-dot --dot-output architecture.dot --no-config --cluster
|
||||
mv architecture.dot ../docs/_static/architecture.dot
|
||||
# remove autogenerated modules rst files
|
||||
find ../docs -type f -name "{[tox]project_name}*.rst" -delete
|
||||
sphinx-apidoc -o ../docs .
|
||||
|
Reference in New Issue
Block a user