;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ebuild.scm ;; Copyright (C) 2025 Cor Legemaat ;; ;; This file is part of ebuild-autogen: you can redistribute it and/or modify it ;; under the terms of the GNU Affero General Public License as published by the ;; Free Software Foundation, version 3 of the License. ;; ;; ebuild-autogen 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 ;; ebuild-autogen. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-module (ebuild fetchers ebuild) #:use-module (ice-9 textual-ports) #:use-module (oop goops) #:use-module (rx irregex)) (define-public fetch-ebuilds (lambda* (repo category package #:key (version-filter (lambda (version) version)) (version-alter (lambda (version) version)) . extract-vars) (let ((dir (opendir (string-append repo "/" category "/" package))) (releases '())) (do ((entry (readdir dir) (readdir dir))) ((eof-object? entry)) ;;(display "file=") (display entry)(newline) (let* ((ebuild-file (open-input-file (string-append repo "/" category "/" package "/" entry))) (version-match (irregex-search `(seq (look-behind ,(string-append package "-")) (+ (or alphanumeric "." "-")) (look-ahead ".ebuild")) entry)) (ebuild-data (if version-match (get-string-all ebuild-file) #f)) (release '())) ;; Get the keywords. (if version-match (begin (set! release (list (cons "version" (irregex-match-substring version-match)))) (map (lambda (var) (let* ((var-match (irregex-search `(seq (look-behind ,(string-append var "=\"")) (+ (& (or printing num) (~ "\""))) (look-ahead "\"")) ebuild-data))) (if var-match (begin ;; (display (string-append var "=")) ;; (display (irregex-match-substring var-match)) ;; (newline) (append! release (list (cons var (irregex-match-substring var-match)))))))) extract-vars) (set! releases (append releases (list release))))) ;;(display "relese = ") (display release) (newline) ;;(display "releses = ") (display releases) (newline) (close ebuild-file))) (closedir dir) releases)))