File TODO changed (mode: 100644) (index 9914b9e..5969908) |
22 |
22 |
[ ] |
[ ] |
23 |
23 |
|
|
24 |
24 |
== next release == |
== next release == |
|
25 |
|
[ ] Anybody with a build can dirty pkg_subrepos? It should not happen. |
|
26 |
|
[ ] 'is_resource' may not be correct for latest PHP. |
25 |
27 |
[ ] When a new distro is added, the dotrepo is not built automatically! |
[ ] When a new distro is added, the dotrepo is not built automatically! |
26 |
|
I think this is done at push time. |
|
|
28 |
|
I think this is done at push time. This is true for "Fedora 36". |
|
29 |
|
Let's see what happens on Fedora 37. |
27 |
30 |
[ ] We need a 'latest' for http://rocketgit.com/op/pkgrepo/main/global/testing |
[ ] We need a 'latest' for http://rocketgit.com/op/pkgrepo/main/global/testing |
28 |
31 |
/fedora/36/x86_64/os/rocketgit-global-testing-1.1-1.noarch.rpm |
/fedora/36/x86_64/os/rocketgit-global-testing-1.1-1.noarch.rpm |
29 |
32 |
[ ] Prod: https://rocketgit.com/user/catalinux/rgfs/pkg |
[ ] Prod: https://rocketgit.com/user/catalinux/rgfs/pkg |
30 |
33 |
"Major version: rawhide (0)" |
"Major version: rawhide (0)" |
31 |
34 |
[ ] Cannot delete jobs from https://rocketgit.com/op/settings/workers/queue |
[ ] Cannot delete jobs from https://rocketgit.com/op/settings/workers/queue |
|
35 |
|
Seems there is no support. build.inc.php must be changed to be in line |
|
36 |
|
with other files. |
32 |
37 |
[ ] Seems the update of keys still happens with key_id as string, even from the code I apply intval(). |
[ ] Seems the update of keys still happens with key_id as string, even from the code I apply intval(). |
33 |
38 |
Probably I need to do correct binding of parameters. |
Probably I need to do correct binding of parameters. |
|
39 |
|
Seems I cannot set the type of parameters. Something is very strange there. |
34 |
40 |
[ ] https://rocketgit.com/op/settings/workers/queue shows '@@x@@' output! |
[ ] https://rocketgit.com/op/settings/workers/queue shows '@@x@@' output! |
35 |
41 |
env=rocky-8-x86_64 |
env=rocky-8-x86_64 |
36 |
42 |
url=ssh://rocketgit@ssh.rocketgit.com/user/catalinux/ninedogs |
url=ssh://rocketgit@ssh.rocketgit.com/user/catalinux/ninedogs |
|
71 |
77 |
[ ] |
[ ] |
72 |
78 |
|
|
73 |
79 |
== Next next release == |
== Next next release == |
|
80 |
|
[ ] Artifacts: set ETag! Also for other downloadable content. |
|
81 |
|
[ ] Allow artifacts to be generated only for some branch. |
|
82 |
|
[ ] Link artifacts with the build job. |
|
83 |
|
[ ] When generating links, '/' is doubled: |
|
84 |
|
https://rocketgit.com/user/catalinux/ninedogs/artifacts/list//docs |
|
85 |
|
[ ] When I activate a new environment, maybe I should allow to rebuild all |
|
86 |
|
repos (already present in other repositories). |
|
87 |
|
[ ] Allow user to control values from dotrepo file. |
|
88 |
|
[ ] Order pkg repo distros by version DESC. |
74 |
89 |
[ ] When looking for distinct user agent, do limit the search in the past? |
[ ] When looking for distinct user agent, do limit the search in the past? |
75 |
90 |
Now it takes around 30s. |
Now it takes around 30s. |
76 |
91 |
[ ] SELinux Relabel only on install, not on update? |
[ ] SELinux Relabel only on install, not on update? |
File inc/ssh.inc.php changed (mode: 100644) (index d499ab1..d469a61) |
... |
... |
function rg_ssh_totp($db, $paras) |
179 |
179 |
rg_log_enter('ssh_totp paras=' . rg_array2string($paras)); |
rg_log_enter('ssh_totp paras=' . rg_array2string($paras)); |
180 |
180 |
|
|
181 |
181 |
$ui_login = rg_ui_login(); |
$ui_login = rg_ui_login(); |
182 |
|
$cmd = array_shift($paras); |
|
|
182 |
|
$cmd = empty($paras) ? '' : array_shift($paras); |
183 |
183 |
switch ($cmd) { |
switch ($cmd) { |
184 |
184 |
case 'enroll': // this has nothing to do with scratch codes |
case 'enroll': // this has nothing to do with scratch codes |
185 |
185 |
if (empty($paras)) { |
if (empty($paras)) { |
|
... |
... |
function rg_ssh_totp($db, $paras) |
202 |
202 |
break; |
break; |
203 |
203 |
} |
} |
204 |
204 |
|
|
205 |
|
$token = array_shift($paras); |
|
|
205 |
|
$token = empty($paras) ? '' : array_shift($paras); |
206 |
206 |
|
|
207 |
207 |
$v = rg_totp_device_verify($db, $ui_login['uid'], $token); |
$v = rg_totp_device_verify($db, $ui_login['uid'], $token); |
208 |
208 |
if ($v['token_valid'] != 1) { |
if ($v['token_valid'] != 1) { |
|
... |
... |
function rg_ssh_totp($db, $paras) |
214 |
214 |
break; |
break; |
215 |
215 |
|
|
216 |
216 |
case 'val': |
case 'val': |
217 |
|
$token = array_shift($paras); |
|
|
217 |
|
$token = empty($paras) ? '' : array_shift($paras); |
218 |
218 |
|
|
219 |
219 |
$days = 0; |
$days = 0; |
220 |
220 |
$hours = 0; |
$hours = 0; |
|
... |
... |
function rg_ssh_totp($db, $paras) |
222 |
222 |
if (empty($paras)) { |
if (empty($paras)) { |
223 |
223 |
$hours = 1; |
$hours = 1; |
224 |
224 |
} else { |
} else { |
225 |
|
$s_expire = array_shift($paras); |
|
|
225 |
|
$s_expire = empty($paras) ? '' : array_shift($paras); |
226 |
226 |
$val = intval($s_expire); |
$val = intval($s_expire); |
227 |
227 |
if (stristr($s_expire, 'y')) |
if (stristr($s_expire, 'y')) |
228 |
228 |
$days = 366 * $val; |
$days = 366 * $val; |
|
... |
... |
function rg_ssh_totp($db, $paras) |
273 |
273 |
break; |
break; |
274 |
274 |
|
|
275 |
275 |
case 'unenroll': |
case 'unenroll': |
276 |
|
$token = array_shift($paras); |
|
|
276 |
|
$token = empty($paras) ? '' : array_shift($paras); |
277 |
277 |
|
|
278 |
278 |
$v = rg_totp_verify_any($db, $ui_login['uid'], $token); |
$v = rg_totp_verify_any($db, $ui_login['uid'], $token); |
279 |
279 |
if ($v['token_valid'] != 1) { |
if ($v['token_valid'] != 1) { |
|
... |
... |
function rg_ssh_totp($db, $paras) |
291 |
291 |
break; |
break; |
292 |
292 |
|
|
293 |
293 |
case 'remove-device': |
case 'remove-device': |
294 |
|
$token = array_shift($paras); |
|
|
294 |
|
$token = empty($paras) ? '' : array_shift($paras); |
295 |
295 |
|
|
296 |
296 |
$v = rg_totp_device_verify($db, $ui_login['uid'], $token); |
$v = rg_totp_device_verify($db, $ui_login['uid'], $token); |
297 |
297 |
if ($v['token_valid'] != 1) { |
if ($v['token_valid'] != 1) { |
|
... |
... |
function rg_ssh_totp($db, $paras) |
316 |
316 |
break; |
break; |
317 |
317 |
} |
} |
318 |
318 |
|
|
319 |
|
$del_ip = array_shift($paras); |
|
|
319 |
|
$del_ip = empty($paras) ? '' : array_shift($paras); |
320 |
320 |
|
|
321 |
321 |
if (rg_ssh_totp_verify_ip($db, $ui_login['uid'], rg_ip()) === FALSE) |
if (rg_ssh_totp_verify_ip($db, $ui_login['uid'], rg_ip()) === FALSE) |
322 |
322 |
break; |
break; |
|
... |
... |
function rg_ssh_api($db, $paras) |
360 |
360 |
rg_prof_start('ssh_api'); |
rg_prof_start('ssh_api'); |
361 |
361 |
rg_log_enter('ssh_api paras=' . rg_array2string($paras)); |
rg_log_enter('ssh_api paras=' . rg_array2string($paras)); |
362 |
362 |
|
|
363 |
|
$cmd = array_shift($paras); |
|
|
363 |
|
$cmd = empty($paras) ? '' : array_shift($paras); |
364 |
364 |
rg_stats_conns_set('type', 'api-over-ssh'); |
rg_stats_conns_set('type', 'api-over-ssh'); |
365 |
365 |
|
|
366 |
366 |
$ret = array(); |
$ret = array(); |
|
... |
... |
function rg_ssh_dispatch($db, $orig_cmd) |
406 |
406 |
rg_log('ssh_dispatch orig_cmd=[' . $orig_cmd . ']'); |
rg_log('ssh_dispatch orig_cmd=[' . $orig_cmd . ']'); |
407 |
407 |
|
|
408 |
408 |
$paras = explode(' ', $orig_cmd); |
$paras = explode(' ', $orig_cmd); |
409 |
|
$cmd = array_shift($paras); |
|
|
409 |
|
$cmd = empty($paras) ? '' : array_shift($paras); |
410 |
410 |
|
|
411 |
411 |
// some commands are not executed here |
// some commands are not executed here |
412 |
412 |
switch ($cmd) { |
switch ($cmd) { |
File inc/user.inc.php changed (mode: 100644) (index c22be30..c34e2ad) |
... |
... |
function rg_user_event_new($db, $event) |
141 |
141 |
|
|
142 |
142 |
// create link by name |
// create link by name |
143 |
143 |
$ret[] = array_merge($event, |
$ret[] = array_merge($event, |
144 |
|
array('category' => 'user_link_by_name', 'prio' => 500)); |
|
|
144 |
|
array( |
|
145 |
|
'category' => 'user_link_by_name', |
|
146 |
|
'source' => 'user_event_new', |
|
147 |
|
'prio' => 500) |
|
148 |
|
); |
145 |
149 |
|
|
146 |
150 |
// notify user |
// notify user |
147 |
151 |
$ret[] = array_merge($event, |
$ret[] = array_merge($event, |
|
... |
... |
function rg_user_event_rename($db, $event) |
196 |
200 |
$event['op'] = "rename"; |
$event['op'] = "rename"; |
197 |
201 |
// notify user |
// notify user |
198 |
202 |
$ret[] = array_merge($event, |
$ret[] = array_merge($event, |
199 |
|
array('category' => 'user_event_notify_user', 'prio' => 100)); |
|
|
203 |
|
array( |
|
204 |
|
'category' => 'user_event_notify_user', |
|
205 |
|
'source' => 'user_event_rename', |
|
206 |
|
'prio' => 100) |
|
207 |
|
); |
200 |
208 |
// TODO: notify watchers |
// TODO: notify watchers |
201 |
209 |
|
|
202 |
210 |
return $ret; |
return $ret; |
|
... |
... |
function rg_user_rename($db, $ui_login, $new_name) |
540 |
548 |
// TODO: Check if all parameters are used. |
// TODO: Check if all parameters are used. |
541 |
549 |
$event = array( |
$event = array( |
542 |
550 |
'category' => 'user_event_rename', |
'category' => 'user_event_rename', |
|
551 |
|
'source' => 'user_rename', |
543 |
552 |
'prio' => 50, |
'prio' => 50, |
544 |
553 |
'ui_login' => $ui_login, |
'ui_login' => $ui_login, |
545 |
554 |
'rename_from' => $ui_login['username'], |
'rename_from' => $ui_login['username'], |
|
... |
... |
function rg_user_edit_no_check($db, $d) |
671 |
680 |
|
|
672 |
681 |
$event = array( |
$event = array( |
673 |
682 |
'category' => 'user_event_new', |
'category' => 'user_event_new', |
|
683 |
|
'source' => 'user_edit_no_check', |
674 |
684 |
'prio' => 50, |
'prio' => 50, |
675 |
685 |
'ui_login' => $d2, |
'ui_login' => $d2, |
676 |
686 |
'base_url' => rg_base_url($db, '', '') |
'base_url' => rg_base_url($db, '', '') |
|
... |
... |
function rg_user_login_by_user_pass_helper($db, $user, $pass, $login_token, |
1311 |
1321 |
|
|
1312 |
1322 |
$event = array( |
$event = array( |
1313 |
1323 |
'category' => 'user_event_login', |
'category' => 'user_event_login', |
|
1324 |
|
'source' => 'user_login_by_user_pass_helper', |
1314 |
1325 |
'prio' => 100, |
'prio' => 100, |
1315 |
1326 |
'itime' => time()); |
'itime' => time()); |
1316 |
1327 |
$r = rg_event_add($db, $event); |
$r = rg_event_add($db, $event); |
|
... |
... |
function rg_user_ask_for_email_confirmation($db, $ui_login) |
2259 |
2270 |
{ |
{ |
2260 |
2271 |
$ev = array( |
$ev = array( |
2261 |
2272 |
'category' => 'ask-email-confirmation', |
'category' => 'ask-email-confirmation', |
|
2273 |
|
'source' => 'user_ask_for_email_confirmation', |
2262 |
2274 |
'prio' => 200, |
'prio' => 200, |
2263 |
2275 |
'ui_login' => $ui_login, |
'ui_login' => $ui_login, |
2264 |
2276 |
'base_url' => rg_base_url($db, '', '') |
'base_url' => rg_base_url($db, '', '') |
|
... |
... |
function rg_user_http_git($db, $rg, $paras) |
2432 |
2444 |
//TODO |
//TODO |
2433 |
2445 |
} |
} |
2434 |
2446 |
|
|
2435 |
|
$prefix = array_shift($paras); |
|
|
2447 |
|
$prefix = empty($paras) ? '' : array_shift($paras); |
2436 |
2448 |
if (strcmp($prefix, 'user') != 0) { |
if (strcmp($prefix, 'user') != 0) { |
2437 |
2449 |
$user = $prefix; |
$user = $prefix; |
2438 |
2450 |
$prefix = ''; |
$prefix = ''; |
2439 |
2451 |
} else { |
} else { |
2440 |
|
$user = array_shift($paras); |
|
|
2452 |
|
$user = empty($paras) ? '' : array_shift($paras); |
2441 |
2453 |
} |
} |
2442 |
|
$repo = array_shift($paras); |
|
|
2454 |
|
$repo = empty($paras) ? '' : array_shift($paras); |
2443 |
2455 |
$file = implode('/', $paras); |
$file = implode('/', $paras); |
2444 |
2456 |
rg_log_debug('file=' . $file); |
rg_log_debug('file=' . $file); |
2445 |
2457 |
|
|
File inc/user/packages.inc.php changed (mode: 100644) (index 5e4818c..3a812b1) |
... |
... |
rg_event_register_functions($_f); |
18 |
18 |
* This is security sensitive: a user may use special chars in username |
* This is security sensitive: a user may use special chars in username |
19 |
19 |
* that, after calling this function, will match another user. |
* that, after calling this function, will match another user. |
20 |
20 |
*/ |
*/ |
21 |
|
function rg_pkg_transform_user($type, $uid, $s) |
|
|
21 |
|
function rg_pkg_transform_user($type, $uid, $repo_username) |
22 |
22 |
{ |
{ |
23 |
23 |
if (strcmp($type, 'deb') == 0) { |
if (strcmp($type, 'deb') == 0) { |
24 |
|
$s2 = strtolower($s); |
|
25 |
|
$s2 = preg_replace('/[^-a-z0-9.]/', '-', $s2); |
|
26 |
|
$s2 = str_replace('--', '-', $s2); |
|
|
24 |
|
$new = strtolower($repo_username); |
|
25 |
|
$new = preg_replace('/[^-a-z0-9.]/', '-', $new); |
|
26 |
|
$new = str_replace('--', '-', $new); |
27 |
27 |
} else if (strcmp($type, 'rpm') == 0) { |
} else if (strcmp($type, 'rpm') == 0) { |
28 |
|
$s2 = preg_replace('/[^-A-Za-z0-9._]/', '-', $s); |
|
|
28 |
|
$new = preg_replace('/[^-A-Za-z0-9._]/', '-', $repo_username); |
29 |
29 |
} else { |
} else { |
30 |
|
$s2 = $s; |
|
|
30 |
|
$new = $repo_username; |
31 |
31 |
} |
} |
32 |
32 |
|
|
33 |
33 |
// I do not have a better idea. Maybe we can have a separate table with |
// I do not have a better idea. Maybe we can have a separate table with |
34 |
34 |
// a string provided by the user, but checked at user creation for |
// a string provided by the user, but checked at user creation for |
35 |
35 |
// collisions. |
// collisions. |
36 |
|
if (strcmp($s, $s2) != 0) |
|
37 |
|
$s2 = 'uid-' . $uid . '-' . $s2; |
|
|
36 |
|
if (strcmp($repo_username, $new) != 0) |
|
37 |
|
$new = 'uid-' . $uid . '-' . $new; |
38 |
38 |
|
|
39 |
|
rg_log_debug('pkg_transform_user[' . $type . ']: [' . $s . '] -> [' . $s2 . ']'); |
|
40 |
|
return $s2; |
|
|
39 |
|
rg_log_debug('pkg_transform_user[' . $type . ']:' |
|
40 |
|
. ' [' . $repo_username . '] -> [' . $new . ']'); |
|
41 |
|
return $new; |
41 |
42 |
} |
} |
42 |
43 |
|
|
43 |
44 |
/* |
/* |
44 |
45 |
* Some chars are not allowed in package names. |
* Some chars are not allowed in package names. |
45 |
46 |
* This is NOT security sensitive because of the solving the user collision. |
* This is NOT security sensitive because of the solving the user collision. |
46 |
47 |
*/ |
*/ |
47 |
|
function rg_pkg_transform_repo($type, $s) |
|
|
48 |
|
function rg_pkg_transform_repo($type, $repo_name) |
48 |
49 |
{ |
{ |
49 |
50 |
if (strcmp($type, 'deb') == 0) { |
if (strcmp($type, 'deb') == 0) { |
50 |
|
$s2 = strtolower($s); |
|
51 |
|
$s2 = preg_replace('/[^-a-z0-9.]/', '-', $s2); |
|
52 |
|
$s2 = str_replace('--', '-', $s2); |
|
|
51 |
|
$new = strtolower($repo_name); |
|
52 |
|
$new = preg_replace('/[^-a-z0-9.]/', '-', $new); |
|
53 |
|
$new = str_replace('--', '-', $new); |
53 |
54 |
} else if (strcmp($type, 'rpm') == 0) { |
} else if (strcmp($type, 'rpm') == 0) { |
54 |
|
$s2 = preg_replace('/[^-A-Za-z0-9._]/', '-', $s); |
|
|
55 |
|
$new = preg_replace('/[^-A-Za-z0-9._]/', '-', $repo_name); |
55 |
56 |
} else { |
} else { |
56 |
|
$s2 = $s; |
|
|
57 |
|
$new = $repo_name; |
57 |
58 |
} |
} |
58 |
59 |
|
|
59 |
|
rg_log_debug('pkg_transform_repo[' . $type . ']: [' . $s . '] -> [' . $s2 . ']'); |
|
60 |
|
return $s2; |
|
|
60 |
|
rg_log_debug('pkg_transform_repo[' . $type . ']:' |
|
61 |
|
. ' [' . $repo_name . '] -> [' . $new . ']'); |
|
62 |
|
return $new; |
61 |
63 |
} |
} |
62 |
64 |
|
|
63 |
65 |
/* |
/* |
64 |
|
* This is called after a push and before sendint the job to a builder |
|
|
66 |
|
* This is called after a push and before sendind the job to a builder |
65 |
67 |
*/ |
*/ |
66 |
68 |
function rg_pkg_prepare_for_build($db, &$a) |
function rg_pkg_prepare_for_build($db, &$a) |
67 |
69 |
{ |
{ |
68 |
70 |
rg_log_enter('pkg_prepare_for_build'); |
rg_log_enter('pkg_prepare_for_build'); |
69 |
|
rg_log_debug('a: ' . rg_array2string_short($a)); |
|
|
71 |
|
rg_log_debug('a: ' . print_r($a, TRUE)); |
70 |
72 |
|
|
71 |
73 |
$ret = array('ok' => 0); |
$ret = array('ok' => 0); |
72 |
74 |
do { |
do { |
|
... |
... |
function rg_pkg_prepare_for_build($db, &$a) |
75 |
77 |
$ei = rg_env_info($a['env']); |
$ei = rg_env_info($a['env']); |
76 |
78 |
$a['env_codename'] = $ei['codename']; |
$a['env_codename'] = $ei['codename']; |
77 |
79 |
|
|
78 |
|
$a['repo_username_allowed'] = rg_pkg_transform_user( |
|
79 |
|
$ei['pkg_type'], $a['uid'], $a['repo_username']); |
|
|
80 |
|
// If building a dotrepo, we do not need these |
|
81 |
|
if (isset($a['repo_username'])) |
|
82 |
|
$a['repo_username_allowed'] = rg_pkg_transform_user( |
|
83 |
|
$ei['pkg_type'], $a['uid'], $a['repo_username']); |
80 |
84 |
if (isset($a['repo_name'])) |
if (isset($a['repo_name'])) |
81 |
85 |
$a['repo_name_allowed'] = rg_pkg_transform_repo($ei['pkg_type'], |
$a['repo_name_allowed'] = rg_pkg_transform_repo($ei['pkg_type'], |
82 |
86 |
$a['repo_name']); |
$a['repo_name']); |
|
... |
... |
function rg_packages_validate_path_deb($distro, &$x, $m) |
168 |
172 |
|
|
169 |
173 |
$ret = array('ok' => 0); |
$ret = array('ok' => 0); |
170 |
174 |
do { |
do { |
171 |
|
$codename = array_shift($x); |
|
|
175 |
|
$codename = empty($x) ? '' : array_shift($x); |
172 |
176 |
$major = rg_env_codename2major($distro, $codename); |
$major = rg_env_codename2major($distro, $codename); |
173 |
177 |
if (!isset($m[$major])) { |
if (!isset($m[$major])) { |
174 |
178 |
$ret['errmsg'] = 'invalid codename [' . $codename . ']' |
$ret['errmsg'] = 'invalid codename [' . $codename . ']' |
|
... |
... |
function rg_packages_validate_path_deb($distro, &$x, $m) |
181 |
185 |
break; |
break; |
182 |
186 |
} |
} |
183 |
187 |
|
|
184 |
|
$junk_main = array_shift($x); |
|
|
188 |
|
$junk_main = empty($x) ? '' : array_shift($x); |
185 |
189 |
|
|
186 |
190 |
if (empty($x)) { |
if (empty($x)) { |
187 |
191 |
$ret['ok'] = 1; |
$ret['ok'] = 1; |
188 |
192 |
break; |
break; |
189 |
193 |
} |
} |
190 |
194 |
|
|
191 |
|
$binary_or_source = array_shift($x); |
|
|
195 |
|
$binary_or_source = empty($x) ? '' : array_shift($x); |
192 |
196 |
|
|
193 |
197 |
$ret['ok'] = 1; |
$ret['ok'] = 1; |
194 |
198 |
} while (0); |
} while (0); |
|
... |
... |
function rg_packages_validate_path_rpm($distro, &$x, $m) |
206 |
210 |
|
|
207 |
211 |
$ret = array('ok' => 0); |
$ret = array('ok' => 0); |
208 |
212 |
do { |
do { |
209 |
|
$major = array_shift($x); |
|
|
213 |
|
$major = empty($x) ? '' : array_shift($x); |
210 |
214 |
if (!isset($m[$major])) { |
if (!isset($m[$major])) { |
211 |
215 |
$ret['errmsg'] = 'invalid major [' . $major . ']'; |
$ret['errmsg'] = 'invalid major [' . $major . ']'; |
212 |
216 |
break; |
break; |
|
... |
... |
function rg_packages_validate_path_rpm($distro, &$x, $m) |
217 |
221 |
break; |
break; |
218 |
222 |
} |
} |
219 |
223 |
|
|
220 |
|
$arch = array_shift($x); |
|
|
224 |
|
$arch = empty($x) ? '' : array_shift($x); |
221 |
225 |
if (!isset($m[$major]['archs'][$arch])) { |
if (!isset($m[$major]['archs'][$arch])) { |
222 |
226 |
$ret['errmsg'] = 'invalid arch [' . $arch . ']'; |
$ret['errmsg'] = 'invalid arch [' . $arch . ']'; |
223 |
227 |
break; |
break; |
|
... |
... |
function rg_packages_validate_path_rpm($distro, &$x, $m) |
228 |
232 |
break; |
break; |
229 |
233 |
} |
} |
230 |
234 |
|
|
231 |
|
$type = array_shift($x); |
|
|
235 |
|
$type = empty($x) ? '' : array_shift($x); |
232 |
236 |
$allow = array('os', 'debug', 'src'); |
$allow = array('os', 'debug', 'src'); |
233 |
237 |
if (!in_array($type, $allow)) { |
if (!in_array($type, $allow)) { |
234 |
238 |
$ret['errmsg'] = 'invalid type [' . $type . ']'; |
$ret['errmsg'] = 'invalid type [' . $type . ']'; |
|
... |
... |
function rg_packages_validate_path($db, $path, $allow_paths) |
259 |
263 |
$d = $r['tree']; |
$d = $r['tree']; |
260 |
264 |
|
|
261 |
265 |
$x = explode('/', $path); |
$x = explode('/', $path); |
262 |
|
$junk = array_shift($x); // because path starts with '/', we ignore the empty element |
|
|
266 |
|
$junk = empty($x) ? '' : array_shift($x); // because path starts with '/', we ignore the empty element |
263 |
267 |
|
|
264 |
|
$distro = array_shift($x); |
|
|
268 |
|
$distro = empty($x) ? '' : array_shift($x); |
265 |
269 |
if (!isset($d[$distro])) { |
if (!isset($d[$distro])) { |
266 |
270 |
$ret['errmsg'] = 'invalid distro [' . $distro . ']'; |
$ret['errmsg'] = 'invalid distro [' . $distro . ']'; |
267 |
271 |
break; |
break; |
|
... |
... |
function rg_packages_validate_path($db, $path, $allow_paths) |
292 |
296 |
$ret['user_path'] = implode('/', $x); |
$ret['user_path'] = implode('/', $x); |
293 |
297 |
|
|
294 |
298 |
$match = FALSE; |
$match = FALSE; |
295 |
|
$next1 = array_shift($x); |
|
296 |
|
$next2 = !empty($x) ? array_shift($x) : ''; |
|
297 |
|
$next3 = !empty($x) ? array_shift($x) : ''; |
|
|
299 |
|
$next1 = empty($x) ? '' : array_shift($x); |
|
300 |
|
$next2 = empty($x) ? '' : array_shift($x); |
|
301 |
|
$next3 = empty($x) ? '' : array_shift($x); |
298 |
302 |
foreach ($allow_paths as $i) { |
foreach ($allow_paths as $i) { |
299 |
303 |
rg_log_debug('testing [' . $next1 . ']/[' . $next2 . ']/[' . $next3 . ']' |
rg_log_debug('testing [' . $next1 . ']/[' . $next2 . ']/[' . $next3 . ']' |
300 |
304 |
. ' vs [' . $i['next1'] . ']/[' . $i['next2'] . ']/[' . $i['next3'] . ']'); |
. ' vs [' . $i['next1'] . ']/[' . $i['next2'] . ']/[' . $i['next3'] . ']'); |
|
... |
... |
function rg_packages_web($db, $rg, $paras, $pass) |
822 |
826 |
rg_log_enter('packages_web paras=' . rg_array2string($paras)); |
rg_log_enter('packages_web paras=' . rg_array2string($paras)); |
823 |
827 |
do { |
do { |
824 |
828 |
$a = array(); |
$a = array(); |
825 |
|
$type = @array_shift($paras); |
|
|
829 |
|
$type = empty($paras) ? '' : array_shift($paras); |
826 |
830 |
if (strcmp($type, 'user') == 0) |
if (strcmp($type, 'user') == 0) |
827 |
|
$a['username'] = @array_shift($paras); |
|
|
831 |
|
$a['username'] = empty($paras) ? '' : array_shift($paras); |
828 |
832 |
else |
else |
829 |
833 |
$a['username'] = ''; |
$a['username'] = ''; |
830 |
|
$a['pkg_repo_name'] = @array_shift($paras); |
|
831 |
|
$a['pkg_subrepo_name'] = @array_shift($paras); |
|
832 |
|
$a['distro'] = @array_shift($paras); |
|
|
834 |
|
$a['pkg_repo_name'] = empty($paras) ? '' : array_shift($paras); |
|
835 |
|
$a['pkg_subrepo_name'] = empty($paras) ? '' : array_shift($paras); |
|
836 |
|
$a['distro'] = empty($paras) ? '' : array_shift($paras); |
833 |
837 |
$a['sent_pass'] = $pass; |
$a['sent_pass'] = $pass; |
834 |
838 |
|
|
835 |
839 |
$r = rg_envs_tree($db, TRUE /*only enabled*/); |
$r = rg_envs_tree($db, TRUE /*only enabled*/); |
|
... |
... |
function rg_packages_web($db, $rg, $paras, $pass) |
852 |
856 |
//rg_log_debug('di: ' . print_r($di, TRUE)); |
//rg_log_debug('di: ' . print_r($di, TRUE)); |
853 |
857 |
|
|
854 |
858 |
if (strcmp($di['pkg_type'], 'rpm') == 0) { |
if (strcmp($di['pkg_type'], 'rpm') == 0) { |
855 |
|
$a['major'] = preg_replace('/[^0-9a-zA-Z]/', '', @array_shift($paras)); // we need 'rawhide' to work! |
|
856 |
|
$a['arch'] = preg_replace('/[^-_0-9a-zA-Z]/', '', @array_shift($paras)); |
|
857 |
|
$a['type'] = @array_shift($paras); |
|
|
859 |
|
$a['major'] = preg_replace('/[^0-9a-zA-Z]/', '', empty($paras) ? '' : array_shift($paras)); // we need 'rawhide' to work! |
|
860 |
|
$a['arch'] = preg_replace('/[^-_0-9a-zA-Z]/', '', empty($paras) ? '' : array_shift($paras)); |
|
861 |
|
$a['type'] = empty($paras) ? '' : array_shift($paras); |
858 |
862 |
$a['path'] = implode('/', $paras); |
$a['path'] = implode('/', $paras); |
859 |
863 |
|
|
860 |
864 |
rg_packages_rpm_helper($db, $rg, $a); |
rg_packages_rpm_helper($db, $rg, $a); |
|
... |
... |
function rg_packages_web($db, $rg, $paras, $pass) |
863 |
867 |
|
|
864 |
868 |
if (strcmp($di['pkg_type'], 'deb') == 0) { |
if (strcmp($di['pkg_type'], 'deb') == 0) { |
865 |
869 |
rg_log_debug('paras: ' . rg_array2string_short($paras)); |
rg_log_debug('paras: ' . rg_array2string_short($paras)); |
866 |
|
$x = @array_shift($paras); |
|
|
870 |
|
$x = empty($paras) ? '' : array_shift($paras); |
867 |
871 |
if (strcmp($x, 'dists') == 0) { // eg dists/buster/InRelease |
if (strcmp($x, 'dists') == 0) { // eg dists/buster/InRelease |
868 |
|
$a['codename'] = @array_shift($paras); // example: 'buster' |
|
|
872 |
|
$a['codename'] = empty($paras) ? '' : array_shift($paras); // example: 'buster' |
869 |
873 |
} else { // eg buster/pool/main/c/a/catab+rgfs_0.1_amd64.deb |
} else { // eg buster/pool/main/c/a/catab+rgfs_0.1_amd64.deb |
870 |
874 |
$a['codename'] = $x; |
$a['codename'] = $x; |
871 |
875 |
} |
} |
File inc/user/packages_rpm.inc.php changed (mode: 100644) (index f91a7e0..55826fd) |
... |
... |
$_f = array( |
12 |
12 |
rg_event_register_functions($_f); |
rg_event_register_functions($_f); |
13 |
13 |
|
|
14 |
14 |
/* |
/* |
15 |
|
* This is called after a push and before sendint the job to a builder |
|
|
15 |
|
* This is called after a push and before sending the job to a builder |
16 |
16 |
*/ |
*/ |
17 |
17 |
function rg_pkg_prepare_for_build_rpm($db, &$a) |
function rg_pkg_prepare_for_build_rpm($db, &$a) |
18 |
18 |
{ |
{ |
|
... |
... |
function rg_pkg_prepare_for_dotrepo($db, &$ev) |
106 |
106 |
} |
} |
107 |
107 |
|
|
108 |
108 |
/* |
/* |
109 |
|
* This is called when a (sub)repo is created/updated to generate the dotrepo rpm |
|
|
109 |
|
* This is called when a pkg (sub)repo is created/updated to generate the dotrepo rpm |
110 |
110 |
* (pkg_subrepo_event_edit). |
* (pkg_subrepo_event_edit). |
111 |
|
* TODO: this duplicates some code with build_send_one/rg_pkg_prepare_for_build |
|
112 |
111 |
*/ |
*/ |
113 |
112 |
function rg_pkg_event_generate_dotrepo_rpm($db, $ev) |
function rg_pkg_event_generate_dotrepo_rpm($db, $ev) |
114 |
113 |
{ |
{ |
115 |
114 |
rg_log_enter('pkg_event_generate_dotrepo_rpm'); |
rg_log_enter('pkg_event_generate_dotrepo_rpm'); |
116 |
115 |
rg_log_debug('ev: ' . rg_array2string_short($ev)); |
rg_log_debug('ev: ' . rg_array2string_short($ev)); |
117 |
|
rg_log_debug('TODO: is repo_uid still defined?'); |
|
118 |
116 |
|
|
119 |
117 |
$ret = FALSE; |
$ret = FALSE; |
120 |
118 |
do { |
do { |
|
... |
... |
function rg_pkg_event_generate_dotrepo_rpm($db, $ev) |
145 |
143 |
function rg_pkg_after_build_rpm($db, $ev) |
function rg_pkg_after_build_rpm($db, $ev) |
146 |
144 |
{ |
{ |
147 |
145 |
rg_log_enter('pkg_after_build_rpm'); |
rg_log_enter('pkg_after_build_rpm'); |
|
146 |
|
rg_log_debug('ev: ' . print_r($ev, TRUE)); |
148 |
147 |
|
|
149 |
148 |
$ret = array('ok' => 0); |
$ret = array('ok' => 0); |
150 |
149 |
do { |
do { |
151 |
150 |
$req = $ev['job']['request']; |
$req = $ev['job']['request']; |
|
151 |
|
//rg_log_debug('req: ' . print_r($req, TRUE)); |
152 |
152 |
|
|
153 |
153 |
foreach ($req['rpm_repo_files'] as $pkg_subrepo_id => $junk) { |
foreach ($req['rpm_repo_files'] as $pkg_subrepo_id => $junk) { |
154 |
154 |
$sri = $req['pkg_subrepos'][$pkg_subrepo_id]; // TODO: should we trust these or we should reload them? |
$sri = $req['pkg_subrepos'][$pkg_subrepo_id]; // TODO: should we trust these or we should reload them? |
|
... |
... |
function rg_pkg_after_build_rpm($db, $ev) |
162 |
162 |
} |
} |
163 |
163 |
} |
} |
164 |
164 |
|
|
165 |
|
$s = $ev['status']; |
|
166 |
|
//rg_log_debug('status: ' . rg_array2string_short($s)); |
|
167 |
|
if (empty($s['pkg_subrepo_dirty'])) { |
|
|
165 |
|
$status = $ev['status']; |
|
166 |
|
//rg_log_debug('status: ' . print_r($status, TRUE)); |
|
167 |
|
if (empty($status['pkg_subrepo_dirty'])) { |
168 |
168 |
$ret['ok'] = 1; |
$ret['ok'] = 1; |
169 |
169 |
break; |
break; |
170 |
170 |
} |
} |
|
... |
... |
function rg_pkg_after_build_rpm($db, $ev) |
176 |
176 |
$a['uid'] = 0; |
$a['uid'] = 0; |
177 |
177 |
$a['repo_id'] = $req['repo_id']; |
$a['repo_id'] = $req['repo_id']; |
178 |
178 |
$a['repo_uid'] = $req['repo_uid']; |
$a['repo_uid'] = $req['repo_uid']; |
179 |
|
$a['repo_username'] = $req['repo_username']; |
|
|
179 |
|
if (isset($req['repo_username'])) // when rebuilding the repo we do not need this! |
|
180 |
|
$a['repo_username'] = $req['repo_username']; |
180 |
181 |
$a['head'] = $req['head']; |
$a['head'] = $req['head']; |
181 |
182 |
$a['orig_job_id'] = $req['orig_job_id']; |
$a['orig_job_id'] = $req['orig_job_id']; |
182 |
183 |
$a['log_sid'] = $req['log_sid']; |
$a['log_sid'] = $req['log_sid']; |
183 |
|
$a['pkg_subrepo_id_list'] = $s['pkg_subrepo_dirty']; |
|
|
184 |
|
$a['pkg_subrepo_id_list'] = $status['pkg_subrepo_dirty']; |
184 |
185 |
$a['env'] = $req['env']; |
$a['env'] = $req['env']; |
185 |
186 |
$a['build_repo_id'] = 0; // this is meta repo operation |
$a['build_repo_id'] = 0; // this is meta repo operation |
186 |
187 |
|
|
|
... |
... |
function rg_packages_rpm_helper($db, $rg, $a) |
334 |
335 |
|
|
335 |
336 |
$r = rg_path_validate($dir, $a['path']); |
$r = rg_path_validate($dir, $a['path']); |
336 |
337 |
if ($r === FALSE) { |
if ($r === FALSE) { |
337 |
|
rg_security_violation_no_exit('path=' . $a['path']); |
|
|
338 |
|
//rg_security_violation_no_exit('path=' . $a['path']); |
338 |
339 |
header($rg['proto'] . ' 404 Not found'); |
header($rg['proto'] . ' 404 Not found'); |
339 |
340 |
echo 'invalid file' . "\n"; |
echo 'invalid file' . "\n"; |
340 |
341 |
break; |
break; |
File inc/user/pkg_subrepo.inc.php changed (mode: 100644) (index ade0403..d45b96b) |
... |
... |
function rg_pkg_subrepo_event_edit($db, $ev) |
46 |
46 |
do { |
do { |
47 |
47 |
$a = $ev; |
$a = $ev; |
48 |
48 |
$a['category'] = 'pkg_generate_dotrepo_rpm'; |
$a['category'] = 'pkg_generate_dotrepo_rpm'; |
|
49 |
|
$a['source'] = 'pkg_subrepo_event_edit'; |
49 |
50 |
$a['force_regenerate_dotrepo'] = 1; |
$a['force_regenerate_dotrepo'] = 1; |
50 |
51 |
|
|
51 |
|
// We try to group the changes by arch, to start fewer machines |
|
|
52 |
|
// We try to group the changes by env, to start fewer machines |
52 |
53 |
$per_env = array(); |
$per_env = array(); |
53 |
54 |
foreach ($ev['pkg_subrepo_id_list'] as $pkg_subrepo_id) { |
foreach ($ev['pkg_subrepo_id_list'] as $pkg_subrepo_id) { |
54 |
55 |
$sri = rg_pkg_subrepo_info($db, $ev['uid'], $pkg_subrepo_id); |
$sri = rg_pkg_subrepo_info($db, $ev['uid'], $pkg_subrepo_id); |
|
... |
... |
function rg_pkg_subrepo_event_edit($db, $ev) |
61 |
62 |
// We do not need to generate dotrepo for never generated subrepos. |
// We do not need to generate dotrepo for never generated subrepos. |
62 |
63 |
// We wait for the first packet in the repo to trigger it. |
// We wait for the first packet in the repo to trigger it. |
63 |
64 |
if (!isset($info['dotrepo'])) { |
if (!isset($info['dotrepo'])) { |
64 |
|
rg_log_debug('env ' . $env . ' never had a dotrepo; skip it'); |
|
|
65 |
|
rg_log_debug('env ' . $env |
|
66 |
|
. ' never had a dotrepo; skip it'); |
65 |
67 |
continue; |
continue; |
66 |
68 |
} |
} |
67 |
69 |
|
|
|
... |
... |
function rg_pkg_subrepo_event_pkg_repo_changed($db, $ev) |
95 |
97 |
{ |
{ |
96 |
98 |
$ret = FALSE; |
$ret = FALSE; |
97 |
99 |
do { |
do { |
98 |
|
$list = rg_pkg_subrepo_list_one($db, $ev['uid']); |
|
|
100 |
|
$list = rg_pkg_subrepo_list_not_global($db, $ev['uid']); |
99 |
101 |
if ($list === FALSE) |
if ($list === FALSE) |
100 |
102 |
break; |
break; |
101 |
103 |
|
|
102 |
|
$ev['source'] = 'pkg_subrepo_event_pkg_repo_changed'; |
|
103 |
104 |
$ev['category'] = 'pkg_subrepo_edit'; |
$ev['category'] = 'pkg_subrepo_edit'; |
104 |
|
$ev['pkg_subrepo_id_list'] = array(); |
|
|
105 |
|
$ev['source'] = 'pkg_subrepo_event_pkg_repo_changed'; |
105 |
106 |
|
|
106 |
107 |
// For each affected subrepo... |
// For each affected subrepo... |
|
108 |
|
$ev['pkg_subrepo_id_list'] = array(); |
107 |
109 |
foreach ($list as $pkg_subrepo_id => $info) { |
foreach ($list as $pkg_subrepo_id => $info) { |
|
110 |
|
// Ignore pkg_repos which were not edited (list_not_global returns all) |
108 |
111 |
if ($info['pkg_repo_id'] != $ev['pkg_repo_id']) |
if ($info['pkg_repo_id'] != $ev['pkg_repo_id']) |
109 |
112 |
continue; |
continue; |
110 |
113 |
|
|
|
... |
... |
function rg_pkg_subrepo_edit($db, $uid, $d) |
288 |
291 |
$ev = array( |
$ev = array( |
289 |
292 |
'category' => $orig_id == 0 ? |
'category' => $orig_id == 0 ? |
290 |
293 |
'pkg_subrepo_add' : 'pkg_subrepo_edit', |
'pkg_subrepo_add' : 'pkg_subrepo_edit', |
|
294 |
|
'source' => 'pkg_subrepo_edit', |
291 |
295 |
'prio' => 100, |
'prio' => 100, |
292 |
|
'uid' => $uid, |
|
|
296 |
|
'uid' => $uid, // obsolete? |
293 |
297 |
'pkg_subrepo_id_list' => array($d['id']) |
'pkg_subrepo_id_list' => array($d['id']) |
294 |
298 |
); |
); |
295 |
299 |
$r = rg_event_add($db, $ev); |
$r = rg_event_add($db, $ev); |
|
... |
... |
function rg_pkg_subrepo_cosmetic_list($db, &$a) |
441 |
445 |
/* |
/* |
442 |
446 |
* Returns the list of pkg subrepos (only for uid $uid, excluding uid 0) |
* Returns the list of pkg subrepos (only for uid $uid, excluding uid 0) |
443 |
447 |
*/ |
*/ |
444 |
|
function rg_pkg_subrepo_list_one($db, $uid) |
|
|
448 |
|
function rg_pkg_subrepo_list_not_global($db, $uid) |
445 |
449 |
{ |
{ |
446 |
|
rg_prof_start('pkg_subrepo_list_one'); |
|
447 |
|
rg_log_enter('pkg_subrepo_list_one: uid=' . $uid); |
|
|
450 |
|
rg_prof_start('pkg_subrepo_list_not_global'); |
|
451 |
|
rg_log_enter('pkg_subrepo_list_not_global: uid=' . $uid); |
448 |
452 |
|
|
449 |
453 |
$ret = FALSE; |
$ret = FALSE; |
450 |
454 |
do { |
do { |
|
... |
... |
function rg_pkg_subrepo_list_one($db, $uid) |
488 |
492 |
} while (0); |
} while (0); |
489 |
493 |
|
|
490 |
494 |
rg_log_exit(); |
rg_log_exit(); |
491 |
|
rg_prof_end('pkg_subrepo_list_one'); |
|
|
495 |
|
rg_prof_end('pkg_subrepo_list_not_global'); |
492 |
496 |
return $ret; |
return $ret; |
493 |
497 |
} |
} |
494 |
498 |
|
|
|
... |
... |
function rg_pkg_subrepo_list_one($db, $uid) |
498 |
502 |
function rg_pkg_subrepo_list($db, $uid) |
function rg_pkg_subrepo_list($db, $uid) |
499 |
503 |
{ |
{ |
500 |
504 |
do { |
do { |
501 |
|
$ret = rg_pkg_subrepo_list_one($db, $uid); |
|
|
505 |
|
$ret = rg_pkg_subrepo_list_not_global($db, $uid); |
502 |
506 |
if ($ret === FALSE) |
if ($ret === FALSE) |
503 |
507 |
break; |
break; |
504 |
508 |
|
|
505 |
509 |
if ($uid == 0) |
if ($uid == 0) |
506 |
510 |
break; |
break; |
507 |
511 |
|
|
508 |
|
$g = rg_pkg_subrepo_list_one($db, 0 /*uid*/); |
|
|
512 |
|
$g = rg_pkg_subrepo_list_not_global($db, 0 /*uid*/); |
509 |
513 |
if ($g === FALSE) |
if ($g === FALSE) |
510 |
514 |
break; |
break; |
511 |
515 |
|
|
|
... |
... |
function rg_pkg_subrepo_list($db, $uid) |
516 |
520 |
} |
} |
517 |
521 |
|
|
518 |
522 |
/* |
/* |
519 |
|
* Returns info about a pkg_subrepo (by id) |
|
|
523 |
|
* Returns info about a pkg_subrepo (by uid and id) |
520 |
524 |
*/ |
*/ |
521 |
525 |
function rg_pkg_subrepo_info($db, $uid, $id) |
function rg_pkg_subrepo_info($db, $uid, $id) |
522 |
526 |
{ |
{ |
|
... |
... |
function rg_pkg_subrepo_info_by_name($db, $uid, $pkg_repo_id, $name) |
592 |
596 |
*/ |
*/ |
593 |
597 |
function rg_pkg_subrepo_select($db, $name, $uid, $id) |
function rg_pkg_subrepo_select($db, $name, $uid, $id) |
594 |
598 |
{ |
{ |
595 |
|
$list = rg_pkg_subrepo_list_one($db, $uid); |
|
|
599 |
|
$list = rg_pkg_subrepo_list_not_global($db, $uid); |
596 |
600 |
if ($list === FALSE) |
if ($list === FALSE) |
597 |
601 |
return rg_warning('Could not load packages subrepos.'); |
return rg_warning('Could not load packages subrepos.'); |
598 |
602 |
|
|
File inc/workers.inc.php changed (mode: 100644) (index ccc2336..fb4b25e) |
... |
... |
function rg_worker_event_add($db, $ev) |
36 |
36 |
$ret = array(); |
$ret = array(); |
37 |
37 |
|
|
38 |
38 |
$ev['category'] = 'rg_keys_event_regen'; |
$ev['category'] = 'rg_keys_event_regen'; |
|
39 |
|
$ev['source'] = 'worker_event_add'; |
39 |
40 |
$ev['prio'] = 10; |
$ev['prio'] = 10; |
40 |
41 |
$ev['source'] = 'worker_event_add'; |
$ev['source'] = 'worker_event_add'; |
41 |
42 |
$ret[] = $ev; |
$ret[] = $ev; |
|
... |
... |
function rg_worker_event_del($db, $ev) |
51 |
52 |
$ret = array(); |
$ret = array(); |
52 |
53 |
|
|
53 |
54 |
$ev['category'] = 'rg_keys_event_regen'; |
$ev['category'] = 'rg_keys_event_regen'; |
|
55 |
|
$ev['source'] = 'worker_event_del'; |
54 |
56 |
$ev['prio'] = 10; |
$ev['prio'] = 10; |
55 |
57 |
$ev['source'] = 'worker_event_del'; |
$ev['source'] = 'worker_event_del'; |
56 |
58 |
$ret[] = $ev; |
$ret[] = $ev; |
|
... |
... |
function rg_worker_add($db, $uid, $a) |
303 |
305 |
|
|
304 |
306 |
$event = array( |
$event = array( |
305 |
307 |
'category' => 'worker_event_add', |
'category' => 'worker_event_add', |
|
308 |
|
'source' => 'worker_add', |
306 |
309 |
'prio' => 50, |
'prio' => 50, |
307 |
310 |
'ui_login' => array('uid' => $uid), |
'ui_login' => array('uid' => $uid), |
308 |
311 |
'add' => $a['id'] == 0 ? 1 : 0, |
'add' => $a['id'] == 0 ? 1 : 0, |
|
... |
... |
function rg_worker_update($db, $uid, $id, $a) |
403 |
406 |
|
|
404 |
407 |
$event = array( |
$event = array( |
405 |
408 |
'category' => 'worker_event_add', |
'category' => 'worker_event_add', |
|
409 |
|
'source' => 'worker_update', |
406 |
410 |
'prio' => 50, |
'prio' => 50, |
407 |
411 |
'ui_login' => array('uid' => $uid), |
'ui_login' => array('uid' => $uid), |
408 |
412 |
'add' => 0, |
'add' => 0, |
|
... |
... |
function rg_worker_remove($db, $uid, $list) |
504 |
508 |
. ' AND id IN (' . $sql_list . ')'; |
. ' AND id IN (' . $sql_list . ')'; |
505 |
509 |
$res = rg_sql_query_params($db, $sql, $params); |
$res = rg_sql_query_params($db, $sql, $params); |
506 |
510 |
if ($res === FALSE) { |
if ($res === FALSE) { |
507 |
|
rg_worker_set_error('cannot delete api keys'); |
|
|
511 |
|
rg_worker_set_error('cannot delete worker'); |
508 |
512 |
break; |
break; |
509 |
513 |
} |
} |
510 |
514 |
rg_sql_free_result($res); |
rg_sql_free_result($res); |
511 |
515 |
|
|
512 |
516 |
$event = array( |
$event = array( |
513 |
517 |
'category' => 'worker_event_del', |
'category' => 'worker_event_del', |
|
518 |
|
'source' => 'worker_remove', |
514 |
519 |
'prio' => 50, |
'prio' => 50, |
515 |
520 |
'ui_login' => array('uid' => $uid), |
'ui_login' => array('uid' => $uid), |
516 |
521 |
'keys' => implode(',', $my_list)); |
'keys' => implode(',', $my_list)); |
File tests/wh_build.php changed (mode: 100644) (index b3da30d..ca5f1dd) |
... |
... |
$extra = array( |
78 |
78 |
'wh::idata::secrets::0::name' => 'secret1', // we cannot use <xss> here - it will be rejected by bash |
'wh::idata::secrets::0::name' => 'secret1', // we cannot use <xss> here - it will be rejected by bash |
79 |
79 |
'wh::idata::secrets::0::value' => 'value1<xss>', |
'wh::idata::secrets::0::value' => 'value1<xss>', |
80 |
80 |
'wh::idata::events' => 'P', |
'wh::idata::events' => 'P', |
81 |
|
'wh::idata::envs[fedora-35-x86_64]' => 'on', |
|
|
81 |
|
'wh::idata::envs[fedora-37-x86_64]' => 'on', |
82 |
82 |
'wh::idata::envs[debian-11-amd64]' => 'on', |
'wh::idata::envs[debian-11-amd64]' => 'on', |
83 |
83 |
'wh::idata::packages' => 'nano', |
'wh::idata::packages' => 'nano', |
84 |
84 |
'wh::idata::cmds::1::cmd' => 'make', |
'wh::idata::cmds::1::cmd' => 'make', |
|
... |
... |
rg_log_exit(); |
206 |
206 |
rg_log(''); |
rg_log(''); |
207 |
207 |
rg_log_enter('Checking public dotrepo download'); |
rg_log_enter('Checking public dotrepo download'); |
208 |
208 |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
209 |
|
$pkg_repo_pub_name, $pkg_subrepo_pub['sr::name'], 'fedora', 35, |
|
|
209 |
|
$pkg_repo_pub_name, $pkg_subrepo_pub['sr::name'], 'fedora', 37, |
210 |
210 |
'x86_64/os/rocketgit-' . $rg_ui['username'] . '-' |
'x86_64/os/rocketgit-' . $rg_ui['username'] . '-' |
211 |
211 |
. $pkg_repo_pub_name . '-' . $pkg_subrepo_pub['sr::name'] . '-1.1-1.noarch.rpm'); |
. $pkg_repo_pub_name . '-' . $pkg_subrepo_pub['sr::name'] . '-1.1-1.noarch.rpm'); |
212 |
212 |
// TODO: try to unpack the rpm? |
// TODO: try to unpack the rpm? |
|
... |
... |
rg_log_exit(); |
223 |
223 |
rg_log(''); |
rg_log(''); |
224 |
224 |
rg_log_enter('Checking private dotrepo download'); |
rg_log_enter('Checking private dotrepo download'); |
225 |
225 |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
226 |
|
$pkg_repo_priv_name, $pkg_subrepo_priv['sr::name'], 'fedora', 35, |
|
|
226 |
|
$pkg_repo_priv_name, $pkg_subrepo_priv['sr::name'], 'fedora', 37, |
227 |
227 |
'x86_64/os/rocketgit-' . $rg_ui['username'] . '-' |
'x86_64/os/rocketgit-' . $rg_ui['username'] . '-' |
228 |
228 |
. $pkg_repo_priv_name . '-' . $pkg_subrepo_priv['sr::name'] . '-1.1-1.noarch.rpm'); |
. $pkg_repo_priv_name . '-' . $pkg_subrepo_priv['sr::name'] . '-1.1-1.noarch.rpm'); |
229 |
229 |
// TODO: try to unpack the rpm? |
// TODO: try to unpack the rpm? |
|
... |
... |
rg_log_exit(); |
239 |
239 |
rg_log(''); |
rg_log(''); |
240 |
240 |
rg_log_enter('Checking private dotrepo download (by bad user)'); |
rg_log_enter('Checking private dotrepo download (by bad user)'); |
241 |
241 |
$r = rg_test_packages_file($rg_bad, $rg_ui, 'user', |
$r = rg_test_packages_file($rg_bad, $rg_ui, 'user', |
242 |
|
$pkg_repo_priv_name, $pkg_subrepo_priv['sr::name'], 'fedora', 35, |
|
|
242 |
|
$pkg_repo_priv_name, $pkg_subrepo_priv['sr::name'], 'fedora', 37, |
243 |
243 |
'x86_64/os/rocketgit-' . $rg_ui['username'] . '-' |
'x86_64/os/rocketgit-' . $rg_ui['username'] . '-' |
244 |
244 |
. $pkg_repo_priv_name . '-' . $pkg_subrepo_priv['sr::name'] . '-1.1-1.noarch.rpm'); |
. $pkg_repo_priv_name . '-' . $pkg_subrepo_priv['sr::name'] . '-1.1-1.noarch.rpm'); |
245 |
245 |
// TODO: try to unpack the rpm? |
// TODO: try to unpack the rpm? |
|
... |
... |
rg_log_exit(); |
254 |
254 |
rg_log(''); |
rg_log(''); |
255 |
255 |
rg_log_enter('Checking packages repomd download'); |
rg_log_enter('Checking packages repomd download'); |
256 |
256 |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
257 |
|
$pkg_repo_pub_name, $pkg_subrepo_pub['sr::name'], 'fedora', 35, |
|
|
257 |
|
$pkg_repo_pub_name, $pkg_subrepo_pub['sr::name'], 'fedora', 37, |
258 |
258 |
'x86_64/os/repodata/repomd.xml'); |
'x86_64/os/repodata/repomd.xml'); |
259 |
259 |
$e = '<?xml '; |
$e = '<?xml '; |
260 |
260 |
if (!strstr($r['body'], $e)) { |
if (!strstr($r['body'], $e)) { |
|
... |
... |
rg_log_exit(); |
274 |
274 |
rg_log(''); |
rg_log(''); |
275 |
275 |
rg_log_enter('Checking packages rpm download'); |
rg_log_enter('Checking packages rpm download'); |
276 |
276 |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
$r = rg_test_packages_file($rg_ui, $rg_ui, 'user', |
277 |
|
$pkg_repo_pub_name, $pkg_subrepo_pub['sr::name'], 'fedora', 35, |
|
|
277 |
|
$pkg_repo_pub_name, $pkg_subrepo_pub['sr::name'], 'fedora', 37, |
278 |
278 |
'x86_64/os/' . $rg_ui['username'] . '+' . $repo['name'] . '-0.1-1.x86_64.rpm'); |
'x86_64/os/' . $rg_ui['username'] . '+' . $repo['name'] . '-0.1-1.x86_64.rpm'); |
279 |
279 |
$e = 'content-type: application/x-rpm'; |
$e = 'content-type: application/x-rpm'; |
280 |
280 |
if (!stristr($r['header'], $e)) { |
if (!stristr($r['header'], $e)) { |
|
... |
... |
rg_log_exit(); |
375 |
375 |
|
|
376 |
376 |
rg_log(''); |
rg_log(''); |
377 |
377 |
rg_log_enter('Checking artifacts 1'); |
rg_log_enter('Checking artifacts 1'); |
378 |
|
$r = rg_test_artifacts_page($rg_ui, $repo, '/envs/fedora-35-x86_64'); |
|
379 |
|
$e = '<a href="/user/' . $rg_ui['username'] . '/' . $repo['name'] . '/artifacts/download/envs/fedora-35-x86_64/bla%C8%99.out">Download</a>'; |
|
|
378 |
|
$r = rg_test_artifacts_page($rg_ui, $repo, '/envs/fedora-37-x86_64'); |
|
379 |
|
$e = '<a href="/user/' . $rg_ui['username'] . '/' . $repo['name'] . '/artifacts/download/envs/fedora-37-x86_64/bla%C8%99.out">Download</a>'; |
380 |
380 |
if (!strstr($r['body'], $e)) { |
if (!strstr($r['body'], $e)) { |
381 |
381 |
rg_log_ml('artifacts: ' . $r['body']); |
rg_log_ml('artifacts: ' . $r['body']); |
382 |
382 |
rg_log('Link to artifact not found [' . $e . ']!'); |
rg_log('Link to artifact not found [' . $e . ']!'); |
383 |
383 |
exit(1); |
exit(1); |
384 |
384 |
} |
} |
385 |
|
$r = rg_test_artifacts_file($rg_ui, $repo, '/envs/fedora-35-x86_64/blaș.out'); |
|
|
385 |
|
$r = rg_test_artifacts_file($rg_ui, $repo, '/envs/fedora-37-x86_64/blaș.out'); |
386 |
386 |
rg_log_ml('blaș.out: ' . print_r($r, TRUE)); |
rg_log_ml('blaș.out: ' . print_r($r, TRUE)); |
387 |
387 |
$e = 'blaș' . "\n"; |
$e = 'blaș' . "\n"; |
388 |
388 |
if (strcmp($r['body'], $e) != 0) { |
if (strcmp($r['body'], $e) != 0) { |