List of commits:
Subject Hash Author Date (UTC)
Cosmetic 04ae5ac6b9805198966a21755d1d430ef5b6a6dd Catalin(ux) M. BOIE 2022-12-11 17:17:39
Keep-alive mechanism for builder/worker 7e3add2ab41feefe37a858439934b8599fb30933 Catalin(ux) M. BOIE 2022-12-10 19:36:53
Bumped version to 0.76 09bb0cc92a9dfce513ce1289a22e71faf4ad1fe1 Catalin(ux) M. BOIE 2022-10-22 06:27:35
Cosmetic 45c59081c97489ccccd35efffa522607fee25a63 Catalin(ux) M. BOIE 2022-10-22 05:52:56
Mostly worker stuff ccf3a8d8da2ad1b0d97418fabb5028b40721835f Catalin(ux) M. BOIE 2022-10-22 05:50:04
wh: lambda: seems we cannot pass x-Amz-Client-Context header empty anymore 7f065b0fb6ceed5d2339afd7590f5a795ed3582e Catalin(ux) M. BOIE 2022-10-21 19:33:58
workers: wrong URL for delete a2b2ff5925b1ee9b4a033da93084c008b7af8c64 Catalin(ux) M. BOIE 2022-10-21 16:03:56
Typo 4557595fb985fb2a0a482a387ef0a61293b511ed Catalin(ux) M. BOIE 2022-03-29 17:06:57
Builder improvements 2c27620922c4990454dc3039b2f1c4a86388501f Catalin(ux) M. BOIE 2022-03-29 06:28:16
Extra space in debian/conffiles preventing Debian build 416ed9995151c29bffb4ca3f0f6901aab7cbaa8e Catalin(ux) M. BOIE 2022-03-28 19:36:06
Show global pkg sub repos; cosmetic 43f60158b760b2789261e703ff2fa0781f590e04 Catalin(ux) M. BOIE 2022-03-28 18:21:07
Cosmetic a60d33914b8a1754c84ddc5440533df9b89337ad Catalin(ux) M. BOIE 2022-03-16 07:40:37
Cosmetic 8bb684cb885e0ad0f24519990a564031ea0e43a9 Catalin(ux) M. BOIE 2022-02-19 08:12:45
Set install_id under lock to not get errors 46904e58621450cc164afe769a2aeb597fbaecd8 Catalin(ux) M. BOIE 2022-02-17 18:08:59
Cosmetic bc38d3b0196d5701f75209a3125543ba096fe340 Catalin(ux) M. BOIE 2022-02-16 19:45:29
Bumped version to 0.75 1341db08f1342e7a6838305e94d31849d6b583c4 Catalin(ux) M. BOIE 2022-02-16 18:58:45
Misc small fixes 7bc12d7ee158d99979dbb91f293162472917a2e2 Catalin(ux) M. BOIE 2022-02-16 18:58:18
We did not validated the plan id - now is fixed. 3786d759107c4028f181c7de77d39382d9f572bf Catalin(ux) M. BOIE 2022-02-16 18:55:05
Added build stats 3f574c94ad35d6f85ee37a4da410499f268e608f Catalin(ux) M. BOIE 2022-02-16 18:53:54
Cosmetic 548c8a909c994ef528c9910c625e6afb88beeead Catalin(ux) M. BOIE 2022-02-16 18:44:12
Commit 04ae5ac6b9805198966a21755d1d430ef5b6a6dd - Cosmetic
Author: Catalin(ux) M. BOIE
Author date (UTC): 2022-12-11 17:17
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2022-12-11 20:59
Parent(s): 7e3add2ab41feefe37a858439934b8599fb30933
Signer:
Signing key:
Signing status: N
Tree: 7866a1b62f09ca825df3ef2b9eec7024f6799037
File Lines added Lines deleted
.gitignore 2 0
History.txt 3 1
TODO 16 1
inc/admin.inc.php 5 0
inc/apikeys.inc.php 4 0
inc/bug.inc.php 4 0
inc/builder.inc.php 1 0
inc/conn.inc.php 2 1
inc/demo.inc.php 2 2
inc/dispatch/dispatch.php 1 1
inc/git.inc.php 4 1
inc/keys.inc.php 4 0
inc/ldap.inc.php 4 3
inc/mr.inc.php 6 3
inc/repo.inc.php 11 1
inc/rights.inc.php 1 0
inc/ssh.inc.php 9 9
inc/user.inc.php 17 5
inc/user/packages.inc.php 47 43
inc/user/packages_deb.inc.php 3 2
inc/user/packages_rpm.inc.php 11 10
inc/user/pkg_map.inc.php 5 3
inc/user/pkg_repo.inc.php 5 1
inc/user/pkg_subrepo.inc.php 18 14
inc/user/repo-page.php 4 2
inc/webhooks.inc.php 4 2
inc/wh/build.inc.php 5 0
inc/wh/cloud.inc.php 2 0
inc/wh/http.inc.php 2 0
inc/wh/lambda.inc.php 2 0
inc/workers.inc.php 6 1
scripts/worker.php 1 1
tests/wh_build.php 9 9
File .gitignore changed (mode: 100644) (index 3e2e24a..acc2186)
... ... Changelog-last
10 10 *.lock *.lock
11 11 *.strace *.strace
12 12 *.bak *.bak
13 *.bkp
14 *.dtmp
File History.txt changed (mode: 100644) (index 0b42c52..90cec2b)
1 1 History from RocketGit point-of-view History from RocketGit point-of-view
2 2
3 2015-01-24 - Created first official RocketGit server (rg2), thanks to Petre.
3 2015-01-24 - Created first official RocketGit server (rg2), thanks to Petre B.
4 4 2015-03-04 - Gitorious acquired by Gitlab 2015-03-04 - Gitorious acquired by Gitlab
5 5 2015-03-13 - Google Code closing the gates. 2015-03-13 - Google Code closing the gates.
6 6 2015-11-18 - rocketgit 0.42 installed on rocketgit.com 2015-11-18 - rocketgit 0.42 installed on rocketgit.com
 
