Initial commit.
This commit is contained in:
commit
878d52ee27
26 changed files with 3341 additions and 0 deletions
66
ebuild/fetchers/ebuild.scm
Normal file
66
ebuild/fetchers/ebuild.scm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ebuild.scm
|
||||
;; Copyright (C) 2025 Cor Legemaat <cor@cor.za.net>
|
||||
;;
|
||||
;; 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 <https://www.gnu.org/licenses/>.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(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))
|
||||
(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
|
||||
(append! release
|
||||
(list (cons var
|
||||
(irregex-match-substring
|
||||
var-match)))))))
|
||||
extract-vars)
|
||||
(set! releases (append releases (list release)))))
|
||||
(close ebuild-file)))
|
||||
(closedir dir)
|
||||
releases)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue