From aaa0255adea2a27299db8b6b3a203e9482ef32ee Mon Sep 17 00:00:00 2001 From: retropikzel Date: Wed, 29 Oct 2025 16:10:51 +0200 Subject: [PATCH] Restructure --- Jenkinsfile | 3 +- Makefile | 26 +-- foreign/c/shell.scm | 2 + foreign/c/shell.sld | 9 + {system => foreign/c/shell}/LICENSE | 0 foreign/c/shell/README.md | 1 + foreign/c/shell/VERSION | 1 + foreign/c/shell/test.scm | 12 ++ {system/retropikzel => foreign/c}/system.scm | 0 {system/retropikzel => foreign/c}/system.sld | 2 +- foreign/c/system/LICENSE | 165 +++++++++++++++++++ foreign/c/system/README.html | 32 ++++ {system => foreign/c/system}/README.md | 0 {system => foreign/c/system}/VERSION | 0 {system => foreign/c/system}/test.scm | 5 +- system/AUTHOR | 1 - system/Jenkinsfile | 34 ---- system/Makefile | 11 -- 18 files changed, 242 insertions(+), 62 deletions(-) create mode 100644 foreign/c/shell.scm create mode 100644 foreign/c/shell.sld rename {system => foreign/c/shell}/LICENSE (100%) create mode 100644 foreign/c/shell/README.md create mode 100644 foreign/c/shell/VERSION create mode 100644 foreign/c/shell/test.scm rename {system/retropikzel => foreign/c}/system.scm (100%) rename {system/retropikzel => foreign/c}/system.sld (85%) create mode 100644 foreign/c/system/LICENSE create mode 100644 foreign/c/system/README.html rename {system => foreign/c/system}/README.md (100%) rename {system => foreign/c/system}/VERSION (100%) rename {system => foreign/c/system}/test.scm (85%) delete mode 100644 system/AUTHOR delete mode 100644 system/Jenkinsfile delete mode 100644 system/Makefile diff --git a/Jenkinsfile b/Jenkinsfile index 8f948cd..64a9150 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { } parameters { - string(name: 'LIBRARIES', defaultValue: 'system', description: '') + string(name: 'LIBRARIES', defaultValue: 'system shell', description: '') } stages { @@ -29,6 +29,7 @@ pipeline { stage("${SCHEME}") { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { sh "make SCHEME=${SCHEME} clean test-docker" + archiveArtifacts artifacts: 'tmp/*/*.log', fingerprint: true } } }] diff --git a/Makefile b/Makefile index c4f73be..19386a9 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ .SILENT: build install test test-docker clean ${TMPDIR} -LIBRARY=system -README=${LIBRARY}/README.html -DESCRIPTION=$(shell head -n1 ${LIBRARY}/README.md) -VERSION=$(shell cat ${LIBRARY}/VERSION) -AUTHOR=$(shell cat ${LIBRARY}/AUTHOR | tr '[:upper:]' '[:lower:]') -LIBRARY_FILE=${LIBRARY}/${AUTHOR}/${LIBRARY}.sld -PKG=${AUTHOR}-${LIBRARY}-${VERSION}.tgz SCHEME=chibi +LIBRARY=system +AUTHOR=Retropikzel + +LIBRARY_FILE=foreign/c/${LIBRARY}.sld +VERSION=$(shell cat foreign/c/${LIBRARY}/VERSION) +DESCRIPTION=$(shell head -n1 foreign/c/${LIBRARY}/README.md) +README=foreign/c/${LIBRARY}/README.html +TESTFILE=foreign/c/${LIBRARY}/test.scm + +PKG=foreign-c-${LIBRARY}-${VERSION}.tgz TMPDIR=tmp/${SCHEME} -TESTFILE=${LIBRARY}/test.scm DOCKERIMG=${SCHEME}:head ifeq "${SCHEME}" "chicken" @@ -17,8 +19,8 @@ endif all: build -build: ${LIBRARY}/LICENSE ${LIBRARY}/VERSION ${LIBRARY}/AUTHOR - echo "
$$(cat ${LIBRARY}/README.md)
" > ${README} +build: foreign/c/${LIBRARY}/LICENSE foreign/c/${LIBRARY}/VERSION + echo "
$$(cat foreign/c/${LIBRARY}/README.md)
" > ${README} snow-chibi package --version=${VERSION} --authors=${AUTHOR} --doc=${README} --description="${DESCRIPTION}" ${LIBRARY_FILE} install: @@ -30,7 +32,9 @@ uninstall: ${TMPDIR}: @mkdir -p ${TMPDIR} @cp ${TESTFILE} ${TMPDIR}/ - @cp -r ${LIBRARY} ${TMPDIR}/ + @mkdir -p ${TMPDIR}/foreign/c + @cp -r foreign/c/${LIBRARY} ${TMPDIR}/foreign/c/ + @cp -r foreign/c/${LIBRARY}.s* ${TMPDIR}/foreign/c/ test: ${TMPDIR} echo "Hello" diff --git a/foreign/c/shell.scm b/foreign/c/shell.scm new file mode 100644 index 0000000..a37a46a --- /dev/null +++ b/foreign/c/shell.scm @@ -0,0 +1,2 @@ +(define (shell cmd) + (display cmd)) diff --git a/foreign/c/shell.sld b/foreign/c/shell.sld new file mode 100644 index 0000000..bc88ba7 --- /dev/null +++ b/foreign/c/shell.sld @@ -0,0 +1,9 @@ +(define-library + (foreign c shell) + (import (scheme base) + (retropikzel named-pipes)) + (export shell) + (include "shell.scm")) + + + diff --git a/system/LICENSE b/foreign/c/shell/LICENSE similarity index 100% rename from system/LICENSE rename to foreign/c/shell/LICENSE diff --git a/foreign/c/shell/README.md b/foreign/c/shell/README.md new file mode 100644 index 0000000..9c01c80 --- /dev/null +++ b/foreign/c/shell/README.md @@ -0,0 +1 @@ +Library to run shell commands and get their output diff --git a/foreign/c/shell/VERSION b/foreign/c/shell/VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/foreign/c/shell/VERSION @@ -0,0 +1 @@ +1.0.0 diff --git a/foreign/c/shell/test.scm b/foreign/c/shell/test.scm new file mode 100644 index 0000000..1fb3b0f --- /dev/null +++ b/foreign/c/shell/test.scm @@ -0,0 +1,12 @@ +(import (scheme base) + (scheme write) + (scheme file) + (scheme process-context) + (foreign c shell) + (srfi 64)) + +(test-begin "foreign-c-shell") + +(display "Hello") + +(test-end "foreign-c-shell") diff --git a/system/retropikzel/system.scm b/foreign/c/system.scm similarity index 100% rename from system/retropikzel/system.scm rename to foreign/c/system.scm diff --git a/system/retropikzel/system.sld b/foreign/c/system.sld similarity index 85% rename from system/retropikzel/system.sld rename to foreign/c/system.sld index 5cb61a4..489fcc0 100644 --- a/system/retropikzel/system.sld +++ b/foreign/c/system.sld @@ -1,5 +1,5 @@ (define-library - (retropikzel system) + (foreign c system) (import (scheme base) (scheme write) (foreign c)) diff --git a/foreign/c/system/LICENSE b/foreign/c/system/LICENSE new file mode 100644 index 0000000..0a04128 --- /dev/null +++ b/foreign/c/system/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/foreign/c/system/README.html b/foreign/c/system/README.html new file mode 100644 index 0000000..485b9a0 --- /dev/null +++ b/foreign/c/system/README.html @@ -0,0 +1,32 @@ +
Execute a shell command.
+
+Built upon [(foreign c)](https://sr.ht/~retropikzel/foreign-c/).
+
+[Repository](https://git.sr.ht/~retropikzel/foreign-c-system)
+
+[Issue tracker](https://sr.ht/~retropikzel/foreign-c/trackers)
+
+[Maling lists](https://sr.ht/~retropikzel/foreign-c/lists)
+
+[Jenkins](https://jenkins.scheme.org/job/retropikzel/job/foreign-c-system/)
+
+
+(**system** _command_)
+
+_command_ is a string containing the command you want to run.
+
+Returns the exit code of the command.
+
+Example:
+
+    (import (scheme base)
+            (scheme write)
+            (scheme file)
+            (retropikzel system))
+
+    (define testfile "test.txt")
+    (system (apply string-append `("echo \"Hello\" > " ,testfile)))
+
+    (define text (with-input-from-file testfile (lambda () (read-line))))
+    (display text)
+    (newline)
diff --git a/system/README.md b/foreign/c/system/README.md similarity index 100% rename from system/README.md rename to foreign/c/system/README.md diff --git a/system/VERSION b/foreign/c/system/VERSION similarity index 100% rename from system/VERSION rename to foreign/c/system/VERSION diff --git a/system/test.scm b/foreign/c/system/test.scm similarity index 85% rename from system/test.scm rename to foreign/c/system/test.scm index c84e363..df09325 100644 --- a/system/test.scm +++ b/foreign/c/system/test.scm @@ -2,8 +2,7 @@ (scheme write) (scheme file) (scheme process-context) - (foreign c) - (retropikzel system) + (foreign c system) (srfi 64)) (test-begin "foreign-c-system") @@ -20,6 +19,6 @@ (define exit-code2 (system "no-such-command")) -(test-assert (not (= exit-code1 0))) +(test-assert (> exit-code2 0)) (test-end "foreign-c-system") diff --git a/system/AUTHOR b/system/AUTHOR deleted file mode 100644 index 44dbcb1..0000000 --- a/system/AUTHOR +++ /dev/null @@ -1 +0,0 @@ -Retropikzel diff --git a/system/Jenkinsfile b/system/Jenkinsfile deleted file mode 100644 index 1fa81ae..0000000 --- a/system/Jenkinsfile +++ /dev/null @@ -1,34 +0,0 @@ -pipeline { - agent any - - options { - disableConcurrentBuilds() - buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) - } - - stages { - stage('Tests') { - steps { - script { - def implementations = sh(script: 'docker run retropikzel1/compile-r7rs:chibi sh -c "compile-r7rs --list-r7rs-schemes"', returnStdout: true).split() - - parallel implementations.collectEntries { SCHEME -> - [(SCHEME): { - stage("${SCHEME}") { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - if("${SCHEME}" == "chicken") { - DOCKERIMG="chicken:5" - } else { - DOCKERIMG="${SCHEME}:head" - } - sh "docker build --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=foreign-c-system-test-${SCHEME} -f Dockerfile.test ." - sh "docker run -v ${WORKSPACE}:/workdir -w /workdir -t foreign-c-system-test-${SCHEME} sh -c \"timeout 120 make SCHEME=${SCHEME} clean all force-install test\"" - } - } - }] - } - } - } - } - } -} diff --git a/system/Makefile b/system/Makefile deleted file mode 100644 index 01ff3f6..0000000 --- a/system/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -VERSION=1.1.2 -build: - snow-chibi package \ - --version=${VERSION} \ - --authors="Retropikzel" \ - --doc=README.html \ - --description="Library for running shell commands" \ - retropikzel/system.sld - -package-name: - @echo "retropikzel-system-${VERSION}