28 28 2021-11-14 - RocketGit 0.74 released and installed on production (between 15:00 and 15:40). 2021-11-14 - RocketGit 0.74 released and installed on production (between 15:00 and 15:40).
29 29 2022-02-16 - RocketGit 0.75 released. 2022-02-16 - RocketGit 0.75 released.
30 30 2022-10-22 - RocketGit 0.76 released - mostly worker stuff 2022-10-22 - RocketGit 0.76 released - mostly worker stuff
31 2022-11-17 - Trimble donated a HP server for the RocketGit project (Embedromix)
32
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/admin.inc.php changed (mode: 100644) (index 7265544..b098f7c)
... ... function rg_admin_invite($db, $event)
64 64 $ret[] = array_merge($event, $ret[] = array_merge($event,
65 65 array( array(
66 66 'category' => 'admin_invite_one', 'category' => 'admin_invite_one',
67 'source' => 'admin_invite',
67 68 'prio' => 100, 'prio' => 100,
68 69 'email' => trim($t[0]), 'email' => trim($t[0]),
69 70 'name' => trim($t[1]) 'name' => trim($t[1])
 
... ... function rg_admin_mails_users($db, $ev)
218 219 $ret[] = array_merge($ev, $ret[] = array_merge($ev,
219 220 array( array(
220 221 'category' => 'admin_mails_users_one', 'category' => 'admin_mails_users_one',
222 'source' => 'admin_mails_users',
221 223 'prio' => 500, 'prio' => 500,
222 224 'email' => $i['email'], 'email' => $i['email'],
223 225 'name' => $i['realname'] 'name' => $i['realname']
 
... ... function rg_admin_mails_users_high_level($db, $rg)
295 297
296 298 $ev = array( $ev = array(
297 299 'category' => 'admin_mails_users', 'category' => 'admin_mails_users',
300 'source' => 'admin_mails_users_high_level',
298 301 'prio' => 50, 'prio' => 50,
299 302 'f' => $f); 'f' => $f);
300 303 $r = rg_event_add($db, $ev); $r = rg_event_add($db, $ev);
 
... ... function rg_admin_mails_invites_high_level($db, $rg)
419 422
420 423 $event = array( $event = array(
421 424 'category' => 'admin_invite', 'category' => 'admin_invite',
425 'source' => 'admin_mails_invites_high_level',
422 426 'prio' => 50 'prio' => 50
423 427 ); );
424 428 $event = array_merge($event, $inv); $event = array_merge($event, $inv);
 
... ... function rg_admin_settings_ssh($db, $rg)
1113 1117 // Nobody will force the regeneration, so, do it here! // Nobody will force the regeneration, so, do it here!
1114 1118 $ev = array( $ev = array(
1115 1119 'category' => 'rg_keys_event_regen', 'category' => 'rg_keys_event_regen',
1120 'source' => 'admin_settings_ssh',
1116 1121 'prio' => 10, 'prio' => 10,
1117 1122 'source' => 'admin_settings_ssh' 'source' => 'admin_settings_ssh'
1118 1123 ); );
File inc/apikeys.inc.php changed (mode: 100644) (index be204e8..535f63a)
... ... function rg_ak_event_new($db, $event)
39 39 $ret = array(); $ret = array();
40 40
41 41 $event['op'] = 'new'; $event['op'] = 'new';
42 $event['source'] = 'ak_event_new';
42 43
43 44 // notify user // notify user
44 45 $a = array('category' => 'ak_event_notify_user', 'prio' => 100); $a = array('category' => 'ak_event_notify_user', 'prio' => 100);
 
... ... function rg_ak_event_del($db, $event)
54 55 { {
55 56 $ret = array(); $ret = array();
56 57 $event['op'] = 'del'; $event['op'] = 'del';
58 $event['source'] = 'ak_event_del';
57 59
58 60 // notify user // notify user
59 61 $a = array('category' => 'ak_event_notify_user', 'prio' => 100); $a = array('category' => 'ak_event_notify_user', 'prio' => 100);
 
... ... function rg_ak_remove($db, $ui_login, $list)
112 114
113 115 $event = array( $event = array(
114 116 'category' => 'ak_event_del', 'category' => 'ak_event_del',
117 'source' => 'ak_remove',
115 118 'prio' => 50, 'prio' => 50,
116 119 'ui_login' => $ui_login, 'ui_login' => $ui_login,
117 120 'keys' => implode(',', $my_list)); 'keys' => implode(',', $my_list));
 
... ... function rg_ak_add($db, $ui_login, $key, $name)
183 186
184 187 $event = array( $event = array(
185 188 'category' => 'ak_event_new', 'category' => 'ak_event_new',
189 'source' => 'ak_add',
186 190 'prio' => 50, 'prio' => 50,
187 191 'ui_login' => $ui_login, 'ui_login' => $ui_login,
188 192 'key' => $key, 'key' => $key,
File inc/bug.inc.php changed (mode: 100644) (index d697c18..a096be4)
... ... function rg_bug_event_add_all($db, $event)
79 79
80 80 $x = $event; $x = $event;
81 81 $x['category'] = 'bug_event_add_one'; $x['category'] = 'bug_event_add_one';
82 $x['source'] = 'bug_event_add_all';
82 83 $x['prio'] = 100; $x['prio'] = 100;
83 84
84 85 // We will sent notifications to all watchers of a repo // We will sent notifications to all watchers of a repo
 
... ... function rg_bug_event_note_add_all($db, $event)
141 142
142 143 $x = $event; $x = $event;
143 144 $x['category'] = 'bug_event_note_add_one'; $x['category'] = 'bug_event_note_add_one';
145 $x['source'] = 'bug_event_note_add_all';
144 146 $x['prio'] = 100; $x['prio'] = 100;
145 147 $x['ui_login'] = array(); $x['ui_login'] = array();
146 148
 
... ... function rg_bug_edit($db, $ui_login, $ri, $data)
450 452 // TODO: seems I do not distinguish between 'add' and 'edit' // TODO: seems I do not distinguish between 'add' and 'edit'
451 453 $event = array( $event = array(
452 454 'category' => 'bug_event_add_all', 'category' => 'bug_event_add_all',
455 'source' => 'bug_edit',
453 456 'prio' => 200, 'prio' => 200,
454 457 'ui_login' => $ui_login, 'ui_login' => $ui_login,
455 458 'ri' => array( 'ri' => array(
 
... ... function rg_bug_note_add($db, $repo_id, $bug_id, $login_uid, $data)
968 971
969 972 $event = array( $event = array(
970 973 'category' => 'bug_event_note_add_all', 'category' => 'bug_event_note_add_all',
974 'source' => 'bug_note_add',
971 975 'prio' => 200, 'prio' => 200,
972 976 'ui_login' => $_ui, 'ui_login' => $_ui,
973 977 'bug' => array( 'bug' => array(
File inc/builder.inc.php changed (mode: 100644) (index a3c81b4..9863c92)
... ... function rg_builder_done($db, $job, $s)
177 177
178 178 $ev = array( $ev = array(
179 179 'category' => 'wh_build_job_done', 'category' => 'wh_build_job_done',
180 'source' => 'builder_done',
180 181 'prio' => 100, 'prio' => 100,
181 182 'uid' => $req['uid'], 'uid' => $req['uid'],
182 183 'job' => $job, 'job' => $job,
File inc/conn.inc.php changed (mode: 100644) (index d36d71f..8110d34)
... ... function rg_conn_shutdown($key, $what)
23 23 if (!isset($rg_conns[$key]['socket'])) if (!isset($rg_conns[$key]['socket']))
24 24 return; return;
25 25
26 if (!is_resource($rg_conns[$key]['socket']))
26 if (!is_resource($rg_conns[$key]['socket'])
27 && !is_object($rg_conns[$key]['socket']))
27 28 return; return;
28 29
29 30 if (($what == 0) || ($what == 2)) if (($what == 0) || ($what == 2))
File inc/demo.inc.php changed (mode: 100644) (index 12a421e..809a917)
... ... function rg_demo($rg, $paras)
65 65 if (empty($paras)) if (empty($paras))
66 66 return rg_template('doc/demo/list.html', $rg, TRUE /*xss*/); return rg_template('doc/demo/list.html', $rg, TRUE /*xss*/);
67 67
68 $demo = array_shift($paras);
68 $demo = empty($paras) ? '' : array_shift($paras);
69 69
70 70 if (!isset($rg_demos[$demo])) if (!isset($rg_demos[$demo]))
71 71 return rg_template('doc/demo/invalid.html', $rg, TRUE /*xss*/); return rg_template('doc/demo/invalid.html', $rg, TRUE /*xss*/);
 
... ... function rg_demo($rg, $paras)
80 80 if (empty($paras)) { if (empty($paras)) {
81 81 $page = '0'; $page = '0';
82 82 } else { } else {
83 $page = array_shift($paras);
83 $page = empty($paras) ? '' : array_shift($paras);
84 84 $page = rg_force_alphanum($page); $page = rg_force_alphanum($page);
85 85 } }
86 86
File inc/dispatch/dispatch.php changed (mode: 100644) (index e9e8396..4b93d76)
... ... case 'stats':
120 120 break; break;
121 121
122 122 case 'doc': case 'doc':
123 $sec = array_shift($paras);
123 $sec = empty($paras) ? '' : array_shift($paras);
124 124 switch ($sec) { switch ($sec) {
125 125 case 'api': case 'api':
126 126 $body .= rg_template('doc/api.html', $rg, TRUE /*xss*/); $body .= rg_template('doc/api.html', $rg, TRUE /*xss*/);
File inc/git.inc.php changed (mode: 100644) (index 60c2814..f76bbcd)
... ... function rg_git_update_branch($db, $a)
2127 2127 // anonymous push - create a merge request // anonymous push - create a merge request
2128 2128 $ev = $a; $ev = $a;
2129 2129 $ev['category'] = 'mr_event_new'; $ev['category'] = 'mr_event_new';
2130 $ev['source'] = 'git_update_branch';
2130 2131 $ev['prio'] = 100; $ev['prio'] = 100;
2131 2132 $r = rg_event_add($db, $ev); $r = rg_event_add($db, $ev);
2132 2133 if ($r !== TRUE) if ($r !== TRUE)
 
... ... function rg_git_update_branch($db, $a)
2145 2146
2146 2147 $ev = $a; $ev = $a;
2147 2148 $ev['category'] = 'repo_event_push'; $ev['category'] = 'repo_event_push';
2149 $ev['source'] = 'git_update_branch';
2148 2150 $ev['prio'] = 50; $ev['prio'] = 50;
2149 2151 $ev['ri'] = array( $ev['ri'] = array(
2150 2152 'repo_id' => $a['repo_id'], 'repo_id' => $a['repo_id'],
 
... ... function rg_git_parse_ref(&$paras)
2307 2309 } }
2308 2310
2309 2311 array_shift($paras); array_shift($paras);
2310 $val = trim(array_shift($paras));
2312 $v = empty($paras) ? '' : array_shift($paras);
2313 $val = trim($v);
2311 2314 $ret['ref_url'] = rawurlencode($ret['ref_type']) $ret['ref_url'] = rawurlencode($ret['ref_type'])
2312 2315 . '/' . rawurlencode($val); . '/' . rawurlencode($val);
2313 2316
File inc/keys.inc.php changed (mode: 100644) (index e61ae33..47d31ad)
... ... function rg_keys_event_new($db, $event)
54 54 // mark keys dirty // mark keys dirty
55 55 $ret[] = array_merge($event, array( $ret[] = array_merge($event, array(
56 56 'category' => 'rg_keys_event_regen', 'category' => 'rg_keys_event_regen',
57 'source' => 'keys_event_new',
57 58 'prio' => 10, 'prio' => 10,
58 59 'source' => 'keys_event_new') 'source' => 'keys_event_new')
59 60 ); );
 
... ... function rg_keys_event_del($db, $event)
73 74 $ret = array(); $ret = array();
74 75 $event['type'] = 1; $event['type'] = 1;
75 76 $event['op'] = "del"; $event['op'] = "del";
77 $event['source'] = 'keys_event_del';
76 78
77 79 // mark keys dirty // mark keys dirty
78 80 $ret[] = array_merge($event, array( $ret[] = array_merge($event, array(
 
... ... function rg_keys_remove($db, $ui_login, $list)
436 438
437 439 $event = array( $event = array(
438 440 'category' => 'keys_event_del', 'category' => 'keys_event_del',
441 'source' => 'keys_remove',
439 442 'prio' => 50, 'prio' => 50,
440 443 'ui_login' => $ui_login, 'ui_login' => $ui_login,
441 444 'keys' => implode(',', $my_list)); 'keys' => implode(',', $my_list));
 
... ... function rg_keys_add($db, $ui_login, $key, $flags)
573 576
574 577 $event = array( $event = array(
575 578 'category' => 'keys_event_new', 'category' => 'keys_event_new',
579 'source' => 'keys_add',
576 580 'prio' => 50, 'prio' => 50,
577 581 'ui_login' => $ui_login, 'ui_login' => $ui_login,
578 582 'ki' => $ki, 'ki' => $ki,
File inc/ldap.inc.php changed (mode: 100644) (index 135d2b1..d545eaa)
... ... function rg_ldap_login($db, $user, $pass, &$ui)
328 328 break; break;
329 329 } }
330 330
331 $euser = ldap_escape($user, NULL, LDAP_ESCAPE_FILTER);
331 $euser = ldap_escape($user, '', LDAP_ESCAPE_FILTER);
332 332
333 333 foreach ($sl['list'] as $si) { foreach ($sl['list'] as $si) {
334 334 //rg_log_ml('ldap server info: ' . print_r($si, TRUE)); //rg_log_ml('ldap server info: ' . print_r($si, TRUE));
 
... ... function rg_ldap_login($db, $user, $pass, &$ui)
361 361 . ')'; . ')';
362 362 if (!empty($si['filter'])) if (!empty($si['filter']))
363 363 $filter = '(&' . $filter $filter = '(&' . $filter
364 . '(' . ldap_escape($si['filter'], NULL, LDAP_ESCAPE_FILTER) . '))';
364 . '(' . ldap_escape($si['filter'], '', LDAP_ESCAPE_FILTER) . '))';
365 365 rg_log_debug('filter: ' . $filter); rg_log_debug('filter: ' . $filter);
366 366 rg_log_debug('base=' . $si['user_base']); rg_log_debug('base=' . $si['user_base']);
367 367
 
... ... function rg_ldap_login($db, $user, $pass, &$ui)
441 441
442 442 $ui['suspended'] = $a['shadow_expire'] <= time() / 24 / 3600 ? 1 : 0; $ui['suspended'] = $a['shadow_expire'] <= time() / 24 / 3600 ? 1 : 0;
443 443 // TODO: With 99999 it will not compute right! // TODO: With 99999 it will not compute right!
444 $ui['expire'] = gmmktime(0, 0, 0, 1, ($a['shadow_expire'] + 24 * 3600 - 1) / 24 / 3600, 1970) - 1;
444 $day = ($a['shadow_expire'] + 24 * 3600 - 1) / 24 / 3600;
445 $ui['expire'] = gmmktime(0, 0, 0, 1, intval($day), 1970) - 1;
445 446
446 447 $ui['ok'] = 1; $ui['ok'] = 1;
447 448
File inc/mr.inc.php changed (mode: 100644) (index 70dfce7..4f44384)
... ... function rg_mr_event_new($db, $ev)
81 81 { {
82 82 $ret = array(); $ret = array();
83 83
84 $ev['source'] = 'mr_event_new';
85
84 86 // Insert it into database // Insert it into database
85 87 $ret[] = array_merge($ev, $ret[] = array_merge($ev,
86 88 array('category' => 'mr_event_add_to_db', 'prio' => 100)); array('category' => 'mr_event_add_to_db', 'prio' => 100));
 
... ... function rg_mr_high_level($db, &$rg, $paras)
405 407 // TODO: mrs.html is empty! // TODO: mrs.html is empty!
406 408 $ret .= rg_template('repo/mrs.html', $rg, TRUE /*xss*/); $ret .= rg_template('repo/mrs.html', $rg, TRUE /*xss*/);
407 409
408 $op = array_shift($paras);
409 if (empty($op)) {
410 if (empty($paras)) {
410 411 $op = 'pending'; $op = 'pending';
411 412 } else { } else {
413 $op = array_shift($paras);
412 414 $mr = sprintf('%u', $op); $mr = sprintf('%u', $op);
413 415 if ($mr > 0) if ($mr > 0)
414 416 $op = ''; $op = '';
 
... ... function rg_mr_high_level($db, &$rg, $paras)
446 448 $mri['already_merged'] = 0; $mri['already_merged'] = 0;
447 449 $against = rg_git_short($mri['refname']); $against = rg_git_short($mri['refname']);
448 450
449 $mr_op = array_shift($paras);
451 $mr_op = empty($paras) ? '' : array_shift($paras);
450 452 rg_log_debug('mr_op=' . $mr_op); rg_log_debug('mr_op=' . $mr_op);
451 453 if (strcmp($mr_op, 'merge') == 0) { if (strcmp($mr_op, 'merge') == 0) {
452 454 if ($rg['can_admin'] !== 1) { if ($rg['can_admin'] !== 1) {
 
... ... function rg_mr_high_level($db, &$rg, $paras)
466 468
467 469 $event = array( $event = array(
468 470 'category' => 'mr_merge', 'category' => 'mr_merge',
471 'source' => 'mr_high_level',
469 472 'prio' => 30, 'prio' => 30,
470 473 'ri' => $rg['ri'], 'ri' => $rg['ri'],
471 474 'repo_path' => $rg['repo_path'], 'repo_path' => $rg['repo_path'],
File inc/repo.inc.php changed (mode: 100644) (index 16f886b..4bb4e42)
... ... function rg_repo_event_new($db, $event)
482 482 $ret = array(); $ret = array();
483 483
484 484 $event['op'] = "new"; $event['op'] = "new";
485 $event['source'] = 'repo_event_new';
485 486
486 487 $x = $event; $x = $event;
487 488 $x['category'] = 'repo_event_storage_create'; $x['category'] = 'repo_event_storage_create';
 
... ... function rg_repo_event_del($db, $event)
529 530 $event['op'] = "del"; $event['op'] = "del";
530 531 // notify user // notify user
531 532 $ret[] = array_merge($event, $ret[] = array_merge($event,
532 array('category' => 'repo_event_notify_user', 'prio' => 100));
533 array(
534 'category' => 'repo_event_notify_user',
535 'source' => 'repo_event_del',
536 'prio' => 100)
537 );
533 538
534 539 // TODO: notify watchers // TODO: notify watchers
535 540
 
... ... function rg_repo_event_update($db, $event)
672 677 $ret = array(); $ret = array();
673 678
674 679 $event['op'] = "update"; $event['op'] = "update";
680 $event['source'] = 'repo_event_update';
675 681
676 682 // make symlink by name // make symlink by name
677 683 $ret[] = array_merge($event, $ret[] = array_merge($event,
 
... ... function rg_repo_event_push($db, $event)
752 758 // TODO: load references and check them? // TODO: load references and check them?
753 759 // 'post-update' hook knows if it succeeded or not. How to use it? // 'post-update' hook knows if it succeeded or not. How to use it?
754 760
761 $event['source'] = 'repo_event_push';
762
755 763 // notify user // notify user
756 764 if (0) { // TODO if (0) { // TODO
757 765 $x = $event; $x = $event;
 
... ... function rg_repo_delete($db, $repo_id, $ui_login)
958 966
959 967 $event = array( $event = array(
960 968 'category' => 'repo_event_del', 'category' => 'repo_event_del',
969 'source' => 'repo_delete',
961 970 'prio' => 50, 'prio' => 50,
962 971 'ui_login' => $ui_login, 'ui_login' => $ui_login,
963 972 'ri' => array( 'ri' => array(
 
... ... function rg_repo_edit($db, $ui_login, &$new)
1206 1215
1207 1216 $event = array( $event = array(
1208 1217 'category' => $cat, 'category' => $cat,
1218 'source' => 'repo_edit',
1209 1219 'prio' => 50, 'prio' => 50,
1210 1220 'notification' => $notification, 'notification' => $notification,
1211 1221 'ui_login' => $ui_login, 'ui_login' => $ui_login,
File inc/rights.inc.php changed (mode: 100644) (index d9851c9..53f4ec2)
... ... function rg_rights_set($db, $type, $a)
445 445
446 446 $ev = array( $ev = array(
447 447 'category' => 'rights_grant', 'category' => 'rights_grant',
448 'source' => 'rights_set',
448 449 'prio' => 100, 'prio' => 100,
449 450 'info' => $a 'info' => $a
450 451 ); );
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_deb.inc.php changed (mode: 100644) (index b936662..5a6dd92)
... ... function rg_pkg_after_build_deb($db, $ev)
119 119 $a['uid'] = 0; $a['uid'] = 0;
120 120 $a['repo_id'] = $req['repo_id']; $a['repo_id'] = $req['repo_id'];
121 121 $a['repo_uid'] = $req['repo_uid']; $a['repo_uid'] = $req['repo_uid'];
122 $a['repo_username'] = $req['repo_username'];
122 if (isset($req['repo_username'])) // when rebuilding the repo we do not need this!
123 $a['repo_username'] = $req['repo_username'];
123 124 $a['head'] = $req['head']; $a['head'] = $req['head'];
124 125 $a['orig_job_id'] = $req['orig_job_id']; $a['orig_job_id'] = $req['orig_job_id'];
125 126 $a['log_sid'] = $req['log_sid']; $a['log_sid'] = $req['log_sid'];
 
... ... function rg_packages_deb_helper($db, $rg, $a)
251 252 // TODO: this function should return the size to not do an extra stat // TODO: this function should return the size to not do an extra stat
252 253 $r = rg_path_validate($dir, $a['path']); $r = rg_path_validate($dir, $a['path']);
253 254 if ($r === FALSE) { if ($r === FALSE) {
254 rg_security_violation_no_exit('path=' . $a['path']);
255 //rg_security_violation_no_exit('path=' . $a['path']);
255 256 header($rg['proto'] . ' 404 Not found'); header($rg['proto'] . ' 404 Not found');
256 257 echo 'invalid file' . "\n"; echo 'invalid file' . "\n";
257 258 break; break;
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_map.inc.php changed (mode: 100644) (index f006ba7..195cb23)
... ... function rg_pkg_maps_get($db, $uid, $repo_name, $ref)
337 337 } }
338 338
339 339 /* /*
340 * Prepares pkg_maps based on a list of pkg subrepo ids and stores it in @a
340 * Prepares pkg_maps based on a list of pkg subrepo ids and stores it back in @a
341 341 */ */
342 342 function rg_pkg_maps_prepare($db, &$a) function rg_pkg_maps_prepare($db, &$a)
343 343 { {
 
... ... function rg_pkg_maps_prepare($db, &$a)
352 352 $a['pkg_subrepos'] = array(); $a['pkg_subrepos'] = array();
353 353
354 354 foreach ($a['pkg_subrepo_id_list'] as $pkg_subrepo_id) { foreach ($a['pkg_subrepo_id_list'] as $pkg_subrepo_id) {
355 $sri = rg_pkg_subrepo_info($db, $a['repo_uid'], $pkg_subrepo_id);
355 $sri = rg_pkg_subrepo_info($db, $a['repo_uid'],
356 $pkg_subrepo_id);
356 357 if ($sri['exists'] != 1) { if ($sri['exists'] != 1) {
357 358 $ret['errmsg'] = $sri['errmsg']; $ret['errmsg'] = $sri['errmsg'];
358 359 break; break;
 
... ... function rg_pkg_maps_prepare($db, &$a)
360 361 $a['pkg_subrepos'][$pkg_subrepo_id] = $sri; $a['pkg_subrepos'][$pkg_subrepo_id] = $sri;
361 362
362 363 $pkg_repo_id = $sri['pkg_repo_id']; $pkg_repo_id = $sri['pkg_repo_id'];
363 $ri = rg_pkg_repo_info($db, $a['repo_uid'], $pkg_repo_id);
364 $ri = rg_pkg_repo_info($db, $a['repo_uid'],
365 $pkg_repo_id);
364 366 if ($ri['exists'] != 1) { if ($ri['exists'] != 1) {
365 367 $ret['errmsg'] = $ri['errmsg']; $ret['errmsg'] = $ri['errmsg'];
366 368 break; break;
File inc/user/pkg_repo.inc.php changed (mode: 100644) (index 93dcf1a..3424432)
... ... function rg_pkg_repo_event_add($db, $ev)
92 92 do { do {
93 93 $a = $ev; $a = $ev;
94 94 $a['category'] = 'pkg_repo_gen_gpg_key'; $a['category'] = 'pkg_repo_gen_gpg_key';
95 $a['source'] = 'pkg_repo_event_add';
95 96 $ret[] = $a; $ret[] = $a;
96 97 } while (0); } while (0);
97 98
 
... ... function rg_pkg_repo_event_edit($db, $ev)
104 105 { {
105 106 rg_prof_start('pkg_repo_event_edit'); rg_prof_start('pkg_repo_event_edit');
106 107 rg_log_enter('pkg_repo_event_edit'); rg_log_enter('pkg_repo_event_edit');
107 rg_log_debug('ev: ' . rg_array2string_short($ev));
108 rg_log_debug('ev: ' . print_r($ev, TRUE));
108 109
109 110 $ev['uid'] = $ev['info']['uid']; $ev['uid'] = $ev['info']['uid'];
110 111 $ev['pkg_repo_id'] = $ev['info']['id']; $ev['pkg_repo_id'] = $ev['info']['id'];
111 112 unset($ev['info']); unset($ev['info']);
112 113
114 $ev['source'] = 'pkg_repo_event_edit';
115
113 116 $ret = array(); $ret = array();
114 117 do { do {
115 118 $a = $ev; $a = $ev;
 
... ... function rg_pkg_repo_edit($db, $d)
212 215 $d['id'] = $row['id']; $d['id'] = $row['id'];
213 216 $ev = array( $ev = array(
214 217 'category' => $orig_id == 0 ? 'pkg_repo_add' : 'pkg_repo_edit', 'category' => $orig_id == 0 ? 'pkg_repo_add' : 'pkg_repo_edit',
218 'source' => 'pkg_repo_edit',
215 219 'prio' => 90, // should be lower than the build prio to have the key 'prio' => 90, // should be lower than the build prio to have the key
216 220 'info' => $d 'info' => $d
217 221 ); );
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/user/repo-page.php changed (mode: 100644) (index d1b1db3..a529370)
... ... function rg_repo_page_source($db, &$rg, &$paras)
231 231 $existing_refs = rg_git_refs($rg['repo_path']); $existing_refs = rg_git_refs($rg['repo_path']);
232 232 rg_log_debug('existing_refs: ' . print_r($existing_refs, TRUE)); rg_log_debug('existing_refs: ' . print_r($existing_refs, TRUE));
233 233
234 $paras2 = array(array_shift($paras), array_shift($paras));
234 $v1 = empty($paras) ? '' : array_shift($paras);
235 $v2 = empty($paras) ? '' : array_shift($paras);
236 $paras2 = array($v1, $v2);
235 237 rg_log_debug('paras: [' . rg_array2string($paras) . ']'); rg_log_debug('paras: [' . rg_array2string($paras) . ']');
236 238 $list = array( $list = array(
237 239 $paras2, $paras2,
 
... ... function rg_repo_page_source($db, &$rg, &$paras)
270 272
271 273 rg_log_debug('_subsubop=[' . $_subsubop . ']'); rg_log_debug('_subsubop=[' . $_subsubop . ']');
272 274 if (strcmp($_subsubop, 'tree') == 0) { if (strcmp($_subsubop, 'tree') == 0) {
273 $type = array_shift($paras);
275 $type = empty($paras) ? '' : array_shift($paras);
274 276 rg_log_debug('tree: type=' . $type); rg_log_debug('tree: type=' . $type);
275 277 if (strncmp($type, 'blob', 4) == 0) { if (strncmp($type, 'blob', 4) == 0) {
276 278 repo_page_blob($ret, $type, $rg, $paras, $ref); repo_page_blob($ret, $type, $rg, $paras, $ref);
File inc/webhooks.inc.php changed (mode: 100644) (index 5f12ed3..3bbee23)
... ... function rg_wh_send($db, $ev)
27 27 break; break;
28 28 } }
29 29
30 $ev['source'] = 'wh_send';
31
30 32 $x = $ev; $x = $ev;
31 33 $x['category'] = 'wh_http_send'; $x['category'] = 'wh_http_send';
32 34 $ret[] = $x; $ret[] = $x;
 
... ... function rg_wh_add_high_level($db, $rg, $op, $paras)
130 132 $rg['wh'] = array(); $rg['wh'] = array();
131 133
132 134 if (strcmp($op, 'add') == 0) { if (strcmp($op, 'add') == 0) {
133 $rg['wh']['htype'] = array_shift($paras);
134 $rg['wh']['hsubtype'] = array_shift($paras);
135 $rg['wh']['htype'] = empty($paras) ? '' : array_shift($paras);
136 $rg['wh']['hsubtype'] = empty($paras) ? '' : array_shift($paras);
135 137 $rg['wh']['id'] = 0; $rg['wh']['id'] = 0;
136 138
137 139 if (!rg_wh_valid($rg['wh']['htype'])) if (!rg_wh_valid($rg['wh']['htype']))
File inc/wh/build.inc.php changed (mode: 100644) (index bf9dc8e..639230b)
... ... function rg_wh_build_job_done($db, $ev)
24 24 $job = $ev['job']; $job = $ev['job'];
25 25 $req = isset($job['request']) ? $job['request'] : $job; $req = isset($job['request']) ? $job['request'] : $job;
26 26
27 $ev['source'] = 'wh_build_job_done';
28
27 29 $ret = FALSE; $ret = FALSE;
28 30 do { do {
29 31 // For example building a rpm repo // For example building a rpm repo
 
... ... function rg_wh_build_send_one($db, $ev)
121 123 // TODO: pass e-mail notification // TODO: pass e-mail notification
122 124 $a['exec'] = array(); $a['exec'] = array();
123 125
126 // TODO: This may be useless because prepare_for_build calls pkg_maps_prepare?
124 127 $r = rg_pkg_maps_get($db, $a['uid'], $ri['name'], $r = rg_pkg_maps_get($db, $a['uid'], $ri['name'],
125 128 $a['refname_short']); $a['refname_short']);
126 129 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
 
... ... function rg_wh_build_send($db, $ev)
171 174 if ($r['ok'] != 1) if ($r['ok'] != 1)
172 175 return FALSE; return FALSE;
173 176
177 $ev['source'] = 'wh_build_send';
178
174 179 // Filter // Filter
175 180 foreach ($r['list'] as $id => $wh) { foreach ($r['list'] as $id => $wh) {
176 181 if (strcmp($wh['htype'], 'build') != 0) if (strcmp($wh['htype'], 'build') != 0)
File inc/wh/cloud.inc.php changed (mode: 100644) (index 29081fe..6e74456)
... ... function rg_wh_cloud_send($db, $ev)
106 106 if ($r['ok'] != 1) if ($r['ok'] != 1)
107 107 return FALSE; return FALSE;
108 108
109 $ev['source'] = 'wh_cloud_send';
110
109 111 // Filter // Filter
110 112 foreach ($r['list'] as $id => $wh) { foreach ($r['list'] as $id => $wh) {
111 113 if (strcmp($wh['htype'], 'cloud') != 0) if (strcmp($wh['htype'], 'cloud') != 0)
File inc/wh/http.inc.php changed (mode: 100644) (index a1e035d..0b45348)
... ... function rg_wh_http_send($db, $ev)
190 190 $cache = array(); $cache = array();
191 191 $ret = array(); $ret = array();
192 192
193 $x['source'] = 'wh_http_send';
194
193 195 // Filter // Filter
194 196 foreach ($r['list'] as $id => $wh) { foreach ($r['list'] as $id => $wh) {
195 197 $error = FALSE; $error = FALSE;
File inc/wh/lambda.inc.php changed (mode: 100644) (index 9ae06b9..e36f1e2)
... ... function rg_wh_lambda_send($db, $ev)
71 71 if ($r['ok'] != 1) if ($r['ok'] != 1)
72 72 return FALSE; return FALSE;
73 73
74 $ev['source'] = 'wh_lambda_send';
75
74 76 // Filter // Filter
75 77 foreach ($r['list'] as $id => $wh) { foreach ($r['list'] as $id => $wh) {
76 78 if (strcmp($wh['htype'], 'lambda') != 0) if (strcmp($wh['htype'], 'lambda') != 0)
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 scripts/worker.php changed (mode: 100644) (index d44167e..c304b96)
... ... function start_worker($job)
1881 1881 . ' if [ "${final}" != "" ]; then' . "\n" . ' if [ "${final}" != "" ]; then' . "\n"
1882 1882 . ' rg_log N "Installing package(s) ${final}"' . "\n" . ' rg_log N "Installing package(s) ${final}"' . "\n"
1883 1883 . ' ${rg_pkg_cmd} ${final} 2>/tmp/install_pkg.err' . "\n" . ' ${rg_pkg_cmd} ${final} 2>/tmp/install_pkg.err' . "\n"
1884 . ' [ "${?}" = "0" ] || rg_log W "Cannot install ${final}: "$(< /tmp/install_pkg.err)' . "\n"
1884 . ' [ "${?}" = "0" ] || rg_log W "Cannot install: "$(< /tmp/install_pkg.err)' . "\n"
1885 1885 . ' # we ignore errors here' . "\n" . ' # we ignore errors here' . "\n"
1886 1886 . ' fi' . "\n" . ' fi' . "\n"
1887 1887 . ' fi' . "\n" . ' fi' . "\n"
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) {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main