blob: 359ac516d3f0831988359807c4290da974dc5111 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
;; kenku --- crawl and reproduce github actions
;; Copyright © 2026 bdunahu <bdunahu@operationnull.com>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(define-module (src crawl-type-wrapper)
#:use-module (srfi srfi-1)
#:use-module (ice-9 string-fun)
#:use-module (ice-9 regex)
#:use-module ((src utils) #:prefix util:)
#:use-module ((src config) #:prefix conf:)
#:use-module ((src crawl-newest-commits) #:prefix new-commit:)
#:use-module (ice-9 textual-ports)
#:export (crawl-types
node-file))
(define mapdir (dirname new-commit:outfile))
(define mapfile (in-vicinity mapdir "external-to-type-map.txt"))
(define typedir (in-vicinity conf:cache-dir "action-types"))
(define node-file (in-vicinity typedir "node.txt"))
(define file->regex `((,node-file . "node[0-9]{1,2}$")
(,(in-vicinity typedir "docker.txt") . "docker$")
(,(in-vicinity typedir "composite.txt") .
"composite$")))
(define (parse-actions str)
(filter (lambda (s) (not (string=? s "")))
(string-split str #\newline)))
(define filter-actions)
(define (crawl-types)
(let* ((actions-to-type-sh (in-vicinity conf:scripts-dir
"actions_to_type.sh")))
(system (string-append actions-to-type-sh " < "
new-commit:outfile " >> " mapfile))) ;append mode
(util:normalize-file mapfile)
(util:filter-actions-on-regex mapfile file->regex parse-actions))
|