Compare commits
993 Commits
rhel8-1943
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
3958d2aa8b | ||
|
fa47a11197 | ||
|
4d10a0ea0c | ||
|
4e956ff173 | ||
|
58e6ca5d7b | ||
|
9536415907 | ||
|
c9e90ec0b2 | ||
|
105e6891f6 | ||
|
4581039da8 | ||
|
ddbb68f61e | ||
|
57675826cd | ||
|
80ee534afc | ||
|
2cb1c84600 | ||
|
918cf2c29d | ||
|
7d45b51ad8 | ||
|
94ef6ed036 | ||
|
d39a5f625e | ||
|
ea0c6c3b3a | ||
|
03da17fb37 | ||
|
d7a845c2d4 | ||
|
774e44060a | ||
|
55eee7d22d | ||
|
e1092c0ee9 | ||
|
eb4866c73d | ||
|
6b2c4d1a88 | ||
|
3c66730d7e | ||
|
8c61a4c5b3 | ||
|
bc46724b1d | ||
|
2dde5eb55f | ||
|
000667fbf5 | ||
|
152b503042 | ||
|
debfb498e3 | ||
|
cc90406a58 | ||
|
ab9068c2d0 | ||
|
f8af828a80 | ||
|
d692ce3662 | ||
|
22c3e76d6c | ||
|
4a678d6670 | ||
|
b9a3f8a788 | ||
|
7c6e3e6800 | ||
|
a01f62def7 | ||
|
506c9a18ff | ||
|
f4e0adc090 | ||
|
8532b683a4 | ||
|
710e65fa6f | ||
|
223f1755ec | ||
|
b3876337c3 | ||
|
ec0eafacd9 | ||
|
6160d340c4 | ||
|
74128fcd59 | ||
|
e144c69535 | ||
|
f2ae286739 | ||
|
c4aba2e47f | ||
|
87f9f77e24 | ||
|
5d9830e88d | ||
|
7a1de81b09 | ||
|
5286e4d917 | ||
|
1e66ac669c | ||
|
c811ba98d4 | ||
|
1adbeef14c | ||
|
96fca67621 | ||
|
a9451842eb | ||
|
6451060bda | ||
|
69c15c9bbe | ||
|
fbb7c5aeef | ||
|
6fc2648121 | ||
|
f783ff77d4 | ||
|
49ff2c7d5c | ||
|
a3810024ac | ||
|
bd9197c76e | ||
|
1843f8b0e0 | ||
|
d3bd740254 | ||
|
fa2e465d51 | ||
|
de2c88883a | ||
|
0b2ce51d96 | ||
|
3f04cf9b59 | ||
|
5dfa95d769 | ||
|
3801c802c5 | ||
|
35cb8f71a7 | ||
|
fab286e785 | ||
|
ea72ace122 | ||
|
0748dbe28c | ||
|
5c0c1a0b84 | ||
|
2342f53aff | ||
|
ff5c5dfe66 | ||
|
322a810403 | ||
|
7ce07c5a7c | ||
|
19ed6ed871 | ||
|
065e0a7f8d | ||
|
9cb34c5520 | ||
|
79a1fd9c46 | ||
|
cc7430fbbd | ||
|
d8e35d73c1 | ||
|
9164f4509d | ||
|
99ba2fe12c | ||
|
b75b692607 | ||
|
823e54dabf | ||
|
2762cf95da | ||
|
e9fa729b2e | ||
|
8602e653ff | ||
|
18fd73ae82 | ||
|
4b6aa1add1 | ||
|
1ffe2125d0 | ||
|
a8e37cdbed | ||
|
856d7d70f3 | ||
|
563db6608d | ||
|
55371c9968 | ||
|
561339c6dc | ||
|
5cf7943305 | ||
|
6d7a1df8fa | ||
|
07a1d8e88a | ||
|
730621808c | ||
|
02c185c9c0 | ||
|
202f90e541 | ||
|
5e4b058bae | ||
|
6803bae6d4 | ||
|
0dc1edb564 | ||
|
83ddffd377 | ||
|
9defb143da | ||
|
7df94aed4d | ||
|
04ce221a65 | ||
|
f6924f8f1f | ||
|
b0318efead | ||
|
a33efe7c51 | ||
|
6400515880 | ||
|
07600b2418 | ||
|
a4e87a07e0 | ||
|
bd37cd5b87 | ||
|
78eec89cda | ||
|
5ae6dce983 | ||
|
c0ec02b3ed | ||
|
0e9262ba20 | ||
|
cd77f6d4d5 | ||
|
b07151c6ee | ||
|
ee2496d672 | ||
|
51a4a93f90 | ||
|
6a8901fb09 | ||
|
d094708f08 | ||
|
46ab9e55f5 | ||
|
abbd86a2f6 | ||
|
1246bd8fba | ||
|
c3c3605b70 | ||
|
f1aee05167 | ||
|
9d6211f1b3 | ||
|
918669f538 | ||
|
468f651af4 | ||
|
83df17ea76 | ||
|
9b06645196 | ||
|
e3e8ff884b | ||
|
5e4bdbfb01 | ||
|
0eda7829a8 | ||
|
7616a10373 | ||
|
506d5d9ebd | ||
|
46ba3d541d | ||
|
44a213ee9a | ||
|
4ce386fe2d | ||
|
2078c83704 | ||
|
c1d247e0f5 | ||
|
86f0e72224 | ||
|
a9a155ff58 | ||
|
92463f16cb | ||
|
ea375ebe60 | ||
|
07f3e48c28 | ||
|
3359b896d1 | ||
|
afa7e2af37 | ||
|
a87f438af1 | ||
|
f36481c8aa | ||
|
e1785d13b8 | ||
e5f50e81c3 | |||
|
47822e5932 | ||
|
5165beef73 | ||
|
556fdf3020 | ||
|
8966c675ee | ||
|
b7e69596e3 | ||
|
d830829929 | ||
|
cc29b99659 | ||
|
27c4c67a59 | ||
|
04bc5e9e86 | ||
|
eb7748236c | ||
|
1c218ecbae | ||
|
abcbbf3194 | ||
|
123827c90a | ||
|
7b08fa8838 | ||
|
4dd7cf8798 | ||
|
d68e01b7e1 | ||
|
14a3c8d5a7 | ||
|
f1c15c67e0 | ||
|
52fd0f823b | ||
|
be2c9333fc | ||
|
68c26bf87b | ||
|
c2a3b7dbf3 | ||
|
48b268dc9e | ||
|
0b9841d5f7 | ||
|
0b5285a3e2 | ||
|
c080180885 | ||
|
e91e38e29c | ||
|
03ff3bb53a | ||
|
65d7397cf2 | ||
|
261e5af463 | ||
|
432a558ad6 | ||
|
bf1be846e5 | ||
|
9a17eba974 | ||
|
a3c4fbb66c | ||
|
e9b088068c | ||
|
d97687a496 | ||
|
0dbfe28745 | ||
|
9b8e0e2335 | ||
|
fa98321942 | ||
|
3c745aed8d | ||
|
4b1a4f8f16 | ||
|
f5de2de821 | ||
|
019cac8a7c | ||
|
9a76c20c6b | ||
|
74f8cd4f34 | ||
|
564f78e629 | ||
|
f83ae2fed3 | ||
|
b97dea0450 | ||
|
2e585c98f3 | ||
|
26e3bc555a | ||
|
6fdb09f9e2 | ||
|
cb639fc30f | ||
|
0f3b517f51 | ||
|
0c44e84cdb | ||
|
c9c1283c56 | ||
|
1d5a0a378b | ||
|
b992350f6b | ||
|
6025da1421 | ||
|
ccb5e1906f | ||
|
f94171bb0f | ||
|
91d71b09a4 | ||
|
d6ce9c907d | ||
|
bc6a080af7 | ||
|
e2e8deb906 | ||
|
a30531d41b | ||
|
92336963f0 | ||
|
54548e4076 | ||
|
622e15c85a | ||
|
cc47ca1f54 | ||
|
0d96f7d86c | ||
|
6820c48372 | ||
|
9af650798c | ||
|
ad54403c6d | ||
|
354c909b9b | ||
|
06d727e4fd | ||
|
d1d30bb974 | ||
|
7d7d158399 | ||
|
fe45fa3610 | ||
|
9dd160ba44 | ||
|
50d0c6e0c1 | ||
|
e31fccc4ae | ||
|
718ac31c47 | ||
|
67410a9770 | ||
|
210fe3d8ef | ||
|
2ee92b75b0 | ||
|
b159555f3f | ||
|
5ca385ce80 | ||
|
35348636c5 | ||
|
a0fce98109 | ||
|
a60cef3e1e | ||
|
5561bbb3bc | ||
|
d265824564 | ||
|
9bb1a0916e | ||
|
0d3cff0dde | ||
|
b86926e275 | ||
|
bae3cb06bc | ||
|
ca876483db | ||
|
887fb6ce35 | ||
|
b69e6d725d | ||
|
350baad384 | ||
|
c038bb53c6 | ||
|
59924fbafb | ||
|
badc07854c | ||
|
ed15b81818 | ||
|
cd65758ebe | ||
|
3b7ab99991 | ||
|
534f437d0c | ||
|
e82ae6b82a | ||
|
10473f59e9 | ||
|
c69c76e9c9 | ||
|
80dd997b9c | ||
|
045bddb37a | ||
|
30d45a8880 | ||
|
70baff3bc2 | ||
|
82e7335761 | ||
|
90b340f828 | ||
|
03d4583cdc | ||
|
f7688f9c8d | ||
|
cc689c0cb9 | ||
|
e38e2ead1e | ||
|
f52e56c628 | ||
|
6839390be2 | ||
|
fad9b324f7 | ||
|
95fd12e1f0 | ||
|
c5f6fd6d30 | ||
|
c345afdc65 | ||
|
ea53a201f2 | ||
|
36422ee944 | ||
|
58f629b020 | ||
|
dcd92cf8c0 | ||
|
637d3ea643 | ||
|
f74a5cc4a6 | ||
|
94b2b58d99 | ||
|
da5ba2421e | ||
|
2b578dcee8 | ||
|
c43ba9e78f | ||
|
1351c4dc63 | ||
|
e7e70313ef | ||
|
b197e448ff | ||
|
cb7e391792 | ||
|
89539a7bf4 | ||
|
454af0c5d5 | ||
|
d67745d755 | ||
|
e1b45958f4 | ||
|
4705ff3b1e | ||
|
a0ae10c2d7 | ||
|
e3654e8297 | ||
|
df7a018ee2 | ||
|
b8bf258a3c | ||
|
d8bf3427a6 | ||
|
cdcfaf562b | ||
|
e365e476af | ||
|
af3494fc46 | ||
|
88162780a7 | ||
|
ba0784d0ee | ||
|
51ce751b16 | ||
|
009c051003 | ||
|
53fba4c2b1 | ||
|
3fdc783850 | ||
|
a02538fdc3 | ||
|
0eb01b84a8 | ||
|
6f0473c742 | ||
|
2fdcfc2e4c | ||
|
63816d9764 | ||
|
4256a1d4f2 | ||
|
2a2313151b | ||
|
eee7a3e47d | ||
|
b5df65f658 | ||
|
3e9b56e66d | ||
|
6a2f465217 | ||
|
1969711d8c | ||
|
4276a68cf3 | ||
|
a414988ee8 | ||
|
27a4165089 | ||
|
c2620b0c85 | ||
|
a59c0241c4 | ||
|
146560b959 | ||
|
b91d742ecb | ||
|
b23c73e52c | ||
|
d16e8f5bfc | ||
|
577c56ebaa | ||
|
b307ff0430 | ||
|
0eda252d61 | ||
|
fd2330c4b7 | ||
|
acbf63013a | ||
|
7396c272b2 | ||
|
ade8945da3 | ||
|
f8f06ccd23 | ||
|
fd55bee85d | ||
|
c384b687ba | ||
|
b2fc391677 | ||
|
5d7aa95f2f | ||
|
bc06abceab | ||
|
1030dd083c | ||
|
de314a0046 | ||
|
4da569442c | ||
|
45498f2b93 | ||
|
1b84f90963 | ||
|
1a6bc098d9 | ||
|
3a453eaad7 | ||
|
2692e8138c | ||
|
584a2d2076 | ||
|
a2c67385e4 | ||
|
29c308ae73 | ||
|
697233c14a | ||
|
3aac31482c | ||
|
6cebc3da88 | ||
|
5efaa876e1 | ||
|
5322664432 | ||
|
f978d4b01c | ||
|
4643afa58d | ||
|
6f01aedc8a | ||
|
58e762f3a1 | ||
|
52f84adde3 | ||
|
8af9723c37 | ||
|
836f0ddf7a | ||
|
ea98969014 | ||
|
421cc9c22f | ||
|
562eb0a15d | ||
|
beff4f6967 | ||
|
66cd1fdb52 | ||
|
a0322afec3 | ||
|
3ee07001b1 | ||
|
1581842132 | ||
|
64ac615fa4 | ||
|
114c1bbda7 | ||
|
584cad72a0 | ||
|
cda497f0cb | ||
|
3b6c6a35d7 | ||
|
4da4b665ef | ||
|
6f686ff9d6 | ||
|
b8c1e706bb | ||
|
40bb80f10f | ||
|
0935a10a0b | ||
|
1e88a99443 | ||
|
278214ff8e | ||
|
f5bb2dca8c | ||
|
985b0bbc48 | ||
|
b9d18216ef | ||
|
361c6de2de | ||
|
babf823b1b | ||
|
835c912e12 | ||
|
1983bddb65 | ||
|
12e632a058 | ||
|
8612ca30db | ||
|
fb1fcce0fd | ||
|
f4a81d6c26 | ||
|
c46f9f034f | ||
|
fcd2d39860 | ||
|
1796489839 | ||
|
cb91fa3c78 | ||
|
cf10fb40f3 | ||
|
9f9cba35a2 | ||
|
0708302464 | ||
|
90626f97b6 | ||
|
9bf8d8a2fc | ||
|
3cb007a25b | ||
|
d496da00d9 | ||
|
d0e947fe3b | ||
|
197c326530 | ||
|
2c141950b0 | ||
|
1f811523b5 | ||
|
6b55c8f8f0 | ||
|
38f1edd2aa | ||
|
4174186c14 | ||
|
e11fc2037f | ||
|
fd57e1106e | ||
|
fce196ad4a | ||
|
dc98837667 | ||
|
eb7f528071 | ||
|
998d0140be | ||
|
fef76930bc | ||
|
e70aae69da | ||
|
f810924042 | ||
|
e947e01331 | ||
|
7ff4d7ac9e | ||
|
f1733369fa | ||
|
13a7dcf2b1 | ||
|
61059a2699 | ||
|
bad9e93c3c | ||
|
61fc4d2b4e | ||
|
682f8a9295 | ||
|
e7ce7cda72 | ||
|
c1aa57022b | ||
|
f0992bc649 | ||
|
fb89e6f275 | ||
|
abe7df34fc | ||
|
932ff5812c | ||
|
9011a564e8 | ||
|
316257fbc0 | ||
|
ffc3432cf2 | ||
|
6d50a5874e | ||
|
7071e62985 | ||
|
f64fe0f1f3 | ||
|
f61dfcc2c7 | ||
|
688f70eefa | ||
|
22b0eb28bc | ||
|
b725eb141a | ||
|
649a9e2239 | ||
|
16fd1a2340 | ||
|
eb8ca5b5bf | ||
|
33151372df | ||
|
42c7c0691c | ||
|
a4dcc34396 | ||
|
4bd03cb8f6 | ||
|
a164ed3d7d | ||
|
ce3a277100 | ||
|
b50f1967c6 | ||
|
8ed910b29a | ||
|
3587ed3663 | ||
|
b71e8f74d8 | ||
|
b67ce5379c | ||
|
6c2b34bf15 | ||
|
c5ae344b4f | ||
|
5dda214c39 | ||
|
29cf2c4e8c | ||
|
ed8a21a627 | ||
|
f24877b06e | ||
|
be15fa6ea8 | ||
|
708314a1fe | ||
|
1ac75e98b4 | ||
|
1e5a5921e3 | ||
|
6120f74c73 | ||
|
795cc3400c | ||
|
3b467f1cd7 | ||
|
c261cec33d | ||
|
4783f6562f | ||
|
6ddaa5e0dd | ||
|
bdffaa02f4 | ||
|
40e9c54cbb | ||
|
303a69bcbd | ||
|
77acc8972b | ||
|
ca171424eb | ||
|
5f5a2d5337 | ||
|
1ba2e6fd4b | ||
|
250f49f78d | ||
|
aa9c2e13b1 | ||
|
5d05deae64 | ||
|
ddb82ef598 | ||
|
2949edf733 | ||
|
c98f9ee40b | ||
|
947cbb1b84 | ||
|
afb745552b | ||
|
d4d050496b | ||
|
123b5c269d | ||
|
596cba2255 | ||
|
40d3055229 | ||
|
fa4bda8317 | ||
|
72ff8e72a9 | ||
|
3e08389a0f | ||
|
4f701e7e92 | ||
|
1111aee92d | ||
|
6ea1c45734 | ||
|
4d35668ab5 | ||
|
e5a8700bdf | ||
|
67007dfa60 | ||
|
2929deaf01 | ||
|
9bdbb29662 | ||
|
95c288d829 | ||
|
21e141a84c | ||
|
0fa5af2e30 | ||
|
65b8a2be68 | ||
|
933fad9ded | ||
|
e45e645fd0 | ||
|
7cbb324ae5 | ||
|
209bdd6911 | ||
|
9c39e73969 | ||
|
8a89edf7bf | ||
|
613d91299d | ||
|
b57de93468 | ||
|
db7b1e4fcd | ||
|
35e44ffb37 | ||
|
44e14176bb | ||
|
434fe58c28 | ||
|
c6fcf9d1eb | ||
|
bd804c271b | ||
|
c941b82b0c | ||
|
c585b91422 | ||
|
8ef4f431d8 | ||
|
3d3dda1400 | ||
|
ba2d834425 | ||
|
6fd06c6931 | ||
|
049f68cb60 | ||
|
69d0913070 | ||
|
2acd13d612 | ||
|
1855ffeb8e | ||
|
d178189ef3 | ||
|
6c6e4fced1 | ||
|
df3aeee802 | ||
|
6ccbfe0585 | ||
|
5dea308080 | ||
|
f9665940bb | ||
|
235813212f | ||
|
59464286f9 | ||
|
655e7e40c0 | ||
|
32d5ff8615 | ||
|
33498b8a87 | ||
|
8c2184d59e | ||
|
02f757d231 | ||
|
61efa91a03 | ||
|
c26477a63c | ||
|
cd8c884adb | ||
|
f6f2308765 | ||
|
d7b96c8f0f | ||
|
372bef945f | ||
|
b1407900ac | ||
|
5f530bd501 | ||
|
f5286e1243 | ||
|
85dfbd7911 | ||
|
e39d2aec22 | ||
|
eef11ef405 | ||
|
d32f477e0b | ||
|
26bd2c1378 | ||
|
b936dfb198 | ||
|
11955f0550 | ||
|
fc9ccb51ee | ||
|
a7e96ab828 | ||
|
f3c147448a | ||
|
3b8de2a233 | ||
|
822bc7ac68 | ||
|
6c5e89ed14 | ||
|
8eaad3bc5e | ||
|
a0ff34dcb1 | ||
|
b47554d716 | ||
|
d27b4fcbd4 | ||
|
ce110afd22 | ||
|
28bd68793b | ||
|
6443f34337 | ||
|
2272b2b189 | ||
|
9041174142 | ||
|
d64a320ba1 | ||
|
1c731b5618 | ||
|
ea78cce882 | ||
|
c95d7084a6 | ||
|
387a71e4cd | ||
|
7e78dc368f | ||
|
d35232d9cc | ||
|
301cb15120 | ||
|
7f562db31f | ||
|
6961dce08b | ||
|
022e9eba3e | ||
|
e194b5926c | ||
|
2af0973155 | ||
|
5dc895fbee | ||
|
57be7313c4 | ||
|
20ebfce164 | ||
|
f26fcba902 | ||
|
8a8802aab7 | ||
|
e918ff807c | ||
|
069c1faa4f | ||
|
24a1a345ab | ||
|
5217215c4b | ||
|
008911d938 | ||
|
98482e444d | ||
|
458d120afe | ||
|
3676cb65bb | ||
|
9577f719ae | ||
|
2a3c41e1ce | ||
|
e4fe1aab32 | ||
|
cc6fdb2fac | ||
|
67dcff18d9 | ||
|
d8439bdc11 | ||
|
961ea18145 | ||
|
de6419f0d1 | ||
|
6680e2ffec | ||
|
677c858f60 | ||
|
612f043b51 | ||
|
2d3f266373 | ||
|
4885434ac9 | ||
|
8a2e2a7a36 | ||
|
f9ade497d3 | ||
|
2950f2641b | ||
|
4fe21135e3 | ||
|
e85bcf4359 | ||
|
f66bff5aa7 | ||
|
6bb64f94ff | ||
|
7ee3b3d661 | ||
|
c53de4e63c | ||
|
35ab6a1336 | ||
|
ca2c3d9e77 | ||
|
3817671587 | ||
|
f9de60b2b7 | ||
|
e939469524 | ||
|
a477db33d6 | ||
|
34ab13b68a | ||
|
d34acfc14c | ||
|
3625e8e27c | ||
|
fd173f7265 | ||
|
3d1d79eea5 | ||
|
6f141658d4 | ||
|
fee5d4594c | ||
|
6b5c4df8b5 | ||
|
26a684932b | ||
|
3762264f56 | ||
|
fa461dc837 | ||
|
883a959442 | ||
|
6563a33f63 | ||
|
d619430d6d | ||
|
6524bb0985 | ||
|
d18934775c | ||
|
4dd9004d13 | ||
|
642b909d24 | ||
|
543a4d88d9 | ||
|
16260c1569 | ||
|
59050df710 | ||
|
e0c8cdc5a8 | ||
|
8f430be2a6 | ||
|
57b4f2e8f3 | ||
|
4b4f4bd0e0 | ||
|
ed63611cb7 | ||
|
ab048947cb | ||
|
14ae0fcac9 | ||
|
9ac4508135 | ||
|
8b11705ea0 | ||
|
9ea1f4c09d | ||
|
35b8957f12 | ||
|
cd6f4fdb67 | ||
|
b88466fd74 | ||
|
c9d706a382 | ||
|
366ae55abe | ||
|
c11bffc357 | ||
|
763ca83f9f | ||
|
af2ae790ce | ||
|
13fbd0861b | ||
|
d6dcb38a78 | ||
|
b61a91954a | ||
|
6ae78fbd47 | ||
|
fb4e6f2588 | ||
|
d69f01d4a8 | ||
|
063a1770e1 | ||
|
bab4b20d0d | ||
|
8e749efbbf | ||
|
134a333d92 | ||
|
fb87db0e1e | ||
|
cc69478249 | ||
|
2e36e941ce | ||
|
e8fd8a496b | ||
|
8a26d0648e | ||
|
6a42570eea | ||
|
6005f98123 | ||
|
9906ad6da3 | ||
|
6631002a81 | ||
|
59d8c91ae5 | ||
|
efaf2bf793 | ||
|
7d2b9d2d30 | ||
|
2eb62014db | ||
|
453b1c1236 | ||
|
a4783ba29f | ||
|
befa3128d7 | ||
|
f80cc97a42 | ||
|
7500a17f27 | ||
|
27e611629f | ||
|
df70e3d677 | ||
|
27aff75aa3 | ||
|
e9e5139750 | ||
|
e1dc54ea8c | ||
|
5409748e75 | ||
|
fa2158c7a9 | ||
|
de8124366e | ||
|
e7f45d333f | ||
|
876ec52215 | ||
|
4e0c7b3fba | ||
|
7e0a288f5b | ||
|
faa65bca3c | ||
|
d7951e3a10 | ||
|
75644689de | ||
|
65b769984b | ||
|
aafa271608 | ||
|
7cc6e86299 | ||
|
98f8b23129 | ||
|
ac9a2fdbc5 | ||
|
6fab72d894 | ||
|
69a2835387 | ||
|
2a7a323ddf | ||
|
c017300ad6 | ||
|
9087de3c86 | ||
|
3b41faae2c | ||
|
81d38b6445 | ||
|
9717b3fd98 | ||
|
0086362f0b | ||
|
c7b0644ee5 | ||
|
6da3079349 | ||
|
6a37f80f0f | ||
|
e7bfab8b4a | ||
|
edc5490a99 | ||
|
acedb3a0ed | ||
|
8ed443ff58 | ||
|
e4c098b7e0 | ||
|
37f264c010 | ||
|
51c73f7570 | ||
|
7e31a2c138 | ||
|
ef8bc70cdd | ||
|
b2eadff77c | ||
|
f360ef9216 | ||
|
003108b15f | ||
|
d5a1993640 | ||
|
1056bfc25b | ||
|
e0c236ff36 | ||
|
18188bf6cf | ||
|
847fff4e11 | ||
|
e33b1e1636 | ||
|
160044ba9d | ||
|
9736dff762 | ||
|
c97a6985fb | ||
|
8e0b7ba2ca | ||
|
c9be91c879 | ||
|
3246c01443 | ||
|
e36b89e9e8 | ||
|
4a66b5b085 | ||
|
78717054d7 | ||
|
ec1ebbc623 | ||
|
ab85ad5c86 | ||
|
c00036251e | ||
|
b4b8985caa | ||
|
a65b93c77d | ||
|
e129c4c4f5 | ||
|
0432c6d56e | ||
|
45e093241d | ||
|
d514696880 | ||
|
330ee6c8b6 | ||
|
40b3eda232 | ||
|
8abf6be950 | ||
|
044d7381a2 | ||
|
a0aab15311 | ||
|
5c0dfb74e6 | ||
|
4a5591e9a4 | ||
|
7e19a4f671 | ||
|
18df16e2b7 | ||
|
4d9ef60460 | ||
|
07acd2e780 | ||
|
55e9653cde | ||
|
8b0d2648dd | ||
|
e0cad3dcf8 | ||
|
57674c9a1a | ||
|
ec908fcd2a | ||
|
972b5c4142 | ||
|
0a76d635ca | ||
|
4e32026354 | ||
|
fb39d9a418 | ||
|
86d556e87c | ||
|
ee98d87cea | ||
|
c52ba4236a | ||
|
deff4d325f | ||
|
40f23f093d | ||
|
844ff9998b | ||
|
04fd94f44b | ||
|
be5d50e6f3 | ||
|
94453ff94e | ||
|
c638926880 | ||
|
83e5f3f885 | ||
|
07de4c371a | ||
|
b1daf6fcd3 | ||
|
47d3a72014 | ||
|
b1e2bbfd17 | ||
|
c8283adc17 | ||
|
fb9e5c4a2b | ||
|
faba254be5 | ||
|
473ee99eb9 | ||
|
d03a198a8c | ||
|
6a3ccd6ade | ||
|
c1af7dd69d | ||
|
f67e2c5d52 | ||
|
785ee7bcc3 | ||
|
2f8f076b1f | ||
|
a2ce0686ca | ||
|
b26d12e457 | ||
|
2efbd7cae5 | ||
|
6c3b0b3cd2 | ||
|
f557b28d19 | ||
|
0e97afdbd6 | ||
|
316a829ff7 | ||
|
55dd45de6e | ||
|
ec4c555174 | ||
|
f93f64a061 | ||
|
2d01bec2b2 | ||
|
439a894947 | ||
|
741e73265c | ||
|
e2dd59c6dc | ||
|
991416adf5 | ||
|
fc9a469ca2 | ||
|
7379102923 | ||
|
b4f9fb5c1f | ||
|
8a2a43be99 | ||
|
76f714eab5 | ||
|
ea7b22a8f5 | ||
|
022734ab01 | ||
|
495dcd13ec | ||
|
e42b797295 | ||
|
ab76c6170e | ||
|
ae19bc7343 | ||
|
aec0e09caa | ||
|
18b03936c2 | ||
|
2ce3752f90 | ||
|
0c19c3304e | ||
|
08fb780bb9 | ||
|
db587afb16 | ||
|
f0dd50fbae | ||
|
42ad6ad0cc | ||
|
4e3044de20 | ||
|
b40c3b2ce3 | ||
|
08c2965fab | ||
|
2d5f434b12 | ||
|
2251c540c8 | ||
|
01582e227d | ||
|
80e2e8e6db | ||
|
bf95a3310b | ||
|
86d836897b | ||
|
18521cec1a | ||
|
066276ed65 | ||
|
8b271aa917 | ||
|
0ff9a674ca | ||
|
b1dd22afa6 | ||
|
83680d92b0 | ||
|
816f1658db | ||
|
231a8ed4b2 | ||
|
fbda20b8b7 | ||
|
e151c8399d | ||
|
8c4804eb15 | ||
|
76d376fe18 | ||
|
bb8fdcb854 | ||
|
eba5658a71 | ||
|
3c6478e179 | ||
|
460a277d4e | ||
|
9e41052992 | ||
|
0eb823ee94 | ||
|
4a3f9e12aa | ||
|
f38f5cc168 | ||
|
7adc5162fb | ||
|
779153a1cf | ||
|
378099cc10 | ||
|
56926baaec | ||
|
86c4ef5f45 | ||
|
59847db275 | ||
|
7f805287ca | ||
|
6d9187d559 | ||
|
82e9df0ac1 | ||
|
e8894b7266 | ||
|
936d193413 | ||
|
98de565979 | ||
|
594e762d63 | ||
|
6cf4e56d2a | ||
|
ca6030c5c7 | ||
|
d8ce013a2b | ||
|
d5d3dd3be3 | ||
|
c9ca451568 | ||
|
a038d76f64 | ||
|
84ee526d3f | ||
|
d47d38e0c8 | ||
|
6f6ce410c0 | ||
|
afa89ea657 | ||
|
dd8e4d9e99 | ||
|
666d7f1e03 | ||
|
1034cfd9a7 | ||
|
23f4b2a3ec | ||
|
22070dcf42 | ||
|
6d677b2207 | ||
|
1f8da3f1a7 | ||
|
bb3d8edd06 | ||
|
095829171a | ||
|
d406fbdf83 | ||
|
3edc85e0b9 | ||
|
683ec03cc8 | ||
|
4a905bdfb0 | ||
|
cd189aa97e | ||
|
8188d921c7 | ||
|
e963af3b1a | ||
|
48e318b391 | ||
|
081da8859a | ||
|
c726f19434 | ||
|
ad549a4601 | ||
|
db67c1267a | ||
|
9eb35c364d | ||
|
6e5ca1f062 | ||
|
e6d64dad61 | ||
|
b1319c7bc1 | ||
|
0455a5d740 | ||
|
12cb2736ac | ||
|
3c31e52b3c | ||
|
9a1dce5619 | ||
|
3974a4e479 | ||
|
a363aee971 | ||
|
07ea61be77 | ||
|
25bec0b50d | ||
|
29ceea3d05 | ||
|
825d1931e4 | ||
|
a9b626a706 | ||
|
5e0246d4a9 | ||
|
5c25f98db7 | ||
|
c9187ce4ca | ||
|
48671b682a | ||
|
d478864fb3 | ||
|
8ed039107b | ||
|
88d8905c0f | ||
|
0a3e6598b2 | ||
|
733c824c49 | ||
|
719aceac82 | ||
|
2fa1da0f5e | ||
|
9b9b627fe5 | ||
|
e86f4f9a36 | ||
|
06c227598c | ||
|
454c74035c | ||
|
63b473d4ba | ||
|
d31bea7bd3 | ||
|
4a91936dd2 | ||
|
94e525f3c7 | ||
|
094c30eda4 | ||
|
89050f068d | ||
|
8e2e0b4ed3 | ||
|
88139bcc03 | ||
|
dc348fac25 | ||
|
1d32a0cb36 | ||
|
d95cb93df0 | ||
|
2fd3174684 | ||
|
1e9ae623d1 | ||
|
db9e2a1e41 | ||
|
106f330bb2 | ||
|
1cf2d8fe6f | ||
|
4462124848 | ||
|
dfaac5c84d | ||
|
f03933e726 | ||
|
e49c49ecb5 | ||
|
567e103058 | ||
|
2ed8b7f86e | ||
|
2f3de6060b |
@ -1,3 +1,5 @@
|
||||
[paths]
|
||||
source = .
|
||||
/lorax/
|
||||
[run]
|
||||
relative_files = True
|
||||
|
28
.github/workflows/tests.yml
vendored
Normal file
28
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: Tests and Coverage
|
||||
# Make sure only one action triggers the job, otherwise pushing to a
|
||||
# pull-request will run it twice.
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- rhel8-branch
|
||||
- rhel7-branch
|
||||
- f31-branch
|
||||
- f32-branch
|
||||
- f33-branch
|
||||
|
||||
jobs:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Clone Repository"
|
||||
uses: actions/checkout@v2
|
||||
- name: Run lorax tests in podman
|
||||
run: sudo make test-in-podman && cp .test-results/.coverage .coverage
|
||||
- name: Coveralls
|
||||
uses: AndreMiras/coveralls-python-action@develop
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,6 +6,8 @@ tests/pylint/.pylint.d/
|
||||
__pycache__/
|
||||
.coverage
|
||||
pylint-log
|
||||
.pytest_cache/
|
||||
.test-results/
|
||||
/lorax-*.tar.gz
|
||||
/bots
|
||||
/test/images
|
||||
|
20
.travis.yml
20
.travis.yml
@ -1,20 +0,0 @@
|
||||
sudo: required
|
||||
language: python
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
- make test-in-docker
|
||||
|
||||
after_success:
|
||||
- |
|
||||
cp .test-results/.coverage ./.coverage.docker
|
||||
|
||||
pip install coverage coveralls
|
||||
coverage combine
|
||||
coveralls
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_failure: change
|
||||
on_success: never
|
@ -1,8 +1,6 @@
|
||||
FROM centos:8
|
||||
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
COPY ./test-packages .
|
||||
RUN dnf -y install $(cat ./test-packages) && touch /.in-container
|
||||
RUN pip3 install pocketlint
|
||||
FROM registry.fedoraproject.org/fedora:rawhide
|
||||
COPY test-packages .
|
||||
RUN dnf -y install $(cat test-packages) && touch /.in-container
|
||||
RUN useradd weldr
|
||||
VOLUME /lorax-ro
|
||||
VOLUME /test-results
|
||||
|
30
HACKING.md
Normal file
30
HACKING.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Hacking on Lorax
|
||||
|
||||
Here's where to get the code:
|
||||
|
||||
$ git clone https://github.com/weldr/lorax
|
||||
$ cd lorax/
|
||||
|
||||
How to build it:
|
||||
|
||||
$ make
|
||||
|
||||
## How to run the tests
|
||||
|
||||
To run the tests you need the following dependencies installed:
|
||||
|
||||
$ yum install python3-nose python3-pytest-mock python3-pocketlint \
|
||||
python3-mock python3-magic
|
||||
|
||||
Run the basic linting tests like this:
|
||||
|
||||
$ make check
|
||||
|
||||
|
||||
To run the broader unit and integration tests we use:
|
||||
|
||||
$ make test
|
||||
|
||||
The tests may also be run using a podman container:
|
||||
|
||||
$ make test-in-podman
|
111
Makefile
111
Makefile
@ -1,18 +1,22 @@
|
||||
PYTHON ?= /usr/bin/python3
|
||||
DESTDIR ?= /
|
||||
DOCKER ?= docker
|
||||
BACKEND ?= lorax-composer
|
||||
PREFIX ?= /usr
|
||||
mandir ?= $(PREFIX)/share/man
|
||||
DOCKER ?= podman
|
||||
PODMAN ?= $(DOCKER)
|
||||
DOCS_VERSION ?= next
|
||||
RUN_TESTS ?= ci
|
||||
|
||||
PKGNAME = lorax
|
||||
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
|
||||
RELEASE = $(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
|
||||
TAG = lorax-$(VERSION)-$(RELEASE)
|
||||
|
||||
IMAGE_RELEASE = rhel8-latest
|
||||
IMAGE_RELEASE = $(shell awk -F: '/FROM/ { print $$2}' Dockerfile.test)
|
||||
|
||||
ifeq ($(TEST_OS),)
|
||||
OS_ID = $(shell awk -F= '/^ID=/ {print $$2}' /etc/os-release)
|
||||
OS_VERSION = $(shell awk -F= '/^VERSION_ID/ {print $$2}' /etc/os-release | tr '.' '-')
|
||||
OS_ID = $(shell awk -F= '/^ID/ {print $$2}' /etc/os-release)
|
||||
OS_VERSION = $(shell awk -F= '/^VERSION_ID/ {print $$2}' /etc/os-release)
|
||||
TEST_OS = $(OS_ID)-$(OS_VERSION)
|
||||
endif
|
||||
export TEST_OS
|
||||
@ -24,24 +28,17 @@ endif
|
||||
|
||||
default: all
|
||||
|
||||
src/composer/version.py: lorax.spec
|
||||
echo "num = '$(VERSION)-$(RELEASE)'" > src/composer/version.py
|
||||
|
||||
src/pylorax/version.py: lorax.spec
|
||||
echo "num = '$(VERSION)-$(RELEASE)'" > src/pylorax/version.py
|
||||
|
||||
all: src/pylorax/version.py src/composer/version.py
|
||||
all: src/pylorax/version.py
|
||||
$(PYTHON) setup.py build
|
||||
|
||||
install: all
|
||||
$(PYTHON) setup.py install --root=$(DESTDIR)
|
||||
$(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
|
||||
mkdir -p $(DESTDIR)/$(mandir)/man1
|
||||
install -m 644 docs/man/lorax.1 $(DESTDIR)/$(mandir)/man1
|
||||
install -m 644 docs/man/livemedia-creator.1 $(DESTDIR)/$(mandir)/man1
|
||||
install -m 644 docs/man/lorax-composer.1 $(DESTDIR)/$(mandir)/man1
|
||||
install -m 644 docs/man/composer-cli.1 $(DESTDIR)/$(mandir)/man1
|
||||
install -m 644 docs/man/*.1 $(DESTDIR)/$(mandir)/man1
|
||||
mkdir -p $(DESTDIR)/etc/bash_completion.d
|
||||
install -m 644 etc/bash_completion.d/composer-cli $(DESTDIR)/etc/bash_completion.d
|
||||
|
||||
check:
|
||||
@echo "*** Running pylint ***"
|
||||
@ -49,28 +46,30 @@ check:
|
||||
|
||||
test:
|
||||
@echo "*** Running tests ***"
|
||||
PYTHONPATH=$(PYTHONPATH):./src/ $(PYTHON) -m nose -v --with-coverage --cover-erase --cover-branches \
|
||||
--cover-package=pylorax --cover-inclusive \
|
||||
./tests/pylorax/ ./tests/composer/
|
||||
PYTHONPATH=$(PYTHONPATH):./src/ $(PYTHON) -X dev -m pytest -v --cov-branch \
|
||||
--cov=pylorax ./tests/pylorax/ ./tests/image-minimizer/
|
||||
|
||||
coverage-3 report -m
|
||||
coverage3 report -m
|
||||
[ -f "/usr/bin/coveralls" ] && [ -n "$(COVERALLS_REPO_TOKEN)" ] && coveralls || echo
|
||||
|
||||
# need `losetup`, which needs Docker to be in privileged mode (--privileged)
|
||||
# but even so fails in Travis CI
|
||||
test_images:
|
||||
sudo -E ./tests/test_cli.sh tests/cli/test_compose_ext4-filesystem.sh \
|
||||
tests/cli/test_compose_partitioned-disk.sh \
|
||||
tests/cli/test_compose_tar.sh \
|
||||
tests/cli/test_compose_qcow2.sh \
|
||||
tests/cli/test_compose_live-iso.sh
|
||||
|
||||
test_cli:
|
||||
sudo -E ./tests/test_cli.sh
|
||||
|
||||
test_mkksiso:
|
||||
sudo -E ./tests/mkksiso/test_mkksiso.sh
|
||||
|
||||
clean_cloud_envs:
|
||||
# clean beakerlib logs from previous executions
|
||||
sudo rm -rf /var/tmp/beakerlib-*/
|
||||
sudo -E ./tests/cleanup/remove_old_objects_aws.sh
|
||||
sudo -E ./tests/cleanup/remove_old_objects_openstack.sh
|
||||
sudo -E ./tests/cleanup/remove_old_objects_azure.sh
|
||||
sudo -E ./tests/cleanup/remove_old_objects_vmware.sh
|
||||
# make sure all cleanup scripts finished successfully
|
||||
sudo sh -c 'grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1 || exit 0'
|
||||
|
||||
clean:
|
||||
-rm -rf build src/pylorax/version.py
|
||||
-rm -rf build src/composer/version.py
|
||||
|
||||
tag:
|
||||
git tag -f $(TAG)
|
||||
@ -78,6 +77,10 @@ tag:
|
||||
docs:
|
||||
$(MAKE) -C docs apidoc html man
|
||||
|
||||
# This is needed to reset the ownership of the new docs files after they are created in a container
|
||||
set-docs-owner:
|
||||
sudo chown -R $(LOCAL_UID):$(LOCAL_GID) docs/
|
||||
|
||||
archive:
|
||||
@git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(TAG) > $(PKGNAME)-$(VERSION).tar
|
||||
@gzip -f $(PKGNAME)-$(VERSION).tar
|
||||
@ -101,17 +104,39 @@ local:
|
||||
@rm -rf /var/tmp/$(PKGNAME)-$(VERSION)
|
||||
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
|
||||
|
||||
local-srpm: local $(PKGNAME).spec
|
||||
rpmbuild -bs \
|
||||
--define "_sourcedir $(CURDIR)" \
|
||||
--define "_srcrpmdir $(CURDIR)" \
|
||||
lorax.spec
|
||||
|
||||
test-in-copy:
|
||||
rsync -aP --exclude=.git /lorax-ro/ /lorax/
|
||||
make -C /lorax/ ci
|
||||
rsync -a --exclude=.git /lorax-ro/ /lorax/
|
||||
make -C /lorax/ $(RUN_TESTS)
|
||||
cp /lorax/.coverage /test-results/
|
||||
|
||||
test-in-docker:
|
||||
sudo $(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
|
||||
sudo $(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results -v `pwd`:/lorax-ro:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
|
||||
test-in-docker: test-in-podman
|
||||
|
||||
test-in-podman:
|
||||
$(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
|
||||
@mkdir -p `pwd`/.test-results
|
||||
$(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results \
|
||||
-v `pwd`:/lorax-ro:ro --security-opt label=disable \
|
||||
--env RUN_TESTS="$(RUN_TESTS)" \
|
||||
welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
|
||||
# rootless podman leaves them owned by the container UID
|
||||
$(MAKE) set-docs-owner
|
||||
|
||||
docs-in-docker: docs-in-podman
|
||||
|
||||
docs-in-podman:
|
||||
$(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
|
||||
$(DOCKER) run -it --rm -v `pwd`:/lorax-ro:ro \
|
||||
-v `pwd`/docs/:/lorax-ro/docs/ \
|
||||
--env LORAX_VERSION=$(DOCS_VERSION) \
|
||||
--env LOCAL_UID=`id -u` --env LOCAL_GID=`id -g` \
|
||||
--security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs
|
||||
|
||||
docs-in-docker:
|
||||
sudo $(DOCKER) run -it --rm -v `pwd`/docs/html/:/lorax/docs/html/ --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs
|
||||
|
||||
ci: check test
|
||||
|
||||
@ -125,7 +150,7 @@ $(VM_IMAGE): srpm bots
|
||||
--upload $(CURDIR)/test/vm.install:/var/tmp/vm.install \
|
||||
--upload $(realpath tests):/ \
|
||||
--run-command "chmod +x /var/tmp/vm.install" \
|
||||
--run-command "cd /var/tmp; BACKEND=$(BACKEND) /var/tmp/vm.install $$srpm" \
|
||||
--run-command "cd /var/tmp; /var/tmp/vm.install $$srpm" \
|
||||
$(TEST_OS)
|
||||
[ -f ~/.config/lorax-test-env ] && bots/image-customize \
|
||||
--upload ~/.config/lorax-test-env:/var/tmp/lorax-test-env \
|
||||
@ -140,16 +165,6 @@ vm: $(VM_IMAGE)
|
||||
# and update the image. Mostly used when testing downstream snapshots to make
|
||||
# sure VM_IMAGE is as close as possible to the host!
|
||||
vm-local-repos: vm
|
||||
bots/image-customize -v \
|
||||
--run-command "rm -rf /etc/yum.repos.d" \
|
||||
$(TEST_OS)
|
||||
bots/image-customize -v \
|
||||
--upload $(REPOS_DIR):/etc/yum.repos.d \
|
||||
--run-command "yum -y remove composer-cli $(BACKEND)" \
|
||||
--run-command "yum -y update" \
|
||||
--run-command "yum -y install composer-cli $(BACKEND)" \
|
||||
--run-command "systemctl enable $(BACKEND).socket" \
|
||||
$(TEST_OS)
|
||||
|
||||
vm-reset:
|
||||
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
|
||||
@ -166,4 +181,4 @@ bots:
|
||||
ci_after_success:
|
||||
# nothing to do here, but Jenkins expects this to be present, otherwise fails
|
||||
|
||||
.PHONY: docs check test srpm vm vm-reset
|
||||
.PHONY: docs check test srpm vm vm-reset docs-in-docker docs-in-podman test-in-docker test-in-podman
|
||||
|
@ -2,6 +2,5 @@ Lorax is a set of tools used to create bootable images.
|
||||
|
||||
* lorax - creates the Anaconda boot.iso used to install Fedora
|
||||
* livemedia-creator - uses Anaconda to create bootable images
|
||||
* lorax-composer - API server implementing the Weldr BDCS protocol using livemedia-creator
|
||||
|
||||
See the [Weldr blog](https://weldr.io) for more info about BDCS and the [Lorax documentation](https://weldr.io/lorax) for more information about Lorax and associated tools.
|
||||
|
135
RELEASE.md
Normal file
135
RELEASE.md
Normal file
@ -0,0 +1,135 @@
|
||||
How to release a new version of Lorax for Fedora
|
||||
================================================
|
||||
|
||||
Install `tito` and `podman` on your system.
|
||||
|
||||
Optionally patch `tito` to support signing the tags with your gpg key. If you
|
||||
do this your key should be available on the public gpg keyservers so that
|
||||
people can verify your signature.
|
||||
|
||||
The upstream `tito` PR can be found [here](https://github.com/dgoodwin/tito/pull/328).
|
||||
|
||||
You will need to have permission to push to the lorax repository, and to the
|
||||
Fedora dist-git repository. If your FAS name isn't listed on the [lorax package
|
||||
page](https://src.fedoraproject.org/rpms/lorax/) members list then you need to
|
||||
contact one of the project admins and ask to be added.
|
||||
|
||||
|
||||
Run the tests
|
||||
-------------
|
||||
You can run the tests using `podman` instead of `docker` by running this from the
|
||||
top level of the checked-out lorax repo:
|
||||
|
||||
DOCKER=podman RUN_TESTS="ci test_cli" make test-in-docker
|
||||
|
||||
If they fail, fix them and submit a PR :)
|
||||
|
||||
You can also run the cockpit CI tests locally:
|
||||
|
||||
make vm
|
||||
./test/check-cli
|
||||
|
||||
See the `./test/README.md` documentation for more details about the cockpit CI
|
||||
tests.
|
||||
|
||||
|
||||
Update the documentation
|
||||
------------------------
|
||||
If there are changes to the code that would effect the documentation you should
|
||||
rebuild the `sphinx` based documents:
|
||||
|
||||
DOCKER=podman make docs-in-docker
|
||||
git add docs/
|
||||
git commit -m "New lorax documentation - x.y"
|
||||
|
||||
The documentation is accessible [from here](https://weldr.io/lorax), and the
|
||||
source for those pages is stored in the `gh-pages` branch of lorax. I have a
|
||||
second `lorax` repository checked out that I use for updating the `gh-pages`
|
||||
branch:
|
||||
|
||||
git clone git@github.com:weldr/lorax.git lorax-gh-pages
|
||||
cd lorax-gh-pages
|
||||
git checkout gh-pages
|
||||
git pull
|
||||
|
||||
And then I rsync the new documentation over from the current lorax build
|
||||
directory:
|
||||
|
||||
rsync -aP --exclude .git --exclude .nojekyll ../lorax/docs/html/ ./
|
||||
git add .
|
||||
git commit -m "Add lorax x.y documentation"
|
||||
git push
|
||||
|
||||
After a few minutes the online version of the documentation should appear.
|
||||
|
||||
Tag and build the release tar.gz
|
||||
--------------------------------
|
||||
We use the `tito` tool to handle incrementing the version number and updating
|
||||
the `lorax.spec` file changelog section using the git commits since the last
|
||||
tag. `tito tag` will open an editor, allowing you to edit the changelog. Make
|
||||
sure it looks clean, entries starting with '- ' and no wrapped lines:
|
||||
|
||||
tito tag
|
||||
git push --follow-tags origin
|
||||
|
||||
Build the release tarball:
|
||||
|
||||
tito build --tgz
|
||||
|
||||
The release tarball will be placed into /tmp/tito/lorax-x.y.z.tar.gz
|
||||
|
||||
|
||||
Build the Fedora lorax package
|
||||
------------------------------
|
||||
The first time you do this you need to clone the Fedora dist-git repository
|
||||
[from here](https://src.fedoraproject.org/rpms/lorax/) using your ssh key:
|
||||
|
||||
git clone URL lorax-fedora
|
||||
|
||||
After that the steps are the same each time, make sure your `lorax-fedora` repo
|
||||
is up to date:
|
||||
|
||||
git co master
|
||||
git pull
|
||||
|
||||
Copy the `lorax.spec` that tito modified from your `lorax` project repo:
|
||||
|
||||
cp /path/to/lorax/repo/lorax.spec .
|
||||
|
||||
Make sure you have a current fedoraproject kerberos ticket, you can use
|
||||
`kswitch -p FEDORAPROJECT.ORG` to switch to it if you need to, or `kinit` to
|
||||
get one. See [the Fedora
|
||||
wiki](https://fedoraproject.org/wiki/Infrastructure/Kerberos) for more details
|
||||
and debugging tips.
|
||||
|
||||
Upload the new release's tar to build system, making sure you pick the right
|
||||
one. The `/tmp/tito/` directory is only cleared out when you reboot, so it may
|
||||
have several versions in there:
|
||||
|
||||
fedpkg new-sources /tmp/tito/lorax-x.y.tar.gz
|
||||
|
||||
Update the changelog. Yes, fedpkg changes the formatting and it is annoying.
|
||||
Make sure the lines start with '- ' and that any wrapped lines are un-wrapped.
|
||||
Usually the committer email address is what will get bumped to the next line:
|
||||
|
||||
fedpkg clog
|
||||
vim clog
|
||||
|
||||
Add all the updated files, make sure nothing has been forgotten (lorax.spec, sources, .gitignore):
|
||||
|
||||
git add -u
|
||||
git status (just to be sure you have all the files added )
|
||||
git commit -F clog
|
||||
git show
|
||||
|
||||
Examine the commit with care. Make sure the sources have changed, that the NVR
|
||||
is correct, and that it contains the %changelog
|
||||
|
||||
At this point anything can be changed, either reset the checkout to the last
|
||||
commit and start over, or fix the problems and squash the changes together into
|
||||
the commit you just made. There should be one commit per-release.
|
||||
|
||||
fedpkg push && fedpkg build
|
||||
|
||||
If there are errors in the build, check the logs in koji at the link provided by fedpkg.
|
||||
|
@ -7,8 +7,8 @@ SPHINXBUILD = sphinx-build-3
|
||||
SPHINXAPIDOC = sphinx-apidoc-3
|
||||
PAPER =
|
||||
BUILDDIR = .
|
||||
SOURCEDIR = ../src/pylorax
|
||||
MODULE_NAMES = pylorax.rst modules.rst
|
||||
SOURCEDIR = ../src
|
||||
MODULE_NAMES = pylorax.rst pylorax.api.rst modules.rst composer.rst composer.cli.rst
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
|
@ -1,141 +0,0 @@
|
||||
composer-cli
|
||||
============
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
``composer-cli`` is an interactive tool for use with a WELDR API server,
|
||||
managing blueprints, exploring available packages, and building new images.
|
||||
`lorax-composer <lorax-composer.html>` and `osbuild-composer
|
||||
<https://osbuild.org>` both implement compatible servers.
|
||||
|
||||
It requires server to be installed on the local system, and the user running it
|
||||
needs to be a member of the ``weldr`` group. They do not need to be root, but
|
||||
all of the `security precautions <lorax-composer.html#security>`_ apply.
|
||||
|
||||
composer-cli cmdline arguments
|
||||
------------------------------
|
||||
|
||||
.. argparse::
|
||||
:ref: composer.cli.cmdline.composer_cli_parser
|
||||
:prog: composer-cli
|
||||
|
||||
Edit a Blueprint
|
||||
----------------
|
||||
|
||||
Start out by listing the available blueprints using ``composer-cli blueprints
|
||||
list``, pick one and save it to the local directory by running ``composer-cli
|
||||
blueprints save http-server``. If there are no blueprints available you can
|
||||
copy one of the examples `from the test suite
|
||||
<https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_.
|
||||
|
||||
Edit the file (it will be saved with a .toml extension) and change the
|
||||
description, add a package or module to it. Send it back to the server by
|
||||
running ``composer-cli blueprints push http-server.toml``. You can verify that it was
|
||||
saved by viewing the changelog - ``composer-cli blueprints changes http-server``.
|
||||
|
||||
Build an image
|
||||
----------------
|
||||
|
||||
Build a ``qcow2`` disk image from this blueprint by running ``composer-cli
|
||||
compose start http-server qcow2``. It will print a UUID that you can use to
|
||||
keep track of the build. You can also cancel the build if needed.
|
||||
|
||||
The available types of images is displayed by ``composer-cli compose types``.
|
||||
Currently this consists of: alibaba, ami, ext4-filesystem, google, live-iso,
|
||||
openstack, partitioned-disk, qcow2, tar, vhd, vmdk
|
||||
|
||||
Monitor the build status
|
||||
------------------------
|
||||
|
||||
Monitor it using ``composer-cli compose status``, which will show the status of
|
||||
all the builds on the system. You can view the end of the anaconda build logs
|
||||
once it is in the ``RUNNING`` state using ``composer-cli compose log UUID``
|
||||
where UUID is the UUID returned by the start command.
|
||||
|
||||
Once the build is in the ``FINISHED`` state you can download the image.
|
||||
|
||||
Download the image
|
||||
------------------
|
||||
|
||||
Downloading the final image is done with ``composer-cli compose image UUID`` and it will
|
||||
save the qcow2 image as ``UUID-disk.qcow2`` which you can then use to boot a VM like this::
|
||||
|
||||
qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2
|
||||
|
||||
|
||||
Image Uploads
|
||||
-------------
|
||||
|
||||
``composer-cli`` can upload the images to a number of services, including AWS,
|
||||
OpenStack, and vSphere. The upload can be started when the build is finished
|
||||
by using ``composer-cli compose start ...``. In order to access the service you need
|
||||
to pass authentication details to composer-cli using a TOML file.
|
||||
|
||||
.. note::
|
||||
|
||||
This is only supported when running the ``osbuild-composer`` API server.
|
||||
|
||||
|
||||
Providers
|
||||
---------
|
||||
|
||||
Providers are where the images are uploaded to. You
|
||||
will need to gather some provider
|
||||
specific information in order to authenticate with it. Please refer to the ``osbuild-composer``
|
||||
documentation for the provider specific fields. You will then create a TOML file with the
|
||||
name of the provider and the settings, like this::
|
||||
|
||||
provider = "aws"
|
||||
|
||||
[settings]
|
||||
aws_access_key = "AWS Access Key"
|
||||
aws_bucket = "AWS Bucket"
|
||||
aws_region = "AWS Region"
|
||||
aws_secret_key = "AWS Secret Key"
|
||||
|
||||
Save this into an ``aws-credentials.toml`` file and use it when running ``start``.
|
||||
|
||||
AWS
|
||||
^^^
|
||||
|
||||
The access key and secret key can be created by going to the
|
||||
``IAM->Users->Security Credentials`` section and creating a new access key. The
|
||||
secret key will only be shown when it is first created so make sure to record
|
||||
it in a secure place. The region should be the region that you want to use the
|
||||
AMI in, and the bucket can be an existing bucket, or a new one, following the
|
||||
normal AWS bucket naming rules. It will be created if it doesn't already exist.
|
||||
|
||||
When uploading the image it is first uploaded to the s3 bucket, and then
|
||||
converted to an AMI. If the conversion is successful the s3 object will be
|
||||
deleted. If it fails, re-trying after correcting the problem will re-use the
|
||||
object if you have not deleted it in the meantime, speeding up the process.
|
||||
|
||||
|
||||
Build an image and upload results
|
||||
---------------------------------
|
||||
|
||||
With the settings stored in a TOML file::
|
||||
|
||||
composer-cli compose start example-http-server ami "http image" aws-settings.toml
|
||||
|
||||
It will return the UUID of the image build. Once
|
||||
the build has finished successfully it will start the upload process.
|
||||
|
||||
|
||||
Debugging
|
||||
---------
|
||||
|
||||
There are a couple of arguments that can be helpful when debugging problems.
|
||||
These are only meant for debugging and should not be used to script access to
|
||||
the API. If you need to do that you can communicate with it directly in the
|
||||
language of your choice.
|
||||
|
||||
``--json`` will return the server's response as a nicely formatted json output
|
||||
instead of printing what the command would usually print.
|
||||
|
||||
``--test=1`` will cause a compose start to start creating an image, and then
|
||||
end with a failed state.
|
||||
|
||||
``--test=2`` will cause a compose to start and then end with a finished state,
|
||||
without actually composing anything.
|
32
docs/conf.py
32
docs/conf.py
@ -51,24 +51,37 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Lorax'
|
||||
copyright = u'2018-2019, Red Hat, Inc.' # pylint: disable=redefined-builtin
|
||||
copyright = u'2018, Red Hat, Inc.' # pylint: disable=redefined-builtin
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
# Pass in LORAX_VERSION to set a specific version
|
||||
# Set LORAX_VERSION=next to bump it to the next release
|
||||
def read_version():
|
||||
"""Read version from $LORAX_VERSION or ../lorax.spec"""
|
||||
"""Read version from $LORAX_VERSION or ../lorax.spec, or bump the version from lorax.spec"""
|
||||
# This allows the .spec version to be overridded. eg. when documenting an upcoming release
|
||||
if "LORAX_VERSION" in os.environ:
|
||||
if "LORAX_VERSION" in os.environ and "next" not in os.environ["LORAX_VERSION"]:
|
||||
return os.environ["LORAX_VERSION"]
|
||||
|
||||
doc_version = None
|
||||
import re
|
||||
version_re = re.compile(r"Version:\s+(.*)")
|
||||
with open("../lorax.spec", "rt") as f:
|
||||
for line in f:
|
||||
m = version_re.match(line)
|
||||
if m:
|
||||
return m.group(1)
|
||||
doc_version = m.group(1)
|
||||
if not doc_version:
|
||||
raise RuntimeError("Failed to find current version")
|
||||
|
||||
# Make it easier to generate docs for the next release
|
||||
if "next" in os.environ["LORAX_VERSION"]:
|
||||
fields = doc_version.split(".")
|
||||
fields[-1] = str(int(fields[-1]) + 1)
|
||||
doc_version = ".".join(fields)
|
||||
|
||||
return doc_version
|
||||
|
||||
#
|
||||
# The short X.Y version.
|
||||
@ -159,6 +172,9 @@ html_static_path = ['_static']
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# Turn off smartquotes, it mangles dashes in the docstrings
|
||||
smartquotes = False
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
@ -249,8 +265,8 @@ latex_documents = [
|
||||
man_pages = [
|
||||
('lorax', 'lorax', u'Lorax Documentation', [u'Weldr Team'], 1),
|
||||
('livemedia-creator', 'livemedia-creator', u'Live Media Creator Documentation', [u'Weldr Team'], 1),
|
||||
('lorax-composer', 'lorax-composer', u'Lorax Composer Documentation', [u'Weldr Team'], 1),
|
||||
('composer-cli', 'composer-cli', u'Composer Cmdline Utility Documentation', [u'Weldr Team'], 1),
|
||||
('mkksiso', 'mkksiso', u'Make Kickstart ISO Utility Documentation', [u'Weldr Team'], 1),
|
||||
('image-minimizer', 'image-minimizer', u'Utility script to remove files and packages', [u'Weldr Team'], 1),
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
@ -287,7 +303,7 @@ texinfo_documents = [
|
||||
epub_title = u'Lorax'
|
||||
epub_author = u'Weldr Team'
|
||||
epub_publisher = u'Weldr Team'
|
||||
epub_copyright = u'2018-2019, Red Hat, Inc.'
|
||||
epub_copyright = u'2018, Red Hat, Inc.'
|
||||
|
||||
# The basename for the epub file. It defaults to the project name.
|
||||
#epub_basename = u'src'
|
||||
@ -394,6 +410,6 @@ class Mock(object):
|
||||
def __getitem__(cls, key):
|
||||
return cls.__getattr__(key)
|
||||
|
||||
MOCK_MODULES = ["selinux", "dnf", "dnf.transaction", "rpmUtils", "rpmUtils.arch"]
|
||||
MOCK_MODULES = ["selinux", "dnf", "dnf.logging", "dnf.transaction", "rpmUtils", "rpmUtils.arch"]
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = Mock()
|
||||
|
@ -1,4 +1,4 @@
|
||||
# RHEL Atomic PXE Live creation kickstart
|
||||
# Fedora Atomic PXE Live creation kickstart
|
||||
# Suitable for use with livemedia-creator --no-virt
|
||||
|
||||
# Settings for unattended installation:
|
||||
@ -12,9 +12,7 @@ part / --fstype="ext4" --size=6000
|
||||
|
||||
shutdown
|
||||
|
||||
# Replace OSTREE-REPO with the url to an ostree repo
|
||||
# Replace OSTREE-REFERENCE with an ostree reference to pull
|
||||
ostreesetup --nogpg --osname=rhel-atomic-host --remote=rhel-atomic-host --url=OSTREE-REPO --ref=OSTREE-REFERENCE
|
||||
ostreesetup --nogpg --osname=fedora-atomic --remote=fedora-atomic --url=https://dl.fedoraproject.org/pub/fedora/linux/atomic/24/ --ref=fedora-atomic/rawhide/x86_64/docker-host
|
||||
|
||||
services --disabled=cloud-init,cloud-init-local,cloud-final,cloud-config,docker-storage-setup
|
||||
|
||||
@ -25,8 +23,6 @@ cat /dev/null > /etc/fstab
|
||||
%end
|
||||
|
||||
%post --erroronfail
|
||||
rm -f /etc/ostree/remotes.d/rhel-atomic-host.conf
|
||||
|
||||
# Replace OSTREE-REPO with the url to an ostree repo
|
||||
ostree remote add --set=gpg-verify=false rhel-atomic-host 'OSTREE-REPO'
|
||||
rm -f /etc/ostree/remotes.d/fedora-atomic.conf
|
||||
ostree remote add --set=gpg-verify=false fedora-atomic 'https://dl.fedoraproject.org/pub/fedora/linux/atomic/24/'
|
||||
%end
|
@ -1,23 +1,18 @@
|
||||
# Minimal install for containers
|
||||
# NOTE: This example is for creating a tar, eg.
|
||||
# livemedia-creator --project RHEL --releasever 8 --make-tar --ks=rhel-container.ks --no-virt
|
||||
#
|
||||
# Minimal Disk Image
|
||||
|
||||
# Use network installation
|
||||
url --url="http://URL-TO-BASEOS/"
|
||||
repo --name=appstream --baseurl="http://URL-TO-APPSTREAM/"
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/"
|
||||
|
||||
# Root password
|
||||
rootpw --plaintext removethispw
|
||||
rootpw --plaintext replace-this-pw
|
||||
# Network information
|
||||
network --bootproto=dhcp --activate
|
||||
# System keyboard
|
||||
keyboard --xlayouts=us --vckeymap=us
|
||||
# System language
|
||||
lang en_US.UTF-8
|
||||
# SELinux configuration
|
||||
selinux --enforcing
|
||||
# Installation logging level
|
||||
logging --level=info
|
||||
# Shutdown after installation
|
||||
shutdown
|
||||
# System timezone
|
||||
@ -32,14 +27,9 @@ part / --fstype="ext4" --size=3000
|
||||
%post
|
||||
# Remove random-seed
|
||||
rm /var/lib/systemd/random-seed
|
||||
|
||||
# Clear /etc/machine-id
|
||||
rm /etc/machine-id
|
||||
touch /etc/machine-id
|
||||
%end
|
||||
|
||||
%packages --nocore --instLangs en
|
||||
httpd
|
||||
-kernel
|
||||
policycoreutils
|
||||
%end
|
@ -1,8 +1,4 @@
|
||||
# Live ISO Image
|
||||
# NOTE: This example is for creating a live-iso, eg.
|
||||
# livemedia-creator --project RHEL --releasever 8 --make-iso --ks=rhel-livemedia.ks --no-virt
|
||||
# NOTE: This example does not include Anaconda and cannot be installed to a harddrive.
|
||||
|
||||
#version=DEVEL
|
||||
# X Window System configuration information
|
||||
xconfig --startxonboot
|
||||
# Keyboard layouts
|
||||
@ -14,8 +10,7 @@ timezone US/Eastern
|
||||
lang en_US.UTF-8
|
||||
# Firewall configuration
|
||||
firewall --enabled --service=mdns
|
||||
url --url="http://URL-TO-BASEOS"
|
||||
repo --name=appstream --baseurl="http://URL-TO-APPSTREAM"
|
||||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/"
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
|
||||
@ -23,7 +18,7 @@ network --bootproto=dhcp --device=link --activate
|
||||
selinux --enforcing
|
||||
|
||||
# System services
|
||||
services --disabled="sshd" --enabled="NetworkManager"
|
||||
services --disabled="sshd" --enabled="NetworkManager,ModemManager"
|
||||
|
||||
# livemedia-creator modifications.
|
||||
shutdown
|
||||
@ -33,6 +28,7 @@ bootloader --location=none
|
||||
clearpart --all --initlabel
|
||||
rootpw rootme
|
||||
# Disk partitioning information
|
||||
reqpart
|
||||
part / --size=6656
|
||||
|
||||
%post
|
||||
@ -67,21 +63,14 @@ livedir="LiveOS"
|
||||
for arg in \`cat /proc/cmdline\` ; do
|
||||
if [ "\${arg##rd.live.dir=}" != "\${arg}" ]; then
|
||||
livedir=\${arg##rd.live.dir=}
|
||||
return
|
||||
continue
|
||||
fi
|
||||
if [ "\${arg##live_dir=}" != "\${arg}" ]; then
|
||||
livedir=\${arg##live_dir=}
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
# enable swaps unless requested otherwise
|
||||
swaps=\`blkid -t TYPE=swap -o device\`
|
||||
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
|
||||
for s in \$swaps ; do
|
||||
action "Enabling swap partition \$s" swapon \$s
|
||||
done
|
||||
fi
|
||||
# enable swapfile unless requested otherwise
|
||||
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /run/initramfs/live/\${livedir}/swap.img ] ; then
|
||||
action "Enabling swap file" swapon /run/initramfs/live/\${livedir}/swap.img
|
||||
fi
|
||||
@ -126,7 +115,6 @@ findPersistentHome() {
|
||||
for arg in \`cat /proc/cmdline\` ; do
|
||||
if [ "\${arg##persistenthome=}" != "\${arg}" ]; then
|
||||
homedev=\${arg##persistenthome=}
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
@ -146,7 +134,7 @@ if [ -n "\$configdone" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# add liveuser with no passwd
|
||||
# add liveuser user with no passwd
|
||||
action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser
|
||||
passwd -d liveuser > /dev/null
|
||||
usermod -aG wheel liveuser > /dev/null
|
||||
@ -179,6 +167,10 @@ systemctl --no-reload disable atd.service 2> /dev/null || :
|
||||
systemctl stop crond.service 2> /dev/null || :
|
||||
systemctl stop atd.service 2> /dev/null || :
|
||||
|
||||
# turn off abrtd on a live image
|
||||
systemctl --no-reload disable abrtd.service 2> /dev/null || :
|
||||
systemctl stop abrtd.service 2> /dev/null || :
|
||||
|
||||
# Don't sync the system clock when running live (RHBZ #1018162)
|
||||
sed -i 's/rtcsync//' /etc/chrony.conf
|
||||
|
||||
@ -186,9 +178,7 @@ sed -i 's/rtcsync//' /etc/chrony.conf
|
||||
touch /.liveimg-configured
|
||||
|
||||
# add static hostname to work around xauth bug
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=679486
|
||||
echo "localhost" > /etc/hostname
|
||||
|
||||
hostnamectl set-hostname "localhost-live"
|
||||
EOF
|
||||
|
||||
# bah, hal starts way too late
|
||||
@ -269,10 +259,9 @@ EOF
|
||||
rm -f /var/lib/rpm/__db*
|
||||
releasever=$(rpm -q --qf '%{version}\n' --whatprovides system-release)
|
||||
basearch=$(uname -i)
|
||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
|
||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
|
||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
echo "Packages within this LiveCD"
|
||||
rpm -qa
|
||||
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
|
||||
# Note that running rpm recreates the rpm db files which aren't needed or wanted
|
||||
rm -f /var/lib/rpm/__db*
|
||||
|
||||
@ -282,15 +271,15 @@ rm -f /var/lib/rpm/__db*
|
||||
# make sure there aren't core files lying around
|
||||
rm -f /core*
|
||||
|
||||
# remove random seed, the newly installed instance should make it's own
|
||||
rm -f /var/lib/systemd/random-seed
|
||||
|
||||
# convince readahead not to collect
|
||||
# FIXME: for systemd
|
||||
|
||||
echo 'File created by kickstart. See systemd-update-done.service(8).' \
|
||||
| tee /etc/.updated >/var/.updated
|
||||
|
||||
# Remove random-seed
|
||||
rm /var/lib/systemd/random-seed
|
||||
|
||||
# Remove the rescue kernel and image to save space
|
||||
# Installation will recreate these on the target
|
||||
rm -f /boot/*-rescue*
|
||||
@ -298,13 +287,15 @@ rm -f /boot/*-rescue*
|
||||
# Remove machine-id on pre generated images
|
||||
rm -f /etc/machine-id
|
||||
touch /etc/machine-id
|
||||
|
||||
%end
|
||||
|
||||
%post
|
||||
|
||||
cat >> /etc/rc.d/init.d/livesys << EOF
|
||||
|
||||
# disable gnome-software automatically downloading updates
|
||||
|
||||
# disable updates plugin
|
||||
cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE
|
||||
[org.gnome.software]
|
||||
download-updates=false
|
||||
@ -343,16 +334,21 @@ if [ -f /usr/share/applications/liveinst.desktop ]; then
|
||||
|
||||
cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
|
||||
[org.gnome.shell]
|
||||
favorite-apps=['firefox.desktop', 'evolution.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop']
|
||||
favorite-apps=['firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop']
|
||||
FOE
|
||||
|
||||
# Make the welcome screen show up
|
||||
if [ -f /usr/share/anaconda/gnome/rhel-welcome.desktop ]; then
|
||||
if [ -f /usr/share/anaconda/gnome/fedora-welcome.desktop ]; then
|
||||
mkdir -p ~liveuser/.config/autostart
|
||||
cp /usr/share/anaconda/gnome/rhel-welcome.desktop /usr/share/applications/
|
||||
cp /usr/share/anaconda/gnome/rhel-welcome.desktop ~liveuser/.config/autostart/
|
||||
cp /usr/share/anaconda/gnome/fedora-welcome.desktop /usr/share/applications/
|
||||
cp /usr/share/anaconda/gnome/fedora-welcome.desktop ~liveuser/.config/autostart/
|
||||
fi
|
||||
|
||||
# Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen
|
||||
cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
|
||||
welcome-dialog-last-shown-version='4294967295'
|
||||
FOE
|
||||
|
||||
# Copy Anaconda branding in place
|
||||
if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then
|
||||
cp -a /usr/share/lorax/product/* /
|
||||
@ -383,31 +379,37 @@ EOF
|
||||
%end
|
||||
|
||||
%packages
|
||||
@base-x
|
||||
@fonts
|
||||
@guest-desktop-agents
|
||||
@hardware-support
|
||||
@multimedia
|
||||
@networkmanager-submodules
|
||||
@workstation-product
|
||||
@gnome-desktop
|
||||
firefox
|
||||
gnome-terminal
|
||||
@^workstation-product-environment
|
||||
@anaconda-tools
|
||||
aajohan-comfortaa-fonts
|
||||
anaconda
|
||||
anaconda-install-env-deps
|
||||
anaconda-live
|
||||
dracut-config-generic
|
||||
dracut-live
|
||||
glibc-all-langpacks
|
||||
grub2-efi
|
||||
grub2-pc-modules
|
||||
kernel
|
||||
# Make sure that DNF doesn't pull in debug kernel to satisfy kmod() requires
|
||||
kernel-modules
|
||||
kernel-modules-extra
|
||||
memtest86+
|
||||
syslinux
|
||||
-@dial-up
|
||||
-@input-methods
|
||||
-@standard
|
||||
-gfs2-utils
|
||||
-dracut-config-rescue
|
||||
-gnome-boxes
|
||||
|
||||
# This package is needed to boot the iso on UEFI
|
||||
shim
|
||||
shim-ia32
|
||||
grub2
|
||||
grub2-efi
|
||||
grub2-efi-*-cdboot
|
||||
grub2-efi-ia32
|
||||
efibootmgr
|
||||
|
||||
# no longer in @core since 2018-10, but needed for livesys script
|
||||
initscripts
|
||||
chkconfig
|
||||
|
||||
%end
|
@ -1,17 +1,10 @@
|
||||
# Minimal Disk Image
|
||||
# NOTE: This example is for creating a disk image, eg.
|
||||
# livemedia-creator --project RHEL --releasever 8 --make-disk --ks=rhel-minimal.ks --no-virt
|
||||
#
|
||||
# Using it for a live-iso will require adding:
|
||||
# dracut-live
|
||||
# system-logos
|
||||
|
||||
#
|
||||
sshpw --username=root --plaintext randOmStrinGhERE
|
||||
# Firewall configuration
|
||||
firewall --enabled
|
||||
# Use network installation
|
||||
url --url="http://URL-TO-BASEOS/"
|
||||
repo --name=appstream --baseurl="http://URL-TO-APPSTREAM/"
|
||||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/"
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
|
||||
@ -23,8 +16,6 @@ keyboard --xlayouts=us --vckeymap=us
|
||||
lang en_US.UTF-8
|
||||
# SELinux configuration
|
||||
selinux --enforcing
|
||||
# Installation logging level
|
||||
logging --level=info
|
||||
# Shutdown after installation
|
||||
shutdown
|
||||
# System timezone
|
||||
@ -34,8 +25,9 @@ bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all --initlabel
|
||||
# Disk partitioning information
|
||||
part / --fstype="ext4" --size=2000
|
||||
part swap --size=512
|
||||
reqpart
|
||||
part / --fstype="ext4" --size=4000
|
||||
part swap --size=1000
|
||||
|
||||
%post
|
||||
# Remove root password
|
||||
@ -43,10 +35,6 @@ passwd -d root > /dev/null
|
||||
|
||||
# Remove random-seed
|
||||
rm /var/lib/systemd/random-seed
|
||||
|
||||
# Clear /etc/machine-id
|
||||
rm /etc/machine-id
|
||||
touch /etc/machine-id
|
||||
%end
|
||||
|
||||
%packages
|
||||
@ -56,7 +44,6 @@ kernel
|
||||
kernel-modules
|
||||
kernel-modules-extra
|
||||
|
||||
memtest86+
|
||||
grub2-efi
|
||||
grub2
|
||||
shim
|
@ -1,16 +1,10 @@
|
||||
# Minimal Disk Image -- Example of image-minimizer usage in %post
|
||||
# NOTE: This example is for creating a disk image, eg.
|
||||
# livemedia-creator --project RHEL --releasever 8 --make-disk --ks=rhel-minimized.ks --no-virt
|
||||
#
|
||||
# Using it for a live-iso will require adding:
|
||||
# dracut-live
|
||||
# system-logos
|
||||
#
|
||||
sshpw --username=root --plaintext randOmStrinGhERE
|
||||
# Firewall configuration
|
||||
firewall --enabled
|
||||
# Use network installation
|
||||
url --url="http://URL-TO-BASEOS/"
|
||||
repo --name=appstream --baseurl="http://URL-TO-APPSTREAM/"
|
||||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/"
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
|
||||
@ -22,8 +16,6 @@ keyboard --xlayouts=us --vckeymap=us
|
||||
lang en_US.UTF-8
|
||||
# SELinux configuration
|
||||
selinux --enforcing
|
||||
# Installation logging level
|
||||
logging --level=info
|
||||
# Shutdown after installation
|
||||
shutdown
|
||||
# System timezone
|
||||
@ -42,10 +34,6 @@ passwd -d root > /dev/null
|
||||
|
||||
# Remove random-seed
|
||||
rm /var/lib/systemd/random-seed
|
||||
|
||||
# Clear /etc/machine-id
|
||||
rm /etc/machine-id
|
||||
touch /etc/machine-id
|
||||
%end
|
||||
|
||||
%packages
|
||||
@ -55,7 +43,6 @@ kernel
|
||||
kernel-modules
|
||||
kernel-modules-extra
|
||||
|
||||
memtest86+
|
||||
grub2-efi
|
||||
grub2
|
||||
shim
|
@ -1,25 +1,20 @@
|
||||
# Minimal Disk Image
|
||||
# NOTE: This example is for creating a qcow2 OpenStack disk image, eg.
|
||||
# livemedia-creator --project RHEL --releasever 8 --make-disk --image-type=qcow2 --ks=rhel-openstack.ks --no-virt
|
||||
#
|
||||
# Firewall configuration
|
||||
firewall --enabled
|
||||
# Use network installation
|
||||
url --url="http://URL-TO-BASEOS/"
|
||||
repo --name=appstream --baseurl="http://URL-TO-APPSTREAM/"
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/"
|
||||
|
||||
# Root password
|
||||
rootpw --plaintext replace-this-pw
|
||||
# Network information
|
||||
network --bootproto=dhcp --activate
|
||||
# System keyboard
|
||||
keyboard --xlayouts=us --vckeymap=us
|
||||
# System language
|
||||
lang en_US.UTF-8
|
||||
# SELinux configuration
|
||||
selinux --enforcing
|
||||
# Installation logging level
|
||||
logging --level=info
|
||||
# Shutdown after installation
|
||||
shutdown
|
||||
# System timezone
|
||||
@ -36,10 +31,6 @@ part / --fstype="ext4" --size=3000
|
||||
%post
|
||||
# Remove random-seed
|
||||
rm /var/lib/systemd/random-seed
|
||||
|
||||
# Clear /etc/machine-id
|
||||
rm /etc/machine-id
|
||||
touch /etc/machine-id
|
||||
%end
|
||||
|
||||
%packages
|
||||
@ -49,7 +40,6 @@ kernel
|
||||
kernel-modules
|
||||
kernel-modules-extra
|
||||
|
||||
memtest86+
|
||||
grub2-efi
|
||||
grub2
|
||||
shim
|
@ -1,14 +1,12 @@
|
||||
# Minimal Vagrant Disk Image
|
||||
# NOTE: This example is for creating a Vagrant disk image, eg.
|
||||
# livemedia-creator --project RHEL --releasever 8 --make-vagrant --ks=rhel-vagrant.ks --no-virt
|
||||
#
|
||||
|
||||
# Firewall configuration
|
||||
firewall --enabled
|
||||
# Use network installation
|
||||
url --url="http://URL-TO-BASEOS/"
|
||||
repo --name=appstream --baseurl="http://URL-TO-APPSTREAM/"
|
||||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/"
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
network --bootproto=dhcp --activate
|
||||
|
||||
# Root account is locked, access via sudo from vagrant user
|
||||
rootpw --lock
|
||||
@ -23,8 +21,6 @@ keyboard --xlayouts=us --vckeymap=us
|
||||
lang en_US.UTF-8
|
||||
# SELinux configuration
|
||||
selinux --enforcing
|
||||
# Installation logging level
|
||||
logging --level=info
|
||||
# Shutdown after installation
|
||||
shutdown
|
||||
# System timezone
|
||||
@ -41,10 +37,6 @@ part swap --size=1000
|
||||
# Remove random-seed
|
||||
rm /var/lib/systemd/random-seed
|
||||
|
||||
# Clear /etc/machine-id
|
||||
rm /etc/machine-id
|
||||
touch /etc/machine-id
|
||||
|
||||
# Setup sudoers for Vagrant
|
||||
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
sed -i 's/Defaults\s*requiretty/Defaults !requiretty/' /etc/sudoers
|
||||
@ -60,7 +52,6 @@ kernel
|
||||
kernel-modules
|
||||
kernel-modules-extra
|
||||
|
||||
memtest86+
|
||||
grub2-efi
|
||||
grub2
|
||||
shim
|
@ -1,4 +1,4 @@
|
||||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: 70a7edc36d19abd5eeb8cb6028d02c14
|
||||
config: 3dbb02a107cfe7acde05f2a0794f42a8
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
docs/html/.doctrees/image-minimizer.doctree
Normal file
BIN
docs/html/.doctrees/image-minimizer.doctree
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
docs/html/.doctrees/mkksiso.doctree
Normal file
BIN
docs/html/.doctrees/mkksiso.doctree
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Overview: module code — Lorax 36.5 documentation</title>
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Overview: module code — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<script src="../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.5
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,81 +33,36 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../image-minimizer.html">image-minimizer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||
<li>Overview: module code</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -153,17 +70,7 @@
|
||||
|
||||
<h1>All modules for which code is available</h1>
|
||||
<ul><li><a href="pylorax.html">pylorax</a></li>
|
||||
<ul><li><a href="pylorax/api/cmdline.html">pylorax.api.cmdline</a></li>
|
||||
<li><a href="pylorax/api/compose.html">pylorax.api.compose</a></li>
|
||||
<li><a href="pylorax/api/config.html">pylorax.api.config</a></li>
|
||||
<li><a href="pylorax/api/crossdomain.html">pylorax.api.crossdomain</a></li>
|
||||
<li><a href="pylorax/api/projects.html">pylorax.api.projects</a></li>
|
||||
<li><a href="pylorax/api/queue.html">pylorax.api.queue</a></li>
|
||||
<li><a href="pylorax/api/recipes.html">pylorax.api.recipes</a></li>
|
||||
<li><a href="pylorax/api/server.html">pylorax.api.server</a></li>
|
||||
<li><a href="pylorax/api/v0.html">pylorax.api.v0</a></li>
|
||||
<li><a href="pylorax/api/workspace.html">pylorax.api.workspace</a></li>
|
||||
<li><a href="pylorax/base.html">pylorax.base</a></li>
|
||||
<ul><li><a href="pylorax/base.html">pylorax.base</a></li>
|
||||
<li><a href="pylorax/buildstamp.html">pylorax.buildstamp</a></li>
|
||||
<li><a href="pylorax/cmdline.html">pylorax.cmdline</a></li>
|
||||
<li><a href="pylorax/creator.html">pylorax.creator</a></li>
|
||||
@ -183,42 +90,30 @@
|
||||
</ul></ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<script src="../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,83 +33,36 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="index.html">Module code</a> »</li>
|
||||
|
||||
<li>pylorax</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -188,22 +103,22 @@
|
||||
<span class="kn">import</span> <span class="nn">configparser</span>
|
||||
<span class="kn">import</span> <span class="nn">tempfile</span>
|
||||
<span class="kn">import</span> <span class="nn">locale</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="k">import</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">import</span> <span class="nn">selinux</span>
|
||||
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
|
||||
<span class="kn">from</span> <span class="nn">glob</span> <span class="kn">import</span> <span class="n">glob</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">BaseLoraxClass</span><span class="p">,</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="kn">import</span> <span class="n">BaseLoraxClass</span><span class="p">,</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">import</span> <span class="nn">pylorax.output</span> <span class="k">as</span> <span class="nn">output</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">dnf</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">remove</span><span class="p">,</span> <span class="n">linktree</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">remove</span><span class="p">,</span> <span class="n">linktree</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="k">import</span> <span class="n">RuntimeBuilder</span><span class="p">,</span> <span class="n">TreeBuilder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.buildstamp</span> <span class="k">import</span> <span class="n">BuildStamp</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treeinfo</span> <span class="k">import</span> <span class="n">TreeInfo</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.discinfo</span> <span class="k">import</span> <span class="n">DiscInfo</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="kn">import</span> <span class="n">RuntimeBuilder</span><span class="p">,</span> <span class="n">TreeBuilder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.buildstamp</span> <span class="kn">import</span> <span class="n">BuildStamp</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treeinfo</span> <span class="kn">import</span> <span class="n">TreeInfo</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.discinfo</span> <span class="kn">import</span> <span class="n">DiscInfo</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
|
||||
|
||||
|
||||
<span class="c1"># get lorax version</span>
|
||||
@ -216,20 +131,17 @@
|
||||
|
||||
<span class="n">DRACUT_DEFAULT</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--xz"</span><span class="p">,</span> <span class="s2">"--install"</span><span class="p">,</span> <span class="s2">"/.buildstamp"</span><span class="p">,</span> <span class="s2">"--no-early-microcode"</span><span class="p">,</span> <span class="s2">"--add"</span><span class="p">,</span> <span class="s2">"fips"</span><span class="p">]</span>
|
||||
|
||||
<span class="c1"># List of drivers to remove on ppc64 arch to keep initrd < 32MiB</span>
|
||||
<span class="n">REMOVE_PPC64_DRIVERS</span> <span class="o">=</span> <span class="s2">"floppy scsi_debug nouveau radeon cirrus mgag200"</span>
|
||||
<span class="n">REMOVE_PPC64_MODULES</span> <span class="o">=</span> <span class="s2">"drm plymouth"</span>
|
||||
|
||||
<span class="c1"># Used for DNF conf.module_platform_id</span>
|
||||
<span class="n">DEFAULT_PLATFORM_ID</span> <span class="o">=</span> <span class="s2">"platform:el8"</span>
|
||||
<span class="n">DEFAULT_PLATFORM_ID</span> <span class="o">=</span> <span class="s2">"platform:f36"</span>
|
||||
<span class="n">DEFAULT_RELEASEVER</span> <span class="o">=</span> <span class="s2">"36"</span>
|
||||
|
||||
<div class="viewcode-block" id="ArchData"><a class="viewcode-back" href="../pylorax.html#pylorax.ArchData">[docs]</a><span class="k">class</span> <span class="nc">ArchData</span><span class="p">(</span><span class="n">DataHolder</span><span class="p">):</span>
|
||||
<span class="n">lib64_arches</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"x86_64"</span><span class="p">,</span> <span class="s2">"ppc64"</span><span class="p">,</span> <span class="s2">"ppc64le"</span><span class="p">,</span> <span class="s2">"s390x"</span><span class="p">,</span> <span class="s2">"ia64"</span><span class="p">,</span> <span class="s2">"aarch64"</span><span class="p">)</span>
|
||||
<span class="n">lib64_arches</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"x86_64"</span><span class="p">,</span> <span class="s2">"ppc64le"</span><span class="p">,</span> <span class="s2">"s390x"</span><span class="p">,</span> <span class="s2">"ia64"</span><span class="p">,</span> <span class="s2">"aarch64"</span><span class="p">)</span>
|
||||
<span class="n">bcj_arch</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">i386</span><span class="o">=</span><span class="s2">"x86"</span><span class="p">,</span> <span class="n">x86_64</span><span class="o">=</span><span class="s2">"x86"</span><span class="p">,</span>
|
||||
<span class="n">ppc</span><span class="o">=</span><span class="s2">"powerpc"</span><span class="p">,</span> <span class="n">ppc64</span><span class="o">=</span><span class="s2">"powerpc"</span><span class="p">,</span> <span class="n">ppc64le</span><span class="o">=</span><span class="s2">"powerpc"</span><span class="p">,</span>
|
||||
<span class="n">ppc64le</span><span class="o">=</span><span class="s2">"powerpc"</span><span class="p">,</span>
|
||||
<span class="n">arm</span><span class="o">=</span><span class="s2">"arm"</span><span class="p">,</span> <span class="n">armhfp</span><span class="o">=</span><span class="s2">"arm"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">buildarch</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">buildarch</span><span class="p">):</span>
|
||||
<span class="nb">super</span><span class="p">(</span><span class="n">ArchData</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">buildarch</span> <span class="o">=</span> <span class="n">buildarch</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">basearch</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">rpm</span><span class="o">.</span><span class="n">basearch</span><span class="p">(</span><span class="n">buildarch</span><span class="p">)</span>
|
||||
@ -238,7 +150,7 @@
|
||||
|
||||
<div class="viewcode-block" id="Lorax"><a class="viewcode-back" href="../pylorax.html#pylorax.Lorax">[docs]</a><span class="k">class</span> <span class="nc">Lorax</span><span class="p">(</span><span class="n">BaseLoraxClass</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="n">BaseLoraxClass</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_configured</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">product</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
@ -343,6 +255,7 @@
|
||||
<span class="n">add_arch_template_vars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">verify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">user_dracut_args</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">squashfs_only</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">skip_branding</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
|
||||
|
||||
<span class="k">assert</span> <span class="bp">self</span><span class="o">.</span><span class="n">_configured</span>
|
||||
@ -476,9 +389,20 @@
|
||||
<span class="n">compressargs</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-Xbcj"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">bcj</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"no BCJ filter for arch </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">)</span>
|
||||
<span class="n">rb</span><span class="o">.</span><span class="n">create_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span><span class="n">runtime</span><span class="p">),</span>
|
||||
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">,</span>
|
||||
<span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">squashfs_only</span><span class="p">:</span>
|
||||
<span class="c1"># Create an ext4 rootfs.img and compress it with squashfs</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">rb</span><span class="o">.</span><span class="n">create_squashfs_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span><span class="n">runtime</span><span class="p">),</span>
|
||||
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">,</span>
|
||||
<span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Create an ext4 rootfs.img and compress it with squashfs</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">rb</span><span class="o">.</span><span class="n">create_ext4_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span><span class="n">runtime</span><span class="p">),</span>
|
||||
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">,</span>
|
||||
<span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">rc</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"rootfs.img creation failed. See program.log"</span><span class="p">)</span>
|
||||
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">rb</span><span class="o">.</span><span class="n">finished</span><span class="p">()</span>
|
||||
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"preparing to build output tree and boot images"</span><span class="p">)</span>
|
||||
@ -499,15 +423,7 @@
|
||||
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">user_dracut_args</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">anaconda_args</span> <span class="o">=</span> <span class="n">dracut_args</span> <span class="o">+</span> <span class="p">[</span><span class="s2">"--add"</span><span class="p">,</span> <span class="s2">"anaconda pollcdrom qemu qemu-net prefixdevname-tools"</span><span class="p">]</span>
|
||||
|
||||
<span class="c1"># ppc64 cannot boot an initrd > 32MiB so remove some drivers</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"ppc64"</span><span class="p">,</span> <span class="s2">"ppc64le"</span><span class="p">):</span>
|
||||
<span class="n">dracut_args</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s2">"--omit-drivers"</span><span class="p">,</span> <span class="n">REMOVE_PPC64_DRIVERS</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># Only omit dracut modules from the initrd so that they're kept for</span>
|
||||
<span class="c1"># upgrade.img</span>
|
||||
<span class="n">anaconda_args</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s2">"--omit"</span><span class="p">,</span> <span class="n">REMOVE_PPC64_MODULES</span><span class="p">])</span>
|
||||
<span class="n">anaconda_args</span> <span class="o">=</span> <span class="n">dracut_args</span> <span class="o">+</span> <span class="p">[</span><span class="s2">"--add"</span><span class="p">,</span> <span class="s2">"anaconda pollcdrom qemu qemu-net"</span><span class="p">]</span>
|
||||
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"dracut args = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dracut_args</span><span class="p">)</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"anaconda args = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">anaconda_args</span><span class="p">)</span>
|
||||
@ -579,6 +495,8 @@
|
||||
<span class="n">f</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">logfile</span><span class="p">))</span><span class="o">+</span><span class="s2">"/program.log"</span>
|
||||
<span class="n">fh</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">FileHandler</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="n">f</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">"w"</span><span class="p">)</span>
|
||||
<span class="n">fh</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">)</span>
|
||||
<span class="n">fmt</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">Formatter</span><span class="p">(</span><span class="s2">"</span><span class="si">%(asctime)s</span><span class="s2"> </span><span class="si">%(levelname)s</span><span class="s2">: </span><span class="si">%(message)s</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">fh</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">fmt</span><span class="p">)</span>
|
||||
<span class="n">program_log</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">fh</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
@ -613,42 +531,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,263 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.cmdline — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.cmdline</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.cmdline</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># cmdline.py</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2018 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">sys</span>
|
||||
<span class="kn">import</span> <span class="nn">argparse</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">vernum</span>
|
||||
|
||||
<span class="n">DEFAULT_USER</span> <span class="o">=</span> <span class="s2">"root"</span>
|
||||
<span class="n">DEFAULT_GROUP</span> <span class="o">=</span> <span class="s2">"weldr"</span>
|
||||
|
||||
<span class="n">version</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{0}</span><span class="s2">-</span><span class="si">{1}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="n">vernum</span><span class="p">)</span>
|
||||
|
||||
<div class="viewcode-block" id="lorax_composer_parser"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.cmdline.lorax_composer_parser">[docs]</a><span class="k">def</span> <span class="nf">lorax_composer_parser</span><span class="p">():</span>
|
||||
<span class="sd">""" Return the ArgumentParser for lorax-composer"""</span>
|
||||
|
||||
<span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">"Lorax Composer API Server"</span><span class="p">,</span>
|
||||
<span class="n">fromfile_prefix_chars</span><span class="o">=</span><span class="s2">"@"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--socket"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"/run/weldr/api.socket"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"SOCKET"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to the socket file to listen on"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--user"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">DEFAULT_USER</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"USER"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"User to use for reduced permissions"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--group"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">DEFAULT_GROUP</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"GROUP"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Group to set ownership of the socket to"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--log"</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">"logfile"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"/var/log/lorax-composer/composer.log"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"LOG"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to logfile (/var/log/lorax-composer/composer.log)"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--mockfiles"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"/var/tmp/bdcs-mockfiles/"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"MOCKFILES"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to JSON files used for /api/mock/ paths (/var/tmp/bdcs-mockfiles/)"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--sharedir"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"SHAREDIR"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Directory containing all the templates. Overrides config file sharedir"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"-V"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">"showver"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"show program's version number and exit"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"-c"</span><span class="p">,</span> <span class="s2">"--config"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"/etc/lorax/composer.conf"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"CONFIG"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to lorax-composer configuration file."</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--releasever"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"STRING"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Release version to use for $releasever in dnf repository urls"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--tmp"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"/var/tmp"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Top level temporary directory"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--proxy"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"PROXY"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Set proxy for DNF, overrides configuration file setting."</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--no-system-repos"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Do not copy over system repos from /etc/yum.repos.d/ at startup"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"BLUEPRINTS"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"BLUEPRINTS"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to the blueprints"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">parser</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -1,313 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.config — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.config</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.config</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2017 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="kn">import</span> <span class="nn">configparser</span>
|
||||
<span class="kn">import</span> <span class="nn">grp</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
|
||||
<div class="viewcode-block" id="ComposerConfig"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.config.ComposerConfig">[docs]</a><span class="k">class</span> <span class="nc">ComposerConfig</span><span class="p">(</span><span class="n">configparser</span><span class="o">.</span><span class="n">SafeConfigParser</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="ComposerConfig.get_default"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.config.ComposerConfig.get_default">[docs]</a> <span class="k">def</span> <span class="nf">get_default</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">section</span><span class="p">,</span> <span class="n">option</span><span class="p">,</span> <span class="n">default</span><span class="p">):</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">section</span><span class="p">,</span> <span class="n">option</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="n">configparser</span><span class="o">.</span><span class="n">Error</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">default</span></div></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="configure"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.config.configure">[docs]</a><span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="n">conf_file</span><span class="o">=</span><span class="s2">"/etc/lorax/composer.conf"</span><span class="p">,</span> <span class="n">root_dir</span><span class="o">=</span><span class="s2">"/"</span><span class="p">,</span> <span class="n">test_config</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
|
||||
<span class="sd">"""lorax-composer configuration</span>
|
||||
|
||||
<span class="sd"> :param conf_file: Path to the config file overriding the default settings</span>
|
||||
<span class="sd"> :type conf_file: str</span>
|
||||
<span class="sd"> :param root_dir: Directory to prepend to paths, defaults to /</span>
|
||||
<span class="sd"> :type root_dir: str</span>
|
||||
<span class="sd"> :param test_config: Set to True to skip reading conf_file</span>
|
||||
<span class="sd"> :type test_config: bool</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">conf</span> <span class="o">=</span> <span class="n">ComposerConfig</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># set defaults</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">)</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"share_dir"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/usr/share/lorax/"</span><span class="p">)))</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/var/lib/lorax/composer/"</span><span class="p">)))</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"repo_dir"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/var/lib/lorax/composer/repos.d/"</span><span class="p">)))</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"dnf_conf"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/var/tmp/composer/dnf.conf"</span><span class="p">)))</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"dnf_root"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/var/tmp/composer/dnf/root/"</span><span class="p">)))</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"cache_dir"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/var/tmp/composer/cache/"</span><span class="p">)))</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"tmp"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s2">"/var/tmp/"</span><span class="p">)))</span>
|
||||
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s2">"users"</span><span class="p">)</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"users"</span><span class="p">,</span> <span class="s2">"root"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Enable all available repo files by default</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s2">"repos"</span><span class="p">)</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"repos"</span><span class="p">,</span> <span class="s2">"use_system_repos"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">)</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"repos"</span><span class="p">,</span> <span class="s2">"enabled"</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s2">"dnf"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">test_config</span><span class="p">:</span>
|
||||
<span class="c1"># read the config file</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">conf_file</span><span class="p">):</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">conf_file</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">conf</span></div>
|
||||
|
||||
<div class="viewcode-block" id="make_dnf_dirs"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.config.make_dnf_dirs">[docs]</a><span class="k">def</span> <span class="nf">make_dnf_dirs</span><span class="p">(</span><span class="n">conf</span><span class="p">):</span>
|
||||
<span class="sd">"""Make any missing dnf directories</span>
|
||||
|
||||
<span class="sd"> :param conf: The configuration to use</span>
|
||||
<span class="sd"> :type conf: ComposerConfig</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"dnf_conf"</span><span class="p">,</span> <span class="s2">"repo_dir"</span><span class="p">,</span> <span class="s2">"cache_dir"</span><span class="p">,</span> <span class="s2">"dnf_root"</span><span class="p">]:</span>
|
||||
<span class="n">p_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="n">p</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="n">p</span> <span class="o">==</span> <span class="s2">"dnf_conf"</span><span class="p">:</span>
|
||||
<span class="n">p_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">p_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">p_dir</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">p_dir</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="make_queue_dirs"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.config.make_queue_dirs">[docs]</a><span class="k">def</span> <span class="nf">make_queue_dirs</span><span class="p">(</span><span class="n">conf</span><span class="p">,</span> <span class="n">gid</span><span class="p">):</span>
|
||||
<span class="sd">"""Make any missing queue directories</span>
|
||||
|
||||
<span class="sd"> :param conf: The configuration to use</span>
|
||||
<span class="sd"> :type conf: ComposerConfig</span>
|
||||
<span class="sd"> :param gid: Group ID that has access to the queue directories</span>
|
||||
<span class="sd"> :type gid: int</span>
|
||||
<span class="sd"> :returns: list of errors</span>
|
||||
<span class="sd"> :rtype: list of str</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">lib_dir</span> <span class="o">=</span> <span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"queue/run"</span><span class="p">,</span> <span class="s2">"queue/new"</span><span class="p">,</span> <span class="s2">"results"</span><span class="p">]:</span>
|
||||
<span class="n">p_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">lib_dir</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">p_dir</span><span class="p">):</span>
|
||||
<span class="n">orig_umask</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">umask</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">p_dir</span><span class="p">,</span> <span class="mo">0o771</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">chown</span><span class="p">(</span><span class="n">p_dir</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">gid</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">umask</span><span class="p">(</span><span class="n">orig_umask</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">p_stat</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">stat</span><span class="p">(</span><span class="n">p_dir</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">p_stat</span><span class="o">.</span><span class="n">st_mode</span> <span class="o">&</span> <span class="mo">0o006</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"Incorrect permissions on </span><span class="si">%s</span><span class="s2">, no o+rw permissions are allowed."</span> <span class="o">%</span> <span class="n">p_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">p_stat</span><span class="o">.</span><span class="n">st_gid</span> <span class="o">!=</span> <span class="n">gid</span> <span class="ow">or</span> <span class="n">p_stat</span><span class="o">.</span><span class="n">st_uid</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">gr_name</span> <span class="o">=</span> <span class="n">grp</span><span class="o">.</span><span class="n">getgrgid</span><span class="p">(</span><span class="n">gid</span><span class="p">)</span><span class="o">.</span><span class="n">gr_name</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> should be owned by root:</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">p_dir</span><span class="p">,</span> <span class="n">gr_name</span><span class="p">))</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">errors</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,264 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.crossdomain — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.crossdomain</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.crossdomain</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2017 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
|
||||
<span class="c1"># crossdomain decorator from - http://flask.pocoo.org/snippets/56/</span>
|
||||
<span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">timedelta</span>
|
||||
<span class="kn">from</span> <span class="nn">flask</span> <span class="k">import</span> <span class="n">make_response</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">current_app</span>
|
||||
<span class="kn">from</span> <span class="nn">functools</span> <span class="k">import</span> <span class="n">update_wrapper</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="crossdomain"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.crossdomain.crossdomain">[docs]</a><span class="k">def</span> <span class="nf">crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">max_age</span><span class="o">=</span><span class="mi">21600</span><span class="p">,</span> <span class="n">attach_to_all</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">automatic_options</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">methods</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">methods</span> <span class="o">=</span> <span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">sorted</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">methods</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="n">headers</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">headers</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
|
||||
<span class="n">headers</span> <span class="o">=</span> <span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">origin</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
|
||||
<span class="n">origin</span> <span class="o">=</span> <span class="p">[</span><span class="n">origin</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">max_age</span><span class="p">,</span> <span class="n">timedelta</span><span class="p">):</span>
|
||||
<span class="n">max_age</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">max_age</span><span class="o">.</span><span class="n">total_seconds</span><span class="p">())</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">get_methods</span><span class="p">():</span>
|
||||
<span class="k">if</span> <span class="n">methods</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">methods</span>
|
||||
|
||||
<span class="n">options_resp</span> <span class="o">=</span> <span class="n">current_app</span><span class="o">.</span><span class="n">make_default_options_response</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="n">options_resp</span><span class="o">.</span><span class="n">headers</span><span class="p">[</span><span class="s1">'allow'</span><span class="p">]</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">wrapped_function</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">automatic_options</span> <span class="ow">and</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s1">'OPTIONS'</span><span class="p">:</span>
|
||||
<span class="n">resp</span> <span class="o">=</span> <span class="n">current_app</span><span class="o">.</span><span class="n">make_default_options_response</span><span class="p">()</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">resp</span> <span class="o">=</span> <span class="n">make_response</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">attach_to_all</span> <span class="ow">and</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">!=</span> <span class="s1">'OPTIONS'</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">resp</span>
|
||||
|
||||
<span class="n">h</span> <span class="o">=</span> <span class="n">resp</span><span class="o">.</span><span class="n">headers</span>
|
||||
|
||||
<span class="n">h</span><span class="o">.</span><span class="n">extend</span><span class="p">([(</span><span class="s2">"Access-Control-Allow-Origin"</span><span class="p">,</span> <span class="n">orig</span><span class="p">)</span> <span class="k">for</span> <span class="n">orig</span> <span class="ow">in</span> <span class="n">origin</span><span class="p">])</span>
|
||||
<span class="n">h</span><span class="p">[</span><span class="s1">'Access-Control-Allow-Methods'</span><span class="p">]</span> <span class="o">=</span> <span class="n">get_methods</span><span class="p">()</span>
|
||||
<span class="n">h</span><span class="p">[</span><span class="s1">'Access-Control-Max-Age'</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">max_age</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">headers</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">h</span><span class="p">[</span><span class="s1">'Access-Control-Allow-Headers'</span><span class="p">]</span> <span class="o">=</span> <span class="n">headers</span>
|
||||
<span class="k">return</span> <span class="n">resp</span>
|
||||
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">provide_automatic_options</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">required_methods</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'OPTIONS'</span><span class="p">]</span>
|
||||
<span class="k">return</span> <span class="n">update_wrapper</span><span class="p">(</span><span class="n">wrapped_function</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">decorator</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,805 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.projects — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.projects</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.projects</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2017 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"lorax-composer"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">configparser</span> <span class="k">import</span> <span class="n">ConfigParser</span>
|
||||
<span class="kn">import</span> <span class="nn">dnf</span>
|
||||
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">time</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.bisect</span> <span class="k">import</span> <span class="n">insort_left</span>
|
||||
|
||||
<span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">T%H:%M:%S"</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="ProjectsError"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.ProjectsError">[docs]</a><span class="k">class</span> <span class="nc">ProjectsError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
|
||||
<span class="k">pass</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="api_time"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.api_time">[docs]</a><span class="k">def</span> <span class="nf">api_time</span><span class="p">(</span><span class="n">t</span><span class="p">):</span>
|
||||
<span class="sd">"""Convert time since epoch to a string</span>
|
||||
|
||||
<span class="sd"> :param t: Seconds since epoch</span>
|
||||
<span class="sd"> :type t: int</span>
|
||||
<span class="sd"> :returns: Time string</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="n">TIME_FORMAT</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="n">t</span><span class="p">))</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="api_changelog"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.api_changelog">[docs]</a><span class="k">def</span> <span class="nf">api_changelog</span><span class="p">(</span><span class="n">changelog</span><span class="p">):</span>
|
||||
<span class="sd">"""Convert the changelog to a string</span>
|
||||
|
||||
<span class="sd"> :param changelog: A list of time, author, string tuples.</span>
|
||||
<span class="sd"> :type changelog: tuple</span>
|
||||
<span class="sd"> :returns: The most recent changelog text or ""</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
|
||||
<span class="sd"> This returns only the most recent changelog entry.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">entry</span> <span class="o">=</span> <span class="n">changelog</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span>
|
||||
<span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span>
|
||||
<span class="n">entry</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="k">return</span> <span class="n">entry</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="pkg_to_project"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_project">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_project</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
|
||||
<span class="sd">"""Extract the details from a hawkey.Package object</span>
|
||||
|
||||
<span class="sd"> :param pkgs: hawkey.Package object with package details</span>
|
||||
<span class="sd"> :type pkgs: hawkey.Package</span>
|
||||
<span class="sd"> :returns: A dict with the name, summary, description, and url.</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
|
||||
<span class="sd"> upstream_vcs is hard-coded to UPSTREAM_VCS</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"name"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
|
||||
<span class="s2">"summary"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">summary</span><span class="p">,</span>
|
||||
<span class="s2">"description"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">description</span><span class="p">,</span>
|
||||
<span class="s2">"homepage"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">url</span><span class="p">,</span>
|
||||
<span class="s2">"upstream_vcs"</span><span class="p">:</span> <span class="s2">"UPSTREAM_VCS"</span><span class="p">}</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="pkg_to_build"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_build">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_build</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
|
||||
<span class="sd">"""Extract the build details from a hawkey.Package object</span>
|
||||
|
||||
<span class="sd"> :param pkg: hawkey.Package object with package details</span>
|
||||
<span class="sd"> :type pkg: hawkey.Package</span>
|
||||
<span class="sd"> :returns: A dict with the build details, epoch, release, arch, build_time, changelog, ...</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
|
||||
<span class="sd"> metadata entries are hard-coded to {}</span>
|
||||
|
||||
<span class="sd"> Note that this only returns the build dict, it does not include the name, description, etc.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"epoch"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">epoch</span><span class="p">,</span>
|
||||
<span class="s2">"release"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">,</span>
|
||||
<span class="s2">"arch"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span>
|
||||
<span class="s2">"build_time"</span><span class="p">:</span> <span class="n">api_time</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">buildtime</span><span class="p">),</span>
|
||||
<span class="s2">"changelog"</span><span class="p">:</span> <span class="s2">"CHANGELOG_NEEDED"</span><span class="p">,</span> <span class="c1"># XXX Not in hawkey.Package</span>
|
||||
<span class="s2">"build_config_ref"</span><span class="p">:</span> <span class="s2">"BUILD_CONFIG_REF"</span><span class="p">,</span>
|
||||
<span class="s2">"build_env_ref"</span><span class="p">:</span> <span class="s2">"BUILD_ENV_REF"</span><span class="p">,</span>
|
||||
<span class="s2">"metadata"</span><span class="p">:</span> <span class="p">{},</span>
|
||||
<span class="s2">"source"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"license"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">license</span><span class="p">,</span>
|
||||
<span class="s2">"version"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span>
|
||||
<span class="s2">"source_ref"</span><span class="p">:</span> <span class="s2">"SOURCE_REF"</span><span class="p">,</span>
|
||||
<span class="s2">"metadata"</span><span class="p">:</span> <span class="p">{}}}</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="pkg_to_project_info"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_project_info">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_project_info</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
|
||||
<span class="sd">"""Extract the details from a hawkey.Package object</span>
|
||||
|
||||
<span class="sd"> :param pkg: hawkey.Package object with package details</span>
|
||||
<span class="sd"> :type pkg: hawkey.Package</span>
|
||||
<span class="sd"> :returns: A dict with the project details, as well as epoch, release, arch, build_time, changelog, ...</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
|
||||
<span class="sd"> metadata entries are hard-coded to {}</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"name"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
|
||||
<span class="s2">"summary"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">summary</span><span class="p">,</span>
|
||||
<span class="s2">"description"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">description</span><span class="p">,</span>
|
||||
<span class="s2">"homepage"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">url</span><span class="p">,</span>
|
||||
<span class="s2">"upstream_vcs"</span><span class="p">:</span> <span class="s2">"UPSTREAM_VCS"</span><span class="p">,</span>
|
||||
<span class="s2">"builds"</span><span class="p">:</span> <span class="p">[</span><span class="n">pkg_to_build</span><span class="p">(</span><span class="n">pkg</span><span class="p">)]}</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="pkg_to_dep"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_dep">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_dep</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
|
||||
<span class="sd">"""Extract the info from a hawkey.Package object</span>
|
||||
|
||||
<span class="sd"> :param pkg: A hawkey.Package object</span>
|
||||
<span class="sd"> :type pkg: hawkey.Package</span>
|
||||
<span class="sd"> :returns: A dict with name, epoch, version, release, arch</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"name"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
|
||||
<span class="s2">"epoch"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">epoch</span><span class="p">,</span>
|
||||
<span class="s2">"version"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span>
|
||||
<span class="s2">"release"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">,</span>
|
||||
<span class="s2">"arch"</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">arch</span><span class="p">}</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="proj_to_module"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.proj_to_module">[docs]</a><span class="k">def</span> <span class="nf">proj_to_module</span><span class="p">(</span><span class="n">proj</span><span class="p">):</span>
|
||||
<span class="sd">"""Extract the name from a project_info dict</span>
|
||||
|
||||
<span class="sd"> :param pkg: dict with package details</span>
|
||||
<span class="sd"> :type pkg: dict</span>
|
||||
<span class="sd"> :returns: A dict with name, and group_type</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
|
||||
<span class="sd"> group_type is hard-coded to "rpm"</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"name"</span><span class="p">:</span> <span class="n">proj</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span>
|
||||
<span class="s2">"group_type"</span><span class="p">:</span> <span class="s2">"rpm"</span><span class="p">}</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="dep_evra"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.dep_evra">[docs]</a><span class="k">def</span> <span class="nf">dep_evra</span><span class="p">(</span><span class="n">dep</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the epoch:version-release.arch for the dep</span>
|
||||
|
||||
<span class="sd"> :param dep: dependency dict</span>
|
||||
<span class="sd"> :type dep: dict</span>
|
||||
<span class="sd"> :returns: epoch:version-release.arch</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">dep</span><span class="p">[</span><span class="s2">"epoch"</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">dep</span><span class="p">[</span><span class="s2">"version"</span><span class="p">]</span><span class="o">+</span><span class="s2">"-"</span><span class="o">+</span><span class="n">dep</span><span class="p">[</span><span class="s2">"release"</span><span class="p">]</span><span class="o">+</span><span class="s2">"."</span><span class="o">+</span><span class="n">dep</span><span class="p">[</span><span class="s2">"arch"</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">dep</span><span class="p">[</span><span class="s2">"epoch"</span><span class="p">])</span><span class="o">+</span><span class="s2">":"</span><span class="o">+</span><span class="n">dep</span><span class="p">[</span><span class="s2">"version"</span><span class="p">]</span><span class="o">+</span><span class="s2">"-"</span><span class="o">+</span><span class="n">dep</span><span class="p">[</span><span class="s2">"release"</span><span class="p">]</span><span class="o">+</span><span class="s2">"."</span><span class="o">+</span><span class="n">dep</span><span class="p">[</span><span class="s2">"arch"</span><span class="p">]</span></div>
|
||||
|
||||
<div class="viewcode-block" id="dep_nevra"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.dep_nevra">[docs]</a><span class="k">def</span> <span class="nf">dep_nevra</span><span class="p">(</span><span class="n">dep</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the name-epoch:version-release.arch"""</span>
|
||||
<span class="k">return</span> <span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">+</span><span class="s2">"-"</span><span class="o">+</span><span class="n">dep_evra</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="projects_list"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_list">[docs]</a><span class="k">def</span> <span class="nf">projects_list</span><span class="p">(</span><span class="n">dbo</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a list of projects</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :returns: List of project info dicts with name, summary, description, homepage, upstream_vcs</span>
|
||||
<span class="sd"> :rtype: list of dicts</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">projects_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="projects_info"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_info">[docs]</a><span class="k">def</span> <span class="nf">projects_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">project_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return details about specific projects</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param project_names: List of names of projects to get info about</span>
|
||||
<span class="sd"> :type project_names: str</span>
|
||||
<span class="sd"> :returns: List of project info dicts with pkg_to_project as well as epoch, version, release, etc.</span>
|
||||
<span class="sd"> :rtype: list of dicts</span>
|
||||
|
||||
<span class="sd"> If project_names is None it will return the full list of available packages</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">project_names</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">available</span><span class="p">()</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">name__glob</span><span class="o">=</span><span class="n">project_names</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">available</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># iterate over pkgs</span>
|
||||
<span class="c1"># - if pkg.name isn't in the results yet, add pkg_to_project_info in sorted position</span>
|
||||
<span class="c1"># - if pkg.name is already in results, get its builds. If the build for pkg is different</span>
|
||||
<span class="c1"># in any way (version, arch, etc.) add it to the entry's builds list. If it is the same,</span>
|
||||
<span class="c1"># skip it.</span>
|
||||
<span class="n">results</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">results_names</span> <span class="o">=</span> <span class="p">{}</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">results_names</span><span class="p">:</span>
|
||||
<span class="n">idx</span> <span class="o">=</span> <span class="n">insort_left</span><span class="p">(</span><span class="n">results</span><span class="p">,</span> <span class="n">pkg_to_project_info</span><span class="p">(</span><span class="n">p</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="n">results_names</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()]</span> <span class="o">=</span> <span class="n">idx</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">build</span> <span class="o">=</span> <span class="n">pkg_to_build</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">build</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">results</span><span class="p">[</span><span class="n">results_names</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()]][</span><span class="s2">"builds"</span><span class="p">]:</span>
|
||||
<span class="n">results</span><span class="p">[</span><span class="n">results_names</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()]][</span><span class="s2">"builds"</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">build</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">results</span></div>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">):</span>
|
||||
<span class="sd">"""Add projects to a new transaction</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param projects: The projects and version globs to find the dependencies for</span>
|
||||
<span class="sd"> :type projects: List of tuples</span>
|
||||
<span class="sd"> :param groups: The groups to include in dependency solving</span>
|
||||
<span class="sd"> :type groups: List of str</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> :rtype: None</span>
|
||||
<span class="sd"> :raises: ProjectsError if there was a problem installing something</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># This resets the transaction and updates the cache.</span>
|
||||
<span class="c1"># It is important that the cache always be synchronized because Anaconda will grab its own copy</span>
|
||||
<span class="c1"># and if that is different the NEVRAs will not match and the build will fail.</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">reset</span><span class="p">(</span><span class="n">goal</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">install_errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">groups</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">group_install</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">[</span><span class="s2">"mandatory"</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">])</span>
|
||||
<span class="k">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">MarkingError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">install_errors</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s2">"Group </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">version</span> <span class="ow">in</span> <span class="n">projects</span><span class="p">:</span>
|
||||
<span class="c1"># Find the best package matching the name + version glob</span>
|
||||
<span class="c1"># dnf can return multiple packages if it is in more than 1 repository</span>
|
||||
<span class="n">query</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">provides__glob</span><span class="o">=</span><span class="n">name</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">version</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">version__glob</span><span class="o">=</span><span class="n">version</span><span class="p">)</span>
|
||||
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">latest</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">query</span><span class="p">:</span>
|
||||
<span class="n">install_errors</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s2">"</span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">version</span><span class="p">),</span> <span class="s2">"No match"</span><span class="p">))</span>
|
||||
<span class="k">continue</span>
|
||||
<span class="n">sltr</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">selector</span><span class="o">.</span><span class="n">Selector</span><span class="p">(</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">pkg</span><span class="o">=</span><span class="n">query</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># NOTE: dnf says in near future there will be a "goal" attribute of Base class</span>
|
||||
<span class="c1"># so yes, we're using a 'private' attribute here on purpose and with permission.</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">_goal</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="n">sltr</span><span class="p">,</span> <span class="n">optional</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">install_errors</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"The following package(s) had problems: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="s2">","</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> (</span><span class="si">%s</span><span class="s2">)"</span> <span class="o">%</span> <span class="p">(</span><span class="n">pattern</span><span class="p">,</span> <span class="n">err</span><span class="p">)</span> <span class="k">for</span> <span class="n">pattern</span><span class="p">,</span> <span class="n">err</span> <span class="ow">in</span> <span class="n">install_errors</span><span class="p">]))</span>
|
||||
|
||||
<div class="viewcode-block" id="projects_depsolve"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_depsolve">[docs]</a><span class="k">def</span> <span class="nf">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the dependencies for a list of projects</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param projects: The projects to find the dependencies for</span>
|
||||
<span class="sd"> :type projects: List of Strings</span>
|
||||
<span class="sd"> :param groups: The groups to include in dependency solving</span>
|
||||
<span class="sd"> :type groups: List of str</span>
|
||||
<span class="sd"> :returns: NEVRA's of the project and its dependencies</span>
|
||||
<span class="sd"> :rtype: list of dicts</span>
|
||||
<span class="sd"> :raises: ProjectsError if there was a problem installing something</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">)</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">resolve</span><span class="p">()</span>
|
||||
<span class="k">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">DepsolveError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"There was a problem depsolving </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">projects</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="p">[]</span>
|
||||
|
||||
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">pkg_to_dep</span><span class="p">,</span> <span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">install_set</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="estimate_size"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.estimate_size">[docs]</a><span class="k">def</span> <span class="nf">estimate_size</span><span class="p">(</span><span class="n">packages</span><span class="p">,</span> <span class="n">block_size</span><span class="o">=</span><span class="mi">6144</span><span class="p">):</span>
|
||||
<span class="sd">"""Estimate the installed size of a package list</span>
|
||||
|
||||
<span class="sd"> :param packages: The packages to be installed</span>
|
||||
<span class="sd"> :type packages: list of hawkey.Package objects</span>
|
||||
<span class="sd"> :param block_size: The block size to use for rounding up file sizes.</span>
|
||||
<span class="sd"> :type block_size: int</span>
|
||||
<span class="sd"> :returns: The estimated size of installed packages</span>
|
||||
<span class="sd"> :rtype: int</span>
|
||||
|
||||
<span class="sd"> Estimating actual requirements is difficult without the actual file sizes, which</span>
|
||||
<span class="sd"> dnf doesn't provide access to. So use the file count and block size to estimate</span>
|
||||
<span class="sd"> a minimum size for each package.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">installed_size</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">packages</span><span class="p">:</span>
|
||||
<span class="n">installed_size</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">files</span><span class="p">)</span> <span class="o">*</span> <span class="n">block_size</span>
|
||||
<span class="n">installed_size</span> <span class="o">+=</span> <span class="n">p</span><span class="o">.</span><span class="n">installsize</span>
|
||||
<span class="k">return</span> <span class="n">installed_size</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="projects_depsolve_with_size"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_depsolve_with_size">[docs]</a><span class="k">def</span> <span class="nf">projects_depsolve_with_size</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">with_core</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the dependencies and installed size for a list of projects</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param project_names: The projects to find the dependencies for</span>
|
||||
<span class="sd"> :type project_names: List of Strings</span>
|
||||
<span class="sd"> :param groups: The groups to include in dependency solving</span>
|
||||
<span class="sd"> :type groups: List of str</span>
|
||||
<span class="sd"> :returns: installed size and a list of NEVRA's of the project and its dependencies</span>
|
||||
<span class="sd"> :rtype: tuple of (int, list of dicts)</span>
|
||||
<span class="sd"> :raises: ProjectsError if there was a problem installing something</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">with_core</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">group_install</span><span class="p">(</span><span class="s2">"core"</span><span class="p">,</span> <span class="p">[</span><span class="s1">'mandatory'</span><span class="p">,</span> <span class="s1">'default'</span><span class="p">,</span> <span class="s1">'optional'</span><span class="p">])</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">resolve</span><span class="p">()</span>
|
||||
<span class="k">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">DepsolveError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"There was a problem depsolving </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">projects</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="p">[])</span>
|
||||
|
||||
<span class="n">installed_size</span> <span class="o">=</span> <span class="n">estimate_size</span><span class="p">(</span><span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">install_set</span><span class="p">)</span>
|
||||
<span class="n">deps</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">pkg_to_dep</span><span class="p">,</span> <span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">install_set</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="k">return</span> <span class="p">(</span><span class="n">installed_size</span><span class="p">,</span> <span class="n">deps</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="modules_list"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.modules_list">[docs]</a><span class="k">def</span> <span class="nf">modules_list</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a list of modules</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param offset: Number of modules to skip</span>
|
||||
<span class="sd"> :type limit: int</span>
|
||||
<span class="sd"> :param limit: Maximum number of modules to return</span>
|
||||
<span class="sd"> :type limit: int</span>
|
||||
<span class="sd"> :returns: List of module information and total count</span>
|
||||
<span class="sd"> :rtype: tuple of a list of dicts and an Int</span>
|
||||
|
||||
<span class="sd"> Modules don't exist in RHEL7 so this only returns projects</span>
|
||||
<span class="sd"> and sets the type to "rpm"</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># TODO - Figure out what to do with this for Fedora 'modules'</span>
|
||||
<span class="n">projs</span> <span class="o">=</span> <span class="n">_unique_dicts</span><span class="p">(</span><span class="n">projects_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">proj_to_module</span><span class="p">,</span> <span class="n">projs</span><span class="p">))</span></div>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_unique_dicts</span><span class="p">(</span><span class="n">lst</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a new list of dicts, only including one match of key(d)</span>
|
||||
|
||||
<span class="sd"> :param lst: list of dicts</span>
|
||||
<span class="sd"> :type lst: list</span>
|
||||
<span class="sd"> :param key: key function to match lst entries</span>
|
||||
<span class="sd"> :type key: function</span>
|
||||
<span class="sd"> :returns: list of the unique lst entries</span>
|
||||
<span class="sd"> :rtype: list</span>
|
||||
|
||||
<span class="sd"> Uses key(d) to test for duplicates in the returned list, creating a</span>
|
||||
<span class="sd"> list of unique return values.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">result</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">result_keys</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">lst</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">key</span><span class="p">(</span><span class="n">d</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">result_keys</span><span class="p">:</span>
|
||||
<span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
|
||||
<span class="n">result_keys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">(</span><span class="n">d</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">result</span>
|
||||
|
||||
<div class="viewcode-block" id="modules_info"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.modules_info">[docs]</a><span class="k">def</span> <span class="nf">modules_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return details about a module, including dependencies</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param module_names: Names of the modules to get info about</span>
|
||||
<span class="sd"> :type module_names: str</span>
|
||||
<span class="sd"> :returns: List of dicts with module details and dependencies.</span>
|
||||
<span class="sd"> :rtype: list of dicts</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">modules</span> <span class="o">=</span> <span class="n">projects_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Add the dependency info to each one</span>
|
||||
<span class="k">for</span> <span class="n">module</span> <span class="ow">in</span> <span class="n">modules</span><span class="p">:</span>
|
||||
<span class="n">module</span><span class="p">[</span><span class="s2">"dependencies"</span><span class="p">]</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="p">[(</span><span class="n">module</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="s2">"*.*"</span><span class="p">)],</span> <span class="p">[])</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">modules</span></div>
|
||||
|
||||
<div class="viewcode-block" id="dnf_repo_to_file_repo"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.dnf_repo_to_file_repo">[docs]</a><span class="k">def</span> <span class="nf">dnf_repo_to_file_repo</span><span class="p">(</span><span class="n">repo</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a string representation of a DNF Repo object suitable for writing to a .repo file</span>
|
||||
|
||||
<span class="sd"> :param repo: DNF Repository</span>
|
||||
<span class="sd"> :type repo: dnf.RepoDict</span>
|
||||
<span class="sd"> :returns: A string</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
|
||||
<span class="sd"> The DNF Repo.dump() function does not produce a string that can be used as a dnf .repo file,</span>
|
||||
<span class="sd"> it ouputs baseurl and gpgkey as python lists which DNF cannot read. So do this manually with</span>
|
||||
<span class="sd"> only the attributes we care about.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">repo_str</span> <span class="o">=</span> <span class="s2">"[</span><span class="si">%s</span><span class="s2">]</span><span class="se">\n</span><span class="s2">name = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">repo</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">repo</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span><span class="p">:</span>
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"metalink = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span>
|
||||
<span class="k">elif</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span><span class="p">:</span>
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"mirrorlist = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span>
|
||||
<span class="k">elif</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">:</span>
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"baseurl = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Repo has no baseurl, metalink, or mirrorlist"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># proxy is optional</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">proxy</span><span class="p">:</span>
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"proxy = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">repo</span><span class="o">.</span><span class="n">proxy</span>
|
||||
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"sslverify = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">repo</span><span class="o">.</span><span class="n">sslverify</span>
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"gpgcheck = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgcheck</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span><span class="p">:</span>
|
||||
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s2">"gpgkey = </span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="s2">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">repo_str</span></div>
|
||||
|
||||
<div class="viewcode-block" id="repo_to_source"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.repo_to_source">[docs]</a><span class="k">def</span> <span class="nf">repo_to_source</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">system_source</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a Weldr Source dict created from the DNF Repository</span>
|
||||
|
||||
<span class="sd"> :param repo: DNF Repository</span>
|
||||
<span class="sd"> :type repo: dnf.RepoDict</span>
|
||||
<span class="sd"> :param system_source: True if this source is an immutable system source</span>
|
||||
<span class="sd"> :type system_source: bool</span>
|
||||
<span class="sd"> :returns: A dict with Weldr Source fields filled in</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
|
||||
<span class="sd"> Example::</span>
|
||||
|
||||
<span class="sd"> {</span>
|
||||
<span class="sd"> "check_gpg": true,</span>
|
||||
<span class="sd"> "check_ssl": true,</span>
|
||||
<span class="sd"> "gpgkey_url": [</span>
|
||||
<span class="sd"> "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64"</span>
|
||||
<span class="sd"> ],</span>
|
||||
<span class="sd"> "name": "fedora",</span>
|
||||
<span class="sd"> "proxy": "http://proxy.brianlane.com:8123",</span>
|
||||
<span class="sd"> "system": true</span>
|
||||
<span class="sd"> "type": "yum-metalink",</span>
|
||||
<span class="sd"> "url": "https://mirrors.fedoraproject.org/metalink?repo=fedora-28&arch=x86_64"</span>
|
||||
<span class="sd"> }</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">source</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"name"</span><span class="p">:</span> <span class="n">repo</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="s2">"system"</span><span class="p">:</span> <span class="n">system_source</span><span class="p">}</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"url"</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"yum-baseurl"</span>
|
||||
<span class="k">elif</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"url"</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"yum-metalink"</span>
|
||||
<span class="k">elif</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"url"</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"yum-mirrorlist"</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Repo has no baseurl, metalink, or mirrorlist"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># proxy is optional</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">proxy</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"proxy"</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">proxy</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo</span><span class="o">.</span><span class="n">sslverify</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"check_ssl"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"check_ssl"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgcheck</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"check_gpg"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"check_gpg"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span><span class="p">:</span>
|
||||
<span class="n">source</span><span class="p">[</span><span class="s2">"gpgkey_urls"</span><span class="p">]</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">source</span></div>
|
||||
|
||||
<div class="viewcode-block" id="source_to_repo"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.source_to_repo">[docs]</a><span class="k">def</span> <span class="nf">source_to_repo</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">dnf_conf</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a dnf Repo object created from a source dict</span>
|
||||
|
||||
<span class="sd"> :param source: A Weldr source dict</span>
|
||||
<span class="sd"> :type source: dict</span>
|
||||
<span class="sd"> :returns: A dnf Repo object</span>
|
||||
<span class="sd"> :rtype: dnf.Repo</span>
|
||||
|
||||
<span class="sd"> Example::</span>
|
||||
|
||||
<span class="sd"> {</span>
|
||||
<span class="sd"> "check_gpg": True,</span>
|
||||
<span class="sd"> "check_ssl": True,</span>
|
||||
<span class="sd"> "gpgkey_urls": [</span>
|
||||
<span class="sd"> "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64"</span>
|
||||
<span class="sd"> ],</span>
|
||||
<span class="sd"> "name": "fedora",</span>
|
||||
<span class="sd"> "proxy": "http://proxy.brianlane.com:8123",</span>
|
||||
<span class="sd"> "system": True</span>
|
||||
<span class="sd"> "type": "yum-metalink",</span>
|
||||
<span class="sd"> "url": "https://mirrors.fedoraproject.org/metalink?repo=fedora-28&arch=x86_64"</span>
|
||||
<span class="sd"> }</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">repo</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">repo</span><span class="o">.</span><span class="n">Repo</span><span class="p">(</span><span class="n">source</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="n">dnf_conf</span><span class="p">)</span>
|
||||
<span class="c1"># This will allow errors to be raised so we can catch them</span>
|
||||
<span class="c1"># without this they are logged, but the repo is silently disabled</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">skip_if_unavailable</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"yum-baseurl"</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s2">"url"</span><span class="p">]</span>
|
||||
<span class="k">elif</span> <span class="n">source</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"yum-metalink"</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">metalink</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s2">"url"</span><span class="p">]</span>
|
||||
<span class="k">elif</span> <span class="n">source</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"yum-mirrorlist"</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s2">"url"</span><span class="p">]</span>
|
||||
|
||||
<span class="k">if</span> <span class="s2">"proxy"</span> <span class="ow">in</span> <span class="n">source</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">proxy</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s2">"proxy"</span><span class="p">]</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s2">"check_ssl"</span><span class="p">]:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">sslverify</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">sslverify</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s2">"check_gpg"</span><span class="p">]:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">gpgcheck</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">gpgcheck</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
|
||||
<span class="k">if</span> <span class="s2">"gpgkey_urls"</span> <span class="ow">in</span> <span class="n">source</span><span class="p">:</span>
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">source</span><span class="p">[</span><span class="s2">"gpgkey_urls"</span><span class="p">])</span>
|
||||
|
||||
<span class="n">repo</span><span class="o">.</span><span class="n">enable</span><span class="p">()</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">repo</span></div>
|
||||
|
||||
<div class="viewcode-block" id="get_source_ids"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.get_source_ids">[docs]</a><span class="k">def</span> <span class="nf">get_source_ids</span><span class="p">(</span><span class="n">source_path</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a list of the source ids in a file</span>
|
||||
|
||||
<span class="sd"> :param source_path: Full path and filename of the source (yum repo) file</span>
|
||||
<span class="sd"> :type source_path: str</span>
|
||||
<span class="sd"> :returns: A list of source id strings</span>
|
||||
<span class="sd"> :rtype: list of str</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">source_path</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="p">[]</span>
|
||||
|
||||
<span class="n">cfg</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="p">(</span><span class="n">strict</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">cfg</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">source_path</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">cfg</span><span class="o">.</span><span class="n">sections</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="get_repo_sources"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.get_repo_sources">[docs]</a><span class="k">def</span> <span class="nf">get_repo_sources</span><span class="p">(</span><span class="n">source_glob</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a list of sources from a directory of yum repositories</span>
|
||||
|
||||
<span class="sd"> :param source_glob: A glob to use to match the source files, including full path</span>
|
||||
<span class="sd"> :type source_glob: str</span>
|
||||
<span class="sd"> :returns: A list of the source ids in all of the matching files</span>
|
||||
<span class="sd"> :rtype: list of str</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">sources</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">source_glob</span><span class="p">):</span>
|
||||
<span class="n">sources</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">get_source_ids</span><span class="p">(</span><span class="n">f</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">sources</span></div>
|
||||
|
||||
<div class="viewcode-block" id="delete_repo_source"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.delete_repo_source">[docs]</a><span class="k">def</span> <span class="nf">delete_repo_source</span><span class="p">(</span><span class="n">source_glob</span><span class="p">,</span> <span class="n">source_name</span><span class="p">):</span>
|
||||
<span class="sd">"""Delete a source from a repo file</span>
|
||||
|
||||
<span class="sd"> :param source_glob: A glob of the repo sources to search</span>
|
||||
<span class="sd"> :type source_glob: str</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> :raises: ProjectsError if there was a problem</span>
|
||||
|
||||
<span class="sd"> A repo file may have multiple sources in it, delete only the selected source.</span>
|
||||
<span class="sd"> If it is the last one in the file, delete the file.</span>
|
||||
|
||||
<span class="sd"> WARNING: This will delete ANY source, the caller needs to ensure that a system</span>
|
||||
<span class="sd"> source_name isn't passed to it.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">found</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">source_glob</span><span class="p">):</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">cfg</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="p">(</span><span class="n">strict</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">cfg</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">source_name</span> <span class="ow">in</span> <span class="n">cfg</span><span class="o">.</span><span class="n">sections</span><span class="p">():</span>
|
||||
<span class="n">found</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="n">cfg</span><span class="o">.</span><span class="n">remove_section</span><span class="p">(</span><span class="n">source_name</span><span class="p">)</span>
|
||||
<span class="c1"># If there are other sections, rewrite the file without the deleted one</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">sections</span><span class="p">())</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">cfg_file</span><span class="p">:</span>
|
||||
<span class="n">cfg</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">cfg_file</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># No sections left, just delete the file</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"Problem deleting repo source </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">source_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">found</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"source </span><span class="si">%s</span><span class="s2"> not found"</span> <span class="o">%</span> <span class="n">source_name</span><span class="p">)</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,875 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.queue — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.queue</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.queue</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1"># Copyright (C) 2018 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="sd">""" Functions to monitor compose queue and run anaconda"""</span>
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">grp</span>
|
||||
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
|
||||
<span class="kn">import</span> <span class="nn">multiprocessing</span> <span class="k">as</span> <span class="nn">mp</span>
|
||||
<span class="kn">import</span> <span class="nn">pytoml</span> <span class="k">as</span> <span class="nn">toml</span>
|
||||
<span class="kn">import</span> <span class="nn">pwd</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
<span class="kn">import</span> <span class="nn">subprocess</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="k">import</span> <span class="n">Popen</span><span class="p">,</span> <span class="n">PIPE</span>
|
||||
<span class="kn">import</span> <span class="nn">time</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">find_templates</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.compose</span> <span class="k">import</span> <span class="n">move_compose_results</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">recipe_from_file</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.timestamp</span> <span class="k">import</span> <span class="n">TS_CREATED</span><span class="p">,</span> <span class="n">TS_STARTED</span><span class="p">,</span> <span class="n">TS_FINISHED</span><span class="p">,</span> <span class="n">write_timestamp</span><span class="p">,</span> <span class="n">timestamp_dict</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.creator</span> <span class="k">import</span> <span class="n">run_creator</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
|
||||
<div class="viewcode-block" id="check_queues"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.check_queues">[docs]</a><span class="k">def</span> <span class="nf">check_queues</span><span class="p">(</span><span class="n">cfg</span><span class="p">):</span>
|
||||
<span class="sd">"""Check to make sure the new and run queue symlinks are correct</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: DataHolder</span>
|
||||
|
||||
<span class="sd"> Also check all of the existing results and make sure any with WAITING</span>
|
||||
<span class="sd"> set in STATUS have a symlink in queue/new/</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># Remove broken symlinks from the new and run queues</span>
|
||||
<span class="n">queue_symlinks</span> <span class="o">=</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/new/*"</span><span class="p">))</span> <span class="o">+</span> \
|
||||
<span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/run/*"</span><span class="p">))</span>
|
||||
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">queue_symlinks</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">link</span><span class="p">)):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Removing broken symlink </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">link</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">link</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Write FAILED to the STATUS of any run queue symlinks and remove them</span>
|
||||
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/run/*"</span><span class="p">)):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Setting build </span><span class="si">%s</span><span class="s2"> to FAILED, and removing symlink from queue/run/"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FAILED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">link</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Check results STATUS messages</span>
|
||||
<span class="c1"># - If STATUS is missing, set it to FAILED</span>
|
||||
<span class="c1"># - RUNNING should be changed to FAILED</span>
|
||||
<span class="c1"># - WAITING should have a symlink in the new queue</span>
|
||||
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"results/*"</span><span class="p">)):</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">)):</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FAILED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="k">continue</span>
|
||||
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">))</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="o">==</span> <span class="s2">"RUNNING"</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Setting build </span><span class="si">%s</span><span class="s2"> to FAILED"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FAILED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="n">status</span> <span class="o">==</span> <span class="s2">"WAITING"</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">islink</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/new/"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Creating missing symlink to new build </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">symlink</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/new/"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">)))</span></div>
|
||||
|
||||
<div class="viewcode-block" id="start_queue_monitor"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.start_queue_monitor">[docs]</a><span class="k">def</span> <span class="nf">start_queue_monitor</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">gid</span><span class="p">):</span>
|
||||
<span class="sd">"""Start the queue monitor as a mp process</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uid: User ID that owns the queue</span>
|
||||
<span class="sd"> :type uid: int</span>
|
||||
<span class="sd"> :param gid: Group ID that owns the queue</span>
|
||||
<span class="sd"> :type gid: int</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">lib_dir</span> <span class="o">=</span> <span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">)</span>
|
||||
<span class="n">share_dir</span> <span class="o">=</span> <span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"share_dir"</span><span class="p">)</span>
|
||||
<span class="n">tmp</span> <span class="o">=</span> <span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"tmp"</span><span class="p">)</span>
|
||||
<span class="n">monitor_cfg</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">composer_dir</span><span class="o">=</span><span class="n">lib_dir</span><span class="p">,</span> <span class="n">share_dir</span><span class="o">=</span><span class="n">share_dir</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="n">uid</span><span class="p">,</span> <span class="n">gid</span><span class="o">=</span><span class="n">gid</span><span class="p">,</span> <span class="n">tmp</span><span class="o">=</span><span class="n">tmp</span><span class="p">)</span>
|
||||
<span class="n">p</span> <span class="o">=</span> <span class="n">mp</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="n">monitor</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">(</span><span class="n">monitor_cfg</span><span class="p">,))</span>
|
||||
<span class="n">p</span><span class="o">.</span><span class="n">daemon</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="n">p</span><span class="o">.</span><span class="n">start</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="monitor"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.monitor">[docs]</a><span class="k">def</span> <span class="nf">monitor</span><span class="p">(</span><span class="n">cfg</span><span class="p">):</span>
|
||||
<span class="sd">"""Monitor the queue for new compose requests</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: DataHolder</span>
|
||||
<span class="sd"> :returns: Does not return</span>
|
||||
|
||||
<span class="sd"> The queue has 2 subdirectories, new and run. When a compose is ready to be run</span>
|
||||
<span class="sd"> a symlink to the uniquely named results directory should be placed in ./queue/new/</span>
|
||||
|
||||
<span class="sd"> When the it is ready to be run (it is checked every 30 seconds or after a previous</span>
|
||||
<span class="sd"> compose is finished) the symlink will be moved into ./queue/run/ and a STATUS file</span>
|
||||
<span class="sd"> will be created in the results directory.</span>
|
||||
|
||||
<span class="sd"> STATUS can contain one of: WAITING, RUNNING, FINISHED, FAILED</span>
|
||||
|
||||
<span class="sd"> If the system is restarted while a compose is running it will move any old symlinks</span>
|
||||
<span class="sd"> from ./queue/run/ to ./queue/new/ and rerun them.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">queue_sort</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Sort the queue entries by their mtime, not their names"""</span>
|
||||
<span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">stat</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/new"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">))</span><span class="o">.</span><span class="n">st_mtime</span>
|
||||
|
||||
<span class="n">check_queues</span><span class="p">(</span><span class="n">cfg</span><span class="p">)</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="n">uuids</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/new"</span><span class="p">)),</span> <span class="n">key</span><span class="o">=</span><span class="n">queue_sort</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Pick the oldest and move it into ./run/</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">uuids</span><span class="p">:</span>
|
||||
<span class="c1"># No composes left to process, sleep for a bit</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">src</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/new"</span><span class="p">,</span> <span class="n">uuids</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
<span class="n">dst</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">"queue/run"</span><span class="p">,</span> <span class="n">uuids</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">rename</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="n">dst</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">OSError</span><span class="p">:</span>
|
||||
<span class="c1"># The symlink may vanish if uuid_cancel() has been called</span>
|
||||
<span class="k">continue</span>
|
||||
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Starting new compose: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dst</span><span class="p">)</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"RUNNING</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">make_compose</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">dst</span><span class="p">))</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Finished building </span><span class="si">%s</span><span class="s2">, results are in </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dst</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">dst</span><span class="p">))</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FINISHED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="n">TS_FINISHED</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
|
||||
<span class="kn">import</span> <span class="nn">traceback</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"traceback: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">traceback</span><span class="o">.</span><span class="n">format_exc</span><span class="p">())</span>
|
||||
|
||||
<span class="c1"># TODO - Write the error message to an ERROR-LOG file to include with the status</span>
|
||||
<span class="c1"># log.error("Error running compose: %s", e)</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FAILED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="n">TS_FINISHED</span><span class="p">)</span>
|
||||
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">dst</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="make_compose"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.make_compose">[docs]</a><span class="k">def</span> <span class="nf">make_compose</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">results_dir</span><span class="p">):</span>
|
||||
<span class="sd">"""Run anaconda with the final-kickstart.ks from results_dir</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: DataHolder</span>
|
||||
<span class="sd"> :param results_dir: The directory containing the metadata and results for the build</span>
|
||||
<span class="sd"> :type results_dir: str</span>
|
||||
<span class="sd"> :returns: Nothing</span>
|
||||
<span class="sd"> :raises: May raise various exceptions</span>
|
||||
|
||||
<span class="sd"> This takes the final-kickstart.ks, and the settings in config.toml and runs Anaconda</span>
|
||||
<span class="sd"> in no-virt mode (directly on the host operating system). Exceptions should be caught</span>
|
||||
<span class="sd"> at the higer level.</span>
|
||||
|
||||
<span class="sd"> If there is a failure, the build artifacts will be cleaned up, and any logs will be</span>
|
||||
<span class="sd"> moved into logs/anaconda/ and their ownership will be set to the user from the cfg</span>
|
||||
<span class="sd"> object.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="c1"># Check on the ks's presence</span>
|
||||
<span class="n">ks_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"final-kickstart.ks"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">ks_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing kickstart file at </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">ks_path</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># The anaconda logs are copied into ./anaconda/ in this directory</span>
|
||||
<span class="n">log_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"logs/"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">log_dir</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">log_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Load the compose configuration</span>
|
||||
<span class="n">cfg_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"config.toml"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing config.toml for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">results_dir</span><span class="p">)</span>
|
||||
<span class="n">cfg_dict</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
|
||||
<span class="c1"># The keys in cfg_dict correspond to the arguments setup in livemedia-creator</span>
|
||||
<span class="c1"># keys that define what to build should be setup in compose_args, and keys with</span>
|
||||
<span class="c1"># defaults should be setup here.</span>
|
||||
|
||||
<span class="c1"># Make sure that image_name contains no path components</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"image_name"</span><span class="p">]</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"image_name"</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># Only support novirt installation, set some other defaults</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"no_virt"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"disk_image"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"fs_image"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"keep_image"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"domacboot"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"anaconda_args"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"proxy"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"armplatform"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"squashfs_args"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"lorax_templates"</span><span class="p">]</span> <span class="o">=</span> <span class="n">find_templates</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">share_dir</span><span class="p">)</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"tmp"</span><span class="p">]</span> <span class="o">=</span> <span class="n">cfg</span><span class="o">.</span><span class="n">tmp</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"dracut_args"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># Use default args for dracut</span>
|
||||
|
||||
<span class="c1"># TODO How to support other arches?</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"arch"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
|
||||
<span class="c1"># Compose things in a temporary directory inside the results directory</span>
|
||||
<span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"result_dir"</span><span class="p">]</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"compose"</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"result_dir"</span><span class="p">])</span>
|
||||
|
||||
<span class="n">install_cfg</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="o">**</span><span class="n">cfg_dict</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Some kludges for the 99-copy-logs %post, failure in it will crash the build</span>
|
||||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"/tmp/NOSAVE_INPUT_KS"</span><span class="p">,</span> <span class="s2">"/tmp/NOSAVE_LOGS"</span><span class="p">]:</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Placing a CANCEL file in the results directory will make execWithRedirect send anaconda a SIGTERM</span>
|
||||
<span class="k">def</span> <span class="nf">cancel_build</span><span class="p">():</span>
|
||||
<span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"CANCEL"</span><span class="p">))</span>
|
||||
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"cfg = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">install_cfg</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">test_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"TEST"</span><span class="p">)</span>
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">TS_STARTED</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">test_path</span><span class="p">):</span>
|
||||
<span class="c1"># Pretend to run the compose</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">test_mode</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">test_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
|
||||
<span class="n">test_mode</span> <span class="o">=</span> <span class="mi">1</span>
|
||||
<span class="k">if</span> <span class="n">test_mode</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"TESTING FAILED compose"</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">install_cfg</span><span class="o">.</span><span class="n">image_name</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"TEST IMAGE"</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">run_creator</span><span class="p">(</span><span class="n">install_cfg</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="n">cancel_build</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Extract the results of the compose into results_dir and cleanup the compose directory</span>
|
||||
<span class="n">move_compose_results</span><span class="p">(</span><span class="n">install_cfg</span><span class="p">,</span> <span class="n">results_dir</span><span class="p">)</span>
|
||||
<span class="k">finally</span><span class="p">:</span>
|
||||
<span class="c1"># Make sure any remaining temporary directories are removed (eg. if there was an exception)</span>
|
||||
<span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">tmp</span><span class="p">,</span> <span class="s2">"lmc-*"</span><span class="p">)):</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">d</span><span class="p">):</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">d</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Make sure that everything under the results directory is owned by the user</span>
|
||||
<span class="n">user</span> <span class="o">=</span> <span class="n">pwd</span><span class="o">.</span><span class="n">getpwuid</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span><span class="o">.</span><span class="n">pw_name</span>
|
||||
<span class="n">group</span> <span class="o">=</span> <span class="n">grp</span><span class="o">.</span><span class="n">getgrgid</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">gid</span><span class="p">)</span><span class="o">.</span><span class="n">gr_name</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Install finished, chowning results to </span><span class="si">%s</span><span class="s2">:</span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">user</span><span class="p">,</span> <span class="n">group</span><span class="p">)</span>
|
||||
<span class="n">subprocess</span><span class="o">.</span><span class="n">call</span><span class="p">([</span><span class="s2">"chown"</span><span class="p">,</span> <span class="s2">"-R"</span><span class="p">,</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">:</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="n">group</span><span class="p">),</span> <span class="n">results_dir</span><span class="p">])</span></div>
|
||||
|
||||
<div class="viewcode-block" id="get_compose_type"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.get_compose_type">[docs]</a><span class="k">def</span> <span class="nf">get_compose_type</span><span class="p">(</span><span class="n">results_dir</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the type of composition.</span>
|
||||
|
||||
<span class="sd"> :param results_dir: The directory containing the metadata and results for the build</span>
|
||||
<span class="sd"> :type results_dir: str</span>
|
||||
<span class="sd"> :returns: The type of compose (eg. 'tar')</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
<span class="sd"> :raises: RuntimeError if no kickstart template can be found.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># Should only be 2 kickstarts, the final-kickstart.ks and the template</span>
|
||||
<span class="n">t</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">ks</span><span class="p">)[:</span><span class="o">-</span><span class="mi">3</span><span class="p">]</span> <span class="k">for</span> <span class="n">ks</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"*.ks"</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="s2">"final-kickstart"</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">ks</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Cannot find ks template for build </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">results_dir</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">t</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span></div>
|
||||
|
||||
<div class="viewcode-block" id="compose_detail"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.compose_detail">[docs]</a><span class="k">def</span> <span class="nf">compose_detail</span><span class="p">(</span><span class="n">results_dir</span><span class="p">):</span>
|
||||
<span class="sd">"""Return details about the build.</span>
|
||||
|
||||
<span class="sd"> :param results_dir: The directory containing the metadata and results for the build</span>
|
||||
<span class="sd"> :type results_dir: str</span>
|
||||
<span class="sd"> :returns: A dictionary with details about the compose</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
<span class="sd"> :raises: IOError if it cannot read the directory, STATUS, or blueprint file.</span>
|
||||
|
||||
<span class="sd"> The following details are included in the dict:</span>
|
||||
|
||||
<span class="sd"> * id - The uuid of the comoposition</span>
|
||||
<span class="sd"> * queue_status - The final status of the composition (FINISHED or FAILED)</span>
|
||||
<span class="sd"> * compose_type - The type of output generated (tar, iso, etc.)</span>
|
||||
<span class="sd"> * blueprint - Blueprint name</span>
|
||||
<span class="sd"> * version - Blueprint version</span>
|
||||
<span class="sd"> * image_size - Size of the image, if finished. 0 otherwise.</span>
|
||||
|
||||
<span class="sd"> Various timestamps are also included in the dict. These are all Unix UTC timestamps.</span>
|
||||
<span class="sd"> It is possible for these timestamps to not always exist, in which case they will be</span>
|
||||
<span class="sd"> None in Python (or null in JSON). The following timestamps are included:</span>
|
||||
|
||||
<span class="sd"> * job_created - When the user submitted the compose</span>
|
||||
<span class="sd"> * job_started - Anaconda started running</span>
|
||||
<span class="sd"> * job_finished - Job entered FINISHED or FAILED state</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">build_id</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">results_dir</span><span class="p">))</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">))</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">recipe_from_file</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"blueprint.toml"</span><span class="p">))</span>
|
||||
|
||||
<span class="n">compose_type</span> <span class="o">=</span> <span class="n">get_compose_type</span><span class="p">(</span><span class="n">results_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="n">image_path</span> <span class="o">=</span> <span class="n">get_image_name</span><span class="p">(</span><span class="n">results_dir</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="o">==</span> <span class="s2">"FINISHED"</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">image_path</span><span class="p">):</span>
|
||||
<span class="n">image_size</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">stat</span><span class="p">(</span><span class="n">image_path</span><span class="p">)</span><span class="o">.</span><span class="n">st_size</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">image_size</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
|
||||
<span class="n">times</span> <span class="o">=</span> <span class="n">timestamp_dict</span><span class="p">(</span><span class="n">results_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">build_id</span><span class="p">,</span>
|
||||
<span class="s2">"queue_status"</span><span class="p">:</span> <span class="n">status</span><span class="p">,</span>
|
||||
<span class="s2">"job_created"</span><span class="p">:</span> <span class="n">times</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">TS_CREATED</span><span class="p">),</span>
|
||||
<span class="s2">"job_started"</span><span class="p">:</span> <span class="n">times</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">TS_STARTED</span><span class="p">),</span>
|
||||
<span class="s2">"job_finished"</span><span class="p">:</span> <span class="n">times</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">TS_FINISHED</span><span class="p">),</span>
|
||||
<span class="s2">"compose_type"</span><span class="p">:</span> <span class="n">compose_type</span><span class="p">,</span>
|
||||
<span class="s2">"blueprint"</span><span class="p">:</span> <span class="n">blueprint</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span>
|
||||
<span class="s2">"version"</span><span class="p">:</span> <span class="n">blueprint</span><span class="p">[</span><span class="s2">"version"</span><span class="p">],</span>
|
||||
<span class="s2">"image_size"</span><span class="p">:</span> <span class="n">image_size</span>
|
||||
<span class="p">}</span></div>
|
||||
|
||||
<div class="viewcode-block" id="queue_status"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.queue_status">[docs]</a><span class="k">def</span> <span class="nf">queue_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">):</span>
|
||||
<span class="sd">"""Return details about what is in the queue.</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :returns: A list of the new composes, and a list of the running composes</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
|
||||
<span class="sd"> This returns a dict with 2 lists. "new" is the list of uuids that are waiting to be built,</span>
|
||||
<span class="sd"> and "run" has the uuids that are being built (currently limited to 1 at a time).</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">queue_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"queue"</span><span class="p">)</span>
|
||||
<span class="n">new_queue</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">queue_dir</span><span class="p">,</span> <span class="s2">"new/*"</span><span class="p">))]</span>
|
||||
<span class="n">run_queue</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">queue_dir</span><span class="p">,</span> <span class="s2">"run/*"</span><span class="p">))]</span>
|
||||
|
||||
<span class="n">new_details</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">new_queue</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">d</span> <span class="o">=</span> <span class="n">compose_detail</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
|
||||
<span class="k">continue</span>
|
||||
<span class="n">new_details</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
|
||||
|
||||
<span class="n">run_details</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">run_queue</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">d</span> <span class="o">=</span> <span class="n">compose_detail</span><span class="p">(</span><span class="n">r</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
|
||||
<span class="k">continue</span>
|
||||
<span class="n">run_details</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="p">{</span>
|
||||
<span class="s2">"new"</span><span class="p">:</span> <span class="n">new_details</span><span class="p">,</span>
|
||||
<span class="s2">"run"</span><span class="p">:</span> <span class="n">run_details</span>
|
||||
<span class="p">}</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_status"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_status">[docs]</a><span class="k">def</span> <span class="nf">uuid_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the details of a specific UUID compose</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: Details about the build</span>
|
||||
<span class="sd"> :rtype: dict or None</span>
|
||||
|
||||
<span class="sd"> Returns the same dict as `compose_details()`</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">compose_detail</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="kc">None</span></div>
|
||||
|
||||
<div class="viewcode-block" id="build_status"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.build_status">[docs]</a><span class="k">def</span> <span class="nf">build_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">status_filter</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the details of finished or failed builds</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param status_filter: What builds to return. None == all, "FINISHED", or "FAILED"</span>
|
||||
<span class="sd"> :type status_filter: str</span>
|
||||
<span class="sd"> :returns: A list of the build details (from compose_details)</span>
|
||||
<span class="sd"> :rtype: list of dicts</span>
|
||||
|
||||
<span class="sd"> This returns a list of build details for each of the matching builds on the</span>
|
||||
<span class="sd"> system. It does not return the status of builds that have not been finished.</span>
|
||||
<span class="sd"> Use queue_status() for those.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">status_filter</span><span class="p">:</span>
|
||||
<span class="n">status_filter</span> <span class="o">=</span> <span class="p">[</span><span class="n">status_filter</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">status_filter</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"FINISHED"</span><span class="p">,</span> <span class="s2">"FAILED"</span><span class="p">]</span>
|
||||
|
||||
<span class="n">results</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">result_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">build</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">result_dir</span> <span class="o">+</span> <span class="s2">"/*"</span><span class="p">):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Checking status of build </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">build</span><span class="p">)</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">build</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">in</span> <span class="n">status_filter</span><span class="p">:</span>
|
||||
<span class="n">results</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">compose_detail</span><span class="p">(</span><span class="n">build</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
|
||||
<span class="k">pass</span>
|
||||
<span class="k">return</span> <span class="n">results</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_cancel"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_cancel">[docs]</a><span class="k">def</span> <span class="nf">uuid_cancel</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Cancel a build and delete its results</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: True if it was canceled and deleted</span>
|
||||
<span class="sd"> :rtype: bool</span>
|
||||
|
||||
<span class="sd"> Only call this if the build status is WAITING or RUNNING</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">cancel_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="s2">"CANCEL"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">cancel_path</span><span class="p">):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Cancel has already been requested for </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="kc">False</span>
|
||||
|
||||
<span class="c1"># This status can change (and probably will) while it is in the middle of doing this:</span>
|
||||
<span class="c1"># It can move from WAITING -> RUNNING or it can move from RUNNING -> FINISHED|FAILED</span>
|
||||
|
||||
<span class="c1"># If it is in WAITING remove the symlink and then check to make sure it didn't show up</span>
|
||||
<span class="c1"># in the run queue</span>
|
||||
<span class="n">queue_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"queue"</span><span class="p">)</span>
|
||||
<span class="n">uuid_new</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">queue_dir</span><span class="p">,</span> <span class="s2">"new"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_new</span><span class="p">):</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">uuid_new</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">OSError</span><span class="p">:</span>
|
||||
<span class="c1"># The symlink may vanish if the queue monitor started the build</span>
|
||||
<span class="k">pass</span>
|
||||
<span class="n">uuid_run</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">queue_dir</span><span class="p">,</span> <span class="s2">"run"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_run</span><span class="p">):</span>
|
||||
<span class="c1"># Make sure the build is still in the waiting state</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"WAITING"</span><span class="p">:</span>
|
||||
<span class="c1"># Successfully removed it before the build started</span>
|
||||
<span class="k">return</span> <span class="n">uuid_delete</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># At this point the build has probably started. Write to the CANCEL file.</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">cancel_path</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Wait for status to move to FAILED or FINISHED</span>
|
||||
<span class="n">started</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"FAILED"</span><span class="p">:</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">elif</span> <span class="n">status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"FINISHED"</span><span class="p">:</span>
|
||||
<span class="c1"># The build finished successfully, no point in deleting it now</span>
|
||||
<span class="k">return</span> <span class="kc">False</span>
|
||||
|
||||
<span class="c1"># Is this taking too long? Exit anyway and try to cleanup.</span>
|
||||
<span class="k">if</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">></span> <span class="n">started</span> <span class="o">+</span> <span class="p">(</span><span class="mi">10</span> <span class="o">*</span> <span class="mi">60</span><span class="p">):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"Failed to cancel the build of </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">break</span>
|
||||
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Remove the partial results</span>
|
||||
<span class="n">uuid_delete</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_delete"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_delete">[docs]</a><span class="k">def</span> <span class="nf">uuid_delete</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Delete all of the results from a compose</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: True if it was deleted</span>
|
||||
<span class="sd"> :rtype: bool</span>
|
||||
<span class="sd"> :raises: This will raise an error if the delete failed</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">uuid_dir</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">)</span> <span class="o"><</span> <span class="mi">10</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Directory length is too short: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid_dir</span><span class="p">)</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="kc">True</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_info"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_info">[docs]</a><span class="k">def</span> <span class="nf">uuid_info</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return information about the composition</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: dictionary of information about the composition or None</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
<span class="sd"> :raises: RuntimeError if there was a problem</span>
|
||||
|
||||
<span class="sd"> This will return a dict with the following fields populated:</span>
|
||||
|
||||
<span class="sd"> * id - The uuid of the comoposition</span>
|
||||
<span class="sd"> * config - containing the configuration settings used to run Anaconda</span>
|
||||
<span class="sd"> * blueprint - The depsolved blueprint used to generate the kickstart</span>
|
||||
<span class="sd"> * commit - The (local) git commit hash for the blueprint used</span>
|
||||
<span class="sd"> * deps - The NEVRA of all of the dependencies used in the composition</span>
|
||||
<span class="sd"> * compose_type - The type of output generated (tar, iso, etc.)</span>
|
||||
<span class="sd"> * queue_status - The final status of the composition (FINISHED or FAILED)</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="kc">None</span>
|
||||
|
||||
<span class="c1"># Load the compose configuration</span>
|
||||
<span class="n">cfg_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"config.toml"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing config.toml for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">cfg_dict</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
|
||||
<span class="n">frozen_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"frozen.toml"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">frozen_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing frozen.toml for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">frozen_dict</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">frozen_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
|
||||
<span class="n">deps_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"deps.toml"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">deps_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing deps.toml for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">deps_dict</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">deps_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
|
||||
<span class="n">details</span> <span class="o">=</span> <span class="n">compose_detail</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="n">commit_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"COMMIT"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">commit_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing commit hash for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">commit_id</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">commit_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">uuid</span><span class="p">,</span>
|
||||
<span class="s2">"config"</span><span class="p">:</span> <span class="n">cfg_dict</span><span class="p">,</span>
|
||||
<span class="s2">"blueprint"</span><span class="p">:</span> <span class="n">frozen_dict</span><span class="p">,</span>
|
||||
<span class="s2">"commit"</span><span class="p">:</span> <span class="n">commit_id</span><span class="p">,</span>
|
||||
<span class="s2">"deps"</span><span class="p">:</span> <span class="n">deps_dict</span><span class="p">,</span>
|
||||
<span class="s2">"compose_type"</span><span class="p">:</span> <span class="n">details</span><span class="p">[</span><span class="s2">"compose_type"</span><span class="p">],</span>
|
||||
<span class="s2">"queue_status"</span><span class="p">:</span> <span class="n">details</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">],</span>
|
||||
<span class="s2">"image_size"</span><span class="p">:</span> <span class="n">details</span><span class="p">[</span><span class="s2">"image_size"</span><span class="p">]</span>
|
||||
<span class="p">}</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_tar"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_tar">[docs]</a><span class="k">def</span> <span class="nf">uuid_tar</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">logs</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a tar of the build data</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :param metadata: Set to true to include all the metadata needed to reproduce the build</span>
|
||||
<span class="sd"> :type metadata: bool</span>
|
||||
<span class="sd"> :param image: Set to true to include the output image</span>
|
||||
<span class="sd"> :type image: bool</span>
|
||||
<span class="sd"> :param logs: Set to true to include the logs from the build</span>
|
||||
<span class="sd"> :type logs: bool</span>
|
||||
<span class="sd"> :returns: A stream of bytes from tar</span>
|
||||
<span class="sd"> :rtype: A generator</span>
|
||||
<span class="sd"> :raises: RuntimeError if there was a problem (eg. missing config file)</span>
|
||||
|
||||
<span class="sd"> This yields an uncompressed tar's data to the caller. It includes</span>
|
||||
<span class="sd"> the selected data to the caller by returning the Popen stdout from the tar process.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build_id"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Load the compose configuration</span>
|
||||
<span class="n">cfg_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"config.toml"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing config.toml for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">cfg_dict</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
<span class="n">image_name</span> <span class="o">=</span> <span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"image_name"</span><span class="p">]</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">include_file</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">f</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">"/logs"</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="n">logs</span>
|
||||
<span class="k">if</span> <span class="n">f</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="n">image_name</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="n">image</span>
|
||||
<span class="k">return</span> <span class="n">metadata</span>
|
||||
<span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">))</span> <span class="k">if</span> <span class="n">include_file</span><span class="p">(</span><span class="n">f</span><span class="p">)]</span>
|
||||
|
||||
<span class="n">tar</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">([</span><span class="s2">"tar"</span><span class="p">,</span> <span class="s2">"-C"</span><span class="p">,</span> <span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"-cf-"</span><span class="p">]</span> <span class="o">+</span> <span class="n">filenames</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">PIPE</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">tar</span><span class="o">.</span><span class="n">stdout</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_image"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_image">[docs]</a><span class="k">def</span> <span class="nf">uuid_image</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the filename and full path of the build's image file</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: The image filename and full path</span>
|
||||
<span class="sd"> :rtype: tuple of strings</span>
|
||||
<span class="sd"> :raises: RuntimeError if there was a problem (eg. invalid uuid, missing config file)</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">get_image_name</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="get_image_name"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.get_image_name">[docs]</a><span class="k">def</span> <span class="nf">get_image_name</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the filename and full path of the build's image file</span>
|
||||
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: The image filename and full path</span>
|
||||
<span class="sd"> :rtype: tuple of strings</span>
|
||||
<span class="sd"> :raises: RuntimeError if there was a problem (eg. invalid uuid, missing config file)</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build_id"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Load the compose configuration</span>
|
||||
<span class="n">cfg_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"config.toml"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing config.toml for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">cfg_dict</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">cfg_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
|
||||
<span class="n">image_name</span> <span class="o">=</span> <span class="n">cfg_dict</span><span class="p">[</span><span class="s2">"image_name"</span><span class="p">]</span>
|
||||
|
||||
<span class="k">return</span> <span class="p">(</span><span class="n">image_name</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="n">image_name</span><span class="p">))</span></div>
|
||||
|
||||
<div class="viewcode-block" id="uuid_log"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.uuid_log">[docs]</a><span class="k">def</span> <span class="nf">uuid_log</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1024</span><span class="p">):</span>
|
||||
<span class="sd">"""Return `size` kbytes from the end of the anaconda.log</span>
|
||||
|
||||
<span class="sd"> :param cfg: Configuration settings</span>
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :param size: Number of kbytes to read. Default is 1024</span>
|
||||
<span class="sd"> :type size: int</span>
|
||||
<span class="sd"> :returns: Up to `size` kbytes from the end of the log</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
<span class="sd"> :raises: RuntimeError if there was a problem (eg. no log file available)</span>
|
||||
|
||||
<span class="sd"> This function tries to return lines from the end of the log, it will</span>
|
||||
<span class="sd"> attempt to start on a line boundry, and may return less than `size` kbytes.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build_id"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># While a build is running the logs will be in /tmp/anaconda.log and when it</span>
|
||||
<span class="c1"># has finished they will be in the results directory</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Status is missing for </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"RUNNING"</span><span class="p">:</span>
|
||||
<span class="n">log_path</span> <span class="o">=</span> <span class="s2">"/tmp/anaconda.log"</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">log_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"logs"</span><span class="p">,</span> <span class="s2">"anaconda"</span><span class="p">,</span> <span class="s2">"anaconda.log"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">log_path</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"No anaconda.log available."</span><span class="p">)</span>
|
||||
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">log_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
|
||||
<span class="n">end</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">tell</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">end</span> <span class="o"><</span> <span class="mi">1024</span> <span class="o">*</span> <span class="n">size</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="n">end</span> <span class="o">-</span> <span class="p">(</span><span class="mi">1024</span> <span class="o">*</span> <span class="n">size</span><span class="p">))</span>
|
||||
<span class="c1"># Find the start of the next line and return the rest</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -1,282 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.server — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.server</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.server</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2017 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"lorax-composer"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">collections</span> <span class="k">import</span> <span class="n">namedtuple</span>
|
||||
<span class="kn">from</span> <span class="nn">flask</span> <span class="k">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">jsonify</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">send_from_directory</span>
|
||||
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">vernum</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.crossdomain</span> <span class="k">import</span> <span class="n">crossdomain</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.v0</span> <span class="k">import</span> <span class="n">v0_api</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
|
||||
<span class="n">GitLock</span> <span class="o">=</span> <span class="n">namedtuple</span><span class="p">(</span><span class="s2">"GitLock"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"repo"</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">,</span> <span class="s2">"dir"</span><span class="p">])</span>
|
||||
|
||||
<span class="n">server</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>
|
||||
|
||||
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"server"</span><span class="p">,</span> <span class="s2">"GitLock"</span><span class="p">]</span>
|
||||
|
||||
<span class="nd">@server</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s1">'/'</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">server_root</span><span class="p">():</span>
|
||||
<span class="n">redirect</span><span class="p">(</span><span class="s2">"/api/docs/"</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@server</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/docs/"</span><span class="p">)</span>
|
||||
<span class="nd">@server</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/docs/<path:path>"</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">api_docs</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="c1"># Find the html docs</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># This assumes it is running from the source tree</span>
|
||||
<span class="n">docs_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">),</span> <span class="s2">"../../../docs/html"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span>
|
||||
<span class="n">docs_path</span> <span class="o">=</span> <span class="n">glob</span><span class="p">(</span><span class="s2">"/usr/share/doc/lorax-*/html/"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">path</span><span class="p">:</span>
|
||||
<span class="n">path</span><span class="o">=</span><span class="s2">"index.html"</span>
|
||||
<span class="k">return</span> <span class="n">send_from_directory</span><span class="p">(</span><span class="n">docs_path</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@server</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/status"</span><span class="p">)</span>
|
||||
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s2">"*"</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">v0_status</span><span class="p">():</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> `/api/v0/status`</span>
|
||||
<span class="sd"> ^^^^^^^^^^^^^^^^</span>
|
||||
<span class="sd"> Return the status of the API Server::</span>
|
||||
|
||||
<span class="sd"> { "api": "0",</span>
|
||||
<span class="sd"> "build": "devel",</span>
|
||||
<span class="sd"> "db_supported": true,</span>
|
||||
<span class="sd"> "db_version": "0",</span>
|
||||
<span class="sd"> "schema_version": "0",</span>
|
||||
<span class="sd"> "backend": "lorax-composer",</span>
|
||||
<span class="sd"> "msgs": []}</span>
|
||||
|
||||
<span class="sd"> The 'msgs' field can be a list of strings describing startup problems or status that</span>
|
||||
<span class="sd"> should be displayed to the user. eg. if the compose templates are not depsolving properly</span>
|
||||
<span class="sd"> the errors will be in 'msgs'.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">backend</span><span class="o">=</span><span class="s2">"lorax-composer"</span><span class="p">,</span>
|
||||
<span class="n">build</span><span class="o">=</span><span class="n">vernum</span><span class="p">,</span>
|
||||
<span class="n">api</span><span class="o">=</span><span class="s2">"0"</span><span class="p">,</span>
|
||||
<span class="n">db_version</span><span class="o">=</span><span class="s2">"0"</span><span class="p">,</span>
|
||||
<span class="n">schema_version</span><span class="o">=</span><span class="s2">"0"</span><span class="p">,</span>
|
||||
<span class="n">db_supported</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">msgs</span><span class="o">=</span><span class="n">server</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"TEMPLATE_ERRORS"</span><span class="p">])</span>
|
||||
|
||||
<span class="n">v0_api</span><span class="p">(</span><span class="n">server</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -1,299 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.workspace — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.workspace</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.workspace</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2017 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">recipe_filename</span><span class="p">,</span> <span class="n">recipe_from_toml</span><span class="p">,</span> <span class="n">RecipeFileError</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="workspace_dir"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.workspace.workspace_dir">[docs]</a><span class="k">def</span> <span class="nf">workspace_dir</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">):</span>
|
||||
<span class="sd">"""Create the workspace's path from a Repository and branch</span>
|
||||
|
||||
<span class="sd"> :param repo: Open repository</span>
|
||||
<span class="sd"> :type repo: Git.Repository</span>
|
||||
<span class="sd"> :param branch: Branch name</span>
|
||||
<span class="sd"> :type branch: str</span>
|
||||
<span class="sd"> :returns: The path to the branch's workspace directory</span>
|
||||
<span class="sd"> :rtype: str</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">repo_path</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">get_location</span><span class="p">()</span><span class="o">.</span><span class="n">get_path</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">repo_path</span><span class="p">,</span> <span class="s2">"workspace"</span><span class="p">,</span> <span class="n">branch</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="workspace_read"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.workspace.workspace_read">[docs]</a><span class="k">def</span> <span class="nf">workspace_read</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_name</span><span class="p">):</span>
|
||||
<span class="sd">"""Read a Recipe from the branch's workspace</span>
|
||||
|
||||
<span class="sd"> :param repo: Open repository</span>
|
||||
<span class="sd"> :type repo: Git.Repository</span>
|
||||
<span class="sd"> :param branch: Branch name</span>
|
||||
<span class="sd"> :type branch: str</span>
|
||||
<span class="sd"> :param recipe_name: The name of the recipe</span>
|
||||
<span class="sd"> :type recipe_name: str</span>
|
||||
<span class="sd"> :returns: The workspace copy of the recipe, or None if it doesn't exist</span>
|
||||
<span class="sd"> :rtype: Recipe or None</span>
|
||||
<span class="sd"> :raises: RecipeFileError</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">ws_dir</span> <span class="o">=</span> <span class="n">workspace_dir</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">)</span>
|
||||
<span class="n">filename</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">recipe_name</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="kc">None</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">'rb'</span><span class="p">)</span>
|
||||
<span class="n">recipe</span> <span class="o">=</span> <span class="n">recipe_from_toml</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"UTF-8"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">RecipeFileError</span>
|
||||
<span class="k">return</span> <span class="n">recipe</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="workspace_write"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.workspace.workspace_write">[docs]</a><span class="k">def</span> <span class="nf">workspace_write</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe</span><span class="p">):</span>
|
||||
<span class="sd">"""Write a recipe to the workspace</span>
|
||||
|
||||
<span class="sd"> :param repo: Open repository</span>
|
||||
<span class="sd"> :type repo: Git.Repository</span>
|
||||
<span class="sd"> :param branch: Branch name</span>
|
||||
<span class="sd"> :type branch: str</span>
|
||||
<span class="sd"> :param recipe: The recipe to write to the workspace</span>
|
||||
<span class="sd"> :type recipe: Recipe</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> :raises: IO related errors</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">ws_dir</span> <span class="o">=</span> <span class="n">workspace_dir</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">)</span>
|
||||
<span class="n">filename</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">,</span> <span class="n">recipe</span><span class="o">.</span><span class="n">filename</span><span class="p">)</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">'wb'</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">recipe</span><span class="o">.</span><span class="n">toml</span><span class="p">()</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s2">"UTF-8"</span><span class="p">))</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="workspace_delete"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.workspace.workspace_delete">[docs]</a><span class="k">def</span> <span class="nf">workspace_delete</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_name</span><span class="p">):</span>
|
||||
<span class="sd">"""Delete the recipe from the workspace</span>
|
||||
|
||||
<span class="sd"> :param repo: Open repository</span>
|
||||
<span class="sd"> :type repo: Git.Repository</span>
|
||||
<span class="sd"> :param branch: Branch name</span>
|
||||
<span class="sd"> :type branch: str</span>
|
||||
<span class="sd"> :param recipe_name: The name of the recipe</span>
|
||||
<span class="sd"> :type recipe_name: str</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> :raises: IO related errors</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">ws_dir</span> <span class="o">=</span> <span class="n">workspace_dir</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">)</span>
|
||||
<span class="n">filename</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">ws_dir</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">recipe_name</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,38 +1,38 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.base — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>pylorax.base — Lorax 35.1 documentation</title>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
35.1
|
||||
</div>
|
||||
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
@ -87,15 +88,15 @@
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@ -130,11 +131,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
@ -177,7 +180,7 @@
|
||||
<span class="c1"># Red Hat Author(s): Martin Gracik <mgracik@redhat.com></span>
|
||||
<span class="c1">#</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">abc</span> <span class="k">import</span> <span class="n">ABCMeta</span><span class="p">,</span> <span class="n">abstractmethod</span>
|
||||
<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABCMeta</span><span class="p">,</span> <span class="n">abstractmethod</span>
|
||||
<span class="kn">import</span> <span class="nn">sys</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">pylorax.output</span> <span class="k">as</span> <span class="nn">output</span>
|
||||
@ -185,7 +188,7 @@
|
||||
|
||||
<div class="viewcode-block" id="BaseLoraxClass"><a class="viewcode-back" href="../../pylorax.html#pylorax.base.BaseLoraxClass">[docs]</a><span class="k">class</span> <span class="nc">BaseLoraxClass</span><span class="p">(</span><span class="nb">object</span><span class="p">,</span> <span class="n">metaclass</span><span class="o">=</span><span class="n">ABCMeta</span><span class="p">):</span>
|
||||
<span class="nd">@abstractmethod</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">LoraxOutput</span><span class="p">()</span>
|
||||
|
||||
<div class="viewcode-block" id="BaseLoraxClass.pcritical"><a class="viewcode-back" href="../../pylorax.html#pylorax.base.BaseLoraxClass.pcritical">[docs]</a> <span class="k">def</span> <span class="nf">pcritical</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">fobj</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="p">):</span>
|
||||
@ -206,19 +209,19 @@
|
||||
|
||||
<div class="viewcode-block" id="DataHolder"><a class="viewcode-back" href="../../pylorax.html#pylorax.base.DataHolder">[docs]</a><span class="k">class</span> <span class="nc">DataHolder</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">attr</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||
<span class="bp">self</span><span class="p">[</span><span class="n">attr</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">attr</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">attr</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">attr</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">attr</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">AttributeError</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">attr</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">attr</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="p">[</span><span class="n">attr</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
|
||||
|
||||
<div class="viewcode-block" id="DataHolder.copy"><a class="viewcode-back" href="../../pylorax.html#pylorax.base.DataHolder.copy">[docs]</a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
@ -230,19 +233,24 @@
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
© Copyright 2018, Red Hat, Inc..
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -251,7 +259,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.buildstamp — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.buildstamp — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.buildstamp</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -181,18 +95,23 @@
|
||||
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax.buildstamp"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">datetime</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="BuildStamp"><a class="viewcode-back" href="../../pylorax.html#pylorax.buildstamp.BuildStamp">[docs]</a><span class="k">class</span> <span class="nc">BuildStamp</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">bugurl</span><span class="p">,</span> <span class="n">isfinal</span><span class="p">,</span> <span class="n">buildarch</span><span class="p">,</span> <span class="n">variant</span><span class="o">=</span><span class="s2">""</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">bugurl</span><span class="p">,</span> <span class="n">isfinal</span><span class="p">,</span> <span class="n">buildarch</span><span class="p">,</span> <span class="n">variant</span><span class="o">=</span><span class="s2">""</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">product</span> <span class="o">=</span> <span class="n">product</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">version</span> <span class="o">=</span> <span class="n">version</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">bugurl</span> <span class="o">=</span> <span class="n">bugurl</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">isfinal</span> <span class="o">=</span> <span class="n">isfinal</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">variant</span> <span class="o">=</span> <span class="n">variant</span>
|
||||
|
||||
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="s1">'SOURCE_DATE_EPOCH'</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
|
||||
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">utcfromtimestamp</span><span class="p">(</span>
|
||||
<span class="nb">int</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">'SOURCE_DATE_EPOCH'</span><span class="p">]))</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
|
||||
<span class="n">now</span> <span class="o">=</span> <span class="n">now</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">"%Y%m</span><span class="si">%d</span><span class="s2">%H%M"</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">uuid</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{0}</span><span class="s2">.</span><span class="si">{1}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">now</span><span class="p">,</span> <span class="n">buildarch</span><span class="p">)</span>
|
||||
|
||||
@ -220,42 +139,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.cmdline — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.cmdline — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.cmdline</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -180,7 +94,7 @@
|
||||
<span class="kn">import</span> <span class="nn">sys</span>
|
||||
<span class="kn">import</span> <span class="nn">argparse</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">vernum</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="kn">import</span> <span class="n">DEFAULT_RELEASEVER</span><span class="p">,</span> <span class="n">vernum</span>
|
||||
|
||||
<span class="n">version</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{0}</span><span class="s2">-</span><span class="si">{1}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="n">vernum</span><span class="p">)</span>
|
||||
|
||||
@ -261,20 +175,27 @@
|
||||
<span class="n">metavar</span><span class="o">=</span><span class="s2">"[repo]"</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">"Names of repos to enable"</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--disablerepo"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"append"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="p">[],</span> <span class="n">dest</span><span class="o">=</span><span class="s2">"disablerepos"</span><span class="p">,</span>
|
||||
<span class="n">metavar</span><span class="o">=</span><span class="s2">"[repo]"</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">"Names of repos to disable"</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--rootfs-size"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Size of root filesystem in GiB. Defaults to 3."</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--rootfs-size"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Size of root filesystem in GiB. Defaults to 2."</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--noverifyssl"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Do not verify SSL certificates"</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--dnfplugin"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"append"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="p">[],</span> <span class="n">dest</span><span class="o">=</span><span class="s2">"dnfplugins"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Enable a DNF plugin by name/glob, or * to enable all of them."</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--squashfs-only"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Use a plain squashfs filesystem for the runtime."</span><span class="p">)</span>
|
||||
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--skip-branding"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Disable automatic branding package selection. Use --installpkgs to add custom branding."</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># dracut arguments</span>
|
||||
<span class="n">dracut_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"dracut arguments"</span><span class="p">)</span>
|
||||
<span class="n">dracut_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"dracut arguments: (default: </span><span class="si">%s</span><span class="s2">)"</span> <span class="o">%</span> <span class="n">dracut_default</span><span class="p">)</span>
|
||||
<span class="n">dracut_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--dracut-conf"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to a dracut.conf file to use instead of the "</span>
|
||||
<span class="s2">"default arguments. See the dracut.conf(5) manpage."</span><span class="p">)</span>
|
||||
<span class="n">dracut_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--dracut-arg"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"append"</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">"dracut_args"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Argument to pass to dracut when "</span>
|
||||
<span class="s2">"rebuilding the initramfs. Pass this "</span>
|
||||
<span class="s2">"once for each argument. NOTE: this "</span>
|
||||
<span class="s2">"overrides the default. (default: </span><span class="si">%s</span><span class="s2">)"</span> <span class="o">%</span> <span class="n">dracut_default</span><span class="p">)</span>
|
||||
<span class="s2">"overrides the defaults."</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># add the show version option</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"-V"</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">"show program's version number and exit"</span><span class="p">,</span>
|
||||
@ -402,7 +323,7 @@
|
||||
|
||||
<span class="c1"># Group of arguments to pass to qemu</span>
|
||||
<span class="n">virt_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"qemu arguments"</span><span class="p">)</span>
|
||||
<span class="n">virt_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--ram"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"MEMORY"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span>
|
||||
<span class="n">virt_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--ram"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"MEMORY"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">2048</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Memory to allocate for installer in megabytes."</span><span class="p">)</span>
|
||||
<span class="n">virt_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--vcpus"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Passed to qemu -smp command"</span><span class="p">)</span>
|
||||
@ -424,12 +345,15 @@
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"RNG device for QEMU (none for no RNG)"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># dracut arguments</span>
|
||||
<span class="n">dracut_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"dracut arguments"</span><span class="p">)</span>
|
||||
<span class="n">dracut_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"dracut arguments: (default: </span><span class="si">%s</span><span class="s2">)"</span> <span class="o">%</span> <span class="n">dracut_default</span><span class="p">)</span>
|
||||
<span class="n">dracut_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--dracut-conf"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Path to a dracut.conf file to use instead of the "</span>
|
||||
<span class="s2">"default arguments. See the dracut.conf(5) manpage."</span><span class="p">)</span>
|
||||
<span class="n">dracut_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--dracut-arg"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"append"</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">"dracut_args"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Argument to pass to dracut when "</span>
|
||||
<span class="s2">"rebuilding the initramfs. Pass this "</span>
|
||||
<span class="s2">"once for each argument. NOTE: this "</span>
|
||||
<span class="s2">"overrides the default. (default: </span><span class="si">%s</span><span class="s2">)"</span> <span class="o">%</span> <span class="n">dracut_default</span><span class="p">)</span>
|
||||
<span class="s2">"overrides the defaults."</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># pxe to live arguments</span>
|
||||
<span class="n">pxelive_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"pxe to live arguments"</span><span class="p">)</span>
|
||||
@ -452,15 +376,13 @@
|
||||
<span class="n">vagrant_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--vagrantfile"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"optional vagrantfile"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--title"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"Linux Live Media"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Substituted for @TITLE@ in bootloader config files"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--project"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"Linux"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"substituted for @PROJECT@ in bootloader config files"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--releasever"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">"8"</span><span class="p">,</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--releasever"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">DEFAULT_RELEASEVER</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"substituted for @VERSION@ in bootloader config files"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--volid"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">"volume id"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--squashfs_args"</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"additional squashfs args"</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--squashfs-only"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Use a plain squashfs filesystem for the runtime."</span><span class="p">)</span>
|
||||
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--timeout"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Cancel installer after X minutes"</span><span class="p">)</span>
|
||||
|
||||
@ -472,42 +394,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.creator — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.creator — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.creator</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -183,30 +97,30 @@
|
||||
<span class="kn">import</span> <span class="nn">glob</span>
|
||||
|
||||
<span class="c1"># Use Mako templates for appliance builder descriptions</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.template</span> <span class="k">import</span> <span class="n">Template</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.exceptions</span> <span class="k">import</span> <span class="n">text_error_template</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.template</span> <span class="kn">import</span> <span class="n">Template</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.exceptions</span> <span class="kn">import</span> <span class="n">text_error_template</span>
|
||||
|
||||
<span class="c1"># Use pykickstart to calculate disk image size</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.parser</span> <span class="k">import</span> <span class="n">KickstartParser</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.constants</span> <span class="k">import</span> <span class="n">KS_SHUTDOWN</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.version</span> <span class="k">import</span> <span class="n">makeVersion</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.parser</span> <span class="kn">import</span> <span class="n">KickstartParser</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.constants</span> <span class="kn">import</span> <span class="n">KS_SHUTDOWN</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.version</span> <span class="kn">import</span> <span class="n">makeVersion</span>
|
||||
|
||||
<span class="c1"># Use the Lorax treebuilder branch for iso creation</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">ArchData</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">execWithRedirect</span><span class="p">,</span> <span class="n">runcmd</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">PartitionMount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">mount</span><span class="p">,</span> <span class="n">umount</span><span class="p">,</span> <span class="n">Mount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">mksquashfs</span><span class="p">,</span> <span class="n">mkrootfsimg</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">copytree</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.installer</span> <span class="k">import</span> <span class="n">novirt_install</span><span class="p">,</span> <span class="n">virt_install</span><span class="p">,</span> <span class="n">InstallError</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="k">import</span> <span class="n">TreeBuilder</span><span class="p">,</span> <span class="n">RuntimeBuilder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="k">import</span> <span class="n">findkernels</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">remove</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="kn">import</span> <span class="n">DEFAULT_RELEASEVER</span><span class="p">,</span> <span class="n">ArchData</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="kn">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">execWithRedirect</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">DracutChroot</span><span class="p">,</span> <span class="n">PartitionMount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">mount</span><span class="p">,</span> <span class="n">umount</span><span class="p">,</span> <span class="n">Mount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">mksquashfs</span><span class="p">,</span> <span class="n">mkrootfsimg</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">copytree</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.installer</span> <span class="kn">import</span> <span class="n">novirt_install</span><span class="p">,</span> <span class="n">virt_install</span><span class="p">,</span> <span class="n">InstallError</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="kn">import</span> <span class="n">TreeBuilder</span><span class="p">,</span> <span class="n">RuntimeBuilder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="kn">import</span> <span class="n">findkernels</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">remove</span>
|
||||
|
||||
|
||||
<span class="c1"># Default parameters for rebuilding initramfs, override with --dracut-args</span>
|
||||
<span class="n">DRACUT_DEFAULT</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--xz"</span><span class="p">,</span> <span class="s2">"--add"</span><span class="p">,</span> <span class="s2">"livenet dmsquash-live convertfs pollcdrom qemu qemu-net"</span><span class="p">,</span>
|
||||
<span class="c1"># Default parameters for rebuilding initramfs, override with --dracut-arg or --dracut-conf</span>
|
||||
<span class="n">DRACUT_DEFAULT</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--xz"</span><span class="p">,</span> <span class="s2">"--add"</span><span class="p">,</span> <span class="s2">"livenet dmsquash-live dmsquash-live-ntfs convertfs pollcdrom qemu qemu-net"</span><span class="p">,</span>
|
||||
<span class="s2">"--omit"</span><span class="p">,</span> <span class="s2">"plymouth"</span><span class="p">,</span> <span class="s2">"--no-hostonly"</span><span class="p">,</span> <span class="s2">"--debug"</span><span class="p">,</span> <span class="s2">"--no-early-microcode"</span><span class="p">]</span>
|
||||
|
||||
<span class="n">RUNTIME</span> <span class="o">=</span> <span class="s2">"images/install.img"</span>
|
||||
@ -219,7 +133,7 @@
|
||||
<span class="sd"> templates, so the the installroot config value is the important part of</span>
|
||||
<span class="sd"> this. Everything else should be a nop.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">conf</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">conf</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span> <span class="o">=</span> <span class="n">conf</span>
|
||||
|
||||
<div class="viewcode-block" id="FakeDNF.reset"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.FakeDNF.reset">[docs]</a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
@ -278,16 +192,36 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">compression</span> <span class="o">=</span> <span class="n">opts</span><span class="o">.</span><span class="n">compression</span> <span class="ow">or</span> <span class="s2">"xz"</span>
|
||||
<span class="n">arch</span> <span class="o">=</span> <span class="n">ArchData</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">arch</span> <span class="ow">or</span> <span class="n">os</span><span class="o">.</span><span class="n">uname</span><span class="p">()</span><span class="o">.</span><span class="n">machine</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">compression</span> <span class="o">==</span> <span class="s2">"xz"</span> <span class="ow">and</span> <span class="n">arch</span><span class="o">.</span><span class="n">bcj</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">compression</span> <span class="o">==</span> <span class="s2">"xz"</span> <span class="ow">and</span> <span class="n">arch</span><span class="o">.</span><span class="n">bcj</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">compress_args</span><span class="p">:</span>
|
||||
<span class="c1"># default to bcj when using xz</span>
|
||||
<span class="n">compressargs</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"-Xbcj"</span><span class="p">,</span> <span class="n">arch</span><span class="o">.</span><span class="n">bcj</span><span class="p">]</span>
|
||||
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">compress_args</span><span class="p">:</span>
|
||||
<span class="n">compressargs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">compress_args</span><span class="p">:</span>
|
||||
<span class="n">compressargs</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">compressargs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">return</span> <span class="p">(</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="dracut_args"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.dracut_args">[docs]</a><span class="k">def</span> <span class="nf">dracut_args</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a list of the args to pass to dracut</span>
|
||||
|
||||
<span class="sd"> Return the default argument list unless one of the dracut cmdline arguments</span>
|
||||
<span class="sd"> has been used.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_conf</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="p">[</span><span class="s2">"--conf"</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_conf</span><span class="p">]</span>
|
||||
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
|
||||
<span class="n">args</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
|
||||
<span class="n">args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">args</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">DRACUT_DEFAULT</span></div>
|
||||
|
||||
<div class="viewcode-block" id="make_appliance"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.make_appliance">[docs]</a><span class="k">def</span> <span class="nf">make_appliance</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">template</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">networks</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ram</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span>
|
||||
<span class="n">vcpus</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">arch</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s2">"Linux"</span><span class="p">,</span> <span class="n">project</span><span class="o">=</span><span class="s2">"Linux"</span><span class="p">,</span>
|
||||
<span class="n">releasever</span><span class="o">=</span><span class="s2">"29"</span><span class="p">):</span>
|
||||
<span class="n">releasever</span><span class="o">=</span><span class="n">DEFAULT_RELEASEVER</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Generate an appliance description file</span>
|
||||
|
||||
@ -301,7 +235,7 @@
|
||||
<span class="sd"> :param str arch: CPU architecture. Default is 'x86_64'</span>
|
||||
<span class="sd"> :param str title: Title, passed to template. Default is 'Linux'</span>
|
||||
<span class="sd"> :param str project: Project, passed to template. Default is 'Linux'</span>
|
||||
<span class="sd"> :param str releasever: Release version, passed to template. Default is 29</span>
|
||||
<span class="sd"> :param str releasever: Release version, passed to template.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">disk_img</span> <span class="ow">and</span> <span class="n">template</span> <span class="ow">and</span> <span class="n">outfile</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="kc">None</span>
|
||||
@ -343,6 +277,8 @@
|
||||
<span class="sd"> :param str mount_dir: Directory tree to compress</span>
|
||||
<span class="sd"> :param str work_dir: Output compressed image to work_dir+images/install.img</span>
|
||||
<span class="sd"> :param int size: Size of disk image, in GiB</span>
|
||||
<span class="sd"> :returns: rc of squashfs creation</span>
|
||||
<span class="sd"> :rtype: int</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">kernel_arch</span> <span class="o">=</span> <span class="n">get_arch</span><span class="p">(</span><span class="n">mount_dir</span><span class="p">)</span>
|
||||
|
||||
@ -354,15 +290,17 @@
|
||||
<span class="n">product</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">project</span><span class="p">,</span> <span class="n">version</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">releasever</span><span class="p">,</span> <span class="n">release</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span>
|
||||
<span class="n">variant</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">bugurl</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">isfinal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># This is a mounted image partition, cannot hardlink to it, so just use it</span>
|
||||
<span class="c1"># symlink mount_dir/images to work_dir/images so we don't run out of space</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">))</span>
|
||||
|
||||
<span class="n">rb</span> <span class="o">=</span> <span class="n">RuntimeBuilder</span><span class="p">(</span><span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">fake_dbo</span><span class="p">)</span>
|
||||
<span class="n">rb</span> <span class="o">=</span> <span class="n">RuntimeBuilder</span><span class="p">(</span><span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">fake_dbo</span><span class="p">,</span> <span class="n">skip_branding</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span> <span class="o">=</span> <span class="n">squashfs_args</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Creating runtime"</span><span class="p">)</span>
|
||||
<span class="n">rb</span><span class="o">.</span><span class="n">create_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">),</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span>
|
||||
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">)</span></div>
|
||||
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">squashfs_only</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Creating a squashfs only runtime"</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">rb</span><span class="o">.</span><span class="n">create_squashfs_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">),</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span>
|
||||
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Creating a squashfs+ext4 runtime"</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">rb</span><span class="o">.</span><span class="n">create_ext4_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">),</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span>
|
||||
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="rebuild_initrds_for_live"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.rebuild_initrds_for_live">[docs]</a><span class="k">def</span> <span class="nf">rebuild_initrds_for_live</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">sys_root_dir</span><span class="p">,</span> <span class="n">results_dir</span><span class="p">):</span>
|
||||
@ -374,15 +312,10 @@
|
||||
<span class="sd"> :param str sys_root_dir: Path to root of the system</span>
|
||||
<span class="sd"> :param str results_dir: Path of directory for storing results</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">=</span> <span class="n">DRACUT_DEFAULT</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"dracut args = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dracut_args</span><span class="p">)</span>
|
||||
<span class="c1"># cmdline dracut args override the defaults, but need to be parsed</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"dracut args = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dracut_args</span><span class="p">(</span><span class="n">opts</span><span class="p">))</span>
|
||||
|
||||
<span class="n">dracut</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"dracut"</span><span class="p">,</span> <span class="s2">"--nomdadmconf"</span><span class="p">,</span> <span class="s2">"--nolvmconf"</span><span class="p">]</span> <span class="o">+</span> <span class="n">dracut_args</span>
|
||||
<span class="n">args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--nomdadmconf"</span><span class="p">,</span> <span class="s2">"--nolvmconf"</span><span class="p">]</span> <span class="o">+</span> <span class="n">dracut_args</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
|
||||
|
||||
<span class="n">kdir</span> <span class="o">=</span> <span class="s2">"boot"</span>
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">ostree</span><span class="p">:</span>
|
||||
@ -394,9 +327,6 @@
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">kernels</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">"No initrds found, cannot rebuild_initrds"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Hush some dracut warnings. TODO: bind-mount proc in place?</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span><span class="s2">"/proc/modules"</span><span class="p">),</span><span class="s2">"w"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">ostree</span><span class="p">:</span>
|
||||
<span class="c1"># Dracut assumes to have some dirs in disk image</span>
|
||||
<span class="c1"># /var/tmp for temp files</span>
|
||||
@ -414,26 +344,18 @@
|
||||
|
||||
<span class="c1"># Write the new initramfs directly to the results directory</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="s2">"results"</span><span class="p">))</span>
|
||||
<span class="n">mount</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">"bind"</span><span class="p">,</span> <span class="n">mnt</span><span class="o">=</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="s2">"results"</span><span class="p">))</span>
|
||||
<span class="c1"># Dracut runs out of space inside the minimal rootfs image</span>
|
||||
<span class="n">mount</span><span class="p">(</span><span class="s2">"/var/tmp"</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">"bind"</span><span class="p">,</span> <span class="n">mnt</span><span class="o">=</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="s2">"var/tmp"</span><span class="p">))</span>
|
||||
<span class="k">for</span> <span class="n">kernel</span> <span class="ow">in</span> <span class="n">kernels</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">kernel</span><span class="p">,</span> <span class="s2">"initrd"</span><span class="p">):</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">kernel</span><span class="o">.</span><span class="n">initrd</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Construct an initrd from the kernel name</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"vmlinuz-"</span><span class="p">,</span> <span class="s2">"initrd-"</span><span class="p">)</span> <span class="o">+</span> <span class="s2">".img"</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"rebuilding </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">with</span> <span class="n">DracutChroot</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="n">bind</span><span class="o">=</span><span class="p">[(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"/results"</span><span class="p">)])</span> <span class="k">as</span> <span class="n">dracut</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">kernel</span> <span class="ow">in</span> <span class="n">kernels</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">kernel</span><span class="p">,</span> <span class="s2">"initrd"</span><span class="p">):</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">kernel</span><span class="o">.</span><span class="n">initrd</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Construct an initrd from the kernel name</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"vmlinuz-"</span><span class="p">,</span> <span class="s2">"initrd-"</span><span class="p">)</span> <span class="o">+</span> <span class="s2">".img"</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"rebuilding </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
|
||||
<span class="n">kver</span> <span class="o">=</span> <span class="n">kernel</span><span class="o">.</span><span class="n">version</span>
|
||||
|
||||
<span class="n">cmd</span> <span class="o">=</span> <span class="n">dracut</span> <span class="o">+</span> <span class="p">[</span><span class="s2">"/results/"</span><span class="o">+</span><span class="n">outfile</span><span class="p">,</span> <span class="n">kver</span><span class="p">]</span>
|
||||
<span class="n">runcmd</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">sys_root_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="p">),</span> <span class="n">results_dir</span><span class="p">)</span>
|
||||
<span class="n">umount</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="s2">"var/tmp"</span><span class="p">),</span> <span class="n">delete</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">umount</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="s2">"results"</span><span class="p">),</span> <span class="n">delete</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span><span class="s2">"/proc/modules"</span><span class="p">))</span></div>
|
||||
<span class="n">kver</span> <span class="o">=</span> <span class="n">kernel</span><span class="o">.</span><span class="n">version</span>
|
||||
<span class="n">dracut</span><span class="o">.</span><span class="n">Run</span><span class="p">(</span><span class="n">args</span> <span class="o">+</span> <span class="p">[</span><span class="s2">"/results/"</span><span class="o">+</span><span class="n">outfile</span><span class="p">,</span> <span class="n">kver</span><span class="p">])</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sys_root_dir</span><span class="p">,</span> <span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="p">),</span> <span class="n">results_dir</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="create_pxe_config"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.create_pxe_config">[docs]</a><span class="k">def</span> <span class="nf">create_pxe_config</span><span class="p">(</span><span class="n">template</span><span class="p">,</span> <span class="n">images_dir</span><span class="p">,</span> <span class="n">live_image_name</span><span class="p">,</span> <span class="n">add_args</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
@ -493,8 +415,10 @@
|
||||
<span class="c1"># Link /images to work_dir/images to make the templates happy</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">islink</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">mount_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">)):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">mount_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">))</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"/bin/ln"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-s"</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">),</span>
|
||||
<span class="n">joinpaths</span><span class="p">(</span><span class="n">mount_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">)])</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"/bin/ln"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-s"</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">),</span>
|
||||
<span class="n">joinpaths</span><span class="p">(</span><span class="n">mount_dir</span><span class="p">,</span> <span class="s2">"images"</span><span class="p">)])</span>
|
||||
<span class="k">if</span> <span class="n">rc</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Failed to symlink images from mount_dir to work_dir"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># The templates expect the config files to be in /tmp/config_files</span>
|
||||
<span class="c1"># I think these should be release specific, not from lorax, but for now</span>
|
||||
@ -516,14 +440,8 @@
|
||||
<span class="n">templatedir</span><span class="o">=</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">lorax_templates</span><span class="p">,</span><span class="s2">"live/"</span><span class="p">),</span>
|
||||
<span class="n">extra_boot_args</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">extra_boot_args</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Rebuilding initrds"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">=</span> <span class="n">DRACUT_DEFAULT</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
|
||||
<span class="n">dracut_args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"dracut args = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dracut_args</span><span class="p">)</span>
|
||||
<span class="n">tb</span><span class="o">.</span><span class="n">rebuild_initrds</span><span class="p">(</span><span class="n">add_args</span><span class="o">=</span><span class="n">dracut_args</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"dracut args = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dracut_args</span><span class="p">(</span><span class="n">opts</span><span class="p">))</span>
|
||||
<span class="n">tb</span><span class="o">.</span><span class="n">rebuild_initrds</span><span class="p">(</span><span class="n">add_args</span><span class="o">=</span><span class="n">dracut_args</span><span class="p">(</span><span class="n">opts</span><span class="p">))</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Building boot.iso"</span><span class="p">)</span>
|
||||
<span class="n">tb</span><span class="o">.</span><span class="n">build</span><span class="p">()</span>
|
||||
|
||||
@ -559,43 +477,6 @@
|
||||
<span class="n">remove</span><span class="p">(</span><span class="n">tmp_mount_dir</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">sysroot_boot_dir</span></div>
|
||||
|
||||
<div class="viewcode-block" id="make_squashfs"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.make_squashfs">[docs]</a><span class="k">def</span> <span class="nf">make_squashfs</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Create a squashfs image of an unpartitioned filesystem disk image</span>
|
||||
|
||||
<span class="sd"> :param str disk_img: Path to the unpartitioned filesystem disk image</span>
|
||||
<span class="sd"> :param str work_dir: Output compressed image to work_dir+images/install.img</span>
|
||||
<span class="sd"> :param str compression: Compression type to use</span>
|
||||
<span class="sd"> :returns: True if squashfs creation was successful. False if there was an error.</span>
|
||||
<span class="sd"> :rtype: bool</span>
|
||||
|
||||
<span class="sd"> Take disk_img and put it into LiveOS/rootfs.img and squashfs this</span>
|
||||
<span class="sd"> tree into work_dir+images/install.img</span>
|
||||
|
||||
<span class="sd"> fsck.ext4 is run on the disk image to make sure there are no errors and to zero</span>
|
||||
<span class="sd"> out any deleted blocks to make it compress better. If this fails for any reason</span>
|
||||
<span class="sd"> it will return False and log the error.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># Make sure free blocks are actually zeroed so it will compress</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"/usr/sbin/fsck.ext4"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-y"</span><span class="p">,</span> <span class="s2">"-f"</span><span class="p">,</span> <span class="s2">"-E"</span><span class="p">,</span> <span class="s2">"discard"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
<span class="k">if</span> <span class="n">rc</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"Problem zeroing free blocks of </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="kc">False</span>
|
||||
|
||||
<span class="n">liveos_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="s2">"runtime/LiveOS"</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">liveos_dir</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">)))</span>
|
||||
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"/bin/ln"</span><span class="p">,</span> <span class="p">[</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">liveos_dir</span><span class="p">,</span> <span class="s2">"rootfs.img"</span><span class="p">)])</span>
|
||||
<span class="k">if</span> <span class="n">rc</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">liveos_dir</span><span class="p">,</span> <span class="s2">"rootfs.img"</span><span class="p">))</span>
|
||||
|
||||
<span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span> <span class="o">=</span> <span class="n">squashfs_args</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
|
||||
<span class="n">mksquashfs</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="s2">"runtime"</span><span class="p">),</span>
|
||||
<span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">),</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span>
|
||||
<span class="n">remove</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="s2">"runtime"</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="kc">True</span></div>
|
||||
|
||||
<div class="viewcode-block" id="calculate_disk_size"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.calculate_disk_size">[docs]</a><span class="k">def</span> <span class="nf">calculate_disk_size</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">):</span>
|
||||
<span class="sd">""" Calculate the disk size from the kickstart</span>
|
||||
|
||||
@ -755,7 +636,10 @@
|
||||
<span class="n">add_pxe_args</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">live_image_name</span> <span class="o">=</span> <span class="s2">"live-rootfs.squashfs.img"</span>
|
||||
<span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span> <span class="o">=</span> <span class="n">squashfs_args</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
|
||||
<span class="n">mksquashfs</span><span class="p">(</span><span class="n">squashfs_root_dir</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">live_image_name</span><span class="p">),</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">mksquashfs</span><span class="p">(</span><span class="n">squashfs_root_dir</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">live_image_name</span><span class="p">),</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">rc</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"mksquashfs failed to create </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">live_image_name</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="kc">None</span>
|
||||
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Rebuilding initramfs for live"</span><span class="p">)</span>
|
||||
<span class="k">with</span> <span class="n">Mount</span><span class="p">(</span><span class="n">rootfs_img</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">"loop"</span><span class="p">)</span> <span class="k">as</span> <span class="n">mnt_dir</span><span class="p">:</span>
|
||||
@ -872,22 +756,24 @@
|
||||
<span class="k">if</span> <span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">fs_image</span> <span class="ow">or</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">disk_image</span><span class="p">:</span>
|
||||
<span class="c1"># Create iso from a filesystem image</span>
|
||||
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">opts</span><span class="o">.</span><span class="n">fs_image</span> <span class="ow">or</span> <span class="n">disk_img</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">make_squashfs</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"squashfs.img creation failed"</span><span class="p">)</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"squashfs.img creation failed"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">cancel_func</span> <span class="ow">and</span> <span class="n">cancel_func</span><span class="p">():</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"ISO creation canceled"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">with</span> <span class="n">Mount</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">"loop"</span><span class="p">)</span> <span class="k">as</span> <span class="n">mount_dir</span><span class="p">:</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">make_runtime</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">mount_dir</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">,</span> <span class="n">calculate_disk_size</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">)</span><span class="o">/</span><span class="mf">1024.0</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">rc</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"make_runtime failed with rc = </span><span class="si">%d</span><span class="s2">. See program.log"</span><span class="p">,</span> <span class="n">rc</span><span class="p">)</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"make_runtime failed with rc = </span><span class="si">%d</span><span class="s2">"</span> <span class="o">%</span> <span class="n">rc</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">cancel_func</span> <span class="ow">and</span> <span class="n">cancel_func</span><span class="p">():</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"ISO creation canceled"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">result_dir</span> <span class="o">=</span> <span class="n">make_livecd</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">mount_dir</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Create iso from a partitioned disk image</span>
|
||||
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">opts</span><span class="o">.</span><span class="n">disk_image</span> <span class="ow">or</span> <span class="n">disk_img</span>
|
||||
<span class="k">with</span> <span class="n">PartitionMount</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span> <span class="k">as</span> <span class="n">img_mount</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">img_mount</span> <span class="ow">and</span> <span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">:</span>
|
||||
<span class="n">make_runtime</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">,</span> <span class="n">calculate_disk_size</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">)</span><span class="o">/</span><span class="mf">1024.0</span><span class="p">)</span>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">make_runtime</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">,</span> <span class="n">calculate_disk_size</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">)</span><span class="o">/</span><span class="mf">1024.0</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">rc</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"make_runtime failed with rc = </span><span class="si">%d</span><span class="s2">. See program.log"</span><span class="p">,</span> <span class="n">rc</span><span class="p">)</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"make_runtime failed with rc = </span><span class="si">%d</span><span class="s2">"</span> <span class="o">%</span> <span class="n">rc</span><span class="p">)</span>
|
||||
<span class="n">result_dir</span> <span class="o">=</span> <span class="n">make_livecd</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># --iso-only removes the extra build artifacts, keeping only the boot.iso</span>
|
||||
@ -936,42 +822,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,38 +1,38 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.decorators — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>pylorax.decorators — Lorax 35.1 documentation</title>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
35.1
|
||||
</div>
|
||||
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
@ -87,15 +88,15 @@
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@ -130,11 +131,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
@ -193,19 +196,24 @@
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
© Copyright 2018, Red Hat, Inc..
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -214,7 +222,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.discinfo — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.discinfo — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.discinfo</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -180,60 +94,54 @@
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax.discinfo"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">time</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="DiscInfo"><a class="viewcode-back" href="../../pylorax.html#pylorax.discinfo.DiscInfo">[docs]</a><span class="k">class</span> <span class="nc">DiscInfo</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">release</span><span class="p">,</span> <span class="n">basearch</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">release</span><span class="p">,</span> <span class="n">basearch</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">release</span> <span class="o">=</span> <span class="n">release</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">basearch</span> <span class="o">=</span> <span class="n">basearch</span>
|
||||
|
||||
<div class="viewcode-block" id="DiscInfo.write"><a class="viewcode-back" href="../../pylorax.html#pylorax.discinfo.DiscInfo.write">[docs]</a> <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="s1">'SOURCE_DATE_EPOCH'</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
|
||||
<span class="n">timestamp</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">'SOURCE_DATE_EPOCH'</span><span class="p">])</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
|
||||
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"writing .discinfo file"</span><span class="p">)</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">fobj</span><span class="p">:</span>
|
||||
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">{0:f}</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()))</span>
|
||||
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">{0:f}</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">timestamp</span><span class="p">))</span>
|
||||
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">{0.release}</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span>
|
||||
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">{0.basearch}</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span></div></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.dnfbase — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.dnfbase — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,93 +33,44 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.dnfbase</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.dnfbase</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2020 Red Hat, Inc.</span>
|
||||
<span></span><span class="c1"># Copyright (C) 2018 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
@ -173,19 +86,19 @@
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"lorax"</span><span class="p">)</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">dnf</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">DEFAULT_PLATFORM_ID</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">flatconfig</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="kn">import</span> <span class="n">DEFAULT_PLATFORM_ID</span><span class="p">,</span> <span class="n">DEFAULT_RELEASEVER</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">flatconfig</span>
|
||||
|
||||
<div class="viewcode-block" id="get_dnf_base_object"><a class="viewcode-back" href="../../pylorax.html#pylorax.dnfbase.get_dnf_base_object">[docs]</a><span class="k">def</span> <span class="nf">get_dnf_base_object</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">mirrorlists</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">repos</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">enablerepos</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">disablerepos</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">tempdir</span><span class="o">=</span><span class="s2">"/var/tmp"</span><span class="p">,</span> <span class="n">proxy</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">releasever</span><span class="o">=</span><span class="s2">"8"</span><span class="p">,</span>
|
||||
<span class="n">cachedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">logdir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">sslverify</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
|
||||
<span class="n">tempdir</span><span class="o">=</span><span class="s2">"/var/tmp"</span><span class="p">,</span> <span class="n">proxy</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">releasever</span><span class="o">=</span><span class="n">DEFAULT_RELEASEVER</span><span class="p">,</span>
|
||||
<span class="n">cachedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">logdir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">sslverify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dnfplugins</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">""" Create a dnf Base object and setup the repositories and installroot</span>
|
||||
|
||||
<span class="sd"> :param string installroot: Full path to the installroot</span>
|
||||
@ -212,6 +125,8 @@
|
||||
<span class="k">return</span> <span class="kc">None</span>
|
||||
|
||||
<span class="n">mirrorlists</span> <span class="o">=</span> <span class="n">mirrorlists</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="n">enablerepos</span> <span class="o">=</span> <span class="n">enablerepos</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="n">disablerepos</span> <span class="o">=</span> <span class="n">disablerepos</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
|
||||
<span class="c1"># sanitize the repositories</span>
|
||||
<span class="n">sources</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">sanitize_repo</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">sources</span><span class="p">)</span>
|
||||
@ -232,6 +147,15 @@
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">logdir</span><span class="p">)</span>
|
||||
|
||||
<span class="n">dnfbase</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">Base</span><span class="p">()</span>
|
||||
<span class="c1"># Enable DNF pluings</span>
|
||||
<span class="c1"># NOTE: These come from the HOST system's environment</span>
|
||||
<span class="k">if</span> <span class="n">dnfplugins</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">dnfplugins</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"*"</span><span class="p">:</span>
|
||||
<span class="c1"># Enable them all</span>
|
||||
<span class="n">dnfbase</span><span class="o">.</span><span class="n">init_plugins</span><span class="p">()</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Only enable the listed plugins</span>
|
||||
<span class="n">dnfbase</span><span class="o">.</span><span class="n">init_plugins</span><span class="p">(</span><span class="n">disabled_glob</span><span class="o">=</span><span class="p">[</span><span class="s2">"*"</span><span class="p">],</span> <span class="n">enable_plugins</span><span class="o">=</span><span class="n">dnfplugins</span><span class="p">)</span>
|
||||
<span class="n">conf</span> <span class="o">=</span> <span class="n">dnfbase</span><span class="o">.</span><span class="n">conf</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">logdir</span> <span class="o">=</span> <span class="n">logdir</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">cachedir</span> <span class="o">=</span> <span class="n">cachedir</span>
|
||||
@ -240,7 +164,12 @@
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">releasever</span> <span class="o">=</span> <span class="n">releasever</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">installroot</span> <span class="o">=</span> <span class="n">installroot</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">prepend_installroot</span><span class="p">(</span><span class="s1">'persistdir'</span><span class="p">)</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">tsflags</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'nodocs'</span><span class="p">)</span>
|
||||
<span class="c1"># this is a weird 'AppendOption' thing that, when you set it,</span>
|
||||
<span class="c1"># actually appends. Doing this adds 'nodocs' to the existing list</span>
|
||||
<span class="c1"># of values, over in libdnf, it does not replace the existing values.</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">tsflags</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'nodocs'</span><span class="p">]</span>
|
||||
<span class="c1"># Log details about the solver</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">debug_solver</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">proxy</span><span class="p">:</span>
|
||||
<span class="n">conf</span><span class="o">.</span><span class="n">proxy</span> <span class="o">=</span> <span class="n">proxy</span>
|
||||
@ -330,47 +259,33 @@
|
||||
<span class="n">dnfbase</span><span class="o">.</span><span class="n">read_comps</span><span class="p">()</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">dnfbase</span></div>
|
||||
|
||||
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.dnfhelper — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.dnfhelper — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.dnfhelper</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -200,7 +114,7 @@
|
||||
|
||||
|
||||
<div class="viewcode-block" id="LoraxDownloadCallback"><a class="viewcode-back" href="../../pylorax.html#pylorax.dnfhelper.LoraxDownloadCallback">[docs]</a><span class="k">class</span> <span class="nc">LoraxDownloadCallback</span><span class="p">(</span><span class="n">dnf</span><span class="o">.</span><span class="n">callback</span><span class="o">.</span><span class="n">DownloadProgress</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">downloads</span> <span class="o">=</span> <span class="n">collections</span><span class="o">.</span><span class="n">defaultdict</span><span class="p">(</span><span class="nb">int</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">last_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">total_files</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
@ -247,12 +161,12 @@
|
||||
|
||||
|
||||
<div class="viewcode-block" id="LoraxRpmCallback"><a class="viewcode-back" href="../../pylorax.html#pylorax.dnfhelper.LoraxRpmCallback">[docs]</a><span class="k">class</span> <span class="nc">LoraxRpmCallback</span><span class="p">(</span><span class="n">dnf</span><span class="o">.</span><span class="n">callback</span><span class="o">.</span><span class="n">TransactionProgress</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="nb">super</span><span class="p">(</span><span class="n">LoraxRpmCallback</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_last_ts</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
|
||||
<div class="viewcode-block" id="LoraxRpmCallback.progress"><a class="viewcode-back" href="../../pylorax.html#pylorax.dnfhelper.LoraxRpmCallback.progress">[docs]</a> <span class="k">def</span> <span class="nf">progress</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">package</span><span class="p">,</span> <span class="n">action</span><span class="p">,</span> <span class="n">ti_done</span><span class="p">,</span> <span class="n">ti_total</span><span class="p">,</span> <span class="n">ts_done</span><span class="p">,</span> <span class="n">ts_total</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">action</span> <span class="o">==</span> <span class="n">dnf</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">PKG_INSTALL</span><span class="p">:</span> <span class="c1"># pylint: disable=no-member</span>
|
||||
<span class="k">if</span> <span class="n">action</span> <span class="o">==</span> <span class="n">dnf</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">PKG_INSTALL</span><span class="p">:</span>
|
||||
<span class="c1"># do not report same package twice</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_ts</span> <span class="o">==</span> <span class="n">ts_done</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
@ -260,7 +174,7 @@
|
||||
|
||||
<span class="n">msg</span> <span class="o">=</span> <span class="s1">'(</span><span class="si">%d</span><span class="s1">/</span><span class="si">%d</span><span class="s1">) </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span> <span class="p">(</span><span class="n">ts_done</span><span class="p">,</span> <span class="n">ts_total</span><span class="p">,</span> <span class="n">package</span><span class="p">)</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="n">action</span> <span class="o">==</span> <span class="n">dnf</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">TRANS_POST</span><span class="p">:</span> <span class="c1"># pylint: disable=no-member</span>
|
||||
<span class="k">elif</span> <span class="n">action</span> <span class="o">==</span> <span class="n">dnf</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">TRANS_POST</span><span class="p">:</span>
|
||||
<span class="n">msg</span> <span class="o">=</span> <span class="s2">"Performing post-installation setup tasks"</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span></div>
|
||||
|
||||
@ -269,42 +183,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.executils — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.executils — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.executils</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -177,15 +91,18 @@
|
||||
<span class="c1">#</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">select</span>
|
||||
<span class="kn">import</span> <span class="nn">subprocess</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="k">import</span> <span class="n">TimeoutExpired</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="n">TimeoutExpired</span>
|
||||
<span class="kn">import</span> <span class="nn">signal</span>
|
||||
<span class="kn">import</span> <span class="nn">time</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax"</span><span class="p">)</span>
|
||||
<span class="n">program_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"program"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">threading</span> <span class="k">import</span> <span class="n">Lock</span>
|
||||
<span class="c1"># pylint: disable=not-context-manager</span>
|
||||
<span class="kn">from</span> <span class="nn">threading</span> <span class="kn">import</span> <span class="n">Lock</span>
|
||||
<span class="n">program_log_lock</span> <span class="o">=</span> <span class="n">Lock</span><span class="p">()</span>
|
||||
|
||||
<span class="n">_child_env</span> <span class="o">=</span> <span class="p">{}</span>
|
||||
@ -209,7 +126,7 @@
|
||||
<span class="k">return</span> <span class="n">env</span></div>
|
||||
|
||||
<div class="viewcode-block" id="ExecProduct"><a class="viewcode-back" href="../../pylorax.html#pylorax.executils.ExecProduct">[docs]</a><span class="k">class</span> <span class="nc">ExecProduct</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rc</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rc</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">rc</span> <span class="o">=</span> <span class="n">rc</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">stdout</span> <span class="o">=</span> <span class="n">stdout</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">stderr</span> <span class="o">=</span> <span class="n">stderr</span></div>
|
||||
@ -441,15 +358,16 @@
|
||||
<span class="sd"> up the process when the output is no longer needed.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">proc</span><span class="p">,</span> <span class="n">argv</span><span class="p">,</span> <span class="n">callback</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">proc</span><span class="p">,</span> <span class="n">argv</span><span class="p">,</span> <span class="n">callback</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_proc</span> <span class="o">=</span> <span class="n">proc</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_argv</span> <span class="o">=</span> <span class="n">argv</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_callback</span> <span class="o">=</span> <span class="n">callback</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="bp">self</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__del__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__del__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># See if the process is still running</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">poll</span><span class="p">()</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="c1"># Stop the process and ignore any problems that might arise</span>
|
||||
@ -458,23 +376,44 @@
|
||||
<span class="k">except</span> <span class="ne">OSError</span><span class="p">:</span>
|
||||
<span class="k">pass</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__next__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># Read the next line, blocking if a line is not yet available</span>
|
||||
<span class="n">line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">line</span> <span class="o">==</span> <span class="s1">''</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_callback</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="p">):</span>
|
||||
<span class="c1"># Output finished, wait for the process to end</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">communicate</span><span class="p">()</span>
|
||||
<span class="k">def</span> <span class="fm">__next__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># Return lines from stdout while also calling _callback</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="c1"># Check for input without blocking</span>
|
||||
<span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">stdout</span><span class="p">],</span> <span class="p">[],</span> <span class="p">[],</span> <span class="mi">0</span><span class="p">)[</span><span class="mi">0</span><span class="p">]:</span>
|
||||
<span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">peek</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="n">size</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">size</span><span class="p">)</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Check for successful exit</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span> <span class="o"><</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">OSError</span><span class="p">(</span><span class="s2">"process '</span><span class="si">%s</span><span class="s2">' was killed by signal </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span>
|
||||
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_argv</span><span class="p">,</span> <span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span><span class="p">))</span>
|
||||
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">OSError</span><span class="p">(</span><span class="s2">"process '</span><span class="si">%s</span><span class="s2">' exited with status </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span>
|
||||
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_argv</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span><span class="p">))</span>
|
||||
<span class="k">raise</span> <span class="ne">StopIteration</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> <span class="o">>=</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
||||
<span class="k">return</span> <span class="n">line</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">line</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">poll</span><span class="p">()</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_callback</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="p">):</span>
|
||||
<span class="c1"># Output finished, wait 60s for the process to end</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">communicate</span><span class="p">(</span><span class="n">timeout</span><span class="o">=</span><span class="mi">60</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">TimeoutExpired</span><span class="p">:</span>
|
||||
<span class="c1"># Did not exit in 60s, kill it and wait 30s more</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">kill</span><span class="p">()</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">communicate</span><span class="p">(</span><span class="n">timeout</span><span class="o">=</span><span class="mi">30</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">TimeoutExpired</span><span class="p">:</span>
|
||||
<span class="k">pass</span>
|
||||
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">OSError</span><span class="p">(</span><span class="s2">"process '</span><span class="si">%s</span><span class="s2">' failed to be killed"</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">_argv</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span> <span class="o"><</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">OSError</span><span class="p">(</span><span class="s2">"process '</span><span class="si">%s</span><span class="s2">' was killed by signal </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span>
|
||||
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_argv</span><span class="p">,</span> <span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span><span class="p">))</span>
|
||||
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">OSError</span><span class="p">(</span><span class="s2">"process '</span><span class="si">%s</span><span class="s2">' exited with status </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span>
|
||||
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_argv</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proc</span><span class="o">.</span><span class="n">returncode</span><span class="p">))</span>
|
||||
<span class="k">raise</span> <span class="ne">StopIteration</span>
|
||||
|
||||
<span class="c1"># Don't loop too fast with no input to read</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.5</span><span class="p">)</span>
|
||||
|
||||
<span class="n">argv</span> <span class="o">=</span> <span class="p">[</span><span class="n">command</span><span class="p">]</span> <span class="o">+</span> <span class="n">argv</span>
|
||||
|
||||
@ -484,7 +423,7 @@
|
||||
<span class="n">stderr</span> <span class="o">=</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">STDOUT</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">proc</span> <span class="o">=</span> <span class="n">startProgram</span><span class="p">(</span><span class="n">argv</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">root</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">subprocess</span><span class="o">.</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">stderr</span><span class="o">=</span><span class="n">stderr</span><span class="p">,</span> <span class="n">bufsize</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
|
||||
<span class="n">proc</span> <span class="o">=</span> <span class="n">startProgram</span><span class="p">(</span><span class="n">argv</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">root</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">subprocess</span><span class="o">.</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">stderr</span><span class="o">=</span><span class="n">stderr</span><span class="p">,</span>
|
||||
<span class="n">env_prune</span><span class="o">=</span><span class="n">env_prune</span><span class="p">,</span> <span class="n">env_add</span><span class="o">=</span><span class="n">env_add</span><span class="p">,</span> <span class="n">reset_handlers</span><span class="o">=</span><span class="n">reset_handlers</span><span class="p">,</span> <span class="n">reset_lang</span><span class="o">=</span><span class="n">reset_lang</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">OSError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">program_log_lock</span><span class="p">:</span>
|
||||
@ -507,42 +446,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.imgutils — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.imgutils — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.imgutils</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -158,7 +72,7 @@
|
||||
<h1>Source code for pylorax.imgutils</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1"># imgutils.py - utility functions/classes for building disk images</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2011-2015 Red Hat, Inc.</span>
|
||||
<span class="c1"># Copyright (C) 2011-2018 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
@ -179,18 +93,18 @@
|
||||
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax.imgutils"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">tempfile</span>
|
||||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="k">import</span> <span class="n">join</span><span class="p">,</span> <span class="n">dirname</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="k">import</span> <span class="n">Popen</span><span class="p">,</span> <span class="n">PIPE</span><span class="p">,</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="kn">import</span> <span class="n">join</span><span class="p">,</span> <span class="n">dirname</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="n">Popen</span><span class="p">,</span> <span class="n">PIPE</span><span class="p">,</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">import</span> <span class="nn">sys</span>
|
||||
<span class="kn">import</span> <span class="nn">time</span>
|
||||
<span class="kn">import</span> <span class="nn">traceback</span>
|
||||
<span class="kn">import</span> <span class="nn">multiprocessing</span>
|
||||
<span class="kn">from</span> <span class="nn">time</span> <span class="k">import</span> <span class="n">sleep</span>
|
||||
<span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">sleep</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">cpfile</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">execWithRedirect</span><span class="p">,</span> <span class="n">execWithCapture</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">cpfile</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">execWithRedirect</span><span class="p">,</span> <span class="n">execWithCapture</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
|
||||
|
||||
<span class="c1">######## Functions for making container images (cpio, tar, squashfs) ##########</span>
|
||||
|
||||
@ -235,9 +149,20 @@
|
||||
<span class="n">archive</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">root</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> <span class="o">+</span> <span class="sa">b</span><span class="s2">"</span><span class="se">\0</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">archive</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
|
||||
<span class="n">comp</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">([</span><span class="n">compression</span><span class="p">]</span> <span class="o">+</span> <span class="n">compressargs</span><span class="p">,</span>
|
||||
<span class="n">stdin</span><span class="o">=</span><span class="n">archive</span><span class="o">.</span><span class="n">stdout</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">"wb"</span><span class="p">))</span>
|
||||
<span class="n">comp</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">"wb"</span><span class="p">)</span> <span class="k">as</span> <span class="n">fout</span><span class="p">:</span>
|
||||
<span class="n">comp</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">([</span><span class="n">compression</span><span class="p">]</span> <span class="o">+</span> <span class="n">compressargs</span><span class="p">,</span>
|
||||
<span class="n">stdin</span><span class="o">=</span><span class="n">archive</span><span class="o">.</span><span class="n">stdout</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">fout</span><span class="p">)</span>
|
||||
<span class="n">comp</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># Clean up the open fds and processes</span>
|
||||
<span class="k">if</span> <span class="n">find</span><span class="p">:</span>
|
||||
<span class="n">find</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
|
||||
<span class="n">find</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
<span class="n">archive</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">archive</span><span class="o">.</span><span class="n">stdin</span><span class="p">:</span>
|
||||
<span class="n">archive</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">archive</span><span class="o">.</span><span class="n">stdout</span><span class="p">:</span>
|
||||
<span class="n">archive</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="n">comp</span><span class="o">.</span><span class="n">returncode</span>
|
||||
<span class="k">except</span> <span class="ne">OSError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">e</span><span class="p">)</span>
|
||||
@ -287,8 +212,8 @@
|
||||
|
||||
<div class="viewcode-block" id="mksparse"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mksparse">[docs]</a><span class="k">def</span> <span class="nf">mksparse</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="p">):</span>
|
||||
<span class="sd">'''use os.ftruncate to create a sparse file of the given size.'''</span>
|
||||
<span class="n">fobj</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">ftruncate</span><span class="p">(</span><span class="n">fobj</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">size</span><span class="p">)</span></div>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">fobj</span><span class="p">:</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">ftruncate</span><span class="p">(</span><span class="n">fobj</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="nb">int</span><span class="p">(</span><span class="n">size</span><span class="p">))</span></div>
|
||||
|
||||
<div class="viewcode-block" id="mkqcow2"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkqcow2">[docs]</a><span class="k">def</span> <span class="nf">mkqcow2</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">'''use qemu-img to create a file of the given size.</span>
|
||||
@ -335,13 +260,31 @@
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Unable to setup </span><span class="si">%s</span><span class="s2"> on </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">loop_dev</span><span class="p">,</span> <span class="n">outfile</span><span class="p">))</span></div>
|
||||
|
||||
<div class="viewcode-block" id="loop_attach"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.loop_attach">[docs]</a><span class="k">def</span> <span class="nf">loop_attach</span><span class="p">(</span><span class="n">outfile</span><span class="p">):</span>
|
||||
<span class="sd">'''Attach a loop device to the given file. Return the loop device name.</span>
|
||||
<span class="sd"> Raises CalledProcessError if losetup fails.'''</span>
|
||||
<span class="n">dev</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">"losetup"</span><span class="p">,</span> <span class="s2">"--find"</span><span class="p">,</span> <span class="s2">"--show"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">])</span>
|
||||
<span class="sd">"""Attach a loop device to the given file. Return the loop device name.</span>
|
||||
|
||||
<span class="c1"># Sometimes the loop device isn't ready yet, make extra sure before returning</span>
|
||||
<span class="n">loop_waitfor</span><span class="p">(</span><span class="n">dev</span><span class="o">.</span><span class="n">strip</span><span class="p">(),</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">dev</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span></div>
|
||||
<span class="sd"> On rare occasions it appears that the device never shows up, some experiments</span>
|
||||
<span class="sd"> seem to indicate that it may be a race with another process using /dev/loop* devices.</span>
|
||||
|
||||
<span class="sd"> So we now try 3 times before actually failing.</span>
|
||||
|
||||
<span class="sd"> Raises CalledProcessError if losetup fails.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">retries</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">retries</span> <span class="o">+=</span> <span class="mi">1</span>
|
||||
<span class="n">dev</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">"losetup"</span><span class="p">,</span> <span class="s2">"--find"</span><span class="p">,</span> <span class="s2">"--show"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">])</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># Sometimes the loop device isn't ready yet, make extra sure before returning</span>
|
||||
<span class="n">loop_waitfor</span><span class="p">(</span><span class="n">dev</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">RuntimeError</span><span class="p">:</span>
|
||||
<span class="c1"># Try to setup the loop device 3 times</span>
|
||||
<span class="k">if</span> <span class="n">retries</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"loop_attach failed, retries exhausted."</span><span class="p">)</span>
|
||||
<span class="k">raise</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Try </span><span class="si">%d</span><span class="s2"> failed, </span><span class="si">%s</span><span class="s2"> did not appear."</span><span class="p">,</span> <span class="n">retries</span><span class="p">,</span> <span class="n">dev</span><span class="p">)</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">return</span> <span class="n">dev</span></div>
|
||||
|
||||
<div class="viewcode-block" id="loop_detach"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.loop_detach">[docs]</a><span class="k">def</span> <span class="nf">loop_detach</span><span class="p">(</span><span class="n">loopdev</span><span class="p">):</span>
|
||||
<span class="sd">'''Detach the given loop device. Return False on failure.'''</span>
|
||||
@ -422,7 +365,7 @@
|
||||
<span class="sd"> If preserve is False, uses cp -R (useful for modeless filesystems)</span>
|
||||
<span class="sd"> raises CalledProcessError if copy fails.'''</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"copytree </span><span class="si">%s</span><span class="s2"> </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">src</span><span class="p">,</span> <span class="n">dest</span><span class="p">)</span>
|
||||
<span class="n">cp</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"cp"</span><span class="p">,</span> <span class="s2">"-a"</span><span class="p">]</span> <span class="k">if</span> <span class="n">preserve</span> <span class="k">else</span> <span class="p">[</span><span class="s2">"cp"</span><span class="p">,</span> <span class="s2">"-R"</span><span class="p">,</span> <span class="s2">"-L"</span><span class="p">]</span>
|
||||
<span class="n">cp</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"cp"</span><span class="p">,</span> <span class="s2">"-a"</span><span class="p">]</span> <span class="k">if</span> <span class="n">preserve</span> <span class="k">else</span> <span class="p">[</span><span class="s2">"cp"</span><span class="p">,</span> <span class="s2">"-R"</span><span class="p">,</span> <span class="s2">"-L"</span><span class="p">,</span> <span class="s2">"--preserve=timestamps"</span><span class="p">]</span>
|
||||
<span class="n">cp</span> <span class="o">+=</span> <span class="p">[</span><span class="n">join</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="s2">"."</span><span class="p">),</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">dest</span><span class="p">)]</span>
|
||||
<span class="n">runcmd</span><span class="p">(</span><span class="n">cp</span><span class="p">)</span></div>
|
||||
|
||||
@ -477,39 +420,64 @@
|
||||
<span class="c1">######## Execution contexts - use with the 'with' statement ##############</span>
|
||||
|
||||
<div class="viewcode-block" id="LoopDev"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.LoopDev">[docs]</a><span class="k">class</span> <span class="nc">LoopDev</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">loopdev</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">filename</span>
|
||||
<span class="k">if</span> <span class="n">size</span><span class="p">:</span>
|
||||
<span class="n">mksparse</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">filename</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">loopdev</span> <span class="o">=</span> <span class="n">loop_attach</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">filename</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">loopdev</span>
|
||||
<span class="k">def</span> <span class="nf">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="n">loop_detach</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">loopdev</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DMDev"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.DMDev">[docs]</a><span class="k">class</span> <span class="nc">DMDev</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dev</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dev</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">mapperdev</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dev</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="o">=</span> <span class="p">(</span><span class="n">dev</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">mapperdev</span> <span class="o">=</span> <span class="n">dm_attach</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dev</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapperdev</span>
|
||||
<span class="k">def</span> <span class="nf">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="n">dm_detach</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapperdev</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="Mount"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.Mount">[docs]</a><span class="k">class</span> <span class="nc">Mount</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dev</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">mnt</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dev</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">mnt</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dev</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">opts</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mnt</span><span class="p">)</span> <span class="o">=</span> <span class="p">(</span><span class="n">dev</span><span class="p">,</span> <span class="n">opts</span><span class="p">,</span> <span class="n">mnt</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">mnt</span> <span class="o">=</span> <span class="n">mount</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dev</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">opts</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mnt</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mnt</span>
|
||||
<span class="k">def</span> <span class="nf">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="n">umount</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mnt</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="kpartx_disk_img"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.kpartx_disk_img">[docs]</a><span class="k">def</span> <span class="nf">kpartx_disk_img</span><span class="p">(</span><span class="n">disk_img</span><span class="p">):</span>
|
||||
<span class="sd">"""Attach a disk image's partitions to /dev/loopX using kpartx</span>
|
||||
|
||||
<span class="sd"> :param disk_img: The full path to a partitioned disk image</span>
|
||||
<span class="sd"> :type disk_img: str</span>
|
||||
<span class="sd"> :returns: list of (loopXpN, size)</span>
|
||||
<span class="sd"> :rtype: list of tuples</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># Example kpartx output</span>
|
||||
<span class="c1"># kpartx -p p -v -a /tmp/diskV2DiCW.im</span>
|
||||
<span class="c1"># add map loop2p1 (253:2): 0 3481600 linear /dev/loop2 2048</span>
|
||||
<span class="c1"># add map loop2p2 (253:3): 0 614400 linear /dev/loop2 3483648</span>
|
||||
<span class="n">kpartx_output</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">"kpartx"</span><span class="p">,</span> <span class="s2">"-v"</span><span class="p">,</span> <span class="s2">"-a"</span><span class="p">,</span> <span class="s2">"-s"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">kpartx_output</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># list of (deviceName, sizeInBytes)</span>
|
||||
<span class="n">loop_devices</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">kpartx_output</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
|
||||
<span class="c1"># add map loop2p3 (253:4): 0 7139328 linear /dev/loop2 528384</span>
|
||||
<span class="c1"># 3rd element is size in 512 byte blocks</span>
|
||||
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"add map "</span><span class="p">):</span>
|
||||
<span class="n">fields</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">8</span><span class="p">:]</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
|
||||
<span class="n">loop_devices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">int</span><span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span><span class="o">*</span><span class="mi">512</span><span class="p">)</span> <span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">loop_devices</span></div>
|
||||
|
||||
<div class="viewcode-block" id="PartitionMount"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.PartitionMount">[docs]</a><span class="k">class</span> <span class="nc">PartitionMount</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="sd">""" Mount a partitioned image file using kpartx """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">mount_ok</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">submount</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">mount_ok</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">submount</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> :param str disk_img: The full path to a partitioned disk image</span>
|
||||
<span class="sd"> :param mount_ok: A function that is passed the mount point and</span>
|
||||
@ -538,23 +506,10 @@
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">mount_ok</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">mount_ok</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">mount_dir</span><span class="p">:</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">mount_dir</span><span class="o">+</span><span class="s2">"/etc/passwd"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Example kpartx output</span>
|
||||
<span class="c1"># kpartx -p p -v -a /tmp/diskV2DiCW.im</span>
|
||||
<span class="c1"># add map loop2p1 (253:2): 0 3481600 linear /dev/loop2 2048</span>
|
||||
<span class="c1"># add map loop2p2 (253:3): 0 614400 linear /dev/loop2 3483648</span>
|
||||
<span class="n">kpartx_output</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">"kpartx"</span><span class="p">,</span> <span class="s2">"-v"</span><span class="p">,</span> <span class="s2">"-a"</span><span class="p">,</span> <span class="s2">"-s"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">disk_img</span><span class="p">])</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">kpartx_output</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># list of (deviceName, sizeInBytes)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">loop_devices</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">kpartx_output</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
|
||||
<span class="c1"># add map loop2p3 (253:4): 0 7139328 linear /dev/loop2 528384</span>
|
||||
<span class="c1"># 3rd element is size in 512 byte blocks</span>
|
||||
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"add map "</span><span class="p">):</span>
|
||||
<span class="n">fields</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">8</span><span class="p">:]</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">loop_devices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">int</span><span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span><span class="o">*</span><span class="mi">512</span><span class="p">)</span> <span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">loop_devices</span> <span class="o">=</span> <span class="n">kpartx_disk_img</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disk_img</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># Mount the device selected by mount_ok, if possible</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">temp_dir</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mkdtemp</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">submount</span><span class="p">:</span>
|
||||
@ -581,7 +536,7 @@
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">temp_dir</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="k">return</span> <span class="bp">self</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">temp_dir</span><span class="p">:</span>
|
||||
<span class="n">umount</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">)</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">temp_dir</span><span class="p">)</span>
|
||||
@ -590,13 +545,49 @@
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"kpartx"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-d"</span><span class="p">,</span> <span class="s2">"-s"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">disk_img</span><span class="p">])</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="DracutChroot"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.DracutChroot">[docs]</a><span class="k">class</span> <span class="nc">DracutChroot</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="sd">"""Setup the chroot for running dracut inside it, cleanup when done</span>
|
||||
|
||||
<span class="sd"> This mount /proc, /dev, and /var/tmp plus optional bind mounted directories</span>
|
||||
<span class="sd"> as a list of (source, destination) tuples where destination is relative to the chroot.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="n">bind</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">=</span> <span class="n">root</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">bind</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"/var/tmp"</span><span class="p">,</span> <span class="s2">"/var/tmp"</span><span class="p">)]</span> <span class="o">+</span> <span class="p">(</span><span class="n">bind</span> <span class="k">if</span> <span class="n">bind</span> <span class="k">else</span> <span class="p">[])</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="p">[</span><span class="n">d</span> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">d</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">bind</span><span class="p">]</span> <span class="o">+</span> <span class="p">[</span><span class="s2">"/proc"</span><span class="p">,</span> <span class="s2">"/dev"</span><span class="p">]:</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="n">d</span><span class="p">):</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">"Making missing dracut chroot directory: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">d</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="n">d</span><span class="p">)</span>
|
||||
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"mount"</span><span class="p">,</span> <span class="s2">"-t"</span><span class="p">,</span> <span class="s2">"proc"</span><span class="p">,</span> <span class="s2">"-o"</span><span class="p">,</span> <span class="s2">"nosuid,noexec,nodev"</span><span class="p">,</span> <span class="s2">"proc"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="s2">"/proc"</span> <span class="p">])</span>
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"mount"</span><span class="p">,</span> <span class="s2">"-t"</span><span class="p">,</span> <span class="s2">"devtmpfs"</span><span class="p">,</span> <span class="s2">"-o"</span><span class="p">,</span> <span class="s2">"mode=0755,noexec,nosuid,strictatime"</span><span class="p">,</span> <span class="s2">"devtmpfs"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="s2">"/dev"</span> <span class="p">])</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">s</span><span class="p">,</span> <span class="n">d</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">bind</span><span class="p">:</span>
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"mount"</span><span class="p">,</span> <span class="s2">"-o"</span><span class="p">,</span> <span class="s2">"bind"</span><span class="p">,</span> <span class="n">s</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="n">d</span><span class="p">])</span>
|
||||
|
||||
<span class="k">return</span> <span class="bp">self</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"umount"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="s2">"/proc"</span> <span class="p">])</span>
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"umount"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="s2">"/dev"</span> <span class="p">])</span>
|
||||
|
||||
<span class="c1"># cleanup bind mounts</span>
|
||||
<span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">d</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">bind</span><span class="p">:</span>
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"umount"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">+</span> <span class="n">d</span> <span class="p">])</span>
|
||||
|
||||
<div class="viewcode-block" id="DracutChroot.Run"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.DracutChroot.Run">[docs]</a> <span class="k">def</span> <span class="nf">Run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span>
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"dracut"</span><span class="p">]</span> <span class="o">+</span> <span class="n">args</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span><span class="p">)</span></div></div>
|
||||
|
||||
|
||||
<span class="c1">######## Functions for making filesystem images ##########################</span>
|
||||
|
||||
<div class="viewcode-block" id="mkfsimage"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkfsimage">[docs]</a><span class="k">def</span> <span class="nf">mkfsimage</span><span class="p">(</span><span class="n">fstype</span><span class="p">,</span> <span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mkfsargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">'''Generic filesystem image creation function.</span>
|
||||
<span class="sd"> fstype should be a filesystem type - "mkfs.${fstype}" must exist.</span>
|
||||
<span class="sd"> graft should be a dict: {"some/path/in/image": "local/file/or/dir"};</span>
|
||||
<span class="sd"> if the path ends with a '/' it's assumed to be a directory.</span>
|
||||
<span class="sd"> if the path ends with a '/' it's assumed to be a directory.</span>
|
||||
<span class="sd"> Will raise CalledProcessError if something goes wrong.'''</span>
|
||||
<span class="n">mkfsargs</span> <span class="o">=</span> <span class="n">mkfsargs</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="n">graft</span> <span class="o">=</span> <span class="n">graft</span> <span class="ow">or</span> <span class="p">{}</span>
|
||||
@ -625,8 +616,12 @@
|
||||
<span class="c1"># convenience functions with useful defaults</span>
|
||||
<div class="viewcode-block" id="mkdosimg"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkdosimg">[docs]</a><span class="k">def</span> <span class="nf">mkdosimg</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="s2">"shortname=winnt,umask=0077"</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="n">graft</span> <span class="o">=</span> <span class="n">graft</span> <span class="ow">or</span> <span class="p">{}</span>
|
||||
<span class="n">mkfsargs</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"-n"</span><span class="p">,</span> <span class="n">label</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="s1">'SOURCE_DATE_EPOCH'</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
|
||||
<span class="n">mkfsargs</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s2">"-i"</span><span class="p">,</span>
|
||||
<span class="s2">"</span><span class="si">{:x}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">'SOURCE_DATE_EPOCH'</span><span class="p">]))])</span>
|
||||
<span class="n">mkfsimage</span><span class="p">(</span><span class="s2">"msdos"</span><span class="p">,</span> <span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="n">mountargs</span><span class="p">,</span>
|
||||
<span class="n">mkfsargs</span><span class="o">=</span><span class="p">[</span><span class="s2">"-n"</span><span class="p">,</span> <span class="n">label</span><span class="p">],</span> <span class="n">graft</span><span class="o">=</span><span class="n">graft</span><span class="p">)</span></div>
|
||||
<span class="n">mkfsargs</span><span class="o">=</span><span class="n">mkfsargs</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="n">graft</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="mkext4img"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkext4img">[docs]</a><span class="k">def</span> <span class="nf">mkext4img</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="n">graft</span> <span class="o">=</span> <span class="n">graft</span> <span class="ow">or</span> <span class="p">{}</span>
|
||||
@ -679,42 +674,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.installer — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.installer — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.installer</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -177,7 +91,7 @@
|
||||
|
||||
<span class="kn">import</span> <span class="nn">glob</span>
|
||||
<span class="kn">import</span> <span class="nn">json</span>
|
||||
<span class="kn">from</span> <span class="nn">math</span> <span class="k">import</span> <span class="n">ceil</span>
|
||||
<span class="kn">from</span> <span class="nn">math</span> <span class="kn">import</span> <span class="n">ceil</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">subprocess</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
@ -185,14 +99,14 @@
|
||||
<span class="kn">import</span> <span class="nn">tempfile</span>
|
||||
|
||||
<span class="c1"># Use the Lorax treebuilder branch for iso creation</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">execWithRedirect</span><span class="p">,</span> <span class="n">execReadlines</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">PartitionMount</span><span class="p">,</span> <span class="n">mksparse</span><span class="p">,</span> <span class="n">mkext4img</span><span class="p">,</span> <span class="n">loop_detach</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">get_loop_name</span><span class="p">,</span> <span class="n">dm_detach</span><span class="p">,</span> <span class="n">mount</span><span class="p">,</span> <span class="n">umount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">mkqemu_img</span><span class="p">,</span> <span class="n">mktar</span><span class="p">,</span> <span class="n">mkcpio</span><span class="p">,</span> <span class="n">mkfsimage_from_disk</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.monitor</span> <span class="k">import</span> <span class="n">LogMonitor</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.mount</span> <span class="k">import</span> <span class="n">IsoMountpoint</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="k">import</span> <span class="n">udev_escape</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">execWithRedirect</span><span class="p">,</span> <span class="n">execReadlines</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">PartitionMount</span><span class="p">,</span> <span class="n">mksparse</span><span class="p">,</span> <span class="n">mkext4img</span><span class="p">,</span> <span class="n">loop_detach</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">get_loop_name</span><span class="p">,</span> <span class="n">dm_detach</span><span class="p">,</span> <span class="n">mount</span><span class="p">,</span> <span class="n">umount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">mkqemu_img</span><span class="p">,</span> <span class="n">mktar</span><span class="p">,</span> <span class="n">mkcpio</span><span class="p">,</span> <span class="n">mkfsimage_from_disk</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.monitor</span> <span class="kn">import</span> <span class="n">LogMonitor</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.mount</span> <span class="kn">import</span> <span class="n">IsoMountpoint</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="kn">import</span> <span class="n">udev_escape</span>
|
||||
|
||||
|
||||
<span class="n">ROOT_PATH</span> <span class="o">=</span> <span class="s2">"/mnt/sysimage/"</span>
|
||||
@ -293,7 +207,15 @@
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Run qemu using an iso and a kickstart</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">opts</span><span class="p">,</span> <span class="n">iso</span><span class="p">,</span> <span class="n">ks_paths</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">img_size</span><span class="o">=</span><span class="mi">2048</span><span class="p">,</span>
|
||||
<span class="c1"># Mapping of arch to qemu command</span>
|
||||
<span class="n">QEMU_CMDS</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"x86_64"</span><span class="p">:</span> <span class="s2">"qemu-system-x86_64"</span><span class="p">,</span>
|
||||
<span class="s2">"i386"</span><span class="p">:</span> <span class="s2">"qemu-system-i386"</span><span class="p">,</span>
|
||||
<span class="s2">"arm"</span><span class="p">:</span> <span class="s2">"qemu-system-arm"</span><span class="p">,</span>
|
||||
<span class="s2">"aarch64"</span><span class="p">:</span> <span class="s2">"qemu-system-aarch64"</span><span class="p">,</span>
|
||||
<span class="s2">"ppc64le"</span><span class="p">:</span> <span class="s2">"qemu-system-ppc64"</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">opts</span><span class="p">,</span> <span class="n">iso</span><span class="p">,</span> <span class="n">ks_paths</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">img_size</span><span class="o">=</span><span class="mi">2048</span><span class="p">,</span>
|
||||
<span class="n">kernel_args</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">memory</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span> <span class="n">vcpus</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">vnc</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">arch</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">cancel_func</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">virtio_host</span><span class="o">=</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> <span class="n">virtio_port</span><span class="o">=</span><span class="mi">6080</span><span class="p">,</span>
|
||||
<span class="n">image_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">boot_uefi</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">ovmf_path</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
@ -319,12 +241,12 @@
|
||||
<span class="sd"> :param bool boot_uefi: Use OVMF to boot the VM in UEFI mode</span>
|
||||
<span class="sd"> :param str ovmf_path: Path to the OVMF firmware</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># RHEL8 only has /usr/libexec/qemu-kvm so we have to use that.</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"/usr/libexec/qemu-kvm"</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span>
|
||||
<span class="c1"># Lookup qemu-system- for arch if passed, or try to guess using host arch</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">QEMU_CMDS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arch</span> <span class="ow">or</span> <span class="n">os</span><span class="o">.</span><span class="n">uname</span><span class="p">()</span><span class="o">.</span><span class="n">machine</span><span class="p">,</span> <span class="s2">"qemu-system-"</span><span class="o">+</span><span class="n">os</span><span class="o">.</span><span class="n">uname</span><span class="p">()</span><span class="o">.</span><span class="n">machine</span><span class="p">)]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">"/usr/bin/"</span><span class="o">+</span><span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span>
|
||||
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> does not exist, cannot run qemu"</span> <span class="o">%</span> <span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-nodefconfig"</span><span class="p">]</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-no-user-config"</span><span class="p">]</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-m"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">memory</span><span class="p">)]</span>
|
||||
<span class="k">if</span> <span class="n">vcpus</span><span class="p">:</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-smp"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">vcpus</span><span class="p">)]</span>
|
||||
@ -358,7 +280,7 @@
|
||||
|
||||
<span class="c1"># Setup the cmdline args</span>
|
||||
<span class="c1"># ======================</span>
|
||||
<span class="n">cmdline_args</span> <span class="o">=</span> <span class="s2">"ks=file:/</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">ks_paths</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
<span class="n">cmdline_args</span> <span class="o">=</span> <span class="s2">"inst.ks=file:/</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">ks_paths</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
<span class="n">cmdline_args</span> <span class="o">+=</span> <span class="s2">" inst.stage2=hd:LABEL=</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">udev_escape</span><span class="p">(</span><span class="n">iso</span><span class="o">.</span><span class="n">label</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">proxy</span><span class="p">:</span>
|
||||
<span class="n">cmdline_args</span> <span class="o">+=</span> <span class="s2">" inst.proxy=</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">opts</span><span class="o">.</span><span class="n">proxy</span>
|
||||
@ -378,9 +300,6 @@
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"qemu </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">display_args</span><span class="p">)</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-nographic"</span><span class="p">,</span> <span class="s2">"-monitor"</span><span class="p">,</span> <span class="s2">"none"</span><span class="p">,</span> <span class="s2">"-serial"</span><span class="p">,</span> <span class="s2">"null"</span><span class="p">,</span> <span class="s2">"-display"</span><span class="p">,</span> <span class="n">display_args</span> <span class="p">]</span>
|
||||
|
||||
<span class="c1"># Setup virtio networking</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-netdev"</span><span class="p">,</span> <span class="s2">"user,id=n1"</span><span class="p">,</span> <span class="s2">"-device"</span><span class="p">,</span> <span class="s2">"virtio-net-pci,netdev=n1"</span><span class="p">]</span>
|
||||
|
||||
<span class="c1"># Setup the virtio log port</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-device"</span><span class="p">,</span> <span class="s2">"virtio-serial-pci,id=virtio-serial0"</span><span class="p">]</span>
|
||||
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"-device"</span><span class="p">,</span> <span class="s2">"virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0"</span>
|
||||
@ -444,7 +363,12 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">cancel_funcs</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">f</span><span class="p">():</span>
|
||||
<span class="n">proc</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span>
|
||||
<span class="c1"># Anaconda runs from unshare, anaconda doesn't exit correctly so try to</span>
|
||||
<span class="c1"># send TERM to all of them directly</span>
|
||||
<span class="kn">import</span> <span class="nn">psutil</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">psutil</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span><span class="n">proc</span><span class="o">.</span><span class="n">pid</span><span class="p">)</span><span class="o">.</span><span class="n">children</span><span class="p">(</span><span class="n">recursive</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
|
||||
<span class="n">p</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span>
|
||||
<span class="n">psutil</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span><span class="n">proc</span><span class="o">.</span><span class="n">pid</span><span class="p">)</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="kc">True</span>
|
||||
<span class="k">return</span> <span class="kc">False</span></div>
|
||||
|
||||
@ -461,7 +385,17 @@
|
||||
|
||||
<span class="sd"> Attempts to cleanup may also fail. Catch these and continue trying the</span>
|
||||
<span class="sd"> other mountpoints.</span>
|
||||
|
||||
<span class="sd"> Anaconda may also leave /run/anaconda.pid behind, clean that up as well.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># Anaconda may not clean up its /var/run/anaconda.pid file</span>
|
||||
<span class="c1"># Make sure the process is really finished (it should be, since it was started from a subprocess call)</span>
|
||||
<span class="c1"># and then remove the pid file.</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">"/var/run/anaconda.pid"</span><span class="p">):</span>
|
||||
<span class="c1"># anaconda may be started using unshare so the pid is always 1</span>
|
||||
<span class="k">if</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"/var/run/anaconda.pid"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"1"</span><span class="p">:</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="s2">"/var/run/anaconda.pid"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="n">dirinstall_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">dirinstall_path</span><span class="p">)</span>
|
||||
<span class="c1"># unmount filesystems</span>
|
||||
@ -498,7 +432,7 @@
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
|
||||
|
||||
<span class="n">args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--kickstart"</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">ks</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s2">"--cmdline"</span><span class="p">,</span> <span class="s2">"--loglevel"</span><span class="p">,</span> <span class="s2">"debug"</span><span class="p">]</span>
|
||||
<span class="n">args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--kickstart"</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">ks</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s2">"--cmdline"</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">anaconda_args</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">anaconda_args</span><span class="p">:</span>
|
||||
<span class="n">args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
@ -543,22 +477,28 @@
|
||||
<span class="c1"># Make sure anaconda has the right product and release</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Running anaconda."</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">execReadlines</span><span class="p">(</span><span class="s2">"anaconda"</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">reset_lang</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">unshare_args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--pid"</span><span class="p">,</span> <span class="s2">"--kill-child"</span><span class="p">,</span> <span class="s2">"--mount"</span><span class="p">,</span> <span class="s2">"--propagation"</span><span class="p">,</span> <span class="s2">"unchanged"</span><span class="p">,</span> <span class="s2">"anaconda"</span><span class="p">]</span> <span class="o">+</span> <span class="n">args</span>
|
||||
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">execReadlines</span><span class="p">(</span><span class="s2">"unshare"</span><span class="p">,</span> <span class="n">unshare_args</span><span class="p">,</span> <span class="n">reset_lang</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
|
||||
<span class="n">env_add</span><span class="o">=</span><span class="p">{</span><span class="s2">"ANACONDA_PRODUCTNAME"</span><span class="p">:</span> <span class="n">opts</span><span class="o">.</span><span class="n">project</span><span class="p">,</span>
|
||||
<span class="s2">"ANACONDA_PRODUCTVERSION"</span><span class="p">:</span> <span class="n">opts</span><span class="o">.</span><span class="n">releasever</span><span class="p">},</span>
|
||||
<span class="n">callback</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="ow">not</span> <span class="n">novirt_cancel_check</span><span class="p">(</span><span class="n">cancel_funcs</span><span class="p">,</span> <span class="n">p</span><span class="p">)):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Make sure the new filesystem is correctly labeled</span>
|
||||
<span class="n">setfiles_args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"-e"</span><span class="p">,</span> <span class="s2">"/proc"</span><span class="p">,</span> <span class="s2">"-e"</span><span class="p">,</span> <span class="s2">"/sys"</span><span class="p">,</span> <span class="s2">"-e"</span><span class="p">,</span> <span class="s2">"/dev"</span><span class="p">,</span>
|
||||
<span class="n">setfiles_args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"-e"</span><span class="p">,</span> <span class="s2">"/proc"</span><span class="p">,</span> <span class="s2">"-e"</span><span class="p">,</span> <span class="s2">"/sys"</span><span class="p">,</span>
|
||||
<span class="s2">"/etc/selinux/targeted/contexts/files/file_contexts"</span><span class="p">,</span> <span class="s2">"/"</span><span class="p">]</span>
|
||||
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"sync"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-f"</span><span class="p">,</span> <span class="n">dirinstall_path</span><span class="p">])</span>
|
||||
<span class="k">if</span> <span class="s2">"--dirinstall"</span> <span class="ow">in</span> <span class="n">args</span><span class="p">:</span>
|
||||
<span class="c1"># setfiles may not be available, warn instead of fail</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"setfiles"</span><span class="p">,</span> <span class="n">setfiles_args</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">dirinstall_path</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="p">(</span><span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span><span class="p">,</span> <span class="ne">OSError</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">"Running setfiles on install tree failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">disk_img</span><span class="p">):</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"du"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-B"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"fstrim"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-v"</span><span class="p">,</span> <span class="n">dirinstall_path</span><span class="p">])</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">PartitionMount</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span> <span class="k">as</span> <span class="n">img_mount</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">img_mount</span> <span class="ow">and</span> <span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">:</span>
|
||||
@ -569,7 +509,10 @@
|
||||
|
||||
<span class="c1"># For image installs, run fstrim to discard unused blocks. This way</span>
|
||||
<span class="c1"># unused blocks do not need to be allocated for sparse image types</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"fstrim"</span><span class="p">,</span> <span class="p">[</span><span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">])</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"du"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-B"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"fstrim"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-v"</span><span class="p">,</span> <span class="n">img_mount</span><span class="o">.</span><span class="n">mount_dir</span><span class="p">])</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">disk_img</span><span class="p">):</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"du"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-B"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
|
||||
<span class="k">except</span> <span class="p">(</span><span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span><span class="p">,</span> <span class="ne">OSError</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"Running anaconda failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
|
||||
@ -661,8 +604,10 @@
|
||||
<span class="k">if</span> <span class="n">rc</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">"novirt_install mktar failed: rc=</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">rc</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># For raw disk images, use fallocate to deallocate unused space</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"fallocate"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"--dig-holes"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">],</span> <span class="n">raise_err</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="c1"># Examine the image for sections that can be made sparse</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"du"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-B"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"fallocate"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"--dig-holes"</span><span class="p">,</span> <span class="s2">"-v"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">],</span> <span class="n">raise_err</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">"du"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-B"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># For make_tar_disk, wrap the result in a tar file, and remove the original disk image.</span>
|
||||
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_tar_disk</span><span class="p">:</span>
|
||||
@ -819,42 +764,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.ltmpl — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.ltmpl — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.ltmpl</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -159,7 +73,7 @@
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># ltmpl.py</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2009-2015 Red Hat, Inc.</span>
|
||||
<span class="c1"># Copyright (C) 2009-2018 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
@ -182,25 +96,25 @@
|
||||
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax.ltmpl"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">re</span><span class="o">,</span> <span class="nn">glob</span><span class="o">,</span> <span class="nn">shlex</span><span class="o">,</span> <span class="nn">fnmatch</span>
|
||||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="k">import</span> <span class="n">basename</span><span class="p">,</span> <span class="n">isdir</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="k">import</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="kn">import</span> <span class="n">basename</span><span class="p">,</span> <span class="n">isdir</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">cpfile</span><span class="p">,</span> <span class="n">mvfile</span><span class="p">,</span> <span class="n">replace</span><span class="p">,</span> <span class="n">remove</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.dnfhelper</span> <span class="k">import</span> <span class="n">LoraxDownloadCallback</span><span class="p">,</span> <span class="n">LoraxRpmCallback</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">mkcpio</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">cpfile</span><span class="p">,</span> <span class="n">mvfile</span><span class="p">,</span> <span class="n">replace</span><span class="p">,</span> <span class="n">remove</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.dnfhelper</span> <span class="kn">import</span> <span class="n">LoraxDownloadCallback</span><span class="p">,</span> <span class="n">LoraxRpmCallback</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="kn">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">mkcpio</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">mako.lookup</span> <span class="k">import</span> <span class="n">TemplateLookup</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.exceptions</span> <span class="k">import</span> <span class="n">text_error_template</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.lookup</span> <span class="kn">import</span> <span class="n">TemplateLookup</span>
|
||||
<span class="kn">from</span> <span class="nn">mako.exceptions</span> <span class="kn">import</span> <span class="n">text_error_template</span>
|
||||
<span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span> <span class="nn">traceback</span>
|
||||
<span class="kn">import</span> <span class="nn">struct</span>
|
||||
<span class="kn">import</span> <span class="nn">dnf</span>
|
||||
<span class="kn">import</span> <span class="nn">collections</span>
|
||||
<span class="kn">import</span> <span class="nn">collections.abc</span>
|
||||
|
||||
<div class="viewcode-block" id="LoraxTemplate"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplate">[docs]</a><span class="k">class</span> <span class="nc">LoraxTemplate</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">directories</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">directories</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="n">directories</span> <span class="o">=</span> <span class="n">directories</span> <span class="ow">or</span> <span class="p">[</span><span class="s2">"/usr/share/lorax"</span><span class="p">]</span>
|
||||
<span class="c1"># we have to add ["/"] to the template lookup directories or the</span>
|
||||
<span class="c1"># file includes won't work properly for absolute paths</span>
|
||||
@ -274,11 +188,13 @@
|
||||
<span class="sd"> # install a bunch of packages</span>
|
||||
<span class="sd"> runner = LoraxTemplateRunner(inroot=rundir, outroot=rundir, dbo=dnf_obj)</span>
|
||||
<span class="sd"> runner.run("install-packages.ltmpl")</span>
|
||||
|
||||
<span class="sd"> NOTES:</span>
|
||||
|
||||
<span class="sd"> * Parsing procedure is roughly:</span>
|
||||
<span class="sd"> 1. Mako template expansion (on the whole file)</span>
|
||||
<span class="sd"> 2. For each line of the result,</span>
|
||||
|
||||
<span class="sd"> a. Whitespace splitting (using shlex.split())</span>
|
||||
<span class="sd"> b. Brace expansion (using brace_expand())</span>
|
||||
<span class="sd"> c. If the first token is the name of a function, call that function</span>
|
||||
@ -287,7 +203,7 @@
|
||||
<span class="sd"> * Parsing and execution are *separate* passes - so you can't use the result</span>
|
||||
<span class="sd"> of a command in an %if statement (or any other control statements)!</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">builtins</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">builtins</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">fatalerrors</span> <span class="o">=</span> <span class="n">fatalerrors</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">templatedir</span> <span class="o">=</span> <span class="n">templatedir</span> <span class="ow">or</span> <span class="s2">"/usr/share/lorax"</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
@ -319,7 +235,7 @@
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># grab the method named in cmd and pass it the given arguments</span>
|
||||
<span class="n">f</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cmd</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'_'</span> <span class="ow">or</span> <span class="n">cmd</span> <span class="o">==</span> <span class="s1">'run'</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">collections</span><span class="o">.</span><span class="n">Callable</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'_'</span> <span class="ow">or</span> <span class="n">cmd</span> <span class="o">==</span> <span class="s1">'run'</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">collections</span><span class="o">.</span><span class="n">abc</span><span class="o">.</span><span class="n">Callable</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"unknown command </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">cmd</span><span class="p">)</span>
|
||||
<span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
@ -341,8 +257,149 @@
|
||||
<span class="k">raise</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="InstallpkgMixin"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.InstallpkgMixin">[docs]</a><span class="k">class</span> <span class="nc">InstallpkgMixin</span><span class="p">:</span>
|
||||
<span class="sd">"""Helper class used with *Runner classes"""</span>
|
||||
<span class="k">def</span> <span class="nf">_pkgver</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pkg_spec</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Helper to parse package version compare operators</span>
|
||||
|
||||
<span class="sd"> Returns a list of matching package objects or an empty list</span>
|
||||
|
||||
<span class="sd"> Examples:</span>
|
||||
<span class="sd"> "bash>4.01"</span>
|
||||
<span class="sd"> "tmux>=3.1.4-5"</span>
|
||||
<span class="sd"> "grub2<2.06"</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># Always return the highest of the filtered results</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">g</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'='</span><span class="p">,</span> <span class="s1">'<'</span><span class="p">,</span> <span class="s1">'>'</span><span class="p">,</span> <span class="s1">'!'</span><span class="p">]</span> <span class="k">if</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">pkg_spec</span><span class="p">):</span>
|
||||
<span class="n">query</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">subject</span><span class="o">.</span><span class="n">Subject</span><span class="p">(</span><span class="n">pkg_spec</span><span class="p">)</span><span class="o">.</span><span class="n">get_best_query</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">pcv</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="sa">r</span><span class="s1">'([!<>=]+)'</span><span class="p">,</span> <span class="n">pkg_spec</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">0</span><span class="p">]:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing package name"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pcv</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Missing version"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pcv</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">3</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Too many comparisons"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">query</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">subject</span><span class="o">.</span><span class="n">Subject</span><span class="p">(</span><span class="n">pcv</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="o">.</span><span class="n">get_best_query</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Parse the comparison operators</span>
|
||||
<span class="k">if</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"="</span> <span class="ow">or</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"=="</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">evr__eq</span> <span class="o">=</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
|
||||
<span class="k">elif</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"!="</span> <span class="ow">or</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"<>"</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">evr__neq</span> <span class="o">=</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
|
||||
<span class="k">elif</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">">"</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">evr__gt</span> <span class="o">=</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
|
||||
<span class="k">elif</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">">="</span> <span class="ow">or</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"=>"</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">evr__gte</span> <span class="o">=</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
|
||||
<span class="k">elif</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"<"</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">evr__lt</span> <span class="o">=</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
|
||||
<span class="k">elif</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"<="</span> <span class="ow">or</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"=<"</span><span class="p">:</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">evr__lte</span> <span class="o">=</span> <span class="n">pcv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># MUST be added last. Otherwise it will only return the latest, not the latest of the</span>
|
||||
<span class="c1"># filtered results.</span>
|
||||
<span class="n">query</span><span class="o">.</span><span class="n">filterm</span><span class="p">(</span><span class="n">latest</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">query</span><span class="o">.</span><span class="n">apply</span><span class="p">()]</span>
|
||||
|
||||
<div class="viewcode-block" id="InstallpkgMixin.installpkg"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.InstallpkgMixin.installpkg">[docs]</a> <span class="k">def</span> <span class="nf">installpkg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">pkgs</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
<span class="sd"> installpkg [--required|--optional] [--except PKGGLOB [--except PKGGLOB ...]] PKGGLOB [PKGGLOB ...]</span>
|
||||
<span class="sd"> Request installation of all packages matching the given globs.</span>
|
||||
<span class="sd"> Note that this is just a *request* - nothing is *actually* installed</span>
|
||||
<span class="sd"> until the 'run_pkg_transaction' command is given.</span>
|
||||
|
||||
<span class="sd"> The non-except PKGGLOB can contain a version comparison. This should</span>
|
||||
<span class="sd"> not be used as a substitute for package dependencies, it should be</span>
|
||||
<span class="sd"> used to enforce installation of tools required by the templates. eg.</span>
|
||||
<span class="sd"> grub2 changed the font location in 2.06-2 so the current templates</span>
|
||||
<span class="sd"> require grub2 to be 2.06-2 or later.</span>
|
||||
|
||||
<span class="sd"> installpkg tmux>=2.8 bash=5.0.0-1</span>
|
||||
|
||||
<span class="sd"> It supports the =,!=,>,>=,<,<= operators. == is an alias for =, and</span>
|
||||
<span class="sd"> <> is an alias for !=</span>
|
||||
|
||||
<span class="sd"> There should be no spaces between the package name, the compare</span>
|
||||
<span class="sd"> operator, and the version.</span>
|
||||
|
||||
<span class="sd"> NOTE: When testing for equality you must include the version AND</span>
|
||||
<span class="sd"> release, otherwise it won't match anything.</span>
|
||||
|
||||
<span class="sd"> --required is now the default. If the PKGGLOB can be missing pass --optional</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="k">if</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'--optional'</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">elif</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'--required'</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="n">excludes</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">while</span> <span class="s1">'--except'</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="n">idx</span> <span class="o">=</span> <span class="n">pkgs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s1">'--except'</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pkgs</span><span class="p">)</span> <span class="o">==</span> <span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"installpkg needs an argument after --except"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># TODO: Check for bare version compare operators</span>
|
||||
<span class="n">excludes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[:</span><span class="n">idx</span><span class="p">]</span> <span class="o">+</span> <span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">2</span><span class="p">:]</span>
|
||||
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="c1"># Did a version compare operatore end up in the list?</span>
|
||||
<span class="k">if</span> <span class="n">p</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'='</span><span class="p">,</span> <span class="s1">'<'</span><span class="p">,</span> <span class="s1">'>'</span><span class="p">,</span> <span class="s1">'!'</span><span class="p">]:</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Version compare operators cannot be surrounded by spaces"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># Start by using Subject to generate a package query, which will</span>
|
||||
<span class="c1"># give us a query object similar to what dbo.install would select,</span>
|
||||
<span class="c1"># minus the handling for multilib. This query may contain</span>
|
||||
<span class="c1"># multiple arches. Pull the package names out of that, filter any</span>
|
||||
<span class="c1"># that match the excludes patterns, and pass those names back to</span>
|
||||
<span class="c1"># dbo.install to do the actual, arch and version and multilib</span>
|
||||
<span class="c1"># aware, package selction.</span>
|
||||
|
||||
<span class="c1"># dnf queries don't have a concept of negative globs which is why</span>
|
||||
<span class="c1"># the filtering is done the hard way.</span>
|
||||
|
||||
<span class="c1"># Get the latest package, or package matching the selected version</span>
|
||||
<span class="n">pkgnames</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_pkgver</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pkgnames</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">PackageNotFoundError</span><span class="p">(</span><span class="s2">"no package matched"</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Apply excludes to the name only</span>
|
||||
<span class="k">for</span> <span class="n">exclude</span> <span class="ow">in</span> <span class="n">excludes</span><span class="p">:</span>
|
||||
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">fnmatch</span><span class="o">.</span><span class="n">fnmatch</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">exclude</span><span class="p">)]</span>
|
||||
|
||||
<span class="c1"># Convert to a sorted NVR list for installation</span>
|
||||
<span class="n">pkgnvrs</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">([</span><span class="s2">"</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">)</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># If the request is a glob, expand it in the log</span>
|
||||
<span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">g</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'*'</span><span class="p">,</span><span class="s1">'?'</span><span class="p">,</span><span class="s1">'.'</span><span class="p">]</span> <span class="k">if</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">p</span><span class="p">):</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"installpkg: </span><span class="si">%s</span><span class="s2"> expands to </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="s2">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">pkgnvrs</span><span class="p">))</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">pkgnvr</span> <span class="ow">in</span> <span class="n">pkgnvrs</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">pkgnvr</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
<span class="k">if</span> <span class="n">required</span><span class="p">:</span>
|
||||
<span class="k">raise</span>
|
||||
<span class="c1"># Not required, log it and continue processing pkgs</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"installpkg </span><span class="si">%s</span><span class="s2"> failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">pkgnvr</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"installpkg </span><span class="si">%s</span><span class="s2"> failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">errors</span> <span class="ow">and</span> <span class="n">required</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">"Required installpkg failed."</span><span class="p">)</span></div></div>
|
||||
|
||||
|
||||
<span class="c1"># TODO: operate inside an actual chroot for safety? Not that RPM bothers..</span>
|
||||
<div class="viewcode-block" id="LoraxTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LoraxTemplateRunner</span><span class="p">(</span><span class="n">TemplateRunner</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="LoraxTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LoraxTemplateRunner</span><span class="p">(</span><span class="n">TemplateRunner</span><span class="p">,</span> <span class="n">InstallpkgMixin</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
<span class="sd"> This class parses and executes Lorax templates. Sample usage:</span>
|
||||
|
||||
@ -373,7 +430,7 @@
|
||||
|
||||
<span class="sd"> * Commands should raise exceptions for errors - don't use sys.exit()</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">dbo</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">dbo</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">inroot</span> <span class="o">=</span> <span class="n">inroot</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">outroot</span> <span class="o">=</span> <span class="n">outroot</span>
|
||||
@ -403,35 +460,31 @@
|
||||
<span class="k">def</span> <span class="nf">_getsize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">files</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">getsize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="n">f</span><span class="p">))</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">files</span> <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="n">f</span><span class="p">)))</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_write_debuginfo_log</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">_write_package_log</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Write a list of debuginfo packages to /root/debug-pkgs.log</span>
|
||||
<span class="sd"> Write the list of installed packages to /root/ on the boot.iso</span>
|
||||
|
||||
<span class="sd"> If lorax is called with a debug repo find the corresponding debuginfo package</span>
|
||||
<span class="sd"> names and write them to /root/debubg-pkgs.log on the boot.iso</span>
|
||||
<span class="sd"> The non-debuginfo packages are written to /root/lorax-packages.log</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">for</span> <span class="n">repo</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">repos</span><span class="p">:</span>
|
||||
<span class="n">repo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">repos</span><span class="p">[</span><span class="n">repo</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="kc">True</span> <span class="k">for</span> <span class="n">url</span> <span class="ow">in</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span> <span class="k">if</span> <span class="s2">"debug"</span> <span class="ow">in</span> <span class="n">url</span><span class="p">):</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span> <span class="ow">and</span> <span class="s2">"debug"</span> <span class="ow">in</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span><span class="p">:</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span> <span class="ow">and</span> <span class="s2">"debug"</span> <span class="ow">in</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span><span class="p">:</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># No debug repos</span>
|
||||
<span class="k">return</span>
|
||||
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="s2">"root/"</span><span class="p">),</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">available</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">available</span><span class="p">()</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">debug_pkgs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">install_set</span><span class="p">):</span>
|
||||
<span class="n">pkgs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">-</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">version</span><span class="si">}</span><span class="s2">-</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">release</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">arch</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">available</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">+</span><span class="s2">"-debuginfo"</span><span class="p">):</span>
|
||||
<span class="n">debug_pkgs</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">"</span><span class="si">{0.name}</span><span class="s2">-debuginfo-</span><span class="si">{0.epoch}</span><span class="s2">:</span><span class="si">{0.version}</span><span class="s2">-</span><span class="si">{0.release}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">p</span><span class="p">)]</span>
|
||||
<span class="n">debug_pkgs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">-debuginfo-</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">epoch</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">version</span><span class="si">}</span><span class="s2">-</span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">release</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="s2">"root/"</span><span class="p">),</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="s2">"root/debug-pkgs.log"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">debug_pkgs</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="se">\n</span><span class="s2">"</span> <span class="o">%</span> <span class="n">pkg</span><span class="p">)</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="s2">"root/lorax-packages.log"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">sorted</span><span class="p">(</span><span class="n">pkgs</span><span class="p">)))</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">debug_pkgs</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_out</span><span class="p">(</span><span class="s2">"root/debug-pkgs.log"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">sorted</span><span class="p">(</span><span class="n">debug_pkgs</span><span class="p">)))</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
|
||||
<div class="viewcode-block" id="LoraxTemplateRunner.install"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.install">[docs]</a> <span class="k">def</span> <span class="nf">install</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">srcglob</span><span class="p">,</span> <span class="n">dest</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
@ -671,7 +724,7 @@
|
||||
<span class="sd"> (this should be replaced with a "find" function)</span>
|
||||
<span class="sd"> runcmd find ${root} -name "*.pyo" -type f -delete</span>
|
||||
<span class="sd"> %for f in find(root, name="*.pyo"):</span>
|
||||
<span class="sd"> remove ${f}</span>
|
||||
<span class="sd"> remove ${f}</span>
|
||||
<span class="sd"> %endfor</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="n">cmd</span> <span class="o">=</span> <span class="n">cmdlist</span>
|
||||
@ -691,77 +744,6 @@
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s1">'command returned failure (</span><span class="si">%d</span><span class="s1">)'</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">returncode</span><span class="p">)</span>
|
||||
<span class="k">raise</span></div>
|
||||
|
||||
<div class="viewcode-block" id="LoraxTemplateRunner.installpkg"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.installpkg">[docs]</a> <span class="k">def</span> <span class="nf">installpkg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">pkgs</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
<span class="sd"> installpkg [--required|--optional] [--except PKGGLOB [--except PKGGLOB ...]] PKGGLOB [PKGGLOB ...]</span>
|
||||
<span class="sd"> Request installation of all packages matching the given globs.</span>
|
||||
<span class="sd"> Note that this is just a *request* - nothing is *actually* installed</span>
|
||||
<span class="sd"> until the 'run_pkg_transaction' command is given.</span>
|
||||
|
||||
<span class="sd"> --required is now the default. If the PKGGLOB can be missing pass --optional</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="k">if</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'--optional'</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">elif</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'--required'</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="n">excludes</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">while</span> <span class="s1">'--except'</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="n">idx</span> <span class="o">=</span> <span class="n">pkgs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s1">'--except'</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pkgs</span><span class="p">)</span> <span class="o">==</span> <span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"installpkg needs an argument after --except"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">excludes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[:</span><span class="n">idx</span><span class="p">]</span> <span class="o">+</span> <span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">2</span><span class="p">:]</span>
|
||||
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># Start by using Subject to generate a package query, which will</span>
|
||||
<span class="c1"># give us a query object similar to what dbo.install would select,</span>
|
||||
<span class="c1"># minus the handling for multilib. This query may contain</span>
|
||||
<span class="c1"># multiple arches. Pull the package names out of that, filter any</span>
|
||||
<span class="c1"># that match the excludes patterns, and pass those names back to</span>
|
||||
<span class="c1"># dbo.install to do the actual, arch and version and multilib</span>
|
||||
<span class="c1"># aware, package selction.</span>
|
||||
|
||||
<span class="c1"># dnf queries don't have a concept of negative globs which is why</span>
|
||||
<span class="c1"># the filtering is done the hard way.</span>
|
||||
|
||||
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">dnf</span><span class="o">.</span><span class="n">subject</span><span class="o">.</span><span class="n">Subject</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">get_best_query</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">latest</span><span class="o">=</span><span class="kc">True</span><span class="p">)]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pkgnames</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">PackageNotFoundError</span><span class="p">(</span><span class="s2">"no package matched"</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Apply excludes to the name only</span>
|
||||
<span class="k">for</span> <span class="n">exclude</span> <span class="ow">in</span> <span class="n">excludes</span><span class="p">:</span>
|
||||
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">fnmatch</span><span class="o">.</span><span class="n">fnmatch</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">exclude</span><span class="p">)]</span>
|
||||
|
||||
<span class="c1"># Convert to a sorted NVR list for installation</span>
|
||||
<span class="n">pkgnvrs</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">([</span><span class="s2">"</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">)</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># If the request is a glob, expand it in the log</span>
|
||||
<span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">g</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'*'</span><span class="p">,</span><span class="s1">'?'</span><span class="p">,</span><span class="s1">'.'</span><span class="p">]</span> <span class="k">if</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">p</span><span class="p">):</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"installpkg: </span><span class="si">%s</span><span class="s2"> expands to </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="s2">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">pkgnvrs</span><span class="p">))</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">pkgnvr</span> <span class="ow">in</span> <span class="n">pkgnvrs</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">pkgnvr</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
<span class="k">if</span> <span class="n">required</span><span class="p">:</span>
|
||||
<span class="k">raise</span>
|
||||
<span class="c1"># Not required, log it and continue processing pkgs</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"installpkg </span><span class="si">%s</span><span class="s2"> failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">pkgnvr</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"installpkg </span><span class="si">%s</span><span class="s2"> failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">errors</span> <span class="ow">and</span> <span class="n">required</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">"Required installpkg failed."</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="LoraxTemplateRunner.removepkg"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removepkg">[docs]</a> <span class="k">def</span> <span class="nf">removepkg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">pkgs</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
<span class="sd"> removepkg PKGGLOB [PKGGLOB...]</span>
|
||||
@ -796,8 +778,8 @@
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">"No packages in transaction"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># If a debug repo has been included, write out a list of debuginfo packages</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_write_debuginfo_log</span><span class="p">()</span>
|
||||
<span class="c1"># Write out the packages installed, including debuginfo packages</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_write_package_log</span><span class="p">()</span>
|
||||
|
||||
<span class="n">pkgs_to_download</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">transaction</span><span class="o">.</span><span class="n">install_set</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Downloading packages"</span><span class="p">)</span>
|
||||
@ -865,6 +847,7 @@
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"removefrom </span><span class="si">%s</span><span class="s2">: no files to remove!"</span><span class="p">,</span> <span class="n">cmd</span><span class="p">)</span></div>
|
||||
|
||||
<span class="c1"># pylint: disable=anomalous-backslash-in-string</span>
|
||||
<div class="viewcode-block" id="LoraxTemplateRunner.removekmod"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removekmod">[docs]</a> <span class="k">def</span> <span class="nf">removekmod</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">globs</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
<span class="sd"> removekmod GLOB [GLOB...] [--allbut] KEEPGLOB [KEEPGLOB...]</span>
|
||||
@ -876,7 +859,7 @@
|
||||
<span class="sd"> to search and one KEEPGLOB to keep. The KEEPGLOB is expanded to be *KEEPGLOB*</span>
|
||||
<span class="sd"> so that it will match anywhere in the path.</span>
|
||||
|
||||
<span class="sd"> This only removes files from under /lib/modules/*/kernel/</span>
|
||||
<span class="sd"> This only removes files from under /lib/modules/\\*/kernel/</span>
|
||||
|
||||
<span class="sd"> Examples:</span>
|
||||
<span class="sd"> removekmod sound drivers/media drivers/hwmon drivers/video</span>
|
||||
@ -959,7 +942,7 @@
|
||||
<span class="k">except</span> <span class="n">CalledProcessError</span><span class="p">:</span>
|
||||
<span class="k">pass</span></div></div>
|
||||
|
||||
<div class="viewcode-block" id="LiveTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LiveTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LiveTemplateRunner</span><span class="p">(</span><span class="n">TemplateRunner</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="LiveTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LiveTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LiveTemplateRunner</span><span class="p">(</span><span class="n">TemplateRunner</span><span class="p">,</span> <span class="n">InstallpkgMixin</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> This class parses and executes a limited Lorax template. Sample usage:</span>
|
||||
|
||||
@ -970,116 +953,39 @@
|
||||
<span class="sd"> It is meant to be used with the live-install.tmpl which lists the per-arch</span>
|
||||
<span class="sd"> pacages needed to build the live-iso output.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dbo</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dbo</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span> <span class="o">=</span> <span class="n">dbo</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">pkgs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
|
||||
<span class="nb">super</span><span class="p">(</span><span class="n">LiveTemplateRunner</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">fatalerrors</span><span class="p">,</span> <span class="n">templatedir</span><span class="p">,</span> <span class="n">defaults</span><span class="p">)</span>
|
||||
|
||||
<div class="viewcode-block" id="LiveTemplateRunner.installpkg"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LiveTemplateRunner.installpkg">[docs]</a> <span class="k">def</span> <span class="nf">installpkg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">pkgs</span><span class="p">):</span>
|
||||
<span class="sd">'''</span>
|
||||
<span class="sd"> installpkg [--required|--optional] [--except PKGGLOB [--except PKGGLOB ...]] PKGGLOB [PKGGLOB ...]</span>
|
||||
<span class="sd"> Request installation of all packages matching the given globs.</span>
|
||||
<span class="sd"> Note that this is just a *request* - nothing is *actually* installed</span>
|
||||
<span class="sd"> until the 'run_pkg_transaction' command is given.</span>
|
||||
|
||||
<span class="sd"> --required is now the default. If the PKGGLOB can be missing pass --optional</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="k">if</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'--optional'</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">elif</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'--required'</span><span class="p">:</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="n">excludes</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">while</span> <span class="s1">'--except'</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="n">idx</span> <span class="o">=</span> <span class="n">pkgs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s1">'--except'</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pkgs</span><span class="p">)</span> <span class="o">==</span> <span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"installpkg needs an argument after --except"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">excludes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[:</span><span class="n">idx</span><span class="p">]</span> <span class="o">+</span> <span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">2</span><span class="p">:]</span>
|
||||
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># Start by using Subject to generate a package query, which will</span>
|
||||
<span class="c1"># give us a query object similar to what dbo.install would select,</span>
|
||||
<span class="c1"># minus the handling for multilib. This query may contain</span>
|
||||
<span class="c1"># multiple arches. Pull the package names out of that, filter any</span>
|
||||
<span class="c1"># that match the excludes patterns, and pass those names back to</span>
|
||||
<span class="c1"># dbo.install to do the actual, arch and version and multilib</span>
|
||||
<span class="c1"># aware, package selction.</span>
|
||||
|
||||
<span class="c1"># dnf queries don't have a concept of negative globs which is why</span>
|
||||
<span class="c1"># the filtering is done the hard way.</span>
|
||||
|
||||
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">dnf</span><span class="o">.</span><span class="n">subject</span><span class="o">.</span><span class="n">Subject</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">get_best_query</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">latest</span><span class="o">=</span><span class="kc">True</span><span class="p">)]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pkgnames</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">PackageNotFoundError</span><span class="p">(</span><span class="s2">"no package matched"</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Apply excludes to the name only</span>
|
||||
<span class="k">for</span> <span class="n">exclude</span> <span class="ow">in</span> <span class="n">excludes</span><span class="p">:</span>
|
||||
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">fnmatch</span><span class="o">.</span><span class="n">fnmatch</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">exclude</span><span class="p">)]</span>
|
||||
|
||||
<span class="c1"># Convert to a sorted NVR list for installation</span>
|
||||
<span class="n">pkgnvrs</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">([</span><span class="s2">"</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">)</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span><span class="p">])</span>
|
||||
|
||||
<span class="c1"># If the request is a glob, expand it in the log</span>
|
||||
<span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">g</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'*'</span><span class="p">,</span><span class="s1">'?'</span><span class="p">,</span><span class="s1">'.'</span><span class="p">]</span> <span class="k">if</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">p</span><span class="p">):</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"installpkg: </span><span class="si">%s</span><span class="s2"> expands to </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="s2">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">pkgnvrs</span><span class="p">))</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">pkgs</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">pkgnvrs</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">pkgnames</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span><span class="p">])</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"installpkg </span><span class="si">%s</span><span class="s2"> failed: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">errors</span> <span class="ow">and</span> <span class="n">required</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">"Required installpkg failed."</span><span class="p">)</span></div></div>
|
||||
<span class="nb">super</span><span class="p">(</span><span class="n">LiveTemplateRunner</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">fatalerrors</span><span class="p">,</span> <span class="n">templatedir</span><span class="p">,</span> <span class="n">defaults</span><span class="p">)</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.monitor — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.monitor — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.monitor</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -192,6 +106,27 @@
|
||||
<span class="sd"> for patterns that would indicate that the installation failed.</span>
|
||||
<span class="sd"> self.server.log_error is set True when this happens.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="n">simple_tests</span> <span class="o">=</span> <span class="p">[</span>
|
||||
<span class="s2">"Traceback ("</span><span class="p">,</span>
|
||||
<span class="s2">"traceback script(s) have been run"</span><span class="p">,</span>
|
||||
<span class="s2">"Out of memory:"</span><span class="p">,</span>
|
||||
<span class="s2">"Call Trace:"</span><span class="p">,</span>
|
||||
<span class="s2">"insufficient disk space:"</span><span class="p">,</span>
|
||||
<span class="s2">"Not enough disk space to download the packages"</span><span class="p">,</span>
|
||||
<span class="s2">"error populating transaction after"</span><span class="p">,</span>
|
||||
<span class="s2">"crashed on signal"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Missed: NoSuchPackage"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Installation failed"</span><span class="p">,</span>
|
||||
<span class="s2">"The following error occurred while installing. This is a fatal error"</span><span class="p">,</span>
|
||||
<span class="s2">"Error in POSTIN scriptlet in rpm package"</span>
|
||||
<span class="p">]</span>
|
||||
|
||||
<span class="n">re_tests</span> <span class="o">=</span> <span class="p">[</span>
|
||||
<span class="sa">r</span><span class="s2">"packaging: base repo .* not valid"</span><span class="p">,</span>
|
||||
<span class="sa">r</span><span class="s2">"packaging: .* requires .*"</span>
|
||||
<span class="p">]</span>
|
||||
|
||||
<div class="viewcode-block" id="LogRequestHandler.setup"><a class="viewcode-back" href="../../pylorax.html#pylorax.monitor.LogRequestHandler.setup">[docs]</a> <span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""Start writing to self.server.log_path"""</span>
|
||||
|
||||
@ -211,30 +146,25 @@
|
||||
<span class="sd"> Loops until self.server.kill is True</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Processing logs from </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">client_address</span><span class="p">)</span>
|
||||
<span class="n">line</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="sa">b</span><span class="s2">""</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">kill</span><span class="p">:</span>
|
||||
<span class="k">break</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">recv</span><span class="p">(</span><span class="mi">4096</span><span class="p">),</span> <span class="s2">"utf8"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">flush</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># check the data for errors and set error flag</span>
|
||||
<span class="c1"># need to assemble it into lines so we can test for the error</span>
|
||||
<span class="c1"># string.</span>
|
||||
<span class="k">while</span> <span class="n">data</span><span class="p">:</span>
|
||||
<span class="n">more</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">line</span> <span class="o">+=</span> <span class="n">more</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">more</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">iserror</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
|
||||
<span class="n">line</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="n">more</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
||||
<span class="n">data</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">recv</span><span class="p">(</span><span class="mi">4096</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">splitlines</span><span class="p">(</span><span class="n">keepends</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="sa">b</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">):</span>
|
||||
<span class="c1"># Ignore invalid UTF8 inside lines</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">iserror</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">line</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="s2">"utf8"</span><span class="p">,</span> <span class="s2">"ignore"</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="s2">"utf8"</span><span class="p">,</span> <span class="s2">"ignore"</span><span class="p">))</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">flush</span><span class="p">()</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="sa">b</span><span class="s2">""</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
|
||||
<span class="c1"># Not the end of the line, keep for later</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="n">line</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">timeout</span><span class="p">:</span>
|
||||
<span class="k">pass</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
|
||||
@ -243,7 +173,6 @@
|
||||
|
||||
<div class="viewcode-block" id="LogRequestHandler.finish"><a class="viewcode-back" href="../../pylorax.html#pylorax.monitor.LogRequestHandler.finish">[docs]</a> <span class="k">def</span> <span class="nf">finish</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Shutting down log processing"</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">close</span><span class="p">()</span></div>
|
||||
|
||||
@ -257,25 +186,13 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="s2">"IGNORED"</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
<span class="n">simple_tests</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"Traceback ("</span><span class="p">,</span>
|
||||
<span class="s2">"Out of memory:"</span><span class="p">,</span>
|
||||
<span class="s2">"Call Trace:"</span><span class="p">,</span>
|
||||
<span class="s2">"insufficient disk space:"</span><span class="p">,</span>
|
||||
<span class="s2">"Not enough disk space to download the packages"</span><span class="p">,</span>
|
||||
<span class="s2">"error populating transaction after"</span><span class="p">,</span>
|
||||
<span class="s2">"traceback script(s) have been run"</span><span class="p">,</span>
|
||||
<span class="s2">"crashed on signal"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Missed: NoSuchPackage"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Installation failed"</span><span class="p">,</span>
|
||||
<span class="s2">"The following error occurred while installing. This is a fatal error"</span><span class="p">]</span>
|
||||
<span class="n">re_tests</span> <span class="o">=</span> <span class="p">[</span><span class="sa">r</span><span class="s2">"packaging: base repo .* not valid"</span><span class="p">,</span>
|
||||
<span class="sa">r</span><span class="s2">"packaging: .* requires .*"</span><span class="p">]</span>
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">simple_tests</span><span class="p">:</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">simple_tests</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_error</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">error_line</span> <span class="o">=</span> <span class="n">line</span>
|
||||
<span class="k">return</span>
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">re_tests</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">re_tests</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">line</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_error</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">error_line</span> <span class="o">=</span> <span class="n">line</span>
|
||||
@ -288,7 +205,7 @@
|
||||
<span class="c1"># Number of seconds to wait for a connection after startup</span>
|
||||
<span class="n">timeout</span> <span class="o">=</span> <span class="mi">60</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">log_path</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">log_path</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Setup the log server</span>
|
||||
|
||||
@ -326,7 +243,7 @@
|
||||
<span class="sd"> This needs to be running before the virt-install runs, it expects</span>
|
||||
<span class="sd"> there to be a listener on the port used for the virtio log port.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">log_path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">log_path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">log_request_handler_class</span><span class="o">=</span><span class="n">LogRequestHandler</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Start a thread to monitor the logs.</span>
|
||||
|
||||
@ -340,7 +257,7 @@
|
||||
<span class="sd"> If log_path isn't set then it only monitors the logs, instead of</span>
|
||||
<span class="sd"> also writing them to disk.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span> <span class="o">=</span> <span class="n">LogServer</span><span class="p">(</span><span class="n">log_path</span><span class="p">,</span> <span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">),</span> <span class="n">LogRequestHandler</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="n">timeout</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span> <span class="o">=</span> <span class="n">LogServer</span><span class="p">(</span><span class="n">log_path</span><span class="p">,</span> <span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">),</span> <span class="n">log_request_handler_class</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="n">timeout</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">port</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">server_address</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">log_path</span> <span class="o">=</span> <span class="n">log_path</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server_thread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">handle_request</span><span class="p">)</span>
|
||||
@ -350,46 +267,35 @@
|
||||
<div class="viewcode-block" id="LogMonitor.shutdown"><a class="viewcode-back" href="../../pylorax.html#pylorax.monitor.LogMonitor.shutdown">[docs]</a> <span class="k">def</span> <span class="nf">shutdown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""Force shutdown of the monitoring thread"""</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">kill</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server_thread</span><span class="o">.</span><span class="n">join</span><span class="p">()</span></div></div>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server_thread</span><span class="o">.</span><span class="n">join</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">server_close</span><span class="p">()</span></div></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.mount — Lorax 36.4 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.mount — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.4
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.mount</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -179,9 +93,9 @@
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"livemedia-creator"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">iso9660</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">mount</span><span class="p">,</span> <span class="n">umount</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">execWithCapture</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">mount</span><span class="p">,</span> <span class="n">umount</span>
|
||||
|
||||
<div class="viewcode-block" id="IsoMountpoint"><a class="viewcode-back" href="../../pylorax.html#pylorax.mount.IsoMountpoint">[docs]</a><span class="k">class</span> <span class="nc">IsoMountpoint</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
@ -192,7 +106,7 @@
|
||||
|
||||
<span class="sd"> stage2 can be either LiveOS/squashfs.img or images/install.img</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">iso_path</span><span class="p">,</span> <span class="n">initrd_path</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">iso_path</span><span class="p">,</span> <span class="n">initrd_path</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Mount the iso</span>
|
||||
|
||||
@ -216,7 +130,9 @@
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">initrd_path</span>
|
||||
|
||||
<span class="n">kernel_list</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"/isolinux/vmlinuz"</span><span class="p">,</span> <span class="s2">"/isolinux/initrd.img"</span><span class="p">),</span>
|
||||
<span class="p">(</span><span class="s2">"/ppc/ppc64/vmlinuz"</span><span class="p">,</span> <span class="s2">"/ppc/ppc64/initrd.img"</span><span class="p">)]</span>
|
||||
<span class="p">(</span><span class="s2">"/ppc/ppc64/vmlinuz"</span><span class="p">,</span> <span class="s2">"/ppc/ppc64/initrd.img"</span><span class="p">),</span>
|
||||
<span class="p">(</span><span class="s2">"/images/pxeboot/vmlinuz"</span><span class="p">,</span> <span class="s2">"/images/pxeboot/initrd.img"</span><span class="p">),</span>
|
||||
<span class="p">(</span><span class="s2">"/images/kernel.img"</span><span class="p">,</span> <span class="s2">"/images/initrd.img"</span><span class="p">)]</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span><span class="o">+</span><span class="s2">"/repodata"</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">repo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span>
|
||||
@ -248,55 +164,48 @@
|
||||
|
||||
<div class="viewcode-block" id="IsoMountpoint.get_iso_label"><a class="viewcode-back" href="../../pylorax.html#pylorax.mount.IsoMountpoint.get_iso_label">[docs]</a> <span class="k">def</span> <span class="nf">get_iso_label</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Get the iso's label using isoinfo</span>
|
||||
<span class="sd"> Get the iso's label using pycdio</span>
|
||||
|
||||
<span class="sd"> Sets self.label if one is found</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">isoinfo_output</span> <span class="o">=</span> <span class="n">execWithCapture</span><span class="p">(</span><span class="s2">"isoinfo"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"-d"</span><span class="p">,</span> <span class="s2">"-i"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">iso_path</span><span class="p">])</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">isoinfo_output</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">isoinfo_output</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
|
||||
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"Volume id: "</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">11</span><span class="p">:]</span>
|
||||
<span class="k">return</span></div></div>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">iso</span> <span class="o">=</span> <span class="n">iso9660</span><span class="o">.</span><span class="n">ISO9660</span><span class="o">.</span><span class="n">IFS</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">iso_path</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">iso</span><span class="o">.</span><span class="n">is_open</span><span class="p">():</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"error opening file"</span><span class="p">)</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">iso</span><span class="o">.</span><span class="n">get_volume_id</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">label</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"error reading volume id"</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">RuntimeError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"Problem reading label from </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">iso_path</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span></div></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.sysutils — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.sysutils — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.sysutils</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -159,7 +73,7 @@
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># sysutils.py</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2009-2015 Red Hat, Inc.</span>
|
||||
<span class="c1"># Copyright (C) 2009-2019 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
@ -189,9 +103,9 @@
|
||||
<span class="kn">import</span> <span class="nn">glob</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
<span class="kn">import</span> <span class="nn">shlex</span>
|
||||
<span class="kn">from</span> <span class="nn">configparser</span> <span class="k">import</span> <span class="n">ConfigParser</span>
|
||||
<span class="kn">from</span> <span class="nn">configparser</span> <span class="kn">import</span> <span class="n">ConfigParser</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">runcmd</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">runcmd</span>
|
||||
|
||||
<div class="viewcode-block" id="joinpaths"><a class="viewcode-back" href="../../pylorax.html#pylorax.sysutils.joinpaths">[docs]</a><span class="k">def</span> <span class="nf">joinpaths</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
|
||||
@ -203,8 +117,8 @@
|
||||
|
||||
|
||||
<div class="viewcode-block" id="touch"><a class="viewcode-back" href="../../pylorax.html#pylorax.sysutils.touch">[docs]</a><span class="k">def</span> <span class="nf">touch</span><span class="p">(</span><span class="n">fname</span><span class="p">):</span>
|
||||
<span class="c1"># python closes the file when it goes out of scope</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span></div>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="replace"><a class="viewcode-back" href="../../pylorax.html#pylorax.sysutils.replace">[docs]</a><span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="n">find</span><span class="p">,</span> <span class="n">sub</span><span class="p">):</span>
|
||||
@ -288,45 +202,61 @@
|
||||
<span class="n">config</span> <span class="o">=</span> <span class="n">UnquotingConfigParser</span><span class="p">()</span>
|
||||
<span class="n">config</span><span class="o">.</span><span class="n">read_string</span><span class="p">(</span><span class="n">conftext</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">config</span><span class="p">[</span><span class="s1">'main'</span><span class="p">]</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">read_tail</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">size</span><span class="p">):</span>
|
||||
<span class="sd">"""Read up to `size` kibibytes from the end of a file"""</span>
|
||||
|
||||
<span class="c1"># NOTE: In py3 text files are unicode, not bytes so we have to open it as bytes</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s2">"rb"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">_read_file_end</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_read_file_end</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">size</span><span class="p">):</span>
|
||||
<span class="sd">"""Read the end of a file</span>
|
||||
|
||||
<span class="sd"> This skips to the next line to avoid starting in the middle of a unicode character.</span>
|
||||
<span class="sd"> And returns "" in the case of a UnicodeDecodeError</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
|
||||
<span class="n">end</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">tell</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">end</span> <span class="o"><</span> <span class="mi">1024</span> <span class="o">*</span> <span class="n">size</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="n">end</span> <span class="o">-</span> <span class="p">(</span><span class="mi">1024</span> <span class="o">*</span> <span class="n">size</span><span class="p">))</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># Find the first newline in the block</span>
|
||||
<span class="n">newline</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="mi">1</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="sa">b</span><span class="s1">'</span><span class="se">\n</span><span class="s1">'</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>
|
||||
<span class="n">text</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">newline</span><span class="p">:]</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"UTF-8"</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">UnicodeDecodeError</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="s2">""</span>
|
||||
<span class="k">return</span> <span class="n">text</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.treebuilder — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.treebuilder — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.treebuilder</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -179,22 +93,22 @@
|
||||
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax.treebuilder"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">re</span>
|
||||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="k">import</span> <span class="n">basename</span>
|
||||
<span class="kn">from</span> <span class="nn">shutil</span> <span class="k">import</span> <span class="n">copytree</span><span class="p">,</span> <span class="n">copy2</span>
|
||||
<span class="kn">from</span> <span class="nn">pathlib</span> <span class="k">import</span> <span class="n">Path</span>
|
||||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="kn">import</span> <span class="n">basename</span>
|
||||
<span class="kn">from</span> <span class="nn">shutil</span> <span class="kn">import</span> <span class="n">copytree</span><span class="p">,</span> <span class="n">copy2</span>
|
||||
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="n">CalledProcessError</span>
|
||||
<span class="kn">from</span> <span class="nn">pathlib</span> <span class="kn">import</span> <span class="n">Path</span>
|
||||
<span class="kn">import</span> <span class="nn">itertools</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">remove</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.ltmpl</span> <span class="k">import</span> <span class="n">LoraxTemplateRunner</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">remove</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="kn">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.ltmpl</span> <span class="kn">import</span> <span class="n">LoraxTemplateRunner</span>
|
||||
<span class="kn">import</span> <span class="nn">pylorax.imgutils</span> <span class="k">as</span> <span class="nn">imgutils</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="k">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span><span class="p">,</span> <span class="n">execWithCapture</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="kn">import</span> <span class="n">DracutChroot</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span><span class="p">,</span> <span class="n">execWithCapture</span>
|
||||
|
||||
<span class="n">templatemap</span> <span class="o">=</span> <span class="p">{</span>
|
||||
<span class="s1">'i386'</span><span class="p">:</span> <span class="s1">'x86.tmpl'</span><span class="p">,</span>
|
||||
<span class="s1">'x86_64'</span><span class="p">:</span> <span class="s1">'x86.tmpl'</span><span class="p">,</span>
|
||||
<span class="s1">'ppc'</span><span class="p">:</span> <span class="s1">'ppc.tmpl'</span><span class="p">,</span>
|
||||
<span class="s1">'ppc64'</span><span class="p">:</span> <span class="s1">'ppc.tmpl'</span><span class="p">,</span>
|
||||
<span class="s1">'ppc64le'</span><span class="p">:</span> <span class="s1">'ppc64le.tmpl'</span><span class="p">,</span>
|
||||
<span class="s1">'s390'</span><span class="p">:</span> <span class="s1">'s390.tmpl'</span><span class="p">,</span>
|
||||
<span class="s1">'s390x'</span><span class="p">:</span> <span class="s1">'s390.tmpl'</span><span class="p">,</span>
|
||||
@ -227,17 +141,12 @@
|
||||
|
||||
<div class="viewcode-block" id="RuntimeBuilder"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder">[docs]</a><span class="k">class</span> <span class="nc">RuntimeBuilder</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="sd">'''Builds the anaconda runtime image.'''</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">dbo</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">dbo</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">installpkgs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">excludepkgs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">add_templates</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">add_template_vars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">skip_branding</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
|
||||
<span class="n">root</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">installroot</span>
|
||||
<span class="c1"># use a copy of product so we can modify it locally</span>
|
||||
<span class="n">product</span> <span class="o">=</span> <span class="n">product</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
|
||||
<span class="n">product</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">product</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">vars</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">arch</span><span class="o">=</span><span class="n">arch</span><span class="p">,</span> <span class="n">product</span><span class="o">=</span><span class="n">product</span><span class="p">,</span> <span class="n">dbo</span><span class="o">=</span><span class="n">dbo</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">root</span><span class="p">,</span>
|
||||
<span class="n">basearch</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">,</span> <span class="n">libdir</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">libdir</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span> <span class="o">=</span> <span class="n">dbo</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span> <span class="o">=</span> <span class="n">LoraxTemplateRunner</span><span class="p">(</span><span class="n">inroot</span><span class="o">=</span><span class="n">root</span><span class="p">,</span> <span class="n">outroot</span><span class="o">=</span><span class="n">root</span><span class="p">,</span>
|
||||
<span class="n">dbo</span><span class="o">=</span><span class="n">dbo</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="n">templatedir</span><span class="p">)</span>
|
||||
@ -245,20 +154,29 @@
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template_vars</span> <span class="o">=</span> <span class="n">add_template_vars</span> <span class="ow">or</span> <span class="p">{}</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_installpkgs</span> <span class="o">=</span> <span class="n">installpkgs</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_excludepkgs</span> <span class="o">=</span> <span class="n">excludepkgs</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">vars</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_skip_branding</span> <span class="o">=</span> <span class="n">skip_branding</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_install_branding</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># use a copy of product so we can modify it locally</span>
|
||||
<span class="n">product</span> <span class="o">=</span> <span class="n">product</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
|
||||
<span class="n">product</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">product</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_branding</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_branding</span><span class="p">(</span><span class="n">skip_branding</span><span class="p">,</span> <span class="n">product</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">vars</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">arch</span><span class="o">=</span><span class="n">arch</span><span class="p">,</span> <span class="n">product</span><span class="o">=</span><span class="n">product</span><span class="p">,</span> <span class="n">dbo</span><span class="o">=</span><span class="n">dbo</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">root</span><span class="p">,</span>
|
||||
<span class="n">basearch</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">,</span> <span class="n">libdir</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">libdir</span><span class="p">,</span>
|
||||
<span class="n">branding</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_branding</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">vars</span>
|
||||
|
||||
<div class="viewcode-block" id="RuntimeBuilder.get_branding"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.get_branding">[docs]</a> <span class="k">def</span> <span class="nf">get_branding</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip</span><span class="p">,</span> <span class="n">product</span><span class="p">):</span>
|
||||
<span class="sd">"""Select the branding from the available 'system-release' packages</span>
|
||||
<span class="sd"> The *best* way to control this is to have a single package in the repo provide 'system-release'</span>
|
||||
<span class="sd"> When there are more than 1 package it will:</span>
|
||||
<span class="sd"> - Make a list of the available packages</span>
|
||||
<span class="sd"> - If variant is set look for a package ending with lower(variant) and use that</span>
|
||||
<span class="sd"> - If there are one or more non-generic packages, use the first one after sorting</span>
|
||||
|
||||
<span class="sd"> Returns the package names of the system-release and release logos package</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_skip_branding</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
<span class="k">if</span> <span class="n">skip</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">release</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">logos</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
|
||||
|
||||
<span class="n">release</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="n">q</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span>
|
||||
@ -267,11 +185,11 @@
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"generic"</span><span class="p">)])</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"No system-release packages found, could not get the release"</span><span class="p">)</span>
|
||||
<span class="k">return</span>
|
||||
<span class="k">return</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">release</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">logos</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
|
||||
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"system-release packages: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">variant</span><span class="p">:</span>
|
||||
<span class="n">variant</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span> <span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">"-"</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">variant</span><span class="o">.</span><span class="n">lower</span><span class="p">())]</span>
|
||||
<span class="k">if</span> <span class="n">product</span><span class="o">.</span><span class="n">variant</span><span class="p">:</span>
|
||||
<span class="n">variant</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span> <span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">"-"</span><span class="o">+</span><span class="n">product</span><span class="o">.</span><span class="n">variant</span><span class="o">.</span><span class="n">lower</span><span class="p">())]</span>
|
||||
<span class="k">if</span> <span class="n">variant</span><span class="p">:</span>
|
||||
<span class="n">release</span> <span class="o">=</span> <span class="n">variant</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">release</span><span class="p">:</span>
|
||||
@ -279,20 +197,25 @@
|
||||
|
||||
<span class="c1"># release</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">'got release: </span><span class="si">%s</span><span class="s1">'</span><span class="p">,</span> <span class="n">release</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">installpkg</span><span class="p">(</span><span class="n">release</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># logos</span>
|
||||
<span class="n">release</span><span class="p">,</span> <span class="n">_suffix</span> <span class="o">=</span> <span class="n">release</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'-'</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">installpkg</span><span class="p">(</span><span class="s1">'</span><span class="si">%s</span><span class="s1">-logos'</span> <span class="o">%</span> <span class="n">release</span><span class="p">)</span>
|
||||
<span class="c1"># logos uses the basename from release (fedora, redhat, centos, ...)</span>
|
||||
<span class="n">logos</span><span class="p">,</span> <span class="n">_suffix</span> <span class="o">=</span> <span class="n">release</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'-'</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">release</span><span class="o">=</span><span class="n">release</span><span class="p">,</span> <span class="n">logos</span><span class="o">=</span><span class="n">logos</span><span class="o">+</span><span class="s2">"-logos"</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="RuntimeBuilder.install"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.install">[docs]</a> <span class="k">def</span> <span class="nf">install</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">'''Install packages and do initial setup with runtime-install.tmpl'''</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_install_branding</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_branding</span><span class="o">.</span><span class="n">release</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">installpkg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_branding</span><span class="o">.</span><span class="n">release</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_branding</span><span class="o">.</span><span class="n">logos</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">installpkg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_branding</span><span class="o">.</span><span class="n">logos</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_installpkgs</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">installpkg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_installpkgs</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_excludepkgs</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">removepkg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_excludepkgs</span><span class="p">)</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="s2">"runtime-install.tmpl"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">tmpl</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_templates</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">tmpl</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">add_template_vars</span><span class="p">)</span></div>
|
||||
|
||||
@ -387,18 +310,34 @@
|
||||
<span class="n">runcmd</span><span class="p">([</span><span class="s2">"depmod"</span><span class="p">,</span> <span class="s2">"-a"</span><span class="p">,</span> <span class="s2">"-F"</span><span class="p">,</span> <span class="n">ksyms</span><span class="p">,</span> <span class="s2">"-b"</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="p">])</span>
|
||||
<span class="n">generate_module_info</span><span class="p">(</span><span class="n">moddir</span><span class="o">+</span><span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">moddir</span><span class="o">+</span><span class="s2">"module-info"</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="RuntimeBuilder.create_runtime"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_runtime">[docs]</a> <span class="k">def</span> <span class="nf">create_runtime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="s2">"/var/tmp/squashfs.img"</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">"xz"</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="RuntimeBuilder.create_squashfs_runtime"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_squashfs_runtime">[docs]</a> <span class="k">def</span> <span class="nf">create_squashfs_runtime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="s2">"/var/tmp/squashfs.img"</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">"xz"</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
|
||||
<span class="sd">"""Create a plain squashfs runtime"""</span>
|
||||
<span class="n">compressargs</span> <span class="o">=</span> <span class="n">compressargs</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">outfile</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># squash the rootfs</span>
|
||||
<span class="k">return</span> <span class="n">imgutils</span><span class="o">.</span><span class="n">mksquashfs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="RuntimeBuilder.create_ext4_runtime"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_ext4_runtime">[docs]</a> <span class="k">def</span> <span class="nf">create_ext4_runtime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="s2">"/var/tmp/squashfs.img"</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">"xz"</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
|
||||
<span class="sd">"""Create a squashfs compressed ext4 runtime"""</span>
|
||||
<span class="c1"># make live rootfs image - must be named "LiveOS/rootfs.img" for dracut</span>
|
||||
<span class="n">compressargs</span> <span class="o">=</span> <span class="n">compressargs</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="n">workdir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">outfile</span><span class="p">),</span> <span class="s2">"runtime-workdir"</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">workdir</span><span class="p">,</span> <span class="s2">"LiveOS"</span><span class="p">))</span>
|
||||
|
||||
<span class="n">imgutils</span><span class="o">.</span><span class="n">mkrootfsimg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">workdir</span><span class="p">,</span> <span class="s2">"LiveOS/rootfs.img"</span><span class="p">),</span>
|
||||
<span class="s2">"Anaconda"</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
|
||||
<span class="c1"># Catch problems with the rootfs being too small and clearly log them</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">imgutils</span><span class="o">.</span><span class="n">mkrootfsimg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">workdir</span><span class="p">,</span> <span class="s2">"LiveOS/rootfs.img"</span><span class="p">),</span>
|
||||
<span class="s2">"Anaconda"</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="n">CalledProcessError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">stdout</span> <span class="ow">and</span> <span class="s2">"No space left on device"</span> <span class="ow">in</span> <span class="n">e</span><span class="o">.</span><span class="n">stdout</span><span class="p">:</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"The rootfs ran out of space with size=</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
|
||||
<span class="k">raise</span>
|
||||
|
||||
<span class="c1"># squash the live rootfs and clean up workdir</span>
|
||||
<span class="n">imgutils</span><span class="o">.</span><span class="n">mksquashfs</span><span class="p">(</span><span class="n">workdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span>
|
||||
<span class="n">remove</span><span class="p">(</span><span class="n">workdir</span><span class="p">)</span></div>
|
||||
<span class="n">rc</span> <span class="o">=</span> <span class="n">imgutils</span><span class="o">.</span><span class="n">mksquashfs</span><span class="p">(</span><span class="n">workdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span>
|
||||
<span class="n">remove</span><span class="p">(</span><span class="n">workdir</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">rc</span></div>
|
||||
|
||||
<div class="viewcode-block" id="RuntimeBuilder.finished"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.finished">[docs]</a> <span class="k">def</span> <span class="nf">finished</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">""" Done using RuntimeBuilder</span>
|
||||
@ -410,7 +349,7 @@
|
||||
<div class="viewcode-block" id="TreeBuilder"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.TreeBuilder">[docs]</a><span class="k">class</span> <span class="nc">TreeBuilder</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="sd">'''Builds the arch-specific boot images.</span>
|
||||
<span class="sd"> inroot should be the installtree root (the newly-built runtime dir)'''</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">runtime</span><span class="p">,</span> <span class="n">isolabel</span><span class="p">,</span> <span class="n">domacboot</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">doupgrade</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">runtime</span><span class="p">,</span> <span class="n">isolabel</span><span class="p">,</span> <span class="n">domacboot</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">doupgrade</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">add_templates</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">add_template_vars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">workdir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">extra_boot_args</span><span class="o">=</span><span class="s2">""</span><span class="p">):</span>
|
||||
|
||||
<span class="c1"># NOTE: if you pass an arg named "runtime" to a mako template it'll</span>
|
||||
@ -444,40 +383,31 @@
|
||||
<span class="sd"> name of the kernel.</span>
|
||||
<span class="sd"> '''</span>
|
||||
<span class="n">add_args</span> <span class="o">=</span> <span class="n">add_args</span> <span class="ow">or</span> <span class="p">[]</span>
|
||||
<span class="n">dracut</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"dracut"</span><span class="p">,</span> <span class="s2">"--nomdadmconf"</span><span class="p">,</span> <span class="s2">"--nolvmconf"</span><span class="p">]</span> <span class="o">+</span> <span class="n">add_args</span>
|
||||
<span class="n">args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--nomdadmconf"</span><span class="p">,</span> <span class="s2">"--nolvmconf"</span><span class="p">]</span> <span class="o">+</span> <span class="n">add_args</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">backup</span><span class="p">:</span>
|
||||
<span class="n">dracut</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"--force"</span><span class="p">)</span>
|
||||
<span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"--force"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">kernels</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">"No kernels found, cannot rebuild_initrds"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Hush some dracut warnings. TODO: bind-mount proc in place?</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">inroot</span><span class="p">,</span><span class="s2">"/proc/modules"</span><span class="p">),</span><span class="s2">"w"</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">kernel</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">kernels</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">prefix</span><span class="p">:</span>
|
||||
<span class="n">idir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">idir</span><span class="p">,</span> <span class="n">prefix</span><span class="o">+</span><span class="s1">'-'</span><span class="o">+</span><span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="o">+</span><span class="s1">'.img'</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">kernel</span><span class="p">,</span> <span class="s2">"initrd"</span><span class="p">):</span>
|
||||
<span class="c1"># If there is an existing initrd, use that</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">kernel</span><span class="o">.</span><span class="n">initrd</span><span class="o">.</span><span class="n">path</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Construct an initrd from the kernel name</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"vmlinuz-"</span><span class="p">,</span> <span class="s2">"initrd-"</span><span class="p">)</span> <span class="o">+</span> <span class="s2">".img"</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"rebuilding </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">backup</span><span class="p">:</span>
|
||||
<span class="n">initrd</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">inroot</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">initrd</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">rename</span><span class="p">(</span><span class="n">initrd</span><span class="p">,</span> <span class="n">initrd</span> <span class="o">+</span> <span class="n">backup</span><span class="p">)</span>
|
||||
<span class="n">cmd</span> <span class="o">=</span> <span class="n">dracut</span> <span class="o">+</span> <span class="p">[</span><span class="n">outfile</span><span class="p">,</span> <span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="p">]</span>
|
||||
<span class="n">runcmd</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">inroot</span><span class="p">)</span>
|
||||
<span class="k">with</span> <span class="n">DracutChroot</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">inroot</span><span class="p">)</span> <span class="k">as</span> <span class="n">dracut</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">kernel</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">kernels</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">prefix</span><span class="p">:</span>
|
||||
<span class="n">idir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">idir</span><span class="p">,</span> <span class="n">prefix</span><span class="o">+</span><span class="s1">'-'</span><span class="o">+</span><span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="o">+</span><span class="s1">'.img'</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">kernel</span><span class="p">,</span> <span class="s2">"initrd"</span><span class="p">):</span>
|
||||
<span class="c1"># If there is an existing initrd, use that</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">kernel</span><span class="o">.</span><span class="n">initrd</span><span class="o">.</span><span class="n">path</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># Construct an initrd from the kernel name</span>
|
||||
<span class="n">outfile</span> <span class="o">=</span> <span class="n">kernel</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"vmlinuz-"</span><span class="p">,</span> <span class="s2">"initrd-"</span><span class="p">)</span> <span class="o">+</span> <span class="s2">".img"</span>
|
||||
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"rebuilding </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># ppc64 cannot boot images > 32MiB, check size and warn</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"ppc64"</span><span class="p">,</span> <span class="s2">"ppc64le"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">outfile</span><span class="p">):</span>
|
||||
<span class="n">st</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">stat</span><span class="p">(</span><span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">st</span><span class="o">.</span><span class="n">st_size</span> <span class="o">></span> <span class="mi">32</span> <span class="o">*</span> <span class="mi">1024</span> <span class="o">*</span> <span class="mi">1024</span><span class="p">:</span>
|
||||
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">"ppc64 initrd </span><span class="si">%s</span><span class="s2"> is > 32MiB"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">inroot</span><span class="p">,</span><span class="s2">"/proc/modules"</span><span class="p">))</span></div>
|
||||
<span class="k">if</span> <span class="n">backup</span><span class="p">:</span>
|
||||
<span class="n">initrd</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">inroot</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">initrd</span><span class="p">):</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">rename</span><span class="p">(</span><span class="n">initrd</span><span class="p">,</span> <span class="n">initrd</span> <span class="o">+</span> <span class="n">backup</span><span class="p">)</span>
|
||||
<span class="n">dracut</span><span class="o">.</span><span class="n">Run</span><span class="p">(</span><span class="n">args</span> <span class="o">+</span> <span class="p">[</span><span class="n">outfile</span><span class="p">,</span> <span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="p">])</span></div>
|
||||
|
||||
<div class="viewcode-block" id="TreeBuilder.build"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.TreeBuilder.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="n">templatefile</span> <span class="o">=</span> <span class="n">templatemap</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">]</span>
|
||||
@ -575,42 +505,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,69 +1,31 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pylorax.treeinfo — Lorax 36.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.treeinfo — Lorax 28.14.42 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
|
||||
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../../_static/language_data.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||
<script src="../../_static/jquery.js"></script>
|
||||
<script src="../../_static/underscore.js"></script>
|
||||
<script src="../../_static/doctools.js"></script>
|
||||
<script src="../../_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../search.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
|
||||
|
||||
|
||||
<a href="../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14.42
|
||||
36.0
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
@ -71,85 +33,37 @@
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../mkksiso.html">mkksiso</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">pylorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">src</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.treeinfo</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
@ -181,18 +95,24 @@
|
||||
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"pylorax.treeinfo"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">configparser</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">time</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="TreeInfo"><a class="viewcode-back" href="../../pylorax.html#pylorax.treeinfo.TreeInfo">[docs]</a><span class="k">class</span> <span class="nc">TreeInfo</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">variant</span><span class="p">,</span> <span class="n">basearch</span><span class="p">,</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">variant</span><span class="p">,</span> <span class="n">basearch</span><span class="p">,</span>
|
||||
<span class="n">packagedir</span><span class="o">=</span><span class="s2">""</span><span class="p">):</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">c</span> <span class="o">=</span> <span class="n">configparser</span><span class="o">.</span><span class="n">ConfigParser</span><span class="p">()</span>
|
||||
|
||||
<span class="k">if</span> <span class="s1">'SOURCE_DATE_EPOCH'</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
|
||||
<span class="n">timestamp</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">'SOURCE_DATE_EPOCH'</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">timestamp</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span>
|
||||
|
||||
<span class="n">section</span> <span class="o">=</span> <span class="s2">"general"</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"timestamp"</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()),</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"timestamp"</span><span class="p">:</span> <span class="n">timestamp</span><span class="p">,</span>
|
||||
<span class="s2">"family"</span><span class="p">:</span> <span class="n">product</span><span class="p">,</span>
|
||||
<span class="s2">"version"</span><span class="p">:</span> <span class="n">version</span><span class="p">,</span>
|
||||
<span class="s2">"name"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">),</span>
|
||||
@ -216,42 +136,30 @@
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018-2019, Red Hat, Inc.
|
||||
|
||||
</p>
|
||||
<p>© Copyright 2018, Red Hat, Inc..</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,62 +0,0 @@
|
||||
composer-cli
|
||||
============
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
``composer-cli`` is used to interact with the ``lorax-composer`` API server, managing blueprints, exploring available packages, and building new images.
|
||||
|
||||
It requires `lorax-composer <lorax-composer.html>`_ to be installed on the
|
||||
local system, and the user running it needs to be a member of the ``weldr``
|
||||
group. They do not need to be root, but all of the `security precautions
|
||||
<lorax-composer.html#security>`_ apply.
|
||||
|
||||
composer-cli cmdline arguments
|
||||
------------------------------
|
||||
|
||||
.. argparse::
|
||||
:ref: composer.cli.cmdline.composer_cli_parser
|
||||
:prog: composer-cli
|
||||
|
||||
Edit a Blueprint
|
||||
----------------
|
||||
|
||||
Start out by listing the available blueprints using ``composer-cli blueprints
|
||||
list``, pick one and save it to the local directory by running ``composer-cli
|
||||
blueprints save http-server``. If there are no blueprints available you can
|
||||
copy one of the examples `from the test suite
|
||||
<https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_.
|
||||
|
||||
Edit the file (it will be saved with a .toml extension) and change the
|
||||
description, add a package or module to it. Send it back to the server by
|
||||
running ``composer-cli blueprints push http-server.toml``. You can verify that it was
|
||||
saved by viewing the changelog - ``composer-cli blueprints changes http-server``.
|
||||
|
||||
Build an image
|
||||
----------------
|
||||
|
||||
Build a ``qcow2`` disk image from this blueprint by running ``composer-cli
|
||||
compose start http-server qcow2``. It will print a UUID that you can use to
|
||||
keep track of the build. You can also cancel the build if needed.
|
||||
|
||||
The available types of images is displayed by ``composer-cli compose types``.
|
||||
Currently this consists of: alibaba, ami, ext4-filesystem, google, live-iso,
|
||||
openstack, partitioned-disk, qcow2, tar, vhd, vmdk
|
||||
|
||||
Monitor the build status
|
||||
------------------------
|
||||
|
||||
Monitor it using ``composer-cli compose status``, which will show the status of
|
||||
all the builds on the system. You can view the end of the anaconda build logs
|
||||
once it is in the ``RUNNING`` state using ``composer-cli compose log UUID``
|
||||
where UUID is the UUID returned by the start command.
|
||||
|
||||
Once the build is in the ``FINISHED`` state you can download the image.
|
||||
|
||||
Download the image
|
||||
------------------
|
||||
|
||||
Downloading the final image is done with ``composer-cli compose image UUID`` and it will
|
||||
save the qcow2 image as ``UUID-disk.qcow2`` which you can then use to boot a VM like this::
|
||||
|
||||
qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2
|
99
docs/html/_sources/image-minimizer.rst.txt
Normal file
99
docs/html/_sources/image-minimizer.rst.txt
Normal file
@ -0,0 +1,99 @@
|
||||
image-minimizer
|
||||
===============
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
`image-minimizer` is a script used as an interpreter for kickstart `%post`
|
||||
sections. It is used to remove rpm packages and individual files from the
|
||||
system that Anaconda has just installed.
|
||||
|
||||
It processes a list of commands that tell it which files or rpms to remove, and
|
||||
which to keep.
|
||||
|
||||
|
||||
image-minimizer cmdline arguments
|
||||
---------------------------------
|
||||
|
||||
`usage: image-minimizer [-h] [-i STRING] [--dryrun] [-v] STRING`
|
||||
|
||||
Optional arguments
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
-h, --help show this help message and exit
|
||||
-i STRING, --installroot STRING
|
||||
Root path to prepend to all file patterns and
|
||||
installation root for RPM operations. Defaults to
|
||||
INSTALL_ROOT or /mnt/sysimage/
|
||||
--dryrun If set, no filesystem changes are made.
|
||||
-v, --verbose Display every action as it is performed.
|
||||
|
||||
Positional arguments
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
:STRING: Filename to process
|
||||
|
||||
|
||||
NOTES
|
||||
-----
|
||||
|
||||
You cannot pass any arguments to `image-minimizer` when using it from the
|
||||
kickstart `%post`.
|
||||
|
||||
When using this from a kickstart the image-minimizer package needs to be available.
|
||||
It is not included on the standard boot.iso, so you will need to include `lorax` in
|
||||
the `%package` section. You can use `image-minimizer` to remove lorax from the install.
|
||||
|
||||
If you are using this with `livemedia-creator` it can be installed on the host
|
||||
system so that `lorax` isn't needed in the `%package` list, and it doesn't need
|
||||
to be removed.
|
||||
|
||||
|
||||
commands
|
||||
--------
|
||||
|
||||
Commands are listed one per line, followed by a space, and then by the
|
||||
package, file, or glob. The globs used are Unix style pathname patterns using
|
||||
`*`, `?`, and `[]` character ranges. globbing is implemented using the python
|
||||
glob module.
|
||||
|
||||
|
||||
* drop <PATTERN>
|
||||
This will remove files from the installation.
|
||||
|
||||
* keep <PATTERN>
|
||||
This will keep files, and should follow any `drop` commands including globs.
|
||||
|
||||
* droprpm <PATTERN>
|
||||
Remove matching rpm packages. Dependencies are not remove, just individual
|
||||
packages matching the glob.
|
||||
|
||||
* keeprpm <PATTERN>
|
||||
Do not remove matching rpm packages, it should follow any `droprpm` commands
|
||||
that include globs.
|
||||
|
||||
|
||||
example
|
||||
-------
|
||||
|
||||
Example Anaconda `%post` usage::
|
||||
|
||||
%post --interpreter=image-minimizer --nochroot
|
||||
|
||||
drop /lib/modules/*/kernel/fs
|
||||
keep /lib/modules/*/kernel/fs/ext*
|
||||
keep /lib/modules/*/kernel/fs/mbcache*
|
||||
keep /lib/modules/*/kernel/fs/squashfs
|
||||
|
||||
droprpm make
|
||||
droprpm mtools
|
||||
droprpm mysql-libs
|
||||
droprpm perl
|
||||
droprpm perl-Pod-*
|
||||
droprpm syslinux
|
||||
keeprpm perl-Pod-Simple
|
||||
|
||||
# Not needed after image-minimizer is done
|
||||
droprpm lorax
|
||||
|
||||
%end
|
@ -14,15 +14,18 @@ Contents:
|
||||
intro
|
||||
lorax
|
||||
livemedia-creator
|
||||
lorax-composer
|
||||
composer-cli
|
||||
mkksiso
|
||||
product-images
|
||||
image-minimizer
|
||||
modules
|
||||
|
||||
Documentation for other Lorax Branches
|
||||
======================================
|
||||
|
||||
* `Fedora 28 <f28-branch/>`_
|
||||
* `Fedora 35 <f35-branch/>`_
|
||||
* `Fedora 34 <f34-branch/>`_
|
||||
* `Fedora 33 <f33-branch/>`_
|
||||
* `RHEL8 lorax-composer <rhel8-branch/>`_
|
||||
* `RHEL7 lorax-composer <lorax-composer/>`_
|
||||
|
||||
Indices and tables
|
||||
|
@ -1,27 +0,0 @@
|
||||
.. Lorax documentation master file, created by
|
||||
sphinx-quickstart on Wed Apr 8 13:46:00 2015.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to Lorax's documentation!
|
||||
=================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
intro
|
||||
lorax
|
||||
livemedia-creator
|
||||
product-images
|
||||
modules
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
@ -1,67 +0,0 @@
|
||||
Introduction to Lorax
|
||||
=====================
|
||||
|
||||
I am the Lorax. I speak for the trees [and images].
|
||||
|
||||
Lorax is used to build the Anaconda Installer boot.iso, it consists of a
|
||||
library, pylorax, a set of templates, and the lorax script. Its operation
|
||||
is driven by a customized set of Mako templates that lists the packages
|
||||
to be installed, steps to execute to remove unneeded files, and creation
|
||||
of the iso for all of the supported architectures.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Before Lorax
|
||||
============
|
||||
|
||||
Tree building tools such as pungi and revisor rely on 'buildinstall' in
|
||||
anaconda/scripts/ to produce the boot images and other such control files
|
||||
in the final tree. The existing buildinstall scripts written in a mix of
|
||||
bash and Python are unmaintainable. Lorax is an attempt to replace them
|
||||
with something more flexible.
|
||||
|
||||
|
||||
EXISTING WORKFLOW:
|
||||
|
||||
pungi and other tools call scripts/buildinstall, which in turn call other
|
||||
scripts to do the image building and data generation. Here's how it
|
||||
currently looks:
|
||||
|
||||
-> buildinstall
|
||||
* process command line options
|
||||
* write temporary yum.conf to point to correct repo
|
||||
* find anaconda release RPM
|
||||
* unpack RPM, pull in those versions of upd-instroot, mk-images,
|
||||
maketreeinfo.py, makestamp.py, and buildinstall
|
||||
|
||||
-> call upd-instroot
|
||||
|
||||
-> call maketreeinfo.py
|
||||
|
||||
-> call mk-images (which figures out which mk-images.ARCH to call)
|
||||
|
||||
-> call makestamp.py
|
||||
|
||||
* clean up
|
||||
|
||||
|
||||
PROBLEMS:
|
||||
|
||||
The existing workflow presents some problems with maintaining the scripts.
|
||||
First, almost all knowledge of what goes in to the stage 1 and stage 2
|
||||
images lives in upd-instroot. The mk-images* scripts copy things from the
|
||||
root created by upd-instroot in order to build the stage 1 image, though
|
||||
it's not completely clear from reading the scripts.
|
||||
|
||||
|
||||
NEW IDEAS:
|
||||
|
||||
Create a new central driver with all information living in Python modules.
|
||||
Configuration files will provide the knowledge previously contained in the
|
||||
upd-instroot and mk-images* scripts.
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ minimum you need:
|
||||
|
||||
``--ks`` to select the kickstart file describing what to install.
|
||||
|
||||
To use livemedia-creator with virtualization you will need to have qemu-kvm installed.
|
||||
To use livemedia-creator with virtualization you will need to have qemu installed.
|
||||
|
||||
If you are going to be using Anaconda directly, with ``--no-virt`` mode, make sure
|
||||
you have the anaconda-tui package installed.
|
||||
@ -63,13 +63,13 @@ Quickstart
|
||||
Run this to create a bootable live iso::
|
||||
|
||||
sudo livemedia-creator --make-iso \
|
||||
--iso=/extra/iso/boot.iso --ks=./docs/rhel-livemedia.ks
|
||||
--iso=/extra/iso/boot.iso --ks=./docs/fedora-livemedia.ks
|
||||
|
||||
You can run it directly from the lorax git repo like this::
|
||||
|
||||
sudo PATH=./src/sbin/:$PATH PYTHONPATH=./src/ ./src/sbin/livemedia-creator \
|
||||
--make-iso --iso=/extra/iso/boot.iso \
|
||||
--ks=./docs/rhel-livemedia.ks --lorax-templates=./share/
|
||||
--ks=./docs/fedora-livemedia.ks --lorax-templates=./share/
|
||||
|
||||
You can observe the installation using vnc. The logs will show what port was
|
||||
chosen, or you can use a specific port by passing it. eg. ``--vnc vnc:127.0.0.1:5``
|
||||
@ -170,10 +170,19 @@ changes. Here are the steps I used to convert the Fedora XFCE spin.
|
||||
dracut-config-generic
|
||||
dracut-live
|
||||
-dracut-config-rescue
|
||||
grub-efi
|
||||
memtest86+
|
||||
grub2-efi
|
||||
syslinux
|
||||
|
||||
User created repositories
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you are using your own repositories and installing groups (eg. @core) make
|
||||
sure you create the repodata with groups like this ``createrepo -g
|
||||
/path/to/groups.xml /path/to/rpms``
|
||||
|
||||
Using a Proxy with repos
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
One drawback to using qemu is that it pulls the packages from the repo each
|
||||
time you run it. To speed things up you either need a local mirror of the
|
||||
packages, or you can use a caching proxy. When using a proxy you pass it to
|
||||
@ -187,7 +196,13 @@ packages will get cached, so your kickstart url would look like:
|
||||
``url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/"``
|
||||
|
||||
You can also add an update repo, but don't name it updates. Add --proxy to it
|
||||
as well.
|
||||
as well. You can use all of the `kickstart commands <https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#chapter-2-kickstart-commands-in-fedora>`_ in your kickstart. Make sure there
|
||||
is only one ``url`` command, other repos have to use the ``repo`` command and cannot be
|
||||
named ``updates`` which is reserved for Anaconda's use. eg.::
|
||||
|
||||
url --url=PRIMARY-REPO-URL --proxy=PROXY-URL
|
||||
repo --name="repo1" --baseurl=FIRST-REPO-URL --proxy=PROXY-URL
|
||||
repo --name="repo2" --baseurl=SECOND-REPO_URL --proxy=PROXY-URL
|
||||
|
||||
|
||||
Anaconda image install (no-virt)
|
||||
@ -212,7 +227,7 @@ the current directory or in the directory used for --logfile
|
||||
|
||||
Example cmdline:
|
||||
|
||||
``sudo livemedia-creator --make-iso --no-virt --ks=./rhel-livemedia.ks``
|
||||
``sudo livemedia-creator --make-iso --no-virt --ks=./fedora-livemedia.ks``
|
||||
|
||||
.. note::
|
||||
Using no-virt to create a partitioned disk image (eg. --make-disk or
|
||||
@ -235,7 +250,7 @@ that it would work with livemedia-creator.
|
||||
|
||||
Example cmdline:
|
||||
|
||||
``sudo livemedia-creator --make-ami --iso=/path/to/boot.iso --ks=./docs/rhel-livemedia-ec2.ks``
|
||||
``sudo livemedia-creator --make-ami --iso=/path/to/boot.iso --ks=./docs/fedora-livemedia-ec2.ks``
|
||||
|
||||
This will produce an ami-root.img file in the working directory.
|
||||
|
||||
@ -292,9 +307,6 @@ The following variables are passed to the template:
|
||||
``networks``
|
||||
list of networks from the kickstart or []
|
||||
|
||||
``title``
|
||||
from ``--title``
|
||||
|
||||
``project``
|
||||
from ``--project``
|
||||
|
||||
@ -307,7 +319,7 @@ The created image can be imported into libvirt using:
|
||||
|
||||
You can also create qcow2 appliance images using ``--image-type=qcow2``, for example::
|
||||
|
||||
sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/rhel-minimal.ks \
|
||||
sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
|
||||
--image-type=qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
|
||||
|
||||
|
||||
@ -320,7 +332,7 @@ no-virt modes of operation. Previously it was only available with no-virt.
|
||||
|
||||
Kickstarts should have a single / partition with no extra mountpoints.
|
||||
|
||||
``livemedia-creator --make-fsimage --iso=/path/to/boot.iso --ks=./docs/rhel-minimal.ks``
|
||||
``livemedia-creator --make-fsimage --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks``
|
||||
|
||||
You can name the output image with ``--image-name`` and set a label on the filesystem with ``--fs-label``
|
||||
|
||||
@ -337,8 +349,8 @@ As with ``--make-fsimage`` the kickstart should be limited to a single / partiti
|
||||
|
||||
For example::
|
||||
|
||||
livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/rhel-minimal.ks \
|
||||
--image-name=rhel-root.tar.xz
|
||||
livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
|
||||
--image-name=fedora-root.tar.xz
|
||||
|
||||
|
||||
Live Image for PXE Boot
|
||||
@ -359,7 +371,7 @@ using Atomic installer iso with local repo included in the image can be found
|
||||
in docs/rhel-atomic-pxe-live.ks.
|
||||
|
||||
The PXE images can also be created with ``--no-virt`` by using the example
|
||||
kickstart in docs/rhel-atomic-pxe-live-novirt.ks. This also works inside the
|
||||
kickstart in docs/fedora-atomic-pxe-live-novirt.ks. This also works inside the
|
||||
mock environment.
|
||||
|
||||
|
||||
@ -370,9 +382,15 @@ As of lorax version 22.2 you can use livemedia-creator and anaconda version
|
||||
22.15 inside of a mock chroot with --make-iso and --make-fsimage.
|
||||
|
||||
.. note::
|
||||
As of mock 1.3.4 you need to use ``--old-chroot`` with mock. Mock now defaults to using systemd-nspawn
|
||||
which cannot create the needed loop device nodes. Passing ``--old-chroot`` will use the old system
|
||||
where ``/dev/loop*`` is setup for you.
|
||||
As of mock version 2.0 you no longer need to pass ``--old-chroot``. You will,
|
||||
however, need to pass ``--enable-network`` so that the mock container can download
|
||||
packages.
|
||||
|
||||
Older versions of mock, between 1.3.4 and 2.0, will need to pass
|
||||
``--old-chroot`` with mock. These versions of mock now default to using
|
||||
systemd-nspawn which cannot create the needed loop device nodes. Passing
|
||||
``--old-chroot`` will use the old system where ``/dev/loop*`` is setup for
|
||||
you.
|
||||
|
||||
On the host system:
|
||||
|
||||
@ -404,16 +422,16 @@ group.
|
||||
``url points to the correct repo``
|
||||
|
||||
7. Init the mock
|
||||
``mock -r rhel-8-x86_64 --old-chroot --init``
|
||||
``mock -r fedora-rawhide-x86_64 --init``
|
||||
|
||||
8. Copy the kickstart inside the mock
|
||||
``mock -r rhel-8-x86_64 --old-chroot --copyin ./rhel-minimal.ks /root/``
|
||||
``mock -r fedora-rawhide-x86_64 --copyin ./fedora-minimal.ks /root/``
|
||||
|
||||
9. Make a minimal iso::
|
||||
|
||||
mock -r rhel-8-x86_64 --old-chroot --chroot -- livemedia-creator --no-virt \
|
||||
mock -r fedora-rawhide-x86_64 --enable-network --chroot -- livemedia-creator --no-virt \
|
||||
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
|
||||
--make-iso --ks /root/rhel-minimal.ks
|
||||
--make-iso --ks /root/fedora-minimal.ks
|
||||
|
||||
Results will be in ./results/try-1 and logs under /results/logs/try-1/
|
||||
including anaconda logs and livemedia-creator logs. The new iso will be
|
||||
@ -458,19 +476,19 @@ group.
|
||||
``url points to the correct repo``
|
||||
|
||||
7. Init the mock
|
||||
``mock -r rhel-8-x86_64 --old-chroot --init``
|
||||
``mock -r fedora-rawhide-x86_64 --init``
|
||||
|
||||
8. Copy the kickstart inside the mock
|
||||
``mock -r rhel-8-x86_64 --old-chroot --copyin ./rhel-minimal.ks /root/``
|
||||
``mock -r fedora-rawhide-x86_64 --copyin ./fedora-minimal.ks /root/``
|
||||
|
||||
9. Copy the Anaconda boot.iso inside the mock
|
||||
``mock -r rhel-8-x86_64 --old-chroot --copyin ./boot.iso /root/``
|
||||
``mock -r fedora-rawhide-x86_64 --copyin ./boot.iso /root/``
|
||||
|
||||
10. Make a minimal iso::
|
||||
|
||||
mock -r rhel-8-x86_64 --old-chroot --chroot -- livemedia-creator \
|
||||
mock -r fedora-rawhide-x86_64 --enable-network --chroot -- livemedia-creator \
|
||||
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
|
||||
--make-iso --ks /root/rhel-minimal.ks --iso /root/boot.iso
|
||||
--make-iso --ks /root/fedora-minimal.ks --iso /root/boot.iso
|
||||
|
||||
Results will be in ./results/try-1 and logs under /results/logs/try-1/
|
||||
including anaconda logs and livemedia-creator logs. The new iso will be
|
||||
@ -490,39 +508,39 @@ You need to have access to an OpenStack provider that allows image uploads, or
|
||||
setup your own using the instructions from the `RDO Project
|
||||
<https://www.rdoproject.org/Quickstart>`_.
|
||||
|
||||
The example kickstart, rhel-openstack.ks, is only slightly different than the
|
||||
rhel-minimal.ks one. It adds the cloud-init and cloud-utils-growpart
|
||||
The example kickstart, fedora-openstack.ks, is only slightly different than the
|
||||
fedora-minimal.ks one. It adds the cloud-init and cloud-utils-growpart
|
||||
packages. OpenStack supports setting up the image using cloud-init, and
|
||||
cloud-utils-growpart will grow the image to fit the instance's disk size.
|
||||
|
||||
Create a qcow2 image using the kickstart like this:
|
||||
|
||||
``sudo livemedia-creator --make-disk --iso=/path/to/boot.iso --ks=/path/to/rhel-openstack.ks --image-type=qcow2``
|
||||
``sudo livemedia-creator --make-disk --iso=/path/to/boot.iso --ks=/path/to/fedora-openstack.ks --image-type=qcow2``
|
||||
|
||||
.. note::
|
||||
On the RHEL7 version of lmc ``--image-type`` isn't supported. You can only create a bare partitioned disk image.
|
||||
|
||||
Import the resulting disk image into the OpenStack system, either via the web UI, or glance on the cmdline::
|
||||
|
||||
glance image-create --name "rhel-openstack" --is-public true --disk-format qcow2 \
|
||||
--container-format bare --file ./rhel-openstack.qcow2
|
||||
glance image-create --name "fedora-openstack" --is-public true --disk-format qcow2 \
|
||||
--container-format bare --file ./fedora-openstack.qcow2
|
||||
|
||||
If qcow2 wasn't used then ``--disk-format`` should be set to raw.
|
||||
|
||||
|
||||
Container Image Creation
|
||||
------------------------
|
||||
Docker Image Creation
|
||||
---------------------
|
||||
|
||||
Use lmc to create a tarfile as described in the `TAR File Creation`_ section, but substitute the
|
||||
rhel-container.ks example kickstart which removes the requirement for core files and the kernel.
|
||||
fedora-docker.ks example kickstart which removes the requirement for core files and the kernel.
|
||||
|
||||
You can then import the tarfile into podman or docker like this:
|
||||
You can then import the tarfile into docker like this (as root):
|
||||
|
||||
``podman import /var/tmp/root.tar.xz rhel-root``
|
||||
``cat /var/tmp/fedora-root.tar.xz | docker import - fedora-root``
|
||||
|
||||
And then run bash inside of it:
|
||||
|
||||
``podman run -i -t rhel-root /bin/bash``
|
||||
``sudo docker run -i -t fedora-root /bin/bash``
|
||||
|
||||
|
||||
Open Container Initiative Image Creation
|
||||
@ -533,7 +551,7 @@ The OCI is a new specification that is still being worked on. You can read more
|
||||
OCI images using the following command::
|
||||
|
||||
sudo livemedia-creator --make-oci --oci-config /path/to/config.json --oci-runtime /path/to/runtime.json \
|
||||
--iso=/path/to/boot.iso --ks=/path/to/rhel-minimal.ks
|
||||
--iso=/path/to/boot.iso --ks=/path/to/fedora-minimal.ks
|
||||
|
||||
You must provide the config.json and runtime.json files to be included in the bundle,
|
||||
their specifications can be found `on the OCI github project <https://github.com/opencontainers/specs>`_
|
||||
@ -549,7 +567,7 @@ Vagrant Image Creation
|
||||
`Vagrant <https://www.vagrantup.com/>`_ images can be created using the following command::
|
||||
|
||||
sudo livemedia-creator --make-vagrant --vagrant-metadata /path/to/metadata.json \
|
||||
--iso=/path/to/boot.iso --ks=/path/to/rhel-vagrant.ks
|
||||
--iso=/path/to/boot.iso --ks=/path/to/fedora-vagrant.ks
|
||||
|
||||
The image created is a `vagrant-libvirt
|
||||
<https://github.com/pradels/vagrant-libvirt>`_ provider image and needs to have
|
||||
@ -581,7 +599,7 @@ firmware files.
|
||||
Now you can run livemedia-creator with ``--virt-uefi`` to boot and install using UEFI::
|
||||
|
||||
sudo livemedia-creator --make-disk --virt-uefi --iso=/path/to/boot.iso \
|
||||
--ks=/path/to/rhel-minimal.ks
|
||||
--ks=/path/to/fedora-minimal.ks
|
||||
|
||||
Make sure that the kickstart you are using creates a /boot/efi partition by including this::
|
||||
|
||||
@ -604,6 +622,16 @@ When creating a new kickstart it is helpful to use vnc so that you can monitor
|
||||
the installation as it happens, and if it gets stuck without lmc detecting the
|
||||
problem you can switch to tty1 and examine the system directly.
|
||||
|
||||
If you suspect problems with %pre or %post sections you can redirect the output
|
||||
to the terminal and examine it by logging into the VM. eg.::
|
||||
|
||||
%pre
|
||||
chvt
|
||||
exec < /dev/tty3 > /dev/tty3 2>/dev/tty3
|
||||
#do stuff
|
||||
echo hello world
|
||||
%end
|
||||
|
||||
If it does get stuck the best way to cancel is to use kill -9 on the qemu pid,
|
||||
lmc will detect that the process died and cleanup.
|
||||
|
||||
@ -636,6 +664,6 @@ Development on this will take place as part of the lorax project, and on the
|
||||
anaconda-devel-list mailing list, and `on github <https://github.com/rhinstaller/lorax>`_
|
||||
|
||||
Feedback, enhancements and bugs are welcome. You can use `bugzilla
|
||||
<https://bugzilla.redhat.com/enter_bug.cgi?product=Red Hat Enterprise Linux 8&component=lorax>`_ to
|
||||
<https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=lorax>`_ to
|
||||
report bugs against the lorax component.
|
||||
|
||||
|
@ -1,638 +0,0 @@
|
||||
livemedia-creator
|
||||
=================
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
livemedia-creator uses `Anaconda <https://github.com/rhinstaller/anaconda>`_,
|
||||
`kickstart <https://github.com/rhinstaller/pykickstart>`_ and `Lorax
|
||||
<https://github.com/rhinstaller/lorax>`_ to create bootable media that use the
|
||||
same install path as a normal system installation. It can be used to make live
|
||||
isos, bootable (partitioned) disk images, tarfiles, and filesystem images for
|
||||
use with virtualization and container solutions like libvirt, docker, and
|
||||
OpenStack.
|
||||
|
||||
The general idea is to use qemu with kickstart and an Anaconda boot.iso to
|
||||
install into a disk image and then use the disk image to create the bootable
|
||||
media.
|
||||
|
||||
livemedia-creator --help will describe all of the options available. At the
|
||||
minimum you need:
|
||||
|
||||
``--make-iso`` to create a final bootable .iso or one of the other ``--make-*`` options.
|
||||
|
||||
``--iso`` to specify the Anaconda install media to use with qemu.
|
||||
|
||||
``--ks`` to select the kickstart file describing what to install.
|
||||
|
||||
To use livemedia-creator with virtualization you will need to have qemu installed.
|
||||
|
||||
If you are going to be using Anaconda directly, with ``--no-virt`` mode, make sure
|
||||
you have the anaconda-tui package installed.
|
||||
|
||||
Conventions used in this document:
|
||||
|
||||
``lmc`` is an abbreviation for livemedia-creator.
|
||||
|
||||
``builder`` is the system where livemedia-creator is being run
|
||||
|
||||
``image`` is the disk image being created by running livemedia-creator
|
||||
|
||||
|
||||
livemedia-creator cmdline arguments
|
||||
-----------------------------------
|
||||
|
||||
.. argparse::
|
||||
:ref: pylorax.cmdline.lmc_parser
|
||||
:prog: livemedia-creator
|
||||
|
||||
|
||||
Quickstart
|
||||
----------
|
||||
|
||||
Run this to create a bootable live iso::
|
||||
|
||||
sudo livemedia-creator --make-iso \
|
||||
--iso=/extra/iso/boot.iso --ks=./docs/fedora-livemedia.ks
|
||||
|
||||
You can run it directly from the lorax git repo like this::
|
||||
|
||||
sudo PATH=./src/sbin/:$PATH PYTHONPATH=./src/ ./src/sbin/livemedia-creator \
|
||||
--make-iso --iso=/extra/iso/boot.iso \
|
||||
--ks=./docs/fedora-livemedia.ks --lorax-templates=./share/
|
||||
|
||||
You can observe the installation using vnc. The logs will show what port was
|
||||
chosen, or you can use a specific port by passing it. eg. ``--vnc vnc:127.0.0.1:5``
|
||||
|
||||
This is usually a good idea when testing changes to the kickstart. lmc tries
|
||||
to monitor the logs for fatal errors, but may not catch everything.
|
||||
|
||||
|
||||
How ISO creation works
|
||||
----------------------
|
||||
|
||||
There are 2 stages, the install stage which produces a disk or filesystem image
|
||||
as its output, and the boot media creation which uses the image as its input.
|
||||
Normally you would run both stages, but it is possible to stop after the
|
||||
install stage, by using ``--image-only``, or to skip the install stage and use
|
||||
a previously created disk image by passing ``--disk-image`` or ``--fs-image``
|
||||
|
||||
When creating an iso qemu boots using the passed Anaconda installer iso
|
||||
and installs the system based on the kickstart. The ``%post`` section of the
|
||||
kickstart is used to customize the installed system in the same way that
|
||||
current spin-kickstarts do.
|
||||
|
||||
livemedia-creator monitors the install process for problems by watching the
|
||||
install logs. They are written to the current directory or to the base
|
||||
directory specified by the --logfile command. You can also monitor the install
|
||||
by using a vnc client. This is recommended when first modifying a kickstart,
|
||||
since there are still places where Anaconda may get stuck without the log
|
||||
monitor catching it.
|
||||
|
||||
The output from this process is a partitioned disk image. kpartx can be used
|
||||
to mount and examine it when there is a problem with the install. It can also
|
||||
be booted using kvm.
|
||||
|
||||
When creating an iso the disk image's / partition is copied into a formatted
|
||||
filesystem image which is then used as the input to lorax for creation of the
|
||||
final media.
|
||||
|
||||
The final image is created by lorax, using the templates in /usr/share/lorax/live/
|
||||
or the live directory below the directory specified by ``--lorax-templates``. The
|
||||
templates are written using the Mako template system with some extra commands
|
||||
added by lorax.
|
||||
|
||||
.. note::
|
||||
The output from --make-iso includes the artifacts used to create the boot.iso;
|
||||
the kernel, initrd, the squashfs filesystem, etc. If you only want the
|
||||
boot.iso you can pass ``--iso-only`` and the other files will be removed. You
|
||||
can also name the iso by using ``--iso-name my-live.iso``.
|
||||
|
||||
|
||||
Kickstarts
|
||||
----------
|
||||
|
||||
The docs/ directory includes several example kickstarts, one to create a live
|
||||
desktop iso using GNOME, and another to create a minimal disk image. When
|
||||
creating your own kickstarts you should start with the minimal example, it
|
||||
includes several needed packages that are not always included by dependencies.
|
||||
|
||||
Or you can use existing spin kickstarts to create live media with a few
|
||||
changes. Here are the steps I used to convert the Fedora XFCE spin.
|
||||
|
||||
1. Flatten the xfce kickstart using ksflatten
|
||||
2. Add zerombr so you don't get the disk init dialog
|
||||
3. Add clearpart --all
|
||||
4. Add swap partition
|
||||
5. bootloader target
|
||||
6. Add shutdown to the kickstart
|
||||
7. Add network --bootproto=dhcp --activate to activate the network
|
||||
This works for F16 builds but for F15 and before you need to pass
|
||||
something on the cmdline that activate the network, like sshd:
|
||||
|
||||
``livemedia-creator --kernel-args="sshd"``
|
||||
|
||||
8. Add a root password::
|
||||
|
||||
rootpw rootme
|
||||
network --bootproto=dhcp --activate
|
||||
zerombr
|
||||
clearpart --all
|
||||
bootloader --location=mbr
|
||||
part swap --size=512
|
||||
shutdown
|
||||
|
||||
9. In the livesys script section of the %post remove the root password. This
|
||||
really depends on how the spin wants to work. You could add the live user
|
||||
that you create to the %wheel group so that sudo works if you wanted to.
|
||||
|
||||
``passwd -d root > /dev/null``
|
||||
|
||||
10. Remove /etc/fstab in %post, dracut handles mounting the rootfs
|
||||
|
||||
``cat /dev/null > /dev/fstab``
|
||||
|
||||
Do this only for live iso's, the filesystem will be mounted read only if
|
||||
there is no /etc/fstab
|
||||
|
||||
11. Don't delete initramfs files from /boot in %post
|
||||
12. When creating live iso's you need to have, at least, these packages in the %package section::
|
||||
dracut-config-generic
|
||||
dracut-live
|
||||
-dracut-config-rescue
|
||||
grub-efi
|
||||
memtest86+
|
||||
syslinux
|
||||
|
||||
One drawback to using qemu is that it pulls the packages from the repo each
|
||||
time you run it. To speed things up you either need a local mirror of the
|
||||
packages, or you can use a caching proxy. When using a proxy you pass it to
|
||||
livemedia-creator like this:
|
||||
|
||||
``--proxy=http://proxy.yourdomain.com:3128``
|
||||
|
||||
You also need to use a specific mirror instead of mirrormanager so that the
|
||||
packages will get cached, so your kickstart url would look like:
|
||||
|
||||
``url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/"``
|
||||
|
||||
You can also add an update repo, but don't name it updates. Add --proxy to it
|
||||
as well.
|
||||
|
||||
|
||||
Anaconda image install (no-virt)
|
||||
--------------------------------
|
||||
|
||||
You can create images without using qemu by passing ``--no-virt`` on the
|
||||
cmdline. This will use Anaconda's directory install feature to handle the
|
||||
install. There are a couple of things to keep in mind when doing this:
|
||||
|
||||
1. It will be most reliable when building images for the same release that the
|
||||
host is running. Because Anaconda has expectations about the system it is
|
||||
running under you may encounter strange bugs if you try to build newer or
|
||||
older releases.
|
||||
|
||||
2. Make sure selinux is set to permissive or disabled. It won't install
|
||||
correctly with selinux set to enforcing yet.
|
||||
|
||||
3. It may totally trash your host. So far I haven't had this happen, but the
|
||||
possibility exists that a bug in Anaconda could result in it operating on
|
||||
real devices. I recommend running it in a virt or on a system that you can
|
||||
afford to lose all data from.
|
||||
|
||||
The logs from anaconda will be placed in an ./anaconda/ directory in either
|
||||
the current directory or in the directory used for --logfile
|
||||
|
||||
Example cmdline:
|
||||
|
||||
``sudo livemedia-creator --make-iso --no-virt --ks=./fedora-livemedia.ks``
|
||||
|
||||
.. note::
|
||||
Using no-virt to create a partitioned disk image (eg. --make-disk or
|
||||
--make-vagrant) will only create disks usable on the host platform (BIOS
|
||||
or UEFI). You can create BIOS partitioned disk images on UEFI by using
|
||||
virt.
|
||||
|
||||
|
||||
AMI Images
|
||||
----------
|
||||
|
||||
Amazon EC2 images can be created by using the --make-ami switch and an appropriate
|
||||
kickstart file. All of the work to customize the image is handled by the kickstart.
|
||||
The example currently included was modified from the cloud-kickstarts version so
|
||||
that it would work with livemedia-creator.
|
||||
|
||||
Example cmdline:
|
||||
|
||||
``sudo livemedia-creator --make-ami --iso=/path/to/boot.iso --ks=./docs/fedora-livemedia-ec2.ks``
|
||||
|
||||
This will produce an ami-root.img file in the working directory.
|
||||
|
||||
At this time I have not tested the image with EC2. Feedback would be welcome.
|
||||
|
||||
|
||||
Appliance Creation
|
||||
------------------
|
||||
|
||||
livemedia-creator can now replace appliance-tools by using the --make-appliance
|
||||
switch. This will create the partitioned disk image and an XML file that can be
|
||||
used with virt-image to setup a virtual system.
|
||||
|
||||
The XML is generated using the Mako template from
|
||||
/usr/share/lorax/appliance/libvirt.xml You can use a different template by
|
||||
passing ``--app-template <template path>``
|
||||
|
||||
Documentation on the Mako template system can be found at the `Mako site
|
||||
<http://docs.makotemplates.org/en/latest/index.html>`_
|
||||
|
||||
The name of the final output XML is appliance.xml, this can be changed with
|
||||
``--app-file <file path>``
|
||||
|
||||
The following variables are passed to the template:
|
||||
|
||||
``disks``
|
||||
A list of disk_info about each disk.
|
||||
Each entry has the following attributes:
|
||||
|
||||
``name``
|
||||
base name of the disk image file
|
||||
|
||||
``format``
|
||||
"raw"
|
||||
|
||||
``checksum_type``
|
||||
"sha256"
|
||||
|
||||
``checksum``
|
||||
sha256 checksum of the disk image
|
||||
|
||||
``name``
|
||||
Name of appliance, from --app-name argument
|
||||
|
||||
``arch``
|
||||
Architecture
|
||||
|
||||
``memory``
|
||||
Memory in KB (from ``--ram``)
|
||||
|
||||
``vcpus``
|
||||
from ``--vcpus``
|
||||
|
||||
``networks``
|
||||
list of networks from the kickstart or []
|
||||
|
||||
``title``
|
||||
from ``--title``
|
||||
|
||||
``project``
|
||||
from ``--project``
|
||||
|
||||
``releasever``
|
||||
from ``--releasever``
|
||||
|
||||
The created image can be imported into libvirt using:
|
||||
|
||||
``virt-image appliance.xml``
|
||||
|
||||
You can also create qcow2 appliance images using ``--image-type=qcow2``, for example::
|
||||
|
||||
sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
|
||||
--image-type=qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
|
||||
|
||||
|
||||
Filesystem Image Creation
|
||||
-------------------------
|
||||
|
||||
livemedia-creator can be used to create un-partitined filesystem images using
|
||||
the ``--make-fsimage`` option. As of version 21.8 this works with both qemu and
|
||||
no-virt modes of operation. Previously it was only available with no-virt.
|
||||
|
||||
Kickstarts should have a single / partition with no extra mountpoints.
|
||||
|
||||
``livemedia-creator --make-fsimage --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks``
|
||||
|
||||
You can name the output image with ``--image-name`` and set a label on the filesystem with ``--fs-label``
|
||||
|
||||
|
||||
TAR File Creation
|
||||
-----------------
|
||||
|
||||
The ``--make-tar`` command can be used to create a tar of the root filesystem. By
|
||||
default it is compressed using xz, but this can be changed using the
|
||||
``--compression`` and ``--compress-arg`` options. This option works with both virt and
|
||||
no-virt install methods.
|
||||
|
||||
As with ``--make-fsimage`` the kickstart should be limited to a single / partition.
|
||||
|
||||
For example::
|
||||
|
||||
livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
|
||||
--image-name=fedora-root.tar.xz
|
||||
|
||||
|
||||
Live Image for PXE Boot
|
||||
-----------------------
|
||||
|
||||
The ``--make-pxe-live`` command will produce squashfs image containing live root
|
||||
filesystem that can be used for pxe boot. Directory with results will contain
|
||||
the live image, kernel image, initrd image and template of pxe configuration
|
||||
for the images.
|
||||
|
||||
|
||||
Atomic Live Image for PXE Boot
|
||||
------------------------------
|
||||
|
||||
The ``--make-ostree-live`` command will produce the same result as ``--make-pxe-live``
|
||||
for installations of Atomic Host. Example kickstart for such an installation
|
||||
using Atomic installer iso with local repo included in the image can be found
|
||||
in docs/rhel-atomic-pxe-live.ks.
|
||||
|
||||
The PXE images can also be created with ``--no-virt`` by using the example
|
||||
kickstart in docs/fedora-atomic-pxe-live-novirt.ks. This also works inside the
|
||||
mock environment.
|
||||
|
||||
|
||||
Using Mock and --no-virt to Create Images
|
||||
-----------------------------------------
|
||||
|
||||
As of lorax version 22.2 you can use livemedia-creator and anaconda version
|
||||
22.15 inside of a mock chroot with --make-iso and --make-fsimage.
|
||||
|
||||
.. note::
|
||||
As of mock 1.2.12 you no longer need to bind mount ``/dev/``, loop devices are setup
|
||||
as part of the standard mock ``/dev/`` creation.
|
||||
|
||||
On the host system:
|
||||
|
||||
1. yum install -y mock
|
||||
|
||||
2. Add a user to the mock group to use for running mock. eg. builder
|
||||
|
||||
3. Create a new /etc/mock/ config file based on the rawhide one, or modify the
|
||||
existing one so that the following options are setup::
|
||||
|
||||
config_opts['chroot_setup_cmd'] = 'install @buildsys-build anaconda-tui lorax'
|
||||
|
||||
# build results go into /home/builder/results/
|
||||
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/home/builder/results','/results/'))
|
||||
|
||||
If you are creating images for a branched release of Fedora you should also enable
|
||||
the updates-testing repository so that you get the latest builds in your mock chroot.
|
||||
|
||||
The following steps are run as the builder user who is a member of the mock
|
||||
group.
|
||||
|
||||
4. Make a directory for results matching the bind mount above
|
||||
``mkdir ~/results/``
|
||||
|
||||
5. Copy the example kickstarts
|
||||
``cp /usr/share/docs/lorax/*ks .``
|
||||
|
||||
6. Make sure tar and dracut-network are in the %packages section and that the
|
||||
``url points to the correct repo``
|
||||
|
||||
7. Init the mock
|
||||
``mock -r fedora-rawhide-x86_64 --init``
|
||||
|
||||
8. Copy the kickstart inside the mock
|
||||
``mock -r fedora-rawhide-x86_64 --copyin ./fedora-minimal.ks /root/``
|
||||
|
||||
9. Make a minimal iso::
|
||||
|
||||
mock -r fedora-rawhide-x86_64 --chroot -- livemedia-creator --no-virt \
|
||||
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
|
||||
--make-iso --ks /root/fedora-minimal.ks
|
||||
|
||||
Results will be in ./results/try-1 and logs under /results/logs/try-1/
|
||||
including anaconda logs and livemedia-creator logs. The new iso will be
|
||||
located at ~/results/try-1/images/boot.iso, and the ~/results/try-1/
|
||||
directory tree will also contain the vmlinuz, initrd, etc.
|
||||
|
||||
|
||||
Using Mock and qemu to Create Images
|
||||
------------------------------------
|
||||
|
||||
Version 25.0 of livemedia-creator switches to using qemu for virtualization.
|
||||
This allows creation of all image types, and use of the KVM on the host if
|
||||
/dev/kvm is present in the mock environment.
|
||||
|
||||
On the host system:
|
||||
|
||||
1. yum install -y mock
|
||||
|
||||
2. Add a user to the mock group to use for running mock. eg. builder
|
||||
|
||||
3. Create a new /etc/mock/ config file based on the rawhide one, or modify the
|
||||
existing one so that the following options are setup::
|
||||
|
||||
config_opts['chroot_setup_cmd'] = 'install @buildsys-build lorax qemu'
|
||||
|
||||
# build results go into /home/builder/results/
|
||||
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/home/builder/results','/results/'))
|
||||
|
||||
If you are creating images for a branched release of Fedora you should also enable
|
||||
the updates-testing repository so that you get the latest builds in your mock chroot.
|
||||
|
||||
The following steps are run as the builder user who is a member of the mock
|
||||
group.
|
||||
|
||||
4. Make a directory for results matching the bind mount above
|
||||
``mkdir ~/results/``
|
||||
|
||||
5. Copy the example kickstarts
|
||||
``cp /usr/share/docs/lorax/*ks .``
|
||||
|
||||
6. Make sure tar and dracut-network are in the %packages section and that the
|
||||
``url points to the correct repo``
|
||||
|
||||
7. Init the mock
|
||||
``mock -r fedora-rawhide-x86_64 --init``
|
||||
|
||||
8. Copy the kickstart inside the mock
|
||||
``mock -r fedora-rawhide-x86_64 --copyin ./fedora-minimal.ks /root/``
|
||||
|
||||
9. Copy the Anaconda boot.iso inside the mock
|
||||
``mock -r fedora-rawhide-x86_64 --copyin ./boot.iso /root/``
|
||||
|
||||
10. Make a minimal iso::
|
||||
|
||||
mock -r fedora-rawhide-x86_64 --chroot -- livemedia-creator \
|
||||
--resultdir=/results/try-1 --logfile=/results/logs/try-1/try-1.log \
|
||||
--make-iso --ks /root/fedora-minimal.ks --iso /root/boot.iso
|
||||
|
||||
Results will be in ./results/try-1 and logs under /results/logs/try-1/
|
||||
including anaconda logs and livemedia-creator logs. The new iso will be
|
||||
located at ~/results/try-1/images/boot.iso, and the ~/results/try-1/
|
||||
directory tree will also contain the vmlinuz, initrd, etc.
|
||||
|
||||
This will run qemu without kvm support, which is going to be very slow. You can
|
||||
add ``mknod /dev/kvm c 10 232;`` to create the device node before running lmc.
|
||||
|
||||
|
||||
OpenStack Image Creation
|
||||
------------------------
|
||||
|
||||
OpenStack supports partitioned disk images so ``--make-disk`` can be used to
|
||||
create images for importing into glance, OpenStack's image storage component.
|
||||
You need to have access to an OpenStack provider that allows image uploads, or
|
||||
setup your own using the instructions from the `RDO Project
|
||||
<https://www.rdoproject.org/Quickstart>`_.
|
||||
|
||||
The example kickstart, fedora-openstack.ks, is only slightly different than the
|
||||
fedora-minimal.ks one. It adds the cloud-init and cloud-utils-growpart
|
||||
packages. OpenStack supports setting up the image using cloud-init, and
|
||||
cloud-utils-growpart will grow the image to fit the instance's disk size.
|
||||
|
||||
Create a qcow2 image using the kickstart like this:
|
||||
|
||||
``sudo livemedia-creator --make-disk --iso=/path/to/boot.iso --ks=/path/to/fedora-openstack.ks --image-type=qcow2``
|
||||
|
||||
.. note::
|
||||
On the RHEL7 version of lmc ``--image-type`` isn't supported. You can only create a bare partitioned disk image.
|
||||
|
||||
Import the resulting disk image into the OpenStack system, either via the web UI, or glance on the cmdline::
|
||||
|
||||
glance image-create --name "fedora-openstack" --is-public true --disk-format qcow2 \
|
||||
--container-format bare --file ./fedora-openstack.qcow2
|
||||
|
||||
If qcow2 wasn't used then ``--disk-format`` should be set to raw.
|
||||
|
||||
|
||||
Docker Image Creation
|
||||
---------------------
|
||||
|
||||
Use lmc to create a tarfile as described in the `TAR File Creation`_ section, but substitute the
|
||||
fedora-docker.ks example kickstart which removes the requirement for core files and the kernel.
|
||||
|
||||
You can then import the tarfile into docker like this (as root):
|
||||
|
||||
``cat /var/tmp/fedora-root.tar.xz | docker import - fedora-root``
|
||||
|
||||
And then run bash inside of it:
|
||||
|
||||
``sudo docker run -i -t fedora-root /bin/bash``
|
||||
|
||||
|
||||
Open Container Initiative Image Creation
|
||||
----------------------------------------
|
||||
|
||||
The OCI is a new specification that is still being worked on. You can read more about it at
|
||||
`the Open Container Initiative website <https://www.opencontainers.org/>`_. You can create
|
||||
OCI images using the following command::
|
||||
|
||||
sudo livemedia-creator --make-oci --oci-config /path/to/config.json --oci-runtime /path/to/runtime.json \
|
||||
--iso=/path/to/boot.iso --ks=/path/to/fedora-minimal.ks
|
||||
|
||||
You must provide the config.json and runtime.json files to be included in the bundle,
|
||||
their specifications can be found `on the OCI github project <https://github.com/opencontainers/specs>`_
|
||||
output will be in the results directory with a default name of bundle.tar.xz
|
||||
|
||||
This will work with ``--no-virt`` and inside a mock since it doesn't use any
|
||||
partitioned disk images.
|
||||
|
||||
|
||||
Vagrant Image Creation
|
||||
----------------------
|
||||
|
||||
`Vagrant <https://www.vagrantup.com/>`_ images can be created using the following command::
|
||||
|
||||
sudo livemedia-creator --make-vagrant --vagrant-metadata /path/to/metadata.json \
|
||||
--iso=/path/to/boot.iso --ks=/path/to/fedora-vagrant.ks
|
||||
|
||||
The image created is a `vagrant-libvirt
|
||||
<https://github.com/pradels/vagrant-libvirt>`_ provider image and needs to have
|
||||
vagrant setup with libvirt before you can use it.
|
||||
|
||||
The ``--vagrant-metadata`` file is optional, it will create a minimal one by
|
||||
default, and if one is passed it will make sure the disk size is setup
|
||||
correctly. If you pass a ``--vagrant-vagrantfile`` it will be included in the
|
||||
image verbatim. By default no vagrantfile is created.
|
||||
|
||||
There is an example Vagrant kickstart file in the docs directory that sets up
|
||||
the vagrant user with the default insecure SSH pubkey and a few useful
|
||||
utilities.
|
||||
|
||||
This also works with ``--no-virt``, but will not work inside a mock due to its
|
||||
use of partitioned disk images and qcow2.
|
||||
|
||||
|
||||
Creating UEFI disk images with virt
|
||||
-----------------------------------
|
||||
|
||||
Partitioned disk images can only be created for the same platform as the host system (BIOS or
|
||||
UEFI). You can use virt to create BIOS images on UEFI systems, and it is also possible
|
||||
to create UEFI images on BIOS systems using OVMF. You first need to setup your system with
|
||||
the OVMF firmware. The details can be `found here linux-kvm OVMF page <http://www.linux-kvm.org/page/OVMF>`_
|
||||
but it amounts to:
|
||||
|
||||
1. Download the firmware.repo from `Gerd Hoffmann <https://www.kraxel.org/repos/>`_ and install it
|
||||
in /etc/yum.repos.d/
|
||||
|
||||
2. Install the edk2.git-ovmf-x64 package
|
||||
|
||||
3. Copy /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd to /usr/share/OVMF/OVMF_CODE.fd
|
||||
|
||||
4. Copy /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd to /usr/share/OVMF/OVMF_VARS.fd
|
||||
|
||||
Now you can run livemedia-creator with ``--virt-uefi`` to boot and install using UEFI::
|
||||
|
||||
sudo livemedia-creator --make-disk --virt-uefi --iso=/path/to/boot.iso \
|
||||
--ks=/path/to/fedora-minimal.ks
|
||||
|
||||
Make sure that the kickstart you are using creates a /boot/efi partition by including this::
|
||||
|
||||
part /boot/efi --fstype="efi" --size=500
|
||||
|
||||
.. note::
|
||||
When using the resulting image with the current version of OVMF (edk2.git-ovmf-x64-0-20151103.b1295.ge5cffca)
|
||||
it will not boot automatically because there is a problem with the fallback path.
|
||||
You can boot it by entering the UEFI shell and running EFI/fedora/shim.efi and
|
||||
then using efibootmgr to setup the correct boot entry.
|
||||
|
||||
|
||||
Debugging problems
|
||||
------------------
|
||||
|
||||
Sometimes an installation will get stuck. When using qemu the logs will
|
||||
be written to ./virt-install.log and most of the time any problems that happen
|
||||
will be near the end of the file. lmc tries to detect common errors and will
|
||||
cancel the installation when they happen. But not everything can be caught.
|
||||
When creating a new kickstart it is helpful to use vnc so that you can monitor
|
||||
the installation as it happens, and if it gets stuck without lmc detecting the
|
||||
problem you can switch to tty1 and examine the system directly.
|
||||
|
||||
If it does get stuck the best way to cancel is to use kill -9 on the qemu pid,
|
||||
lmc will detect that the process died and cleanup.
|
||||
|
||||
If lmc didn't handle the cleanup for some reason you can do this:
|
||||
1. ``sudo umount /tmp/lmc-XXXX`` to unmount the iso from its mountpoint.
|
||||
2. ``sudo rm -rf /tmp/lmc-XXXX``
|
||||
3. ``sudo rm /var/tmp/lmc-disk-XXXXX`` to remove the disk image.
|
||||
|
||||
Note that lmc uses the lmc- prefix for all of its temporary files and
|
||||
directories to make it easier to find and clean up leftovers.
|
||||
|
||||
The logs from the qemu run are stored in virt-install.log, logs from
|
||||
livemedia-creator are in livemedia.log and program.log
|
||||
|
||||
You can add ``--image-only`` to skip the .iso creation and examine the resulting
|
||||
disk image. Or you can pass ``--keep-image`` to keep it around after the iso has
|
||||
been created.
|
||||
|
||||
Cleaning up aborted ``--no-virt`` installs can sometimes be accomplished by
|
||||
running the ``anaconda-cleanup`` script. As of Fedora 18 anaconda is
|
||||
multi-threaded and it can sometimes become stuck and refuse to exit. When this
|
||||
happens you can usually clean up by first killing the anaconda process then
|
||||
running ``anaconda-cleanup``.
|
||||
|
||||
|
||||
Hacking
|
||||
-------
|
||||
|
||||
Development on this will take place as part of the lorax project, and on the
|
||||
anaconda-devel-list mailing list, and `on github <https://github.com/rhinstaller/lorax>`_
|
||||
|
||||
Feedback, enhancements and bugs are welcome. You can use `bugzilla
|
||||
<https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=lorax>`_ to
|
||||
report bugs against the lorax component.
|
||||
|
@ -1,490 +0,0 @@
|
||||
lorax-composer
|
||||
==============
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
``lorax-composer`` is an API server that allows you to build disk images using
|
||||
`Blueprints`_ to describe the package versions to be installed into the image.
|
||||
It is compatible with the Weldr project's bdcs-api REST protocol. More
|
||||
information on Weldr can be found `on the Weldr blog <http://www.weldr.io>`_.
|
||||
|
||||
Behind the scenes it uses `livemedia-creator <livemedia-creator.html>`_ and
|
||||
`Anaconda <https://anaconda-installer.readthedocs.io/en/latest/>`_ to handle the
|
||||
installation and configuration of the images.
|
||||
|
||||
Important Things To Note
|
||||
------------------------
|
||||
|
||||
* As of version 30.7 SELinux can be set to Enforcing. The current state is
|
||||
logged for debugging purposes and if there are SELinux denials they should
|
||||
be reported as a bug.
|
||||
|
||||
* All image types lock the root account, except for live-iso. You will need to either
|
||||
use one of the `Customizations`_ methods for setting a ssh key/password, install a
|
||||
package that creates a user, or use something like `cloud-init` to setup access at
|
||||
boot time.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
The best way to install ``lorax-composer`` is to use ``sudo dnf install
|
||||
lorax-composer composer-cli``, this will setup the weldr user and install the
|
||||
systemd socket activation service. You will then need to enable it with ``sudo
|
||||
systemctl enable lorax-composer.socket && sudo systemctl start
|
||||
lorax-composer.socket``. This will leave the server off until the first request
|
||||
is made. Systemd will then launch the server and it will remain running until
|
||||
the system is rebooted.
|
||||
|
||||
Quickstart
|
||||
----------
|
||||
|
||||
1. Create a ``weldr`` user and group by running ``useradd weldr``
|
||||
2. Remove any pre-existing socket directory with ``rm -rf /run/weldr/``
|
||||
A new directory with correct permissions will be created the first time the server runs.
|
||||
3. Enable the socket activation with ``systemctl enable lorax-composer.socket
|
||||
&& sudo systemctl start lorax-composer.socket``.
|
||||
|
||||
NOTE: You can also run it directly with ``lorax-composer /path/to/blueprints``. However,
|
||||
``lorax-composer`` does not react well to being started both on the command line and via
|
||||
socket activation at the same time. It is therefore recommended that you run it directly
|
||||
on the command line only for testing or development purposes. For real use or development
|
||||
of other projects that simply use the API, you should stick to socket activation only.
|
||||
|
||||
The ``/path/to/blueprints/`` directory is where the blueprints' git repo will
|
||||
be created, and all the blueprints created with the ``/api/v0/blueprints/new``
|
||||
route will be stored. If there are blueprint ``.toml`` files in the top level
|
||||
of the directory they will be imported into the blueprint git storage when
|
||||
``lorax-composer`` starts.
|
||||
|
||||
Logs
|
||||
----
|
||||
|
||||
Logs are stored under ``/var/log/lorax-composer/`` and include all console
|
||||
messages as well as extra debugging info and API requests.
|
||||
|
||||
Security
|
||||
--------
|
||||
|
||||
Some security related issues that you should be aware of before running ``lorax-composer``:
|
||||
|
||||
* One of the API server threads needs to retain root privileges in order to run Anaconda.
|
||||
* Only allow authorized users access to the ``weldr`` group and socket.
|
||||
|
||||
Since Anaconda kickstarts are used there is the possibility that a user could
|
||||
inject commands into a blueprint that would result in the kickstart executing
|
||||
arbitrary code on the host. Only authorized users should be allowed to build
|
||||
images using ``lorax-composer``.
|
||||
|
||||
lorax-composer cmdline arguments
|
||||
--------------------------------
|
||||
|
||||
.. argparse::
|
||||
:ref: pylorax.api.cmdline.lorax_composer_parser
|
||||
:prog: lorax-composer
|
||||
|
||||
|
||||
How it Works
|
||||
------------
|
||||
|
||||
The server runs as root, and as ``weldr``. Communication with it is via a unix
|
||||
domain socket (``/run/weldr/api.socket`` by default). The directory and socket
|
||||
are owned by ``root:weldr`` so that any user in the ``weldr`` group can use the API
|
||||
to control ``lorax-composer``.
|
||||
|
||||
At startup the server will check for the correct permissions and
|
||||
ownership of a pre-existing directory, or it will create a new one if it
|
||||
doesn't exist. The socket path and group owner's name can be changed from the
|
||||
cmdline by passing it the ``--socket`` and ``--group`` arguments.
|
||||
|
||||
It will then drop root privileges for the API thread and run as the ``weldr``
|
||||
user. The queue and compose thread still runs as root because it needs to be
|
||||
able to mount/umount files and run Anaconda.
|
||||
|
||||
Composing Images
|
||||
----------------
|
||||
|
||||
The `welder-web <https://github.com/weldr/welder-web/>`_ GUI project can be used to construct
|
||||
blueprints and create composes using a web browser.
|
||||
|
||||
Or use the command line with `composer-cli <composer-cli.html>`_.
|
||||
|
||||
Blueprints
|
||||
----------
|
||||
|
||||
Blueprints are simple text files in `TOML <https://github.com/toml-lang/toml>`_ format that describe
|
||||
which packages, and what versions, to install into the image. They can also define a limited set
|
||||
of customizations to make to the final image.
|
||||
|
||||
Example blueprints can be found in the ``lorax-composer`` `test suite
|
||||
<https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_, with a simple one
|
||||
looking like this::
|
||||
|
||||
name = "base"
|
||||
description = "A base system with bash"
|
||||
version = "0.0.1"
|
||||
|
||||
[[packages]]
|
||||
name = "bash"
|
||||
version = "4.4.*"
|
||||
|
||||
The ``name`` field is the name of the blueprint. It can contain spaces, but they will be converted to ``-``
|
||||
when it is written to disk. It should be short and descriptive.
|
||||
|
||||
``description`` can be a longer description of the blueprint, it is only used for display purposes.
|
||||
|
||||
``version`` is a `semver compatible <https://semver.org/>`_ version number. If
|
||||
a new blueprint is uploaded with the same ``version`` the server will
|
||||
automatically bump the PATCH level of the ``version``. If the ``version``
|
||||
doesn't match it will be used as is. eg. Uploading a blueprint with ``version``
|
||||
set to ``0.1.0`` when the existing blueprint ``version`` is ``0.0.1`` will
|
||||
result in the new blueprint being stored as ``version 0.1.0``.
|
||||
|
||||
[[packages]] and [[modules]]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
These entries describe the package names and matching version glob to be installed into the image.
|
||||
|
||||
The names must match the names exactly, and the versions can be an exact match
|
||||
or a filesystem-like glob of the version using ``*`` wildcards and ``?``
|
||||
character matching.
|
||||
|
||||
NOTE: As of lorax-composer-29.2-1 the versions are not used for depsolving,
|
||||
that is planned for a future release. And currently there are no differences
|
||||
between ``packages`` and ``modules`` in ``lorax-composer``.
|
||||
|
||||
[[groups]]
|
||||
~~~~~~~~~~
|
||||
|
||||
These entries describe a group of packages to be installed into the image. Package groups are
|
||||
defined in the repository metadata. Each group has a descriptive name used primarily for display
|
||||
in user interfaces and an ID more commonly used in kickstart files. Here, the ID is the expected
|
||||
way of listing a group.
|
||||
|
||||
Groups have three different ways of categorizing their packages: mandatory, default, and optional.
|
||||
For purposes of blueprints, mandatory and default packages will be installed. There is no mechanism
|
||||
for selecting optional packages.
|
||||
|
||||
Customizations
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
The ``[customizations]`` section can be used to configure the hostname of the final image. eg.::
|
||||
|
||||
[customizations]
|
||||
hostname = "baseimage"
|
||||
|
||||
This is optional and may be left out to use the defaults.
|
||||
|
||||
|
||||
[customizations.kernel]
|
||||
***********************
|
||||
|
||||
This allows you to append arguments to the bootloader's kernel commandline. This will not have any
|
||||
effect on ``tar`` or ``ext4-filesystem`` images since they do not include a bootloader.
|
||||
|
||||
For example::
|
||||
|
||||
[customizations.kernel]
|
||||
append = "nosmt=force"
|
||||
|
||||
|
||||
[[customizations.sshkey]]
|
||||
*************************
|
||||
|
||||
Set an existing user's ssh key in the final image::
|
||||
|
||||
[[customizations.sshkey]]
|
||||
user = "root"
|
||||
key = "PUBLIC SSH KEY"
|
||||
|
||||
The key will be added to the user's authorized_keys file.
|
||||
|
||||
|
||||
[[customizations.user]]
|
||||
***********************
|
||||
|
||||
Add a user to the image, and/or set their ssh key.
|
||||
All fields for this section are optional except for the ``name``, here is a complete example::
|
||||
|
||||
[[customizations.user]]
|
||||
name = "admin"
|
||||
description = "Administrator account"
|
||||
password = "$6$CHO2$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L..."
|
||||
key = "PUBLIC SSH KEY"
|
||||
home = "/srv/widget/"
|
||||
shell = "/usr/bin/bash"
|
||||
groups = ["widget", "users", "wheel"]
|
||||
uid = 1200
|
||||
gid = 1200
|
||||
|
||||
If the password starts with ``$6$``, ``$5$``, or ``$2b$`` it will be stored as
|
||||
an encrypted password. Otherwise it will be treated as a plain text password.
|
||||
|
||||
|
||||
[[customizations.group]]
|
||||
************************
|
||||
|
||||
Add a group to the image. ``name`` is required and ``gid`` is optional::
|
||||
|
||||
[[customizations.group]]
|
||||
name = "widget"
|
||||
gid = 1130
|
||||
|
||||
|
||||
[customizations.timezone]
|
||||
*************************
|
||||
|
||||
Customizing the timezone and the NTP servers to use for the system::
|
||||
|
||||
[customizations.timezone]
|
||||
timezone = "US/Eastern"
|
||||
ntpservers = ["0.north-america.pool.ntp.org", "1.north-america.pool.ntp.org"]
|
||||
|
||||
The values supported by ``timezone`` can be listed by running ``timedatectl list-timezones``.
|
||||
|
||||
If no timezone is setup the system will default to using `UTC`. The ntp servers are also
|
||||
optional and will default to using the distribution defaults which are fine for most uses.
|
||||
|
||||
In some image types there are already NTP servers setup, eg. Google cloud image, and they
|
||||
cannot be overridden because they are required to boot in the selected environment. But the
|
||||
timezone will be updated to the one selected in the blueprint.
|
||||
|
||||
|
||||
[customizations.locale]
|
||||
***********************
|
||||
|
||||
Customize the locale settings for the system::
|
||||
|
||||
[customizations.locale]
|
||||
languages = ["en_US.UTF-8"]
|
||||
keyboard = "us"
|
||||
|
||||
The values supported by ``languages`` can be listed by running ``localectl list-locales`` from
|
||||
the command line.
|
||||
|
||||
The values supported by ``keyboard`` can be listed by running ``localectl list-keymaps`` from
|
||||
the command line.
|
||||
|
||||
Multiple languages can be added. The first one becomes the
|
||||
primary, and the others are added as secondary. One or the other of ``languages``
|
||||
or ``keyboard`` must be included (or both) in the section.
|
||||
|
||||
|
||||
[customizations.firewall]
|
||||
*************************
|
||||
|
||||
By default the firewall blocks all access except for services that enable their ports explicitly,
|
||||
like ``sshd``. This command can be used to open other ports or services. Ports are configured using
|
||||
the port:protocol format::
|
||||
|
||||
[customizations.firewall]
|
||||
ports = ["22:tcp", "80:tcp", "imap:tcp", "53:tcp", "53:udp"]
|
||||
|
||||
Numeric ports, or their names from ``/etc/services`` can be used in the ``ports`` enabled/disabled lists.
|
||||
|
||||
The blueprint settings extend any existing settings in the image templates, so if ``sshd`` is
|
||||
already enabled it will extend the list of ports with the ones listed by the blueprint.
|
||||
|
||||
If the distribution uses ``firewalld`` you can specify services listed by ``firewall-cmd --get-services``
|
||||
in a ``customizations.firewall.services`` section::
|
||||
|
||||
[customizations.firewall.services]
|
||||
enabled = ["ftp", "ntp", "dhcp"]
|
||||
disabled = ["telnet"]
|
||||
|
||||
Remember that the ``firewall.services`` are different from the names in ``/etc/services``.
|
||||
|
||||
Both are optional, if they are not used leave them out or set them to an empty list ``[]``. If you
|
||||
only want the default firewall setup this section can be omitted from the blueprint.
|
||||
|
||||
NOTE: The ``Google`` and ``OpenStack`` templates explicitly disable the firewall for their environment.
|
||||
This cannot be overridden by the blueprint.
|
||||
|
||||
[customizations.services]
|
||||
*************************
|
||||
|
||||
This section can be used to control which services are enabled at boot time.
|
||||
Some image types already have services enabled or disabled in order for the
|
||||
image to work correctly, and cannot be overridden. eg. ``ami`` requires
|
||||
``sshd``, ``chronyd``, and ``cloud-init``. Without them the image will not
|
||||
boot. Blueprint services are added to, not replacing, the list already in the
|
||||
templates, if any.
|
||||
|
||||
The service names are systemd service units. You may specify any systemd unit
|
||||
file accepted by ``systemctl enable`` eg. ``cockpit.socket``::
|
||||
|
||||
[customizations.services]
|
||||
enabled = ["sshd", "cockpit.socket", "httpd"]
|
||||
disabled = ["postfix", "telnetd"]
|
||||
|
||||
|
||||
[[repos.git]]
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The ``[[repos.git]]`` entries are used to add files from a `git repository<https://git-scm.com/>`
|
||||
repository to the created image. The repository is cloned, the specified ``ref`` is checked out
|
||||
and an rpm is created to install the files to a ``destination`` path. The rpm includes a summary
|
||||
with the details of the repository and reference used to create it. The rpm is also included in the
|
||||
image build metadata.
|
||||
|
||||
To create an rpm named ``server-config-1.0-1.noarch.rpm`` you would add this to your blueprint::
|
||||
|
||||
[[repos.git]]
|
||||
rpmname="server-config"
|
||||
rpmversion="1.0"
|
||||
rpmrelease="1"
|
||||
summary="Setup files for server deployment"
|
||||
repo="PATH OF GIT REPO TO CLONE"
|
||||
ref="v1.0"
|
||||
destination="/opt/server/"
|
||||
|
||||
* rpmname: Name of the rpm to create, also used as the prefix name in the tar archive
|
||||
* rpmversion: Version of the rpm, eg. "1.0.0"
|
||||
* rpmrelease: Release of the rpm, eg. "1"
|
||||
* summary: Summary string for the rpm
|
||||
* repo: URL of the get repo to clone and create the archive from
|
||||
* ref: Git reference to check out. eg. origin/branch-name, git tag, or git commit hash
|
||||
* destination: Path to install the / of the git repo at when installing the rpm
|
||||
|
||||
An rpm will be created with the contents of the git repository referenced, with the files
|
||||
being installed under ``/opt/server/`` in this case.
|
||||
|
||||
``ref`` can be any valid git reference for use with ``git archive``. eg. to use the head
|
||||
of a branch set it to ``origin/branch-name``, a tag name, or a commit hash.
|
||||
|
||||
Note that the repository is cloned in full each time a build is started, so pointing to a
|
||||
repository with a large amount of history may take a while to clone and use a significant
|
||||
amount of disk space. The clone is temporary and is removed once the rpm is created.
|
||||
|
||||
|
||||
Adding Output Types
|
||||
-------------------
|
||||
|
||||
``livemedia-creator`` supports a large number of output types, and only some of
|
||||
these are currently available via ``lorax-composer``. To add a new output type to
|
||||
lorax-composer a kickstart file needs to be added to ``./share/composer/``. The
|
||||
name of the kickstart is what will be used by the ``/compose/types`` route, and the
|
||||
``compose_type`` field of the POST to start a compose. It also needs to have
|
||||
code added to the :py:func:`pylorax.api.compose.compose_args` function. The
|
||||
``_MAP`` entry in this function defines what lorax-composer will pass to
|
||||
:py:func:`pylorax.installer.novirt_install` when it runs the compose. When the
|
||||
compose is finished the output files need to be copied out of the build
|
||||
directory (``/var/lib/lorax/composer/results/<UUID>/compose/``),
|
||||
:py:func:`pylorax.api.compose.move_compose_results` handles this for each type.
|
||||
You should move them instead of copying to save space.
|
||||
|
||||
If the new output type does not have support in livemedia-creator it should be
|
||||
added there first. This will make the output available to the widest number of
|
||||
users.
|
||||
|
||||
Example: Add partitioned disk support
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Partitioned disk support is something that livemedia-creator already supports
|
||||
via the ``--make-disk`` cmdline argument. To add this to lorax-composer it
|
||||
needs 3 things:
|
||||
|
||||
* A ``partitioned-disk.ks`` file in ``./share/composer/``
|
||||
* A new entry in the _MAP in :py:func:`pylorax.api.compose.compose_args`
|
||||
* Add a bit of code to :py:func:`pylorax.api.compose.move_compose_results` to move the disk image from
|
||||
the compose directory to the results directory.
|
||||
|
||||
The ``partitioned-disk.ks`` is pretty similar to the example minimal kickstart
|
||||
in ``./docs/rhel-minimal.ks``. You should remove the ``url`` and ``repo``
|
||||
commands, they will be added by the compose process. Make sure the bootloader
|
||||
packages are included in the ``%packages`` section at the end of the kickstart,
|
||||
and you will want to leave off the ``%end`` so that the compose can append the
|
||||
list of packages from the blueprint.
|
||||
|
||||
The new ``_MAP`` entry should be a copy of one of the existing entries, but with ``make_disk`` set
|
||||
to ``True``. Make sure that none of the other ``make_*`` options are ``True``. The ``image_name`` is
|
||||
what the name of the final image will be.
|
||||
|
||||
``move_compose_results()`` can be as simple as moving the output file into
|
||||
the results directory, or it could do some post-processing on it. The end of
|
||||
the function should always clean up the ``./compose/`` directory, removing any
|
||||
unneeded extra files. This is especially true for the ``live-iso`` since it produces
|
||||
the contents of the iso as well as the boot.iso itself.
|
||||
|
||||
Package Sources
|
||||
---------------
|
||||
|
||||
By default lorax-composer uses the host's configured repositories. It copies
|
||||
the ``*.repo`` files from ``/etc/yum.repos.d/`` into
|
||||
``/var/lib/lorax/composer/repos.d/`` at startup, these are immutable system
|
||||
repositories and cannot be deleted or changed. If you want to add additional
|
||||
repos you can put them into ``/var/lib/lorax/composer/repos.d/`` or use the
|
||||
``/api/v0/projects/source/*`` API routes to create them.
|
||||
|
||||
The new source can be added by doing a POST to the ``/api/v0/projects/source/new``
|
||||
route using JSON (with `Content-Type` header set to `application/json`) or TOML
|
||||
(with it set to `text/x-toml`). The format of the source looks like this (in
|
||||
TOML)::
|
||||
|
||||
name = "custom-source-1"
|
||||
url = "https://url/path/to/repository/"
|
||||
type = "yum-baseurl"
|
||||
proxy = "https://proxy-url/"
|
||||
check_ssl = true
|
||||
check_gpg = true
|
||||
gpgkey_urls = ["https://url/path/to/gpg-key"]
|
||||
|
||||
The ``proxy`` and ``gpgkey_urls`` entries are optional. All of the others are required. The supported
|
||||
types for the urls are:
|
||||
|
||||
* ``yum-baseurl`` is a URL to a yum repository.
|
||||
* ``yum-mirrorlist`` is a URL for a mirrorlist.
|
||||
* ``yum-metalink`` is a URL for a metalink.
|
||||
|
||||
If ``check_ssl`` is true the https certificates must be valid. If they are self-signed you can either set
|
||||
this to false, or add your Certificate Authority to the host system.
|
||||
|
||||
If ``check_gpg`` is true the GPG key must either be installed on the host system, or ``gpgkey_urls``
|
||||
should point to it.
|
||||
|
||||
You can edit an existing source (other than system sources), by doing a POST to the ``new`` route
|
||||
with the new version of the source. It will overwrite the previous one.
|
||||
|
||||
A list of existing sources is available from ``/api/v0/projects/source/list``, and detailed info
|
||||
on a source can be retrieved with the ``/api/v0/projects/source/info/<source-name>`` route. By default
|
||||
it returns JSON but it can also return TOML if ``?format=toml`` is added to the request.
|
||||
|
||||
Non-system sources can be deleted by doing a ``DELETE`` request to the
|
||||
``/api/v0/projects/source/delete/<source-name>`` route.
|
||||
|
||||
The documentation for the source API routes can be `found here <pylorax.api.html#api-v0-projects-source-list>`_
|
||||
|
||||
The configured sources are used for all blueprint depsolve operations, and for composing images.
|
||||
When adding additional sources you must make sure that the packages in the source do not
|
||||
conflict with any other package sources, otherwise depsolving will fail.
|
||||
|
||||
DVD ISO Package Source
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In some situations the system may want to *only* use a DVD iso as the package
|
||||
source, not the repos from the network. ``lorax-composer`` and ``anaconda``
|
||||
understand ``file://`` URLs so you can mount an iso on the host, and replace the
|
||||
system repo files with a configuration file pointing to the DVD.
|
||||
|
||||
* Stop the ``lorax-composer.service`` if it is running
|
||||
* Move the repo files in ``/etc/yum.repos.d/`` someplace safe
|
||||
* Create a new ``iso.repo`` file in ``/etc/yum.repos.d/``::
|
||||
|
||||
[iso]
|
||||
name=iso
|
||||
baseurl=file:///mnt/iso/
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release
|
||||
|
||||
* Remove all the cached repo files from ``/var/lib/lorax/composer/repos/``
|
||||
* Restart the ``lorax-composer.service``
|
||||
* Check the output of ``composer-cli status show`` for any output specific depsolve errors.
|
||||
For example, the DVD usually does not include ``grub2-efi-*-cdboot-*`` so the live-iso image
|
||||
type will not be available.
|
||||
|
||||
If you want to *add* the DVD source to the existing sources you can do that by
|
||||
mounting the iso and creating a source file to point to it as described in the
|
||||
`Package Sources`_ documentation. In that case there is no need to remove the other
|
||||
sources from ``/etc/yum.repos.d/`` or clear the cached repos.
|
@ -51,7 +51,7 @@ You can add your own repos with ``-s`` and packages with higher NVRs will
|
||||
override the ones in the distribution repositories.
|
||||
|
||||
Under ``./results/`` will be the release tree files: .discinfo, .treeinfo, everything that
|
||||
goes onto the boot.iso, the pxeboot directory, and the boot.iso under ``./images/``.
|
||||
goes onto the boot.iso, the pxeboot directory, and the boot.iso under ``./results/images/``.
|
||||
|
||||
|
||||
Branding
|
||||
@ -62,6 +62,17 @@ that doesn't start with ``generic-`` and will install it. It then selects a
|
||||
corresponding logo package by using the first part of the system-release package and
|
||||
appending ``-logos`` to it. eg. fedora-release and fedora-logos.
|
||||
|
||||
Variants
|
||||
~~~~~~~~
|
||||
|
||||
If a ``variant`` is passed to lorax it will select a ``system-release`` package that
|
||||
ends with the variant name. eg. Passing ``--variant workstation`` will select the
|
||||
``fedora-release-workstation`` package if it exists. It will select a logo package
|
||||
the same way it does for non-variants. eg. ``fedora-logos``.
|
||||
|
||||
If there is no package ending with the variant name it will fall back to using the
|
||||
first non-generic package providing ``system-release``.
|
||||
|
||||
Custom Branding
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@ -80,8 +91,12 @@ are unexpectedly included.
|
||||
Running inside of mock
|
||||
----------------------
|
||||
|
||||
If you are using lorax with mock v1.3.4 or later you will need to pass
|
||||
``--old-chroot`` to mock. Mock now defaults to using systemd-nspawn which cannot
|
||||
As of mock version 2.0 you no longer need to pass ``--old-chroot``. You will,
|
||||
however, need to pass ``--enable-network`` so that the mock container can download
|
||||
packages.
|
||||
|
||||
Older versions of mock, between 1.3.4 and 2.0, will need to pass ``--old-chroot``
|
||||
to mock. These versions of mock default to using systemd-nspawn which cannot
|
||||
create the needed loop device nodes. Passing ``--old-chroot`` will use the old
|
||||
system where ``/dev/loop*`` is setup for you.
|
||||
|
||||
@ -170,7 +185,7 @@ on the architecture that the iso is being created for. They are also stored in
|
||||
configuration template files, configuration variable substitution, treeinfo
|
||||
metadata (via the :func:`treeinfo <pylorax.ltmpl.LoraxTemplateRunner.treeinfo>`
|
||||
template command). Kernel and initrd are copied from the installroot to their
|
||||
final locations and then mkisofs is run to create the boot.iso
|
||||
final locations and then xorrisofs is run to create the boot.iso
|
||||
|
||||
|
||||
Custom Templates
|
||||
|
@ -1,144 +0,0 @@
|
||||
Lorax
|
||||
=====
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
"I am the Lorax. I speak for the trees [and images]."
|
||||
|
||||
The `lorax <https://github.com/rhinstaller/lorax>`_ tool is used to create the
|
||||
`Anaconda <https://github.com/rhinstaller/anaconda>`_ installer boot.iso as
|
||||
well as the basic release tree, and .treeinfo metadata file. Its dependencies
|
||||
are fairly light-weight because it needs to be able to run in a mock chroot
|
||||
environment. It is best to run lorax from the same release as is being targeted
|
||||
because the templates may have release specific logic in them. eg. Use the
|
||||
rawhide version to build the boot.iso for rawhide, along with the rawhide
|
||||
repositories.
|
||||
|
||||
|
||||
lorax cmdline arguments
|
||||
-----------------------
|
||||
|
||||
.. argparse::
|
||||
:ref: pylorax.cmdline.lorax_parser
|
||||
:prog: lorax
|
||||
|
||||
|
||||
Quickstart
|
||||
----------
|
||||
|
||||
Run this as root to create a boot.iso in ``./results/``::
|
||||
|
||||
dnf install lorax
|
||||
setenforce 0
|
||||
lorax -p Fedora -v 23 -r 23 \
|
||||
-s http://dl.fedoraproject.org/pub/fedora/linux/releases/23/Everything/x86_64/os/ \
|
||||
-s http://dl.fedoraproject.org/pub/fedora/linux/updates/23/x86_64/ \
|
||||
./results/
|
||||
setenforce 1
|
||||
|
||||
You can add your own repos with ``-s`` and packages with higher NVRs will
|
||||
override the ones in the distribution repositories.
|
||||
|
||||
Under ``./results/`` will be the release tree files: .discinfo, .treeinfo, everything that
|
||||
goes onto the boot.iso, the pxeboot directory, and the boot.iso under ``./images/``.
|
||||
|
||||
|
||||
How it works
|
||||
------------
|
||||
|
||||
Lorax uses `dnf <https://github.com/rpm-software-management/dnf>`_ to install
|
||||
packages into a temporary directory, sets up configuration files, it then
|
||||
removes unneeded files to save space, and creates a squashfs filesystem of the
|
||||
files. The iso is then built using a generic initramfs and the kernel from the
|
||||
selected repositories.
|
||||
|
||||
To drive these processes Lorax uses a custom template system, based on `Mako
|
||||
templates <http://www.makotemplates.org/>`_ with the addition of custom
|
||||
commands (documented in :class:`pylorax.ltmpl.LoraxTemplateRunner`). Mako
|
||||
supports ``%if/%endif`` blocks as well as free-form python code inside ``<%
|
||||
%>`` tags and variable substitution with ``${}``. The default templates are
|
||||
shipped with lorax in ``/usr/share/lorax/templates.d/99-generic/`` and use the
|
||||
``.tmpl`` extension.
|
||||
|
||||
|
||||
runtime-install.tmpl
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``runtime-install.tmpl`` template lists packages to be installed using the
|
||||
``installpkg`` command. This template is fairly simple, installing common packages and
|
||||
architecture specific packages. It must end with the ``run_pkg_transaction``
|
||||
command which tells dnf to download and install the packages.
|
||||
|
||||
|
||||
runtime-postinstall.tmpl
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``runtime-postinstall.tmpl`` template is where the system configuration
|
||||
happens. The installer environment is similar to a normal running system, but
|
||||
needs some special handling. Configuration files are setup, systemd is told to
|
||||
start the anaconda.target instead of a default system target, and a number of
|
||||
unneeded services are disabled, some of which can interfere with the
|
||||
installation. A number of template commands are used here:
|
||||
|
||||
* :func:`append <pylorax.ltmpl.LoraxTemplateRunner.append>` to add text to a file.
|
||||
* :func:`chmod <pylorax.ltmpl.LoraxTemplateRunner.chmod>` changes the file's mode.
|
||||
* :func:`gconfset <pylorax.ltmpl.LoraxTemplateRunner.gconfset>` runs gconfset.
|
||||
* :func:`install <pylorax.ltmpl.LoraxTemplateRunner.install>` to install a file into the installroot.
|
||||
* :func:`mkdir <pylorax.ltmpl.LoraxTemplateRunner.mkdir>` makes a new directory.
|
||||
* :func:`move <pylorax.ltmpl.LoraxTemplateRunner.move>` to move a file into the installroot
|
||||
* :func:`replace <pylorax.ltmpl.LoraxTemplateRunner.replace>` does text substitution in a file
|
||||
* :func:`remove <pylorax.ltmpl.LoraxTemplateRunner.remove>` deletes a file
|
||||
* :func:`runcmd <pylorax.ltmpl.LoraxTemplateRunner.runcmd>` run arbitrary commands.
|
||||
* :func:`symlink <pylorax.ltmpl.LoraxTemplateRunner.symlink>` creates a symlink
|
||||
* :func:`systemctl <pylorax.ltmpl.LoraxTemplateRunner.systemctl>` runs systemctl in the installroot
|
||||
|
||||
|
||||
runtime-cleanup.tmpl
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``runtime-cleanup.tmpl`` template is used to remove files that aren't strictly needed
|
||||
by the installation environment. In addition to the ``remove`` template command it uses:
|
||||
|
||||
* :func:`removepkg <pylorax.ltmpl.LoraxTemplateRunner.removepkg>`
|
||||
remove all of a specific package's contents. A package may be pulled in as a dependency, but
|
||||
not really used. eg. sound support.
|
||||
* :func:`removefrom <pylorax.ltmpl.LoraxTemplateRunner.removefrom>`
|
||||
Removes some files from a package. A file glob can be used, or the --allbut option to
|
||||
remove everything except a select few.
|
||||
* :func:`removekmod <pylorax.ltmpl.LoraxTemplateRunner.removekmod>`
|
||||
Removes kernel modules
|
||||
|
||||
|
||||
The squashfs filesystem
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
After ``runtime-*.tmpl`` templates have finished their work lorax creates an
|
||||
empty ext4 filesystem, copies the remaining files to it, and makes a squashfs
|
||||
filesystem of it. This file is the / of the boot.iso's installer environment
|
||||
and is what is in the LiveOS/squashfs.img file on the iso.
|
||||
|
||||
|
||||
iso creation
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The iso creation is handled by another set of templates. The one used depends
|
||||
on the architecture that the iso is being created for. They are also stored in
|
||||
``/usr/share/lorax/templates.d/99-generic`` and are named after the arch, like
|
||||
``x86.tmpl`` and ``aarch64.tmpl``. They handle creation of the tree, copying
|
||||
configuration template files, configuration variable substitution, treeinfo
|
||||
metadata (via the :func:`treeinfo <pylorax.ltmpl.LoraxTemplateRunner.treeinfo>`
|
||||
template command). Kernel and initrd are copied from the installroot to their
|
||||
final locations and then mkisofs is run to create the boot.iso
|
||||
|
||||
|
||||
Custom Templates
|
||||
----------------
|
||||
|
||||
The default set of templates and configuration files from the lorax-generic-templates package
|
||||
are shipped in the ``/usr/share/lorax/templates.d/99-generic/`` directory. You can
|
||||
make a copy of them and place them into another directory under ``templates.d``
|
||||
and they will be used instead if their sort order is below all other directories. This
|
||||
allows multiple packages to ship lorax templates without conflict. You can (and probably
|
||||
should) select the specific template directory by passing ``--sharedir`` to lorax.
|
||||
|
131
docs/html/_sources/mkksiso.rst.txt
Normal file
131
docs/html/_sources/mkksiso.rst.txt
Normal file
@ -0,0 +1,131 @@
|
||||
mkksiso
|
||||
=======
|
||||
|
||||
:Authors:
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
|
||||
``mkksiso`` is a tool for creating kickstart boot isos. In it's simplest form
|
||||
you can add a kickstart to a boot.iso and the kickstart will be executed when
|
||||
the iso is booted. If the original iso was created with EFI and Mac support the
|
||||
kickstart boot.iso will include this support as well.
|
||||
|
||||
``mkksiso`` needs to be run as root, it depends on mounting the original iso
|
||||
and you need to be root to be able to do that. The host system architecture
|
||||
needs to match that of the iso. ``mkksiso`` will raise an error if it finds a
|
||||
.discinfo on the iso with a mismatched arch.
|
||||
|
||||
|
||||
mkksiso cmdline arguments
|
||||
-------------------------
|
||||
|
||||
Add a kickstart and files to an iso
|
||||
|
||||
``usage: mkksiso [-h] [-a ADD_PATHS] [-c CMDLINE] [--debug] ks input_iso output_iso``
|
||||
|
||||
Optional arguments
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
-h, --help show this help message and exit
|
||||
-a ADD_PATHS, --add ADD_PATHS
|
||||
File or directory to add to ISO (may be used multiple
|
||||
times)
|
||||
-c CMDLINE, --cmdline CMDLINE
|
||||
Arguments to add to kernel cmdline
|
||||
--debug print debugging info
|
||||
-V VOLID, --volid VOLID
|
||||
Set the ISO volume id, defaults to input's
|
||||
|
||||
Positional arguments
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
:ks: Kickstart to add to the ISO
|
||||
|
||||
:input_iso: ISO to modify
|
||||
|
||||
:output_iso: Full pathname of iso to be created
|
||||
|
||||
|
||||
Create a kickstart boot.iso or DVD
|
||||
----------------------------------
|
||||
|
||||
Create a kickstart like you normally would, kickstart documentation can be
|
||||
`found here <https://pykickstart.readthedocs.io/en/latest/>`_, including the
|
||||
``url`` and ``repo`` commands. If you are creating a DVD and only need the
|
||||
content on the DVD you can use the ``cdrom`` command to install without a
|
||||
network connection. Then run ``mkksiso`` like this::
|
||||
|
||||
mkksiso /PATH/TO/KICKSTART /PATH/TO/ISO /PATH/TO/NEW-ISO
|
||||
|
||||
This will create a new iso with the kickstart in the root directory, and the
|
||||
kernel cmdline will have ``inst.ks=...`` added to it so that it will be
|
||||
executed when the iso is booted (be careful not to boot on a system you don't
|
||||
want to wipe out! There will be no prompting).
|
||||
|
||||
By default the volume id of the iso is preserved. You can set a custom volid
|
||||
by passing ``-V`` and the string to set. The kernel cmdline will be changes, and the iso will have th custom volume id.
|
||||
eg.::
|
||||
|
||||
mkksiso -V "Test Only" /PATH/TO/KICKSTART /PATH/TO/ISO /PATH/TO/NEW-ISO
|
||||
|
||||
|
||||
Adding package repos to a boot.iso
|
||||
----------------------------------
|
||||
|
||||
You can add repo directories to the iso using ``--add /PATH/TO/REPO/``, make
|
||||
sure it contains the ``repodata`` directory by running ``createrepo_c`` on it
|
||||
first. In the kickstart you can refer to the directories (and files) on the iso
|
||||
using ``file:///run/install/repo/DIRECTORY/``. You can then use these repos in
|
||||
the kickstart like this::
|
||||
|
||||
repo --name=extra-repo --baseurl=file:///run/install/repo/extra-repo/
|
||||
|
||||
Run ``mkksiso`` like so::
|
||||
|
||||
mkksiso --add /PATH/TO/REPO/ /PATH/TO/KICKSTART /PATH/TO/ISO /PATH/TO/NEW-ISO
|
||||
|
||||
|
||||
Create a liveimg boot.iso
|
||||
-------------------------
|
||||
|
||||
You can use the kickstart `liveimg command
|
||||
<https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#liveimg>`_,
|
||||
to install a pre-generated disk image or tar to the system the iso is booting
|
||||
on.
|
||||
|
||||
Create a disk image or tar with ``osbuild-composer`` or ``livemedia-creator``,
|
||||
make sure the image includes tools expected by ``anaconda``, as well as the
|
||||
kernel and bootloader support. In ``osbuild-composer`` use the ``tar`` image
|
||||
type and make sure to include the ``kernel``, ``grub2``, and ``grub2-tools``
|
||||
packages. If you plan to install it to a UEFI machine make sure to include
|
||||
``grub2-efi`` and ``efibootmgr`` in the blueprint.
|
||||
|
||||
Add the ``root.tar.xz`` file to the iso using ``--add /PATH/TO/ROOT.TAR.XZ``,
|
||||
and in the kickstart reference it with the ``liveimg`` command like this::
|
||||
|
||||
liveimg --url=file:///run/install/repo/root.tar.xz
|
||||
|
||||
It is also a good idea to use the ``--checksum`` argument to ``liveimg`` to be
|
||||
sure the file hasn't been corrupted::
|
||||
|
||||
mkksiso --add /PATH/TO/root.tar.xz /PATH/TO/KICKSTART /PATH/TO/ISO /PATH/TO/NEW-ISO
|
||||
|
||||
When this iso is booted it will execute the kickstart and install the liveimg
|
||||
contents to the system without any prompting.
|
||||
|
||||
|
||||
How it works
|
||||
------------
|
||||
|
||||
``mkksiso`` first examines the system to make sure the tools it needs are installed,
|
||||
it will work with ``xorrisofs`` or ``mkisofs`` installed. It mounts the source iso,
|
||||
and copies the directories that need to be modified to a temporary directory.
|
||||
|
||||
It then modifies the boot configuration files to include the ``inst.ks`` command,
|
||||
and checks to see if the original iso supports EFI. If it does it regenerates the
|
||||
EFI boot images with the new configuration, and then runs the available iso creation
|
||||
tool to add the new files and directories to the new iso. If the architecture is
|
||||
``x86_64`` it will also make sure the iso can be booted as an iso or from a USB
|
||||
stick (hybridiso).
|
||||
|
||||
The last step is to update the iso checksums so that booting with test enabled
|
||||
will pass.
|
@ -1,5 +1,5 @@
|
||||
pylorax
|
||||
=======
|
||||
src
|
||||
===
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
@ -1,7 +0,0 @@
|
||||
pylorax
|
||||
=======
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
pylorax
|
@ -1,27 +0,0 @@
|
||||
Product and Updates Images
|
||||
==========================
|
||||
|
||||
Lorax now supports creation of product.img and updates.img as part of the build
|
||||
process. This is implemented using the installimg template command which will
|
||||
take the contents of a directory and create a compressed archive from it. The
|
||||
directory must be created by one of the packages installed by
|
||||
runtime-install.tmpl or by passing ``--installpkgs <pkgname>`` to lorax at
|
||||
runtime. The x86, ppc, ppc64le and aarch64 templates all look for
|
||||
/usr/share/lorax/product/ and /usr/share/lorax/updates/ directories in the
|
||||
install chroot while creating the final install tree. If there are files in
|
||||
those directories lorax will create images/product.img and/or
|
||||
images/updates.img
|
||||
|
||||
These archives are just like an anaconda updates image -- their contents are
|
||||
copied over the top of the filesystem at boot time so that you can drop in
|
||||
files to add to or replace anything on the filesystem.
|
||||
|
||||
Anaconda has several places that it looks for updates, the one for product.img
|
||||
is in /run/install/product. So for example, to add an installclass to Anaconda
|
||||
you would put your custom class here:
|
||||
|
||||
``/usr/share/lorax/product/run/install/product/pyanaconda/installclasses/custom.py``
|
||||
|
||||
If the packages containing the product/updates files are not included as part
|
||||
of normal dependencies you can add specific packages with the ``--installpkgs``
|
||||
command or the installpkgs paramater of :class:`pylorax.treebuilder.RuntimeBuilder`
|
@ -1,102 +0,0 @@
|
||||
pylorax.api package
|
||||
===================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
pylorax.api.cmdline module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: pylorax.api.cmdline
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.compose module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: pylorax.api.compose
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.config module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: pylorax.api.config
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.crossdomain module
|
||||
------------------------------
|
||||
|
||||
.. automodule:: pylorax.api.crossdomain
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.dnfbase module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: pylorax.api.dnfbase
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.projects module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: pylorax.api.projects
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.queue module
|
||||
------------------------
|
||||
|
||||
.. automodule:: pylorax.api.queue
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.recipes module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: pylorax.api.recipes
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.server module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: pylorax.api.server
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.v0 module
|
||||
---------------------
|
||||
|
||||
.. automodule:: pylorax.api.v0
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.api.workspace module
|
||||
----------------------------
|
||||
|
||||
.. automodule:: pylorax.api.workspace
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: pylorax.api
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
@ -1,13 +1,6 @@
|
||||
pylorax package
|
||||
===============
|
||||
|
||||
Subpackages
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
|
||||
pylorax.api
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
@ -155,7 +148,6 @@ pylorax.treeinfo module
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
|
@ -1,134 +0,0 @@
|
||||
pylorax package
|
||||
===============
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
pylorax.base module
|
||||
-------------------
|
||||
|
||||
.. automodule:: pylorax.base
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.buildstamp module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: pylorax.buildstamp
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.cmdline module
|
||||
----------------------
|
||||
|
||||
.. automodule:: pylorax.cmdline
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.decorators module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: pylorax.decorators
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.discinfo module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: pylorax.discinfo
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.dnfhelper module
|
||||
------------------------
|
||||
|
||||
.. automodule:: pylorax.dnfhelper
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.executils module
|
||||
------------------------
|
||||
|
||||
.. automodule:: pylorax.executils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.imgutils module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: pylorax.imgutils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.ltmpl module
|
||||
--------------------
|
||||
|
||||
.. automodule:: pylorax.ltmpl
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.monitor module
|
||||
----------------------
|
||||
|
||||
.. automodule:: pylorax.monitor
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.mount module
|
||||
--------------------
|
||||
|
||||
.. automodule:: pylorax.mount
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.output module
|
||||
---------------------
|
||||
|
||||
.. automodule:: pylorax.output
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.sysutils module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: pylorax.sysutils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.treebuilder module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: pylorax.treebuilder
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pylorax.treeinfo module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: pylorax.treeinfo
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: pylorax
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
@ -1,22 +0,0 @@
|
||||
.. lorax documentation master file, created by
|
||||
sphinx-quickstart on Mon May 11 15:06:14 2015.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to lorax's documentation!
|
||||
=================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 673 B |
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Sphinx stylesheet -- basic theme.
|
||||
*
|
||||
* :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
@ -15,6 +15,12 @@ div.clearer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
div.section::after {
|
||||
display: block;
|
||||
content: '';
|
||||
clear: left;
|
||||
}
|
||||
|
||||
/* -- relbar ---------------------------------------------------------------- */
|
||||
|
||||
div.related {
|
||||
@ -124,7 +130,7 @@ ul.search li a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.search li div.context {
|
||||
ul.search li p.context {
|
||||
color: #888;
|
||||
margin: 2px 0 0 30px;
|
||||
text-align: left;
|
||||
@ -271,25 +277,25 @@ p.rubric {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left {
|
||||
img.align-left, figure.align-left, .figure.align-left, object.align-left {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right {
|
||||
img.align-right, figure.align-right, .figure.align-right, object.align-right {
|
||||
clear: right;
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
img.align-center, figure.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
img.align-default, .figure.align-default {
|
||||
img.align-default, figure.align-default, .figure.align-default {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
@ -313,24 +319,31 @@ img.align-default, .figure.align-default {
|
||||
|
||||
/* -- sidebars -------------------------------------------------------------- */
|
||||
|
||||
div.sidebar {
|
||||
div.sidebar,
|
||||
aside.sidebar {
|
||||
margin: 0 0 0.5em 1em;
|
||||
border: 1px solid #ddb;
|
||||
padding: 7px 7px 0 7px;
|
||||
padding: 7px;
|
||||
background-color: #ffe;
|
||||
width: 40%;
|
||||
float: right;
|
||||
clear: right;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
p.sidebar-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.admonition, div.topic, blockquote {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px 7px 0 7px;
|
||||
padding: 7px;
|
||||
margin: 10px 0 10px 0;
|
||||
}
|
||||
|
||||
@ -352,10 +365,6 @@ div.admonition dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.admonition dl {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
p.admonition-title {
|
||||
margin: 0px 10px 5px 0px;
|
||||
font-weight: bold;
|
||||
@ -366,9 +375,30 @@ div.body p.centered {
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
/* -- content of sidebars/topics/admonitions -------------------------------- */
|
||||
|
||||
div.sidebar > :last-child,
|
||||
aside.sidebar > :last-child,
|
||||
div.topic > :last-child,
|
||||
div.admonition > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.sidebar::after,
|
||||
aside.sidebar::after,
|
||||
div.topic::after,
|
||||
div.admonition::after,
|
||||
blockquote::after {
|
||||
display: block;
|
||||
content: '';
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -- tables ---------------------------------------------------------------- */
|
||||
|
||||
table.docutils {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
@ -416,32 +446,34 @@ table.citation td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
th > p:first-child,
|
||||
td > p:first-child {
|
||||
th > :first-child,
|
||||
td > :first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
th > p:last-child,
|
||||
td > p:last-child {
|
||||
th > :last-child,
|
||||
td > :last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
/* -- figures --------------------------------------------------------------- */
|
||||
|
||||
div.figure {
|
||||
div.figure, figure {
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
div.figure p.caption {
|
||||
div.figure p.caption, figcaption {
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
div.figure p.caption span.caption-number {
|
||||
div.figure p.caption span.caption-number,
|
||||
figcaption span.caption-number {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.figure p.caption span.caption-text {
|
||||
div.figure p.caption span.caption-text,
|
||||
figcaption span.caption-text {
|
||||
}
|
||||
|
||||
/* -- field list styles ----------------------------------------------------- */
|
||||
@ -468,10 +500,71 @@ table.field-list td, table.field-list th {
|
||||
|
||||
/* -- hlist styles ---------------------------------------------------------- */
|
||||
|
||||
table.hlist {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
table.hlist td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -- object description styles --------------------------------------------- */
|
||||
|
||||
.sig {
|
||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
||||
}
|
||||
|
||||
.sig-name, code.descname {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sig-name {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
code.descname {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.sig-prename, code.descclassname {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.sig-paren {
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.sig-param.n {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* C++ specific styling */
|
||||
|
||||
.sig-inline.c-texpr,
|
||||
.sig-inline.cpp-texpr {
|
||||
font-family: unset;
|
||||
}
|
||||
|
||||
.sig.c .k, .sig.c .kt,
|
||||
.sig.cpp .k, .sig.cpp .kt {
|
||||
color: #0033B3;
|
||||
}
|
||||
|
||||
.sig.c .m,
|
||||
.sig.cpp .m {
|
||||
color: #1750EB;
|
||||
}
|
||||
|
||||
.sig.c .s, .sig.c .sc,
|
||||
.sig.cpp .s, .sig.cpp .sc {
|
||||
color: #067D17;
|
||||
}
|
||||
|
||||
|
||||
/* -- other body styles ----------------------------------------------------- */
|
||||
|
||||
@ -495,17 +588,37 @@ ol.upperroman {
|
||||
list-style: upper-roman;
|
||||
}
|
||||
|
||||
li > p:first-child {
|
||||
:not(li) > ol > li:first-child > :first-child,
|
||||
:not(li) > ul > li:first-child > :first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
li > p:last-child {
|
||||
:not(li) > ol > li:last-child > :last-child,
|
||||
:not(li) > ul > li:last-child > :last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
ol.simple ol p,
|
||||
ol.simple ul p,
|
||||
ul.simple ol p,
|
||||
ul.simple ul p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
ol.simple > li:not(:first-child) > p,
|
||||
ul.simple > li:not(:first-child) > p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
ol.simple p,
|
||||
ul.simple p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dl.footnote > dt,
|
||||
dl.citation > dt {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
dl.footnote > dd,
|
||||
@ -520,14 +633,15 @@ dl.citation > dd:after {
|
||||
}
|
||||
|
||||
dl.field-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: fit-content(30%) auto;
|
||||
}
|
||||
|
||||
dl.field-list > dt {
|
||||
flex-basis: 20%;
|
||||
font-weight: bold;
|
||||
word-break: break-word;
|
||||
padding-left: 0.5em;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
dl.field-list > dt:after {
|
||||
@ -535,8 +649,8 @@ dl.field-list > dt:after {
|
||||
}
|
||||
|
||||
dl.field-list > dd {
|
||||
flex-basis: 70%;
|
||||
padding-left: 1em;
|
||||
padding-left: 0.5em;
|
||||
margin-top: 0em;
|
||||
margin-left: 0em;
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
@ -545,7 +659,7 @@ dl {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
dd > p:first-child {
|
||||
dd > :first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
@ -559,6 +673,11 @@ dd {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
dl > dd:last-child,
|
||||
dl > dd:last-child > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt:target, span.highlighted {
|
||||
background-color: #fbe54e;
|
||||
}
|
||||
@ -572,14 +691,6 @@ dl.glossary dt {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.sig-paren {
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.versionmodified {
|
||||
font-style: italic;
|
||||
}
|
||||
@ -636,6 +747,10 @@ pre {
|
||||
overflow-y: hidden; /* fixes display issues on Chrome browsers */
|
||||
}
|
||||
|
||||
pre, div[class*="highlight-"] {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
span.pre {
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
@ -643,22 +758,57 @@ span.pre {
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
div[class*="highlight-"] {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
td.linenos pre {
|
||||
padding: 5px 0px;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
table.highlighttable {
|
||||
margin-left: 0.5em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
table.highlighttable tbody {
|
||||
display: block;
|
||||
}
|
||||
|
||||
table.highlighttable tr {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
table.highlighttable td {
|
||||
padding: 0 0.5em 0 0.5em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.highlighttable td.linenos {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
table.highlighttable td.code {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.highlight .hll {
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.highlight pre,
|
||||
table.highlighttable pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.code-block-caption + div {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div.code-block-caption {
|
||||
margin-top: 1em;
|
||||
padding: 2px 5px;
|
||||
font-size: small;
|
||||
}
|
||||
@ -667,8 +817,14 @@ div.code-block-caption code {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
div.code-block-caption + div > div.highlight > pre {
|
||||
margin-top: 0;
|
||||
table.highlighttable td.linenos,
|
||||
span.linenos,
|
||||
div.highlight span.gp { /* gp: Generic.Prompt */
|
||||
user-select: none;
|
||||
-webkit-user-select: text; /* Safari fallback only */
|
||||
-webkit-user-select: none; /* Chrome/Safari */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-ms-user-select: none; /* IE10+ */
|
||||
}
|
||||
|
||||
div.code-block-caption span.caption-number {
|
||||
@ -680,21 +836,7 @@ div.code-block-caption span.caption-text {
|
||||
}
|
||||
|
||||
div.literal-block-wrapper {
|
||||
padding: 1em 1em 0;
|
||||
}
|
||||
|
||||
div.literal-block-wrapper div.highlight {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
code.descname {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
code.descclassname {
|
||||
background-color: transparent;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
code.xref, a code {
|
||||
@ -735,8 +877,7 @@ span.eqno {
|
||||
}
|
||||
|
||||
span.eqno a.headerlink {
|
||||
position: relative;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 756 B |
Binary file not shown.
Before Width: | Height: | Size: 829 B |
Binary file not shown.
Before Width: | Height: | Size: 641 B |
@ -1 +1 @@
|
||||
.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
|
||||
.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:local("fontawesome/FontAwesome") format("truetype")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Sphinx JavaScript utilities for all documentation.
|
||||
*
|
||||
* :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
@ -29,9 +29,14 @@ if (!window.console || !console.firebug) {
|
||||
|
||||
/**
|
||||
* small helper function to urldecode strings
|
||||
*
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
|
||||
*/
|
||||
jQuery.urldecode = function(x) {
|
||||
return decodeURIComponent(x).replace(/\+/g, ' ');
|
||||
if (!x) {
|
||||
return x
|
||||
}
|
||||
return decodeURIComponent(x.replace(/\+/g, ' '));
|
||||
};
|
||||
|
||||
/**
|
||||
@ -283,10 +288,12 @@ var Documentation = {
|
||||
},
|
||||
|
||||
initOnKeyListeners: function() {
|
||||
$(document).keyup(function(event) {
|
||||
$(document).keydown(function(event) {
|
||||
var activeElementType = document.activeElement.tagName;
|
||||
// don't navigate when in search box or textarea
|
||||
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
|
||||
// don't navigate when in search box, textarea, dropdown or button
|
||||
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
|
||||
&& activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey
|
||||
&& !event.shiftKey) {
|
||||
switch (event.keyCode) {
|
||||
case 37: // left
|
||||
var prevHref = $('link[rel="prev"]').prop('href');
|
||||
@ -294,12 +301,14 @@ var Documentation = {
|
||||
window.location.href = prevHref;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 39: // right
|
||||
var nextHref = $('link[rel="next"]').prop('href');
|
||||
if (nextHref) {
|
||||
window.location.href = nextHref;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,11 @@
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
||||
VERSION: '28.14.42',
|
||||
VERSION: '36.5',
|
||||
LANGUAGE: 'None',
|
||||
COLLAPSE_INDEX: false,
|
||||
BUILDER: 'html',
|
||||
FILE_SUFFIX: '.html',
|
||||
LINK_SUFFIX: '.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt',
|
||||
NAVIGATION_WITH_KEYS: false
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 222 B |
Binary file not shown.
Before Width: | Height: | Size: 202 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